chore: cleaning a bit

This commit is contained in:
Georgy Litvinov 2021-08-26 16:38:21 +02:00
parent 48ebe71c8e
commit f58b4f58de
3 changed files with 297 additions and 206 deletions

View file

@ -434,7 +434,5 @@ Private Function confirm(description)
End Function
Sub Macro1
End Sub
</script:module>

View file

@ -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

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="journals" script:language="StarBasic">Private sub journalsMark31
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="journals" script:language="StarBasic">Private sub journalsMark33
End sub
Dim templateName As String
@ -1132,36 +1132,25 @@ sub backspace
dispatcher.executeDispatch(document, &quot;.uno:SwBackspace&quot;, &quot;&quot;, 0, Array())
end Sub
Sub shrinkPageContent
Function shrinkPageContent() As Boolean
Dim oViewCursor As Object &apos;View cursor
Dim oTextCursor As Object &apos;Text cursor
Dim oViewCurInitPosition As Object
Dim oSaveEndSelection As Object &apos;Text cursor
Dim oEnum As Variant&apos;Cursor enumeration
Dim oPar As Object&apos;Current paragraph
Dim sTextContent As String &apos;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
&apos;saveCurrentVersion
kernShrinkValue = 8
scaleWidthShrinkValue = 7
scaleCharHeight = 2
scaleIntervalHeight = 3
sTextContent = &quot;com.sun.star.text.TextContent&quot;
oViewCursor = ThisComponent.CurrentController.getViewCursor()
oViewCurInitPosition = oViewcursor.Text.createTextCursorByRange(oViewCursor)
&apos;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) &lt;&gt; 1 Then
oTextCursor.goRight(1,false)
End If
End If
&apos;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)
&apos;Insert hyphen if needed
insertHyphen(oLastChars,oViewCursor)
insertHyphen()
End If
&apos;Return to initial position
oTextCursor.gotoRange(oSaveEndSelection,false) &apos;Go to end of text to check page changes
oTextCursor.goLeft(1,false)
&apos;Set saved position to initial state
oSaveEndSelection = oTextCursor.Text.createTextCursorByRange(oTextCursor)
&apos;If one of textRanges is Footnote or Endnote we can&apos;t select them so it is better to exit now
If oTextCursor.Text.supportsService(&quot;com.sun.star.text.Endnote&quot;) OR _
oTextCursor.Text.supportsService(&quot;com.sun.star.text.Footnote&quot;) OR _
oTextCursor.Text.supportsService(&quot;com.sun.star.text.CellProperties&quot;) OR _
oSaveEndSelection.Text.supportsService(&quot;com.sun.star.text.Endnote&quot;) OR _
oSaveEndSelection.Text.supportsService(&quot;com.sun.star.text.Footnote&quot;) OR _
oSaveEndSelection.Text.supportsService(&quot;com.sun.star.text.CellProperties&quot;) Then
shrinkPageContent = false
oViewCursor.gotoRange(oViewCurInitPosition,false)
Exit Function
EndIf
oViewCursor.goToRange(oTextCursor,false)
oViewCursor.jumpToPreviousPage()
oViewCursor.jumpToStartOfPage()
&apos;If one of textRanges is Footnote or Endnote we can&apos;t select them so it is better to exit now
If oTextCursor.Text.supportsService(&quot;com.sun.star.text.Endnote&quot;) OR oTextCursor.Text.supportsService(&quot;com.sun.star.text.Footnote&quot;) Or oTextCursor.Text.supportsService(&quot;com.sun.star.text.CellProperties&quot;) Then
shrinkPageContent = false
oViewCursor.gotoRange(oViewCurInitPosition,false)
Exit Sub
EndIf
If oSaveEndSelection.Text.supportsService(&quot;com.sun.star.text.Endnote&quot;) OR oSaveEndSelection.Text.supportsService(&quot;com.sun.star.text.Footnote&quot;) Or oTextCursor.Text.supportsService(&quot;com.sun.star.text.CellProperties&quot;) Then
shrinkPageContent = false
oViewCursor.gotoRange(oViewCurInitPosition,false)
Exit Sub
EndIf
oTextCursor.gotoRange(oSaveEndSelection,true)
oViewCursor.gotoRange(oSaveEndSelection,false) &apos;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()
&apos;If we moved right to the next para and page haven&apos;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()
&apos;If we moved right to the next para and page haven&apos;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()
&apos;If we moved right to the next para and page haven&apos;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 &apos;View cursor
Dim oText As Object &apos;Text object in current document
Dim oSaveEndSelection As Object &apos;Text cursor
&apos;saveCurrentVersion
oViewCursor = ThisComponent.CurrentController.getViewCursor()
Dim saveFirstLineIndent As Boolean
&apos;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)
&apos;Select last 2 characters
oViewCursor.goLeft(2,true)
If Len(oViewCursor.String) = 2 Then
&apos;Insert hyphen if needed
oLastChars = oViewCursor.Text.createTextCursorByRange(oViewCursor)
insertHyphen(oLastChars,oViewCursor)
End If
&apos;Return to initial position
oViewCursor.gotoRange(oSaveEndSelection,false) &apos;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 &apos;paragraph enumeration
Dim oPar &apos;current paragraph
Dim oSecEnum &apos;sections enumeration
Dim oParSection &apos;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(&quot;com.sun.star.text.Paragraph&quot;) Then
oPar.charScaleWidth = 100 - i
If pageNum &lt;&gt; 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 &apos;paragraph enumeration
Dim oPar &apos;current paragraph
Dim oSecEnum &apos;sections enumeration
Dim oParSection &apos;paragraph text section
Sub configureCursorPositionForContentShrink()
&apos; Globalscope.BasicLibraries.LoadLibrary(&quot;MRILib&quot;)
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(&quot;com.sun.star.text.TextRanges&quot;) Then
selectionTextRange = curSelection.Anchor
oViewCursor.JumpToFirstPage(false)
oViewCursor.goToRange(selectionTextRange,false)
EndIf
oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor)
&apos;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 &lt;&gt; initPageNum) Then
isShrinkPageSucceded = true
Else
oTextCursor = oViewcursor.Text.createTextCursorByRange(oViewCursor)
oTextCursor.goRight(1,false)
oViewCursor.goToRange(oTextCursor,false)
If oViewCursor.getPage &lt;&gt; 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
&apos;In endntote footnote or table shrink is not possible
If oViewCursor.Text.supportsService(&quot;com.sun.star.text.Endnote&quot;) OR _
oViewCursor.Text.supportsService(&quot;com.sun.star.text.Footnote&quot;) OR _
oViewCursor.Text.supportsService(&quot;com.sun.star.text.CellProperties&quot;) Then
canShrinkContent = false
oViewCursor.goToRange(oSavePosition,false)
Exit Function
EndIf
&apos;If current paragraph has page break before
If oSavePosition.BreakType &lt;&gt; 0 Then
canShrinkContent = false
oViewCursor.goToRange(oSavePosition,false)
Exit Function
EndIf
initPageNum = oViewcursor.getPage()
oViewCursor.JumpToPreviousPage(false)
oViewCursor.jumpToStartOfPage()
startPageNum = oViewcursor.getPage()
&apos;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 &lt;&gt; 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)
&apos;If Len(oTextCursor.String) &gt; 0 Then
&apos; AddToArray(targetContent,oTextCursor.Text.createTextCursorByRange(oTextCursor))
&apos; 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) &gt; 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()
&apos;If we moved right to the next para and page haven&apos;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&apos;paragraph enumeration
Dim oPar As Object &apos;current paragraph
Dim oSecEnum As Object&apos;sections enumeration
Dim oParSection As Object&apos;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 &apos;paragraph enumeration
Dim oPar &apos;current paragraph
Dim oSecEnum &apos;sections enumeration
Dim oParSection &apos;paragraph text section
Function shrinkCharHeight(oTextCursor As Object, oViewCursor As Object, iterations As Integer) As Boolean
Dim oParEnum As Object&apos;paragraph enumeration
Dim oPar As Object&apos;current paragraph
Dim oSecEnum As Object&apos;sections enumeration
Dim oParSection As Object&apos;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 &apos;paragraph enumeration
Dim oPar &apos;current paragraph
Dim oSecEnum &apos;sections enumeration
Dim oParSection &apos;paragraph text section
Function shrinkIntervalHeight(oTextCursor As Object ,oViewCursor As Object,iterations As Integer) As Boolean
Dim oParEnum As Object &apos;paragraph enumeration
Dim oPar As Object &apos;current paragraph
Dim oSecEnum As Object &apos;sections enumeration
Dim oParSection As Object &apos;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 &apos;View cursor
Dim oTextCursor As Object&apos;Text cursor
Dim oSaveEndSelection As Object &apos;Text cursor
Dim oEnum As Object&apos;Cursor enumeration
Dim oText As Object&apos;Text object in current document
Dim oPar As Object&apos;Current paragraph
Dim sTextContent As String&apos;Service name for text content.
sTextContent = &quot;com.sun.star.text.TextContent&quot;
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(&quot;com.sun.star.frame.DispatchHelper&quot;)
Sub splitPages
Dim oViewCursor As Object &apos;View cursor
Dim oText As Object &apos;Text object in current document
Dim oSaveEndSelection As Object &apos;Text cursor
&apos;saveCurrentVersion
oViewCursor = ThisComponent.CurrentController.getViewCursor()
Dim saveFirstLineIndent As Boolean
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, &quot;.uno:InsertPagebreak&quot;, &quot;&quot;, 0, Array())
end sub
Sub insertHyphen(oTextCursor,oViewCursor)
Dim lastChars
&apos;lastChars = oTextCursor.getString()
replacementhyp
&apos;MsgBox lastChars
&apos;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)
&apos;Select last 2 characters
oViewCursor.goLeft(2,true)
If Len(oViewCursor.String) = 2 Then
&apos;Insert hyphen if needed
oLastChars = oViewCursor.Text.createTextCursorByRange(oViewCursor)
insertHyphen()
End If
&apos;Return to initial position
oViewCursor.gotoRange(oSaveEndSelection,false) &apos;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(&quot;com.sun.star.frame.DispatchHelper&quot;)
dispatcher.executeDispatch(document, &quot;.uno:InsertPagebreak&quot;, &quot;&quot;, 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(&quot;com.sun.star.frame.DispatchHelper&quot;)
@ -1538,6 +1630,7 @@ sub replacementhyp
args1(11).Name = &quot;SearchItem.SearchString&quot;
args1(11).Value = &quot;([a-zA-Zа-яА-Я])([a-zA-Zа-яА-Я])&quot;
args1(12).Name = &quot;SearchItem.ReplaceString&quot;
&apos; &quot;$1 U+00AD $2&quot;
args1(12).Value = &quot;$1­$2&quot;
args1(13).Name = &quot;SearchItem.Locale&quot;
args1(13).Value = 255