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"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> <!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 End Sub
@ -40,6 +40,7 @@ Private Sub makerUpMenu
dialog.getControl(&quot;loadStandardStyles&quot;).Label = getTranslation(&quot;advancedMenuLoadStandardStyles&quot;) dialog.getControl(&quot;loadStandardStyles&quot;).Label = getTranslation(&quot;advancedMenuLoadStandardStyles&quot;)
dialog.getControl(&quot;removeManualPageBreaks&quot;).Label = getTranslation(&quot;advancedMenuRemoveManualPageBreaks&quot;) dialog.getControl(&quot;removeManualPageBreaks&quot;).Label = getTranslation(&quot;advancedMenuRemoveManualPageBreaks&quot;)
dialog.getControl(&quot;removeBasic&quot;).Label = getTranslation(&quot;advancedMenuRemoveBasic&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;Cancel&quot;).Label = getTranslation(&quot;buttonCancel&quot;)
dialog.getControl(&quot;OK&quot;).Label = getTranslation(&quot;buttonOK&quot;) dialog.getControl(&quot;OK&quot;).Label = getTranslation(&quot;buttonOK&quot;)
dialog.getControl(&quot;buttonLoad&quot;).Label = getTranslation(&quot;buttonLoad&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 If dialog.getControl(&quot;removeBasic&quot;).state = 1 Then
removeLibs removeLibs
EndIf EndIf
If dialog.getControl(&quot;resetChapterNumberingRules&quot;).state = 1 Then
resetChapterNumberingRules
EndIf
statusIndicator.end() statusIndicator.end()
saveAndreload() saveAndreload()
@ -193,6 +197,7 @@ Private Sub quietCleaning
statusIndicator.Start(getTranslation(&quot;statusLoadingStylesFromTemplate&quot;),100) statusIndicator.Start(getTranslation(&quot;statusLoadingStylesFromTemplate&quot;),100)
loadArticleStyles loadArticleStyles
removeLibs removeLibs
resetChapterNumberingRules
addTimeStampToProperties addTimeStampToProperties
saveCleanedVersion(&quot;Standard cleaning&quot;) saveCleanedVersion(&quot;Standard cleaning&quot;)
statusIndicator.end() statusIndicator.end()
@ -1856,5 +1861,31 @@ sub saveCleanedVersion(comment)
args1(0).Name = &quot;VersionComment&quot; args1(0).Name = &quot;VersionComment&quot;
args1(0).Value = comment args1(0).Value = comment
dispatcher.executeDispatch(document, &quot;.uno:Save&quot;, &quot;&quot;, 0, args1()) 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> </script:module>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd"> <!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="CleaningDialog" dlg:left="107" dlg:top="22" dlg:width="237" dlg:height="201" dlg:help-text="&amp;21.CleaningDialog.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&amp;22.CleaningDialog.Title"> <dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="CleaningDialog" dlg:left="107" dlg:top="22" dlg:width="237" dlg:height="211" dlg:help-text="&amp;21.CleaningDialog.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&amp;22.CleaningDialog.Title">
<dlg:bulletinboard> <dlg:bulletinboard>
<dlg:button dlg:id="Cancel" dlg:tab-index="0" dlg:left="28" dlg:top="187" dlg:width="40" dlg:height="12" dlg:value="Отмена" dlg:button-type="cancel"/> <dlg:button dlg:id="Cancel" dlg:tab-index="0" dlg:left="28" dlg:top="197" dlg:width="40" dlg:height="12" dlg:value="Отмена" dlg:button-type="cancel"/>
<dlg:button dlg:id="CommandButton1" dlg:tab-index="1" dlg:left="24" dlg:top="170" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/> <dlg:button dlg:id="CommandButton1" dlg:tab-index="1" dlg:left="24" dlg:top="170" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
<dlg:button dlg:id="OK" dlg:tab-index="2" dlg:left="92" dlg:top="187" dlg:width="40" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/> <dlg:button dlg:id="OK" dlg:tab-index="2" dlg:left="92" dlg:top="197" dlg:width="40" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/>
<dlg:checkbox dlg:id="fontsInStyles" dlg:tab-index="3" dlg:left="11" dlg:top="10" dlg:width="218" dlg:height="7" dlg:value="Заменить названия шрифтов в стилях" dlg:checked="false"/> <dlg:checkbox dlg:id="fontsInStyles" dlg:tab-index="3" dlg:left="11" dlg:top="10" dlg:width="218" dlg:height="7" dlg:value="Заменить названия шрифтов в стилях" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeLinks" dlg:tab-index="6" dlg:left="11" dlg:top="50" dlg:width="218" dlg:height="7" dlg:value="Удалить гиперссылки" dlg:checked="false"/> <dlg:checkbox dlg:id="removeLinks" dlg:tab-index="6" dlg:left="11" dlg:top="50" dlg:width="218" dlg:height="7" dlg:value="Удалить гиперссылки" dlg:checked="false"/>
<dlg:checkbox dlg:id="cleanFormatting" dlg:tab-index="5" dlg:left="11" dlg:top="30" dlg:width="218" dlg:height="7" dlg:value="Очистить форматирование" dlg:checked="false"/> <dlg:checkbox dlg:id="cleanFormatting" dlg:tab-index="5" dlg:left="11" dlg:top="30" dlg:width="218" dlg:height="7" dlg:value="Очистить форматирование" dlg:checked="false"/>
@ -20,10 +20,11 @@
<dlg:checkbox dlg:id="removeManualPageBreaks" dlg:tab-index="15" dlg:left="11" dlg:top="150" dlg:width="218" dlg:height="7" dlg:value="Удалить все разрывы страниц" dlg:checked="false"/> <dlg:checkbox dlg:id="removeManualPageBreaks" dlg:tab-index="15" dlg:left="11" dlg:top="150" dlg:width="218" dlg:height="7" dlg:value="Удалить все разрывы страниц" dlg:checked="false"/>
<dlg:checkbox dlg:id="replaceWhiteBackground" dlg:tab-index="16" dlg:left="11" dlg:top="40" dlg:width="218" dlg:height="7" dlg:value="Заменить белый фон символов на прозрачный" dlg:checked="false"/> <dlg:checkbox dlg:id="replaceWhiteBackground" dlg:tab-index="16" dlg:left="11" dlg:top="40" dlg:width="218" dlg:height="7" dlg:value="Заменить белый фон символов на прозрачный" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeBasic" dlg:tab-index="17" dlg:left="11" dlg:top="160" dlg:width="218" dlg:height="7" dlg:value="Удалить макросы" dlg:checked="false"/> <dlg:checkbox dlg:id="removeBasic" dlg:tab-index="17" dlg:left="11" dlg:top="160" dlg:width="218" dlg:height="7" dlg:value="Удалить макросы" dlg:checked="false"/>
<dlg:button dlg:id="buttonLoad" dlg:tab-index="18" dlg:left="158" dlg:top="186" dlg:width="52" dlg:height="12" dlg:value="loadTemplate"> <dlg:button dlg:id="buttonLoad" dlg:tab-index="18" dlg:left="158" dlg:top="197" dlg:width="52" dlg:height="12" dlg:value="loadTemplate">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Redaction.Configuration.setDeafultTemplate?language=Basic&amp;location=application" script:language="Script"/> <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Redaction.Configuration.setDeafultTemplate?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button> </dlg:button>
<dlg:checkbox dlg:id="removeAllFields" dlg:tab-index="19" dlg:left="11" dlg:top="170" dlg:width="218" dlg:height="7" dlg:value="Удалить все поля" dlg:checked="false"/> <dlg:checkbox dlg:id="removeAllFields" dlg:tab-index="19" dlg:left="11" dlg:top="170" dlg:width="218" dlg:height="7" dlg:value="Удалить все поля" dlg:checked="false"/>
<dlg:checkbox dlg:id="fixDOI" dlg:tab-index="20" dlg:left="11" dlg:top="100" dlg:width="218" dlg:height="7" dlg:value="Исправить DOI" dlg:checked="false"/> <dlg:checkbox dlg:id="fixDOI" dlg:tab-index="20" dlg:left="11" dlg:top="100" dlg:width="218" dlg:height="7" dlg:value="Исправить DOI" dlg:checked="false"/>
<dlg:checkbox dlg:id="resetChapterNumberingRules" dlg:tab-index="21" dlg:left="11" dlg:top="180" dlg:width="218" dlg:height="7" dlg:value="Сбросить настройки нумерации глав" dlg:checked="false"/>
</dlg:bulletinboard> </dlg:bulletinboard>
</dlg:window> </dlg:window>

View file

@ -269,6 +269,9 @@ Function getRussian(identifier As String) As String
Case &quot;statusFixingDOI&quot; Case &quot;statusFixingDOI&quot;
getRussian = &quot;Исправляем DOI&quot; getRussian = &quot;Исправляем DOI&quot;
Exit Function Exit Function
Case &quot;advancedMenuResetChapterNumberingRules&quot;
getRussian = &quot;Сбросить настройки нумерации глав&quot;
Exit Function
Case Else Case Else
getRussian = &quot;Перевод не найден&quot; getRussian = &quot;Перевод не найден&quot;
End Select End Select
@ -520,6 +523,9 @@ Function getEnglish(identifier As String) As String
Case &quot;statusFixingDOI&quot; Case &quot;statusFixingDOI&quot;
getEnglish = &quot;Fixing DOI&quot; getEnglish = &quot;Fixing DOI&quot;
Exit Function Exit Function
Case &quot;advancedMenuResetChapterNumberingRules&quot;
getEnglish = &quot;Reset chapter numbering settings&quot;
Exit Function
Case Else Case Else
getEnglish = &quot;No translation&quot; getEnglish = &quot;No translation&quot;
End Select End Select
@ -770,6 +776,9 @@ Function getCroatian(identifier As String) As String
Case &quot;statusFixingDOI&quot; Case &quot;statusFixingDOI&quot;
getCroatian = &quot;Ispravljamo DOI&quot; getCroatian = &quot;Ispravljamo DOI&quot;
Exit Function Exit Function
Case &quot;advancedMenuResetChapterNumberingRules&quot;
getCroatian = &quot;Resetirajte postavke numeriranja poglavlja&quot;
Exit Function
Case Else Case Else
getCroatian = &quot;No translation&quot; getCroatian = &quot;No translation&quot;
End Select End Select
@ -1020,6 +1029,9 @@ Function getSerbian(identifier As String) As String
Case &quot;statusFixingDOI&quot; Case &quot;statusFixingDOI&quot;
getSerbian = &quot;Исправљамо DOI&quot; getSerbian = &quot;Исправљамо DOI&quot;
Exit Function Exit Function
Case &quot;advancedMenuResetChapterNumberingRules&quot;
getSerbian = &quot;Ресетујте поставке нумерисања поглавља&quot;
Exit Function
Case Else Case Else
getSerbian = &quot;No translation&quot; getSerbian = &quot;No translation&quot;
End Select End Select
@ -1270,6 +1282,9 @@ Function getBosnian(identifier As String) As String
Case &quot;statusFixingDOI&quot; Case &quot;statusFixingDOI&quot;
getBosnian = &quot;Ispravljamo DOI&quot; getBosnian = &quot;Ispravljamo DOI&quot;
Exit Function Exit Function
Case &quot;advancedMenuResetChapterNumberingRules&quot;
getBosnian = &quot;Resetirajte postavke numeriranja poglavlja&quot;
Exit Function
Case Else Case Else
getBosnian = &quot;No translation&quot; getBosnian = &quot;No translation&quot;
End Select End Select

Binary file not shown.