fix: fixed text char height shrinking. Use initial value of characters instead of getting it from paragraph style

This commit is contained in:
Georgy Litvinov 2021-08-23 18:53:47 +02:00
parent d05aed70d6
commit 2b37cfe542
2 changed files with 5 additions and 3 deletions

View file

@ -1131,6 +1131,7 @@ sub backspace
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:SwBackspace", "", 0, Array()) dispatcher.executeDispatch(document, ".uno:SwBackspace", "", 0, Array())
end Sub end Sub
Sub shrinkPageContent 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
@ -1355,13 +1356,15 @@ Function shrinkCharHeight(oTextCursor,oViewCursor,iterations) As Boolean
Dim oSecEnum 'sections enumeration Dim oSecEnum 'sections enumeration
Dim oParSection 'paragraph text section Dim oParSection 'paragraph text section
Dim pageNum As Integer Dim pageNum As Integer
Dim parCursor As Object
pageNum = oViewCursor.getPage() pageNum = oViewCursor.getPage()
For i = 1 To iterations Step 1 For i = 1 To iterations Step 1
oParEnum = oTextCursor.createEnumeration() oParEnum = oTextCursor.createEnumeration()
Do While oParEnum.hasMoreElements() Do While oParEnum.hasMoreElements()
oPar = oParEnum.nextElement() oPar = oParEnum.nextElement()
If oPar.supportsService("com.sun.star.text.Paragraph") Then If oPar.supportsService("com.sun.star.text.Paragraph") Then
oPar.charHeight = roundHeight(oPar.charHeight) - 0.1 parCursor = oTextCursor.Text.createTextCursorByRange(oPar)
parCursor.charHeight = roundHeight(parCursor.charHeight) - 0.1
If pageNum <> oViewCursor.getPage() Then If pageNum <> oViewCursor.getPage() Then
shrinkCharHeight = true shrinkCharHeight = true
Exit Function Exit Function
@ -1388,7 +1391,6 @@ Function roundHeight(nHeight)
roundHeight=lHeight roundHeight=lHeight
End Function End Function
Function shrinkIntervalHeight(oTextCursor,oViewCursor,iterations) As Boolean Function shrinkIntervalHeight(oTextCursor,oViewCursor,iterations) As Boolean
Dim oParEnum 'paragraph enumeration Dim oParEnum 'paragraph enumeration
Dim oPar 'current paragraph Dim oPar 'current paragraph