Reset chapters numbering settings

This commit is contained in:
Georgy Litvinov 2021-01-12 01:07:00 +01:00
parent 857267ba75
commit 87fcbbbdef
4 changed files with 53 additions and 6 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 mark72
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark73
End Sub
@ -40,6 +40,7 @@ Private Sub makerUpMenu
dialog.getControl(&quot;loadStandardStyles&quot;).Label = getTranslation(&quot;advancedMenuLoadStandardStyles&quot;)
dialog.getControl(&quot;removeManualPageBreaks&quot;).Label = getTranslation(&quot;advancedMenuRemoveManualPageBreaks&quot;)
dialog.getControl(&quot;removeBasic&quot;).Label = getTranslation(&quot;advancedMenuRemoveBasic&quot;)
dialog.getControl(&quot;resetChapterNumberingRules&quot;).Label = getTranslation(&quot;advancedMenuResetChapterNumberingRules&quot;)
dialog.getControl(&quot;Cancel&quot;).Label = getTranslation(&quot;buttonCancel&quot;)
dialog.getControl(&quot;OK&quot;).Label = getTranslation(&quot;buttonOK&quot;)
dialog.getControl(&quot;buttonLoad&quot;).Label = getTranslation(&quot;buttonLoad&quot;)
@ -133,6 +134,9 @@ Private Sub cleanAccordingTo(dialog As Object)
If dialog.getControl(&quot;removeBasic&quot;).state = 1 Then
removeLibs
EndIf
If dialog.getControl(&quot;resetChapterNumberingRules&quot;).state = 1 Then
resetChapterNumberingRules
EndIf
statusIndicator.end()
saveAndreload()
@ -193,6 +197,7 @@ Private Sub quietCleaning
statusIndicator.Start(getTranslation(&quot;statusLoadingStylesFromTemplate&quot;),100)
loadArticleStyles
removeLibs
resetChapterNumberingRules
addTimeStampToProperties
saveCleanedVersion(&quot;Standard cleaning&quot;)
statusIndicator.end()
@ -1856,5 +1861,31 @@ sub saveCleanedVersion(comment)
args1(0).Name = &quot;VersionComment&quot;
args1(0).Value = comment
dispatcher.executeDispatch(document, &quot;.uno:Save&quot;, &quot;&quot;, 0, args1())
end sub
end Sub
Sub resetChapterNumberingRules
Dim chapNumRules As Object
Dim numRulesProps As Variant
Dim numRuleProperty As Variant
Dim i As Integer
chapNumRules = ThisComponent.ChapterNumberingRules
For i = 0 To chapNumRules.Count - 1
numRulesProps = chapNumRules.getByIndex(i)
For n = LBound(numRulesProps) To UBound(numRulesProps)
numRuleProperty = numRulesProps(n)
If (numRuleProperty.Name = &quot;Prefix&quot;) Then
numRuleProperty.Value = &quot;&quot;
End If
If (numRuleProperty.Name = &quot;Suffix&quot;) Then
numRuleProperty.Value = &quot;&quot;
End If
If (numRuleProperty.Name = &quot;CharStyleName&quot;) Then
numRuleProperty.Value = &quot;None&quot;
End If
numRulesProps(n) = numRuleProperty
Next n
chapNumRules.replaceByIndex(i,numRulesProps)
Next i
End Sub
</script:module>