summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2017-06-13 05:17:53 -0700
committerAndras Timar <andras.timar@collabora.com>2018-04-12 02:20:36 -0700
commit2d851c2865236e12eb4240530a734b06f973fc7b (patch)
tree9a972acdacff369223263580800d49f6162442ee
parent7b264a2925ecfd954583433717d8dad9d19684db (diff)
Fix Table Properties macro
Change-Id: I45e5b258ba8f739e3dc0043978488ee9e4ad74b4
-rw-r--r--sw/uiconfig/swriter/menubar/menubar.xml1
-rw-r--r--wizards/source/tools/Misc.xba35
2 files changed, 36 insertions, 0 deletions
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index f78f75a05e97..8f3247aad1db 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -748,6 +748,7 @@
<menu:menuitem menu:id=".uno:MacroOrganizer?TabId:short=1"/>
</menu:menupopup>
</menu:menu>
+ <menu:menuitem menu:id="vnd.sun.star.script:Tools.Misc.FixTableProperties?language=Basic&amp;location=application" menu:label="Fix Table Properties"/>
<menu:menuitem menu:id=".uno:OpenXMLFilterSettings"/>
<menu:menuitem menu:id="service:com.sun.star.deployment.ui.PackageManagerDialog"/>
<menu:menuitem menu:id=".uno:ConfigureDialog"/>
diff --git a/wizards/source/tools/Misc.xba b/wizards/source/tools/Misc.xba
index 2bf17d32e984..7a001683c9bd 100644
--- a/wizards/source/tools/Misc.xba
+++ b/wizards/source/tools/Misc.xba
@@ -838,4 +838,39 @@ End Sub
Function CalIsLeapYear(ByVal iYear as Integer) as Boolean
CalIsLeapYear = ((iYear Mod 4 = 0) And ((iYear Mod 100 &lt;&gt; 0) Or (iYear Mod 400 = 0)))
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;
+End Sub
</script:module>