fix: Fixed shrink page content bug
This commit is contained in:
parent
8611814942
commit
8785038720
1 changed files with 30 additions and 29 deletions
|
@ -1136,10 +1136,10 @@ Sub shrinkPageContent
|
|||
Dim oViewCursor As Object 'View cursor
|
||||
Dim oTextCursor As Object 'Text cursor
|
||||
Dim oViewCurInitPosition As Object
|
||||
Dim oSaveEndSelection 'Text cursor
|
||||
Dim oEnum 'Cursor enumeration
|
||||
Dim oPar 'Current paragraph
|
||||
Dim sTextContent$ 'Service name for text content.
|
||||
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
|
||||
|
@ -1154,34 +1154,35 @@ Sub shrinkPageContent
|
|||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||
oViewCurInitPosition = oViewcursor.Text.createTextCursorByRange(oViewCursor)
|
||||
'Check if we are at start of paragraph go to the end of previous paragraph
|
||||
If oViewCursor.Text.createTextCursorByRange(oViewCursor).isStartOfParagraph() Then
|
||||
oViewCursor.goLeft(1,false)
|
||||
If Len(oViewCursor.String) <> 1 Then
|
||||
oViewCursor.goRight(1,false)
|
||||
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
|
||||
oViewCursor.goRight(1,false)
|
||||
oSaveEndSelection = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
||||
oTextCursor.goRight(1,false)
|
||||
oSaveEndSelection = oTextCursor.Text.createTextCursorByRange(oTextCursor)
|
||||
'Select last 2 characters
|
||||
oViewCursor.goLeft(2,true)
|
||||
If Len(oViewCursor.String) = 2 Then
|
||||
oLastChars = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
||||
'Insert hyphen if needed
|
||||
insertHyphen(oLastChars,oViewCursor)
|
||||
oTextCursor.goLeft(2,true)
|
||||
If Len(oTextCursor.String) = 2 Then
|
||||
oLastChars = oTextCursor.Text.createTextCursorByRange(oTextCursor)
|
||||
oViewCursor.goToRange(oTextCursor, false)
|
||||
'Insert hyphen if needed
|
||||
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)
|
||||
oTextCursor.gotoRange(oSaveEndSelection,false) 'Go to end of text to check page changes
|
||||
oTextCursor.goLeft(1,false)
|
||||
'Set saved position to initial state
|
||||
oSaveEndSelection = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
||||
|
||||
oSaveEndSelection = oTextCursor.Text.createTextCursorByRange(oTextCursor)
|
||||
oViewCursor.goToRange(oTextCursor,false)
|
||||
|
||||
oViewCursor.jumpToPreviousPage()
|
||||
oViewCursor.jumpToStartOfPage()
|
||||
oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
||||
|
||||
'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
|
||||
|
@ -1262,8 +1263,8 @@ End Sub
|
|||
|
||||
Sub splitPages
|
||||
Dim oViewCursor As Object 'View cursor
|
||||
Dim oText 'Text object in current document
|
||||
Dim oSaveEndSelection 'Text 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
|
||||
|
@ -1421,12 +1422,12 @@ End Function
|
|||
|
||||
Sub savecursor
|
||||
Dim oViewCursor As Object 'View cursor
|
||||
Dim oTextCursor 'Text cursor
|
||||
Dim oSaveEndSelection 'Text cursor
|
||||
Dim oEnum 'Cursor enumeration
|
||||
Dim oText 'Text object in current document
|
||||
Dim oPar 'Current paragraph
|
||||
Dim sTextContent$ 'Service name for text content.
|
||||
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue