Added filter for bad default paragraph styles settings

This commit is contained in:
Georgy Litvinov 2020-06-18 15:26:48 +02:00
parent a8f91c44c4
commit 805815e2ae
3 changed files with 35 additions and 3 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark54
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark55
End Sub
@ -55,6 +55,10 @@ Private Sub cleanAccordingTo(dialog As Object)
saveDocument
statusIndicator.Start(getTranslation(&quot;statusStarted&quot;),100)
doNotTrack
If dialog.getControl(&quot;loadStandardStyles&quot;).state = 1 Then
statusIndicator.Start(getTranslation(&quot;resaving&quot;),100)
saveAsDocAndBackToODT
EndIf
If dialog.getControl(&quot;fontsInStyles&quot;).state = 1 Then
statusIndicator.Start(getTranslation(&quot;statusReplaceFontsInStyles&quot;),100)
replaceStyleFonts
@ -138,6 +142,7 @@ Private Sub quietCleaning
Dim statusIndicator As Object
statusIndicator = ThisComponent.getCurrentController.statusIndicator
saveDocument
saveAsDocAndBackToODT
statusIndicator.Start(getTranslation(&quot;statusStarted&quot;),100)
doNotTrack
statusIndicator.Start(getTranslation(&quot;statusReplaceFontsInStyles&quot;),100)
@ -667,7 +672,7 @@ Private Sub saveAndreload()
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
dispatcher.executeDispatch(document, &quot;.uno:Save&quot;, &quot;&quot;, 0, Array())
dispatcher.executeDispatch(document, &quot;.uno:Reload&quot;, &quot;&quot;, 0, Array())
End Sub
@ -1710,4 +1715,30 @@ Private Function insertUserField(cursor As Object,fieldName As String,fieldValue
cursor.Text.insertTextContent(cursor, oField, False)
oField.IsVisible = false
End Function
sub saveAsDocAndBackToODT
dim document as object
dim dispatcher as object
Dim path As String
Dim tmpName As String
Dim oldName As String
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
oldName = ThisComponent.getURL()
tmpName = oldName &amp; &quot;--tmp&quot; &amp; &quot;.doc&quot;
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = &quot;URL&quot;
args1(0).Value = tmpName
args1(1).Name = &quot;FilterName&quot;
args1(1).Value = &quot;MS Word 97&quot;
dispatcher.executeDispatch(document, &quot;.uno:SaveAs&quot;, &quot;&quot;, 0, args1())
dispatcher.executeDispatch(document, &quot;.uno:Reload&quot;, &quot;&quot;, 0, Array())
args1(0).Value = oldName
args1(1).Value = &quot;writer8&quot;
dispatcher.executeDispatch(document, &quot;.uno:SaveAs&quot;, &quot;&quot;, 0, args1())
dispatcher.executeDispatch(document, &quot;.uno:Reload&quot;, &quot;&quot;, 0, Array())
If FileExists(tmpName) Then
Kill(tmpName)
End If
end sub
</script:module>

View file

@ -3,7 +3,7 @@
xmlns:dep="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="pro.litvinovg.Redaction" />
<version value="0.7.12" />
<version value="0.7.13" />
<platform value="all" />
<display-name>
<name lang="en">Cleaning and validation documents for publishing in html and epub with pagination</name>

View file

@ -1,3 +1,4 @@
0.7.13 Added conversion to doc and back to odt to filter broken default paragraph style settings
0.7.12 Transaltions update, fix for mistakes added
0.7.11 Serbian, Croatian, Bosnian translations added
0.7.9 Translations improved