[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - wizards/source
Aron Budea (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 6 09:35:54 UTC 2019
wizards/source/tools/Misc.xba | 87 +++++++++++++++++++++++++++---------------
1 file changed, 56 insertions(+), 31 deletions(-)
New commits:
commit 5d307ea40061a06db12678139cff739e05c751e9
Author: Aron Budea <aron.budea at collabora.com>
AuthorDate: Mon May 6 07:36:14 2019 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 6 11:35:25 2019 +0200
[cp] Updated Fix Table Properties macro
Change-Id: I7f8695789e1223df7bbb235fa6081ed91502ab99
Reviewed-on: https://gerrit.libreoffice.org/71838
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/wizards/source/tools/Misc.xba b/wizards/source/tools/Misc.xba
index 7a001683c9bd..33f2456389df 100644
--- a/wizards/source/tools/Misc.xba
+++ b/wizards/source/tools/Misc.xba
@@ -841,36 +841,61 @@ End Function
' Sub that fixes various issues in tables imported from DOC/DOCX
Sub FixTableProperties
- sumTables = 0
- sumSplit = 0
- sumRelativeWidth = 0
- sumRows = 0
- oTables = ThisComponent.TextTables
- For i = 0 To oTables.getCount() - 1
- oTable = oTables(i)
- sumTables = sumTables + 1
- If oTable.getPropertyValue("Split") = false Then
- sumSplit = sumSplit + 1
- oTable.setPropertyValue("Split", true)
- End If
- If oTable.getPropertyValue("HoriOrient") <> 6 And _
- oTable.getPropertyValue("IsWidthRelative") = false Then
- sumRelativeWidth = sumRelativeWidth + 1
- oTable.setPropertyValue("RelativeWidth", 100)
- End If
- For j = 0 To oTable.getRows.getCount - 1
- oRow = oTable.getRows.getByIndex(j)
- If oRow.getPropertyValue("IsSplitAllowed") = false Then
- sumRows = sumRows + 1
- oRow.setPropertyValue("IsSplitAllowed", true)
- End If
- Next
- Next
-
- s = "Out of " & sumTables & " table(s)" & CHR(13) & _
- "Relative setting was added to: " & sumRelativeWidth & CHR(13) & _
- "Property to enable breaking across pages was enabled for: " & sumSplit & CHR(13) & CHR(13) & _
- "No. of rows property to enable breaking across pages was enabled for: " & sumRows & CHR(13) & CHR(13) & "Save the file afterwards!"
- MsgBox s, 0, "Result"
+ sumTables = 0
+ sumSplit = 0
+ sumRelativeWidth = 0
+ sumRows = 0
+ sumPara = 0
+ oTables = ThisComponent.TextTables
+ For i = 0 To oTables.getCount() - 1
+ oTable = oTables(i)
+ sumTables = sumTables + 1
+ If oTable.getPropertyValue("Split") = false Then
+ sumSplit = sumSplit + 1
+ oTable.setPropertyValue("Split", true)
+ End If
+ If oTable.getPropertyValue("HoriOrient") <> 6 And _
+ oTable.getPropertyValue("IsWidthRelative") = false Then
+ sumRelativeWidth = sumRelativeWidth + 1
+ oTable.setPropertyValue("RelativeWidth", 100)
+ End If
+ For j = 0 To oTable.getRows.getCount - 1
+ oRow = oTable.getRows.getByIndex(j)
+ If oRow.getPropertyValue("IsSplitAllowed") = false Then
+ sumRows = sumRows + 1
+ oRow.setPropertyValue("IsSplitAllowed", true)
+ End If
+ Next
+
+ sNames = oTable.getCellNames()
+ For k = LBound(sNames) To UBound(sNames)
+ oCell = oTable.getCellByName(sNames(k))
+ cType = oCell.getType()
+ If oCell.getType() = com.sun.star.table.CellContentType.TEXT Then
+ oCellCursor = oCell.createTextCursor()
+ oParEnum = oCell.createEnumeration()
+ Do While oParEnum.hasMoreElements()
+ oPar = oParEnum.nextElement()
+ leftMargin = oPar.getPropertyValue("ParaLeftMargin")
+ rightMargin = oPar.getPropertyValue("ParaRightMargin")
+ firstLineIndent = oPar.getPropertyValue("ParaFirstLineIndent")
+ 'If any are < 0, consider bad, and reset all to 0
+ If leftMargin < 0 Or rightMargin < 0 Or firstLineIndent < 0 Then
+ sumPara = sumPara + 1
+ oPar.setPropertyValue("ParaLeftMargin", 0)
+ oPar.setPropertyValue("ParaRightMargin", 0)
+ oPar.setPropertyValue("ParaFirstLineIndent", 0)
+ End If
+ Loop
+ End If
+ Next
+ Next
+
+ s = "Out of " & sumTables & " table(s)" & CHR(13) & _
+ "Relative setting was added to: " & sumRelativeWidth & CHR(13) & _
+ "Property to enable breaking across pages was enabled for: " & sumSplit & CHR(13) & CHR(13) & _
+ "No. of rows property to enable breaking across pages was enabled for: " & sumRows & CHR(13) & _
+ "No. of paragraphs in cells where paragraph properties were reset: " & sumPara & CHR(13) & CHR(13) & "Save the file afterwards!"
+ MsgBox s, 0, "Result"
End Sub
</script:module>
More information about the Libreoffice-commits
mailing list