From 0d8e96286ff082239fd28be38c2293c3510663ed Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Tue, 5 Nov 2019 00:40:28 +0300 Subject: [PATCH] Remove user defined page styles on cleaning --- IPHRedaction/Clean.xba | 22 ++++++++++++++++++++-- description.xml | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/IPHRedaction/Clean.xba b/IPHRedaction/Clean.xba index 8baaadc..879fee0 100644 --- a/IPHRedaction/Clean.xba +++ b/IPHRedaction/Clean.xba @@ -1,6 +1,6 @@ -Sub markXXFXK +Sub markXXFXKY End Sub @@ -23,6 +23,7 @@ Sub cleanButton fixTableWidth fixDrawingAnchors fixFrequentMistakes + removeUserPageStyles loadArticleStyles statusIndicator.end() saveAndreload() @@ -102,6 +103,23 @@ Private Sub convertFontsToCharStyles loop End Sub +Private Sub removeUserPageStyles + Dim oStyles As Object + Dim oStyle As Object + oStyles = ThisComponent.StyleFamilies.getByName("PageStyles") + Dim count As Long + count = oStyles.count - 1 + For i = 0 to count + oStyle = oStyles.getByIndex(i) + If oStyle.isUserDefined Then + oStyles.removeByName(oStyle.getName) + count = oStyles.count - 1 + 'restart if style removed as sorting is unreliable + i = -1 + EndIf + Next i +End Sub + Private Sub fixFrequentMistakes Dim NBSP As String Dim space As String @@ -854,4 +872,4 @@ Private Function getStyleNames(oFamily,bLocalized as Boolean, _ Endif xArray(iUB) = vNextElement End Sub - + \ No newline at end of file diff --git a/description.xml b/description.xml index ad44f53..83c34bc 100644 --- a/description.xml +++ b/description.xml @@ -3,7 +3,7 @@ xmlns:dep="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> - + Redaction for publishing in Institute of philosophy