diff --git a/IPHRedaction/Clean.xba b/IPHRedaction/Clean.xba index 0138b9c..e0725e1 100644 --- a/IPHRedaction/Clean.xba +++ b/IPHRedaction/Clean.xba @@ -11,6 +11,8 @@ saveDocument doNotTrack statusIndicator.Start("Чистка документа начата, подождите",30) + + convertFontsToCharStyles cleanFormatting disposeAllLinks disposeAllBookmarks @@ -22,6 +24,32 @@ saveAndreload() End Sub + +'Replaces manual formatting text with font into character style with assigned font +Private Sub convertFontsToCharStyles + Dim oDoc + oDoc = Thiscomponent + Dim srch(0) as new com.sun.star.beans.PropertyValue + SDesc = Thiscomponent.createSearchDescriptor() + SDesc.SearchAll = true + SDesc.ValueSearch = false + SDesc.SearchStyles = false + SDesc.SearchRegularExpression = false + SDesc.SearchString = "" + srch(0).Name = "CharFontName" + SDesc.SetSearchAttributes(srch()) + founds = Thiscomponent.findFirst(SDesc) + do while not isNull(founds) + curFont = founds.CharFontName + If Not DocHasCharStyle(oDoc,curFont) Then + oProps() = Array(CreateProperty("CharFontName", curFont)) + CreateCharacterStyle(curFont, oProps()) + End If + founds.CharStyleNames = Array(curFont) + founds = Thiscomponent.findNext(founds.getend, SDesc) + loop +End Sub + Private Sub fixFrequentMistakes Dim NBSP As String Dim space As String diff --git a/description.xml b/description.xml index 5f990d2..21aaa1d 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 diff --git a/redaction.oxt b/redaction.oxt index 506d914..a4a8afc 100644 Binary files a/redaction.oxt and b/redaction.oxt differ