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 oViewCursor As Object 'View cursor
|
||||||
Dim oTextCursor As Object 'Text cursor
|
Dim oTextCursor As Object 'Text cursor
|
||||||
Dim oViewCurInitPosition As Object
|
Dim oViewCurInitPosition As Object
|
||||||
Dim oSaveEndSelection 'Text cursor
|
Dim oSaveEndSelection As Object 'Text cursor
|
||||||
Dim oEnum 'Cursor enumeration
|
Dim oEnum As Variant'Cursor enumeration
|
||||||
Dim oPar 'Current paragraph
|
Dim oPar As Object'Current paragraph
|
||||||
Dim sTextContent$ 'Service name for text content.
|
Dim sTextContent As String 'Service name for text content.
|
||||||
Dim scaleWidthShrinkValue As Integer
|
Dim scaleWidthShrinkValue As Integer
|
||||||
Dim scaleCharHeight As Integer
|
Dim scaleCharHeight As Integer
|
||||||
Dim scaleIntervalHeight As Integer
|
Dim scaleIntervalHeight As Integer
|
||||||
|
@ -1154,34 +1154,35 @@ Sub shrinkPageContent
|
||||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||||
oViewCurInitPosition = oViewcursor.Text.createTextCursorByRange(oViewCursor)
|
oViewCurInitPosition = oViewcursor.Text.createTextCursorByRange(oViewCursor)
|
||||||
'Check if we are at start of paragraph go to the end of previous paragraph
|
'Check if we are at start of paragraph go to the end of previous paragraph
|
||||||
If oViewCursor.Text.createTextCursorByRange(oViewCursor).isStartOfParagraph() Then
|
oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
||||||
oViewCursor.goLeft(1,false)
|
If oTextCursor.isStartOfParagraph() Then
|
||||||
If Len(oViewCursor.String) <> 1 Then
|
oTextCursor.goLeft(1,false)
|
||||||
oViewCursor.goRight(1,false)
|
If Len(oTextCursor.String) <> 1 Then
|
||||||
|
oTextCursor.goRight(1,false)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
'Move right to select left and right characters and save position to the right
|
'Move right to select left and right characters and save position to the right
|
||||||
oViewCursor.goRight(1,false)
|
oTextCursor.goRight(1,false)
|
||||||
oSaveEndSelection = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
oSaveEndSelection = oTextCursor.Text.createTextCursorByRange(oTextCursor)
|
||||||
'Select last 2 characters
|
'Select last 2 characters
|
||||||
oViewCursor.goLeft(2,true)
|
oTextCursor.goLeft(2,true)
|
||||||
If Len(oViewCursor.String) = 2 Then
|
If Len(oTextCursor.String) = 2 Then
|
||||||
oLastChars = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
oLastChars = oTextCursor.Text.createTextCursorByRange(oTextCursor)
|
||||||
|
oViewCursor.goToRange(oTextCursor, false)
|
||||||
'Insert hyphen if needed
|
'Insert hyphen if needed
|
||||||
insertHyphen(oLastChars,oViewCursor)
|
insertHyphen(oLastChars,oViewCursor)
|
||||||
End If
|
End If
|
||||||
'Return to initial position
|
'Return to initial position
|
||||||
oViewCursor.gotoRange(oSaveEndSelection,false) 'Go to end of text to check page changes
|
oTextCursor.gotoRange(oSaveEndSelection,false) 'Go to end of text to check page changes
|
||||||
oViewCursor.goLeft(1,false)
|
oTextCursor.goLeft(1,false)
|
||||||
'Set saved position to initial state
|
'Set saved position to initial state
|
||||||
oSaveEndSelection = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
oSaveEndSelection = oTextCursor.Text.createTextCursorByRange(oTextCursor)
|
||||||
|
oViewCursor.goToRange(oTextCursor,false)
|
||||||
|
|
||||||
oViewCursor.jumpToPreviousPage()
|
oViewCursor.jumpToPreviousPage()
|
||||||
oViewCursor.jumpToStartOfPage()
|
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 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
|
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
|
shrinkPageContent = false
|
||||||
|
@ -1262,8 +1263,8 @@ End Sub
|
||||||
|
|
||||||
Sub splitPages
|
Sub splitPages
|
||||||
Dim oViewCursor As Object 'View cursor
|
Dim oViewCursor As Object 'View cursor
|
||||||
Dim oText 'Text object in current document
|
Dim oText As Object 'Text object in current document
|
||||||
Dim oSaveEndSelection 'Text cursor
|
Dim oSaveEndSelection As Object 'Text cursor
|
||||||
'saveCurrentVersion
|
'saveCurrentVersion
|
||||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||||
Dim saveFirstLineIndent As Boolean
|
Dim saveFirstLineIndent As Boolean
|
||||||
|
@ -1421,12 +1422,12 @@ End Function
|
||||||
|
|
||||||
Sub savecursor
|
Sub savecursor
|
||||||
Dim oViewCursor As Object 'View cursor
|
Dim oViewCursor As Object 'View cursor
|
||||||
Dim oTextCursor 'Text cursor
|
Dim oTextCursor As Object'Text cursor
|
||||||
Dim oSaveEndSelection 'Text cursor
|
Dim oSaveEndSelection As Object 'Text cursor
|
||||||
Dim oEnum 'Cursor enumeration
|
Dim oEnum As Object'Cursor enumeration
|
||||||
Dim oText 'Text object in current document
|
Dim oText As Object'Text object in current document
|
||||||
Dim oPar 'Current paragraph
|
Dim oPar As Object'Current paragraph
|
||||||
Dim sTextContent$ 'Service name for text content.
|
Dim sTextContent As String'Service name for text content.
|
||||||
sTextContent = "com.sun.star.text.TextContent"
|
sTextContent = "com.sun.star.text.TextContent"
|
||||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||||
oSaveEndSelection = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
oSaveEndSelection = oViewCursor.Text.createTextCursorByRange(oViewCursor)
|
||||||
|
|
Loading…
Add table
Reference in a new issue