From f58b4f58def11697aa4f51b33702c28d71c8e821 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Thu, 26 Aug 2021 16:38:21 +0200 Subject: [PATCH] chore: cleaning a bit --- ePublishing/Hyphenations.xba | 2 - ePublishing/MakeUp.xba | 4 +- ePublishing/journals.xba | 497 +++++++++++++++++++++-------------- 3 files changed, 297 insertions(+), 206 deletions(-) diff --git a/ePublishing/Hyphenations.xba b/ePublishing/Hyphenations.xba index e9e8175..0ad9425 100644 --- a/ePublishing/Hyphenations.xba +++ b/ePublishing/Hyphenations.xba @@ -434,7 +434,5 @@ Private Function confirm(description) End Function -Sub Macro1 -End Sub \ No newline at end of file diff --git a/ePublishing/MakeUp.xba b/ePublishing/MakeUp.xba index e8b46c2..8e715a9 100644 --- a/ePublishing/MakeUp.xba +++ b/ePublishing/MakeUp.xba @@ -263,7 +263,7 @@ Sub getFNAreaStart End Sub -Function changeCharWidth(delta) As Boolean +Function changeCharWidth(delta As Integer) As Boolean Dim oViewCursor As Object Dim oTextCursor As Object Dim charScale As Integer @@ -277,7 +277,7 @@ Function changeCharWidth(delta) As Boolean oViewCursor.charScaleWidth = charScale + delta End Function -Function changeKern(delta) As Boolean +Function changeKern(delta As Integer) As Boolean Dim oViewCursor As Object Dim oTextCursor As Object Dim kerning As Integer diff --git a/ePublishing/journals.xba b/ePublishing/journals.xba index e8b262b..1b1f096 100644 --- a/ePublishing/journals.xba +++ b/ePublishing/journals.xba @@ -1,6 +1,6 @@ -Private sub journalsMark31 +Private sub journalsMark33 End sub Dim templateName As String @@ -1132,36 +1132,25 @@ sub backspace dispatcher.executeDispatch(document, ".uno:SwBackspace", "", 0, Array()) end Sub -Sub shrinkPageContent +Function shrinkPageContent() As Boolean Dim oViewCursor As Object 'View cursor Dim oTextCursor As Object 'Text cursor Dim oViewCurInitPosition As Object Dim oSaveEndSelection As Object 'Text cursor Dim oEnum As Variant'Cursor enumeration Dim oPar As Object'Current paragraph - Dim sTextContent As String 'Service name for text content. - Dim scaleWidthShrinkValue As Integer Dim scaleCharHeight As Integer Dim scaleIntervalHeight As Integer Dim kernShrinkValue As Integer Dim startOfPara As Boolean - 'saveCurrentVersion + kernShrinkValue = 8 - scaleWidthShrinkValue = 7 scaleCharHeight = 2 scaleIntervalHeight = 3 - sTextContent = "com.sun.star.text.TextContent" oViewCursor = ThisComponent.CurrentController.getViewCursor() oViewCurInitPosition = oViewcursor.Text.createTextCursorByRange(oViewCursor) - 'Check if we are at start of paragraph go to the end of previous paragraph + oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) - If oTextCursor.isStartOfParagraph() Then - oTextCursor.goLeft(1,false) - If Len(oTextCursor.String) <> 1 Then - oTextCursor.goRight(1,false) - End If - End If - 'Move right to select left and right characters and save position to the right oTextCursor.goRight(1,false) oSaveEndSelection = oTextCursor.Text.createTextCursorByRange(oTextCursor) @@ -1171,169 +1160,253 @@ Sub shrinkPageContent oLastChars = oTextCursor.Text.createTextCursorByRange(oTextCursor) oViewCursor.goToRange(oTextCursor, false) 'Insert hyphen if needed - insertHyphen(oLastChars,oViewCursor) + insertHyphen() End If 'Return to initial position oTextCursor.gotoRange(oSaveEndSelection,false) 'Go to end of text to check page changes oTextCursor.goLeft(1,false) 'Set saved position to initial state oSaveEndSelection = oTextCursor.Text.createTextCursorByRange(oTextCursor) + 'If one of textRanges is Footnote or Endnote we can't select them so it is better to exit now + If oTextCursor.Text.supportsService("com.sun.star.text.Endnote") OR _ + oTextCursor.Text.supportsService("com.sun.star.text.Footnote") OR _ + oTextCursor.Text.supportsService("com.sun.star.text.CellProperties") OR _ + oSaveEndSelection.Text.supportsService("com.sun.star.text.Endnote") OR _ + oSaveEndSelection.Text.supportsService("com.sun.star.text.Footnote") OR _ + oSaveEndSelection.Text.supportsService("com.sun.star.text.CellProperties") Then + shrinkPageContent = false + oViewCursor.gotoRange(oViewCurInitPosition,false) + Exit Function + EndIf + oViewCursor.goToRange(oTextCursor,false) - oViewCursor.jumpToPreviousPage() oViewCursor.jumpToStartOfPage() - - 'If one of textRanges is Footnote or Endnote we can't select them so it is better to exit now - If oTextCursor.Text.supportsService("com.sun.star.text.Endnote") OR oTextCursor.Text.supportsService("com.sun.star.text.Footnote") Or oTextCursor.Text.supportsService("com.sun.star.text.CellProperties") Then - shrinkPageContent = false - oViewCursor.gotoRange(oViewCurInitPosition,false) - Exit Sub - EndIf - If oSaveEndSelection.Text.supportsService("com.sun.star.text.Endnote") OR oSaveEndSelection.Text.supportsService("com.sun.star.text.Footnote") Or oTextCursor.Text.supportsService("com.sun.star.text.CellProperties") Then - shrinkPageContent = false - oViewCursor.gotoRange(oViewCurInitPosition,false) - Exit Sub - EndIf oTextCursor.gotoRange(oSaveEndSelection,true) oViewCursor.gotoRange(oSaveEndSelection,false) 'Go to end of text to check page changes - If shrinkIntervalHeight(oTextCursor,oViewCursor,scaleIntervalHeight) Then - oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) - If oTextCursor.isEndOfParagraph() Then - pos1 = oViewCursor.getPage() - oViewCursor.goRight(1,false) - pos2 = oViewCursor.getPage() - 'If we moved right to the next para and page haven't changed insert pageBreak - If pos1 = pos2 Then - insertPageBreak - End If - Else - insertPageBreak - If Not IsNull(oTextCursor.ParaFirstLineIndent) Then - oTextCursor.ParaFirstLineIndent = 0 - End If - - End If - - Exit Sub + If shrinkKern(oTextCursor,oViewCursor,kernShrinkValue) Or _ + shrinkCharHeight(oTextCursor,oViewCursor,scaleCharHeight) Or _ + shrinkIntervalHeight(oTextCursor,oViewCursor,scaleIntervalHeight) Then + insertHardPageBreakIfNotOnPageBorder() + Exit Function End If - If shrinkCharHeight(oTextCursor,oViewCursor,scaleCharHeight) Then - oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) - If oTextCursor.isEndOfParagraph() Then - pos1 = oViewCursor.getPage() - oViewCursor.goRight(1,false) - pos2 = oViewCursor.getPage() - 'If we moved right to the next para and page haven't changed insert pageBreak - If pos1 = pos2 Then - insertPageBreak - End If - Else - insertPageBreak - If Not IsNull(oTextCursor.ParaFirstLineIndent) Then - oTextCursor.ParaFirstLineIndent = 0 - End If - - End If - - Exit Sub - End If - If shrinkKern(oTextCursor,oViewCursor,kernShrinkValue) Then - oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) - If oTextCursor.isEndOfParagraph() Then - pos1 = oViewCursor.getPage() - oViewCursor.goRight(1,false) - pos2 = oViewCursor.getPage() - 'If we moved right to the next para and page haven't changed insert pageBreak - If pos1 = pos2 Then - insertPageBreak - End If - Else - insertPageBreak - If Not IsNull(oTextCursor.ParaFirstLineIndent) Then - oTextCursor.ParaFirstLineIndent = 0 - End If - - End If - - Exit Sub - End If - - -End Sub - -Sub splitPages - Dim oViewCursor As Object 'View cursor - Dim oText As Object 'Text object in current document - Dim oSaveEndSelection As Object 'Text cursor - 'saveCurrentVersion - oViewCursor = ThisComponent.CurrentController.getViewCursor() - Dim saveFirstLineIndent As Boolean - - 'Check if we are at start of paragraph go to the end of previous paragraph - If oViewCursor.Text.createTextCursorByRange(oViewCursor).isEndOfParagraph() Then - oViewCursor.goRight(1,false) - End If - If oViewCursor.Text.createTextCursorByRange(oViewCursor).isStartOfParagraph() Then - saveFirstLineIndent = true - Else - saveFirstLineIndent = false - End If - - oViewCursor.goRight(1,false) - oSaveEndSelection = oViewCursor.Text.createTextCursorByRange(oViewCursor) - 'Select last 2 characters - oViewCursor.goLeft(2,true) - - If Len(oViewCursor.String) = 2 Then - 'Insert hyphen if needed - oLastChars = oViewCursor.Text.createTextCursorByRange(oViewCursor) - insertHyphen(oLastChars,oViewCursor) - End If - 'Return to initial position - oViewCursor.gotoRange(oSaveEndSelection,false) 'Go to end of text to check page changes - oViewCursor.goLeft(1,false) - insertPageBreak - If Not saveFirstLineIndent Then - oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) - If Not IsNull(oTextCursor.ParaFirstLineIndent) Then - oTextCursor.ParaFirstLineIndent = 0 - End If - End If -End Sub - - - - - -Function shrinkScaleWidth(oTextCursor,oViewCursor,iterations) As Boolean - Dim oParEnum 'paragraph enumeration - Dim oPar 'current paragraph - Dim oSecEnum 'sections enumeration - Dim oParSection 'paragraph text section - Dim pageNum As Integer - pageNum = oViewCursor.getPage() - For i = 1 To iterations Step 1 - oParEnum = oTextCursor.createEnumeration() - Do While oParEnum.hasMoreElements() - oPar = oParEnum.nextElement() - If oPar.supportsService("com.sun.star.text.Paragraph") Then - oPar.charScaleWidth = 100 - i - If pageNum <> oViewCursor.getPage() Then - shrinkScaleWidth = true - Exit Function - End If - End If - Loop - Next i - shrinkScaleWidth = false End Function -Function shrinkKern(oTextCursor,oViewCursor,iterations) As Boolean - Dim oParEnum 'paragraph enumeration - Dim oPar 'current paragraph - Dim oSecEnum 'sections enumeration - Dim oParSection 'paragraph text section +Sub configureCursorPositionForContentShrink() +' Globalscope.BasicLibraries.LoadLibrary("MRILib") + Dim oViewCursor As Object + Dim oTextCursor As Object + Dim curSelection As Object + Dim selectionTextRange + Dim nextChar As String + Dim prefChar As String + oViewCursor = ThisComponent.CurrentController.getViewCursor() + curSelection = ThisComponent.getCurrentSelection() + If Not curSelection.supportsService("com.sun.star.text.TextRanges") Then + selectionTextRange = curSelection.Anchor + oViewCursor.JumpToFirstPage(false) + oViewCursor.goToRange(selectionTextRange,false) + EndIf + oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) + 'At start of Para + oTextCursor.collapseToEnd() + If oTextCursor.isStartOfParagraph() AND NOT oTextCursor.isEndOfParagraph() Then + oTextCursor.goLeft(1,false) + EndIf + oViewCursor.goToRange(oTextCursor,false) +End Sub + +Function isShrinkPageSucceded(initPosition As Object,initPageNum As String) As Boolean + Dim oViewCursor As Object + Dim oTextCursor As Object + isShrinkPageSucceded = false + oViewCursor = ThisComponent.CurrentController.getViewCursor() + oViewCursor.goToRange(initPosition,false) + If (oViewCursor.getPage <> initPageNum) Then + isShrinkPageSucceded = true + Else + oTextCursor = oViewcursor.Text.createTextCursorByRange(oViewCursor) + oTextCursor.goRight(1,false) + oViewCursor.goToRange(oTextCursor,false) + If oViewCursor.getPage <> initPageNum Then + isShrinkPageSucceded = true + EndIf + EndIf +End Function + +Function getShrinkPageContentInitPosition() As Object + Dim oViewCursor As Object + Dim oTextCursor As Object + oViewCursor = ThisComponent.CurrentController.getViewCursor() + oTextCursor = oViewcursor.Text.createTextCursorByRange(oViewCursor) + If NOT oTextCursor.isEndOfParagraph() Then + oTextCursor.goLeft(1,false) + oTextCursor.goRight(2,true) + oViewCursor.goToRange(oTextCursor,false) + insertHyphen() + oTextCursor.goLeft(1,false) + oViewCursor.goToRange(oTextCursor,false) + insertPageBreak + oTextCursor.goLeft(1,false) + oViewCursor.goToRange(oTextCursor,false) + getShrinkPageContentInitPosition = oViewcursor.Text.createTextCursorByRange(oViewCursor) + Else + oTextCursor.goRight(1,false) + oViewCursor.goToRange(oTextCursor,false) + oViewCursor.BreakType = com.sun.star.style.BreakType.PAGE_BEFORE + oTextCursor.goLeft(1,false) + oViewCursor.goToRange(oTextCursor,false) + getShrinkPageContentInitPosition = oViewcursor.Text.createTextCursorByRange(oViewCursor) + EndIf +End Function + +Function canShrinkContent() As Boolean + Dim oViewCursor As Object + Dim oTextCursor As Object + Dim oSavePosition As Object + Dim oStartPosition As Object + Dim initPageNum As Long + Dim startPageNum As Long + oViewCursor = ThisComponent.CurrentController.getViewCursor() + oSavePosition = oViewCursor.Text.createTextCursorByRange(oViewCursor) + canShrinkContent = true + 'In endntote footnote or table shrink is not possible + If oViewCursor.Text.supportsService("com.sun.star.text.Endnote") OR _ + oViewCursor.Text.supportsService("com.sun.star.text.Footnote") OR _ + oViewCursor.Text.supportsService("com.sun.star.text.CellProperties") Then + canShrinkContent = false + oViewCursor.goToRange(oSavePosition,false) + Exit Function + EndIf + 'If current paragraph has page break before + If oSavePosition.BreakType <> 0 Then + canShrinkContent = false + oViewCursor.goToRange(oSavePosition,false) + Exit Function + EndIf + initPageNum = oViewcursor.getPage() + oViewCursor.JumpToPreviousPage(false) + oViewCursor.jumpToStartOfPage() + startPageNum = oViewcursor.getPage() + 'No previous page exists + If startPageNum = initPageNum Then + oViewCursor.goToRange(oSavePosition,false) + canShrinkContent = false + Exit Function + EndIf + oViewCursor.goToRange(oSavePosition,false) + oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) + Do While oViewcursor.getPage() = initPageNum + oTextCursor.gotoPreviousParagraph(false) + oViewCursor.goToRange(oTextCursor,false) + If oTextCursor.BreakType <> 0 Then + canShrinkContent = false + oViewCursor.goToRange(oSavePosition,false) + Exit Function + EndIf + Loop + oViewCursor.goToRange(oSavePosition,false) +End Function + + +Function shrinkPageContentNew() As Boolean + Dim oViewCursor As Object + Dim oTextCursor As Object + Dim initPosition As Object + Dim initPageNum As String + Dim oSaveEndSelection As Object + Dim oEnum As Variant + Dim oPar As Object + Dim startOfPara As Boolean + Dim targetContent() As Object + oViewCursor = ThisComponent.CurrentController.getViewCursor() + + configureCursorPositionForContentShrink() + If Not canShrinkContent() Then + Exit Function + EndIf + initPageNum = oViewcursor.getPage() + initPosition = getShrinkPageContentInitPosition() + oViewcursor.goToRange(initPosition,false) + oViewCursor.JumpToPreviousPage(false) + oViewCursor.jumpToStartOfPage() + startPosition = oViewCursor.Text.createTextCursorByRange(oViewCursor) + targetContent = selectContentToShrink(initPosition,startPosition) + +End Function + +Function selectContentToShrink(initPosition As Object, startPosition As Object) + Dim oViewCursor As Object + Dim oTextCursor As Object + Dim startPageNum As Long + Dim prevPageNum As Long + Dim savePosition As Object + Dim targetContent() As Variant + oViewCursor = ThisComponent.CurrentController.getViewCursor() + oViewcursor.goToRange(startPosition,false) + prevPageNum = oViewcursor.getPage() + oViewcursor.goToRange(initPosition,false) + startPageNum = oViewcursor.getPage() + oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) + + 'If Len(oTextCursor.String) > 0 Then + ' AddToArray(targetContent,oTextCursor.Text.createTextCursorByRange(oTextCursor)) + ' EndIf + Do While startPageNum = oViewcursor.getPage() OR prevPageNum = oViewcursor.getPage() + savePosition = oTextCursor.getStart() + oTextCursor.gotoStartOfParagraph(true) + oViewCursor.goToRange(oTextCursor,false) + oViewCursor.collapseToStart() + If Len(oTextCursor.String) > 0 Then + If (startPageNum = oViewcursor.getPage() OR prevPageNum = oViewcursor.getPage()) Then + AddToArray(targetContent,oTextCursor.Text.createTextCursorByRange(oTextCursor)) + Else + oTextCursor.goToRange(savePosition,false) + oViewCursor.goToRange(oTextCursor,false) + oViewCursor.JumpToStartOfPage(false) + oTextCursor.goToRange(oViewCursor,true) + AddToArray(targetContent,oTextCursor.Text.createTextCursorByRange(oTextCursor)) + EndIf + EndIf + oTextCursor.gotoPreviousParagraph(false) + oTextCursor.gotoEndOfParagraph(false) + oViewCursor.goToRange(oTextCursor,false) + Loop + selectContentToShrink = targetContent +End Function + + + +Sub insertHardPageBreakIfNotOnPageBorder() + Dim oViewCursor As Object + Dim oTextCursor As Object + Dim pos1 As Integer + Dim pos2 As Integer + oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) + If oTextCursor.isEndOfParagraph() Then + pos1 = oViewCursor.getPage() + oViewCursor.goRight(1,false) + pos2 = oViewCursor.getPage() + 'If we moved right to the next para and page haven't changed insert pageBreak + If pos1 = pos2 Then + insertPageBreak + End If + Else + insertPageBreak + If Not IsNull(oTextCursor.ParaFirstLineIndent) Then + oTextCursor.ParaFirstLineIndent = 0 + End If + End If +End Sub + +Function shrinkKern(oTextCursor As Object, oViewCursor As Object,iterations As Integer) As Boolean + Dim oParEnum As Object'paragraph enumeration + Dim oPar As Object 'current paragraph + Dim oSecEnum As Object'sections enumeration + Dim oParSection As Object'paragraph text section Dim pageNum As Integer + Dim i As Integer pageNum = oViewCursor.getPage() For i = 2 To iterations Step 2 oParEnum = oTextCursor.createEnumeration() @@ -1351,13 +1424,14 @@ Function shrinkKern(oTextCursor,oViewCursor,iterations) As Boolean shrinkKern = false End Function -Function shrinkCharHeight(oTextCursor,oViewCursor,iterations) As Boolean - Dim oParEnum 'paragraph enumeration - Dim oPar 'current paragraph - Dim oSecEnum 'sections enumeration - Dim oParSection 'paragraph text section +Function shrinkCharHeight(oTextCursor As Object, oViewCursor As Object, iterations As Integer) As Boolean + Dim oParEnum As Object'paragraph enumeration + Dim oPar As Object'current paragraph + Dim oSecEnum As Object'sections enumeration + Dim oParSection As Object'paragraph text section Dim pageNum As Integer Dim parCursor As Object + Dim i As Integer pageNum = oViewCursor.getPage() For i = 1 To iterations Step 1 oParEnum = oTextCursor.createEnumeration() @@ -1392,13 +1466,13 @@ Function roundHeight(nHeight) roundHeight=lHeight End Function -Function shrinkIntervalHeight(oTextCursor,oViewCursor,iterations) As Boolean - Dim oParEnum 'paragraph enumeration - Dim oPar 'current paragraph - Dim oSecEnum 'sections enumeration - Dim oParSection 'paragraph text section +Function shrinkIntervalHeight(oTextCursor As Object ,oViewCursor As Object,iterations As Integer) As Boolean + Dim oParEnum As Object 'paragraph enumeration + Dim oPar As Object 'current paragraph + Dim oSecEnum As Object 'sections enumeration + Dim oParSection As Object 'paragraph text section Dim pageNum As Integer - Dim lineSpacing + Dim lineSpacing As Object pageNum = oViewCursor.getPage() For i = 1 To iterations Step 1 oParEnum = oTextCursor.createEnumeration() @@ -1420,15 +1494,13 @@ Function shrinkIntervalHeight(oTextCursor,oViewCursor,iterations) As Boolean shrinkIntervalHeight = false End Function -Sub savecursor +Sub savecursor() Dim oViewCursor As Object 'View cursor Dim oTextCursor As Object'Text cursor Dim oSaveEndSelection As Object 'Text cursor Dim oEnum As Object'Cursor enumeration Dim oText As Object'Text object in current document Dim oPar As Object'Current paragraph - Dim sTextContent As String'Service name for text content. - sTextContent = "com.sun.star.text.TextContent" oViewCursor = ThisComponent.CurrentController.getViewCursor() oSaveEndSelection = oViewCursor.Text.createTextCursorByRange(oViewCursor) REM oViewCursor.getText.insertString(oViewCursor.getStart(), CHR$(257), False) @@ -1477,37 +1549,57 @@ Sub savecursor End Sub - -sub insertPageBreak - rem ---------------------------------------------------------------------- - rem define variables - dim document as object - dim dispatcher as object - rem ---------------------------------------------------------------------- - rem get access to the document - document = ThisComponent.CurrentController.Frame - dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") +Sub splitPages + Dim oViewCursor As Object 'View cursor + Dim oText As Object 'Text object in current document + Dim oSaveEndSelection As Object 'Text cursor + 'saveCurrentVersion + oViewCursor = ThisComponent.CurrentController.getViewCursor() + Dim saveFirstLineIndent As Boolean - rem ---------------------------------------------------------------------- - dispatcher.executeDispatch(document, ".uno:InsertPagebreak", "", 0, Array()) - - -end sub - -Sub insertHyphen(oTextCursor,oViewCursor) - Dim lastChars - 'lastChars = oTextCursor.getString() - replacementhyp - 'MsgBox lastChars + 'Check if we are at start of paragraph go to the end of previous paragraph + If oViewCursor.Text.createTextCursorByRange(oViewCursor).isEndOfParagraph() Then + oViewCursor.goRight(1,false) + End If + If oViewCursor.Text.createTextCursorByRange(oViewCursor).isStartOfParagraph() Then + saveFirstLineIndent = true + Else + saveFirstLineIndent = false + End If + + oViewCursor.goRight(1,false) + oSaveEndSelection = oViewCursor.Text.createTextCursorByRange(oViewCursor) + 'Select last 2 characters + oViewCursor.goLeft(2,true) + + If Len(oViewCursor.String) = 2 Then + 'Insert hyphen if needed + oLastChars = oViewCursor.Text.createTextCursorByRange(oViewCursor) + insertHyphen() + End If + 'Return to initial position + oViewCursor.gotoRange(oSaveEndSelection,false) 'Go to end of text to check page changes + oViewCursor.goLeft(1,false) + insertPageBreak + If Not saveFirstLineIndent Then + oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor) + If Not IsNull(oTextCursor.ParaFirstLineIndent) Then + oTextCursor.ParaFirstLineIndent = 0 + End If + End If End Sub -sub replacementhyp - rem ---------------------------------------------------------------------- - rem define variables +Sub insertPageBreak + dim document as object + dim dispatcher as object + document = ThisComponent.CurrentController.Frame + dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") + dispatcher.executeDispatch(document, ".uno:InsertPagebreak", "", 0, Array()) +End Sub + +Sub insertHyphen() dim document as object dim dispatcher as object - rem ---------------------------------------------------------------------- - rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") @@ -1538,6 +1630,7 @@ sub replacementhyp args1(11).Name = "SearchItem.SearchString" args1(11).Value = "([a-zA-Zа-яА-Я])([a-zA-Zа-яА-Я])" args1(12).Name = "SearchItem.ReplaceString" + ' "$1 U+00AD $2" args1(12).Value = "$1­$2" args1(13).Name = "SearchItem.Locale" args1(13).Value = 255