summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAron Budea <aron.budea@collabora.com>2019-05-06 07:36:14 +0200
committerAndras Timar <andras.timar@collabora.com>2019-05-06 11:35:15 +0200
commit41d57bd387af44af6eeda27c692a6ac82c9d4b61 (patch)
treec369bfba471788d92b01344f16e79108d203e3fe
parent4eaff1246710443a0a6870f547ba8fdc1c71341a (diff)
[cp] Updated Fix Table Properties macroco-6.0-29
Change-Id: I7f8695789e1223df7bbb235fa6081ed91502ab99 Reviewed-on: https://gerrit.libreoffice.org/71852 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--wizards/source/tools/Misc.xba87
1 files changed, 56 insertions, 31 deletions
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
&apos; 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(&quot;Split&quot;) = false Then
- sumSplit = sumSplit + 1
- oTable.setPropertyValue(&quot;Split&quot;, true)
- End If
- If oTable.getPropertyValue(&quot;HoriOrient&quot;) &lt;&gt; 6 And _
- oTable.getPropertyValue(&quot;IsWidthRelative&quot;) = false Then
- sumRelativeWidth = sumRelativeWidth + 1
- oTable.setPropertyValue(&quot;RelativeWidth&quot;, 100)
- End If
- For j = 0 To oTable.getRows.getCount - 1
- oRow = oTable.getRows.getByIndex(j)
- If oRow.getPropertyValue(&quot;IsSplitAllowed&quot;) = false Then
- sumRows = sumRows + 1
- oRow.setPropertyValue(&quot;IsSplitAllowed&quot;, true)
- End If
- Next
- Next
-
- s = &quot;Out of &quot; &amp; sumTables &amp; &quot; table(s)&quot; &amp; CHR(13) &amp; _
- &quot;Relative setting was added to: &quot; &amp; sumRelativeWidth &amp; CHR(13) &amp; _
- &quot;Property to enable breaking across pages was enabled for: &quot; &amp; sumSplit &amp; CHR(13) &amp; CHR(13) &amp; _
- &quot;No. of rows property to enable breaking across pages was enabled for: &quot; &amp; sumRows &amp; CHR(13) &amp; CHR(13) &amp; &quot;Save the file afterwards!&quot;
- MsgBox s, 0, &quot;Result&quot;
+ 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(&quot;Split&quot;) = false Then
+ sumSplit = sumSplit + 1
+ oTable.setPropertyValue(&quot;Split&quot;, true)
+ End If
+ If oTable.getPropertyValue(&quot;HoriOrient&quot;) &lt;&gt; 6 And _
+ oTable.getPropertyValue(&quot;IsWidthRelative&quot;) = false Then
+ sumRelativeWidth = sumRelativeWidth + 1
+ oTable.setPropertyValue(&quot;RelativeWidth&quot;, 100)
+ End If
+ For j = 0 To oTable.getRows.getCount - 1
+ oRow = oTable.getRows.getByIndex(j)
+ If oRow.getPropertyValue(&quot;IsSplitAllowed&quot;) = false Then
+ sumRows = sumRows + 1
+ oRow.setPropertyValue(&quot;IsSplitAllowed&quot;, 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(&quot;ParaLeftMargin&quot;)
+ rightMargin = oPar.getPropertyValue(&quot;ParaRightMargin&quot;)
+ firstLineIndent = oPar.getPropertyValue(&quot;ParaFirstLineIndent&quot;)
+ &apos;If any are &lt; 0, consider bad, and reset all to 0
+ If leftMargin &lt; 0 Or rightMargin &lt; 0 Or firstLineIndent &lt; 0 Then
+ sumPara = sumPara + 1
+ oPar.setPropertyValue(&quot;ParaLeftMargin&quot;, 0)
+ oPar.setPropertyValue(&quot;ParaRightMargin&quot;, 0)
+ oPar.setPropertyValue(&quot;ParaFirstLineIndent&quot;, 0)
+ End If
+ Loop
+ End If
+ Next
+ Next
+
+ s = &quot;Out of &quot; &amp; sumTables &amp; &quot; table(s)&quot; &amp; CHR(13) &amp; _
+ &quot;Relative setting was added to: &quot; &amp; sumRelativeWidth &amp; CHR(13) &amp; _
+ &quot;Property to enable breaking across pages was enabled for: &quot; &amp; sumSplit &amp; CHR(13) &amp; CHR(13) &amp; _
+ &quot;No. of rows property to enable breaking across pages was enabled for: &quot; &amp; sumRows &amp; CHR(13) &amp; _
+ &quot;No. of paragraphs in cells where paragraph properties were reset: &quot; &amp; sumPara &amp; CHR(13) &amp; CHR(13) &amp; &quot;Save the file afterwards!&quot;
+ MsgBox s, 0, &quot;Result&quot;
End Sub
</script:module>