Added fonts to styles conversion

This commit is contained in:
George Litvinov 2019-10-29 15:05:22 +03:00
parent e9caf166d1
commit d5ba33005f
3 changed files with 29 additions and 1 deletions

View file

@ -11,6 +11,8 @@
saveDocument saveDocument
doNotTrack doNotTrack
statusIndicator.Start("Чистка документа начата, подождите",30) statusIndicator.Start("Чистка документа начата, подождите",30)
convertFontsToCharStyles
cleanFormatting cleanFormatting
disposeAllLinks disposeAllLinks
disposeAllBookmarks disposeAllBookmarks
@ -22,6 +24,32 @@
saveAndreload() saveAndreload()
End Sub 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 Private Sub fixFrequentMistakes
Dim NBSP As String Dim NBSP As String
Dim space As String Dim space As String

View file

@ -3,7 +3,7 @@
xmlns:dep="http://openoffice.org/extensions/description/2006" xmlns:dep="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink"> xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="pro.litvinovg.Redaction" /> <identifier value="pro.litvinovg.Redaction" />
<version value="0.2.3" /> <version value="0.2.4" />
<platform value="all" /> <platform value="all" />
<display-name> <display-name>
<name lang="en">Redaction for publishing in Institute of philosophy</name> <name lang="en">Redaction for publishing in Institute of philosophy</name>

Binary file not shown.