Created menu for cleaning control

This commit is contained in:
Georgy Litvinov 2020-03-06 11:04:22 +01:00
parent 66915ccd38
commit b76d5ca142
3 changed files with 92 additions and 4 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 mark24 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark26
End Sub End Sub
@ -12,10 +12,77 @@ Sub cleanButton
Else Else
makerUpMenu() makerUpMenu()
EndIf EndIf
End Sub End Sub
Sub makerUpMenu() Private Sub makerUpMenu
Dim dialog As Object
DialogLibraries.LoadLibrary(&quot;Redaction&quot;)
dialog = CreateUnoDialog(DialogLibraries.Redaction.CleaningDialog)
dialog.setVisible(true)
Select Case dialog.Execute()
Case 1
cleanAccordingTo(dialog)
Case 0
End Select
dialog.dispose()
Exit sub
End Sub
Private Sub cleanAccordingTo(dialog)
Dim statusIndicator as Object
statusIndicator = ThisComponent.getCurrentController.statusIndicator
dialog.setVisible(false)
saveDocument
statusIndicator.Start(&quot;Чистка документа начата, подождите&quot;,100)
doNotTrack
If dialog.getControl(&quot;fontsInStyles&quot;).state = 1 Then
statusIndicator.Start(&quot;Заменяем шрифты в стилях&quot;,100)
replaceStyleFonts
EndIf
If dialog.getControl(&quot;symbolsConversion&quot;).state = 1 Then
statusIndicator.Start(&quot;Конвертируем символы в целевые шрифты&quot;,100)
unicodeSymbolsConversion
EndIf
If dialog.getControl(&quot;cleanFormatting&quot;).state = 1 Then
statusIndicator.Start(&quot;Чистим ручное форматирование&quot;,100)
cleanFormatting
EndIf
If dialog.getControl(&quot;removeLinks&quot;).state = 1 Then
statusIndicator.Start(&quot;Удаляем гиперссылки&quot;,100)
removeHyperlinks
EndIf
If dialog.getControl(&quot;removeBookmarks&quot;).state = 1 Then
statusIndicator.Start(&quot;Удаляем закладки&quot;,100)
disposeAllBookmarks
EndIf
If dialog.getControl(&quot;configTables&quot;).state = 1 Then
statusIndicator.Start(&quot;Настраиваем таблицы&quot;,100)
fixTableWidth
EndIf
If dialog.getControl(&quot;configAnchors&quot;).state = 1 Then
statusIndicator.Start(&quot;Настраиваем привязку изображений&quot;,100)
fixDrawingAnchors
EndIf
If dialog.getControl(&quot;fixMistakes&quot;).state = 1 Then
statusIndicator.Start(&quot;Исправляем часто встречающиеся ошибки&quot;,100)
fixFrequentMistakes
EndIf
If dialog.getControl(&quot;removeInitPageBreak&quot;).state = 1 Then
statusIndicator.Start(&quot;Удаляем разрыв страницы, если он задан в начале документа&quot;,100)
removeFirstElementPageBreak
EndIf
If dialog.getControl(&quot;removePageStyles&quot;).state = 1 Then
statusIndicator.Start(&quot;Удаляем пользовательские стили страниц&quot;,100)
removeUserPageStyles
EndIf
If dialog.getControl(&quot;loadStandardStyles&quot;).state = 1 Then
statusIndicator.Start(&quot;Загружаем стили из шаблона&quot;,100)
loadArticleStyles
EndIf
statusIndicator.end()
saveAndreload()
MsgBox &quot;Чистка завершена.&quot;
End Sub End Sub
Private Sub quietCleaning Private Sub quietCleaning

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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="108" dlg:top="17" dlg:width="237" dlg:height="156" dlg:closeable="true" dlg:moveable="true">
<dlg:bulletinboard>
<dlg:button dlg:id="Cancel" dlg:tab-index="0" dlg:left="65" dlg:top="139" dlg:width="40" dlg:height="12" dlg:value="Отмена" dlg:button-type="cancel"/>
<dlg:button dlg:id="CommandButton1" dlg:tab-index="1" dlg:left="41" dlg:top="169" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
<dlg:button dlg:id="OK" dlg:tab-index="2" dlg:left="129" dlg:top="139" dlg:width="40" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/>
<dlg:checkbox dlg:id="fontsInStyles" dlg:tab-index="3" dlg:left="10" dlg:top="9" dlg:width="218" dlg:height="7" dlg:value="Заменить названия шрифтов в стилях" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeLinks" dlg:tab-index="6" dlg:left="10" dlg:top="40" dlg:width="218" dlg:height="7" dlg:value="Удалить гиперссылки" dlg:checked="false"/>
<dlg:checkbox dlg:id="cleanFormatting" dlg:tab-index="5" dlg:left="10" dlg:top="30" dlg:width="218" dlg:height="7" dlg:value="Очистить форматирование" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeBookmarks" dlg:tab-index="7" dlg:left="10" dlg:top="51" dlg:width="218" dlg:height="7" dlg:value="Удалить закладки" dlg:checked="false"/>
<dlg:checkbox dlg:id="configTables" dlg:tab-index="8" dlg:left="10" dlg:top="61" dlg:width="218" dlg:height="7" dlg:value="Настроить свойства таблиц" dlg:checked="false"/>
<dlg:checkbox dlg:id="configAnchors" dlg:tab-index="9" dlg:left="10" dlg:top="71" dlg:width="218" dlg:height="7" dlg:value="Настроить привязки изображений" dlg:checked="false"/>
<dlg:checkbox dlg:id="fixMistakes" dlg:tab-index="10" dlg:left="10" dlg:top="81" dlg:width="218" dlg:height="7" dlg:value="Исправить часто встречающиеся ошибки набора" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeInitPageBreak" dlg:tab-index="11" dlg:left="10" dlg:top="92" dlg:width="218" dlg:height="7" dlg:value="Удалить разрыв страницы в начале документа" dlg:checked="false"/>
<dlg:checkbox dlg:id="removePageStyles" dlg:tab-index="12" dlg:left="10" dlg:top="103" dlg:width="218" dlg:height="7" dlg:value="Удалить пользовательские стили страниц" dlg:checked="false"/>
<dlg:checkbox dlg:id="loadStandardStyles" dlg:tab-index="13" dlg:left="10" dlg:top="114" dlg:width="218" dlg:height="7" dlg:value="Загрузить стили страниц из шаблона Статья.ott" dlg:checked="false"/>
<dlg:checkbox dlg:id="symbolsConversion" dlg:tab-index="4" dlg:left="10" dlg:top="20" dlg:width="218" dlg:height="7" dlg:value="Произвести конвертацию символов" dlg:checked="false"/>
</dlg:bulletinboard>
</dlg:window>

View file

@ -2,4 +2,5 @@
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> <!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Redaction" library:readonly="false" library:passwordprotected="false"> <library:library xmlns:library="http://openoffice.org/2000/library" library:name="Redaction" library:readonly="false" library:passwordprotected="false">
<library:element library:name="ConfigDialog"/> <library:element library:name="ConfigDialog"/>
<library:element library:name="CleaningDialog"/>
</library:library> </library:library>