From b76d5ca142384857fffe07a37b8350f429f52c1e Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Fri, 6 Mar 2020 11:04:22 +0100 Subject: [PATCH] Created menu for cleaning control --- Redaction/Clean.xba | 75 ++++++++++++++++++++++++++++++++++-- Redaction/CleaningDialog.xdl | 20 ++++++++++ Redaction/dialog.xlb | 1 + 3 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 Redaction/CleaningDialog.xdl diff --git a/Redaction/Clean.xba b/Redaction/Clean.xba index eccd76d..48666a4 100644 --- a/Redaction/Clean.xba +++ b/Redaction/Clean.xba @@ -1,6 +1,6 @@ -Sub mark24 +Sub mark26 End Sub @@ -11,11 +11,78 @@ Sub cleanButton quietCleaning() Else makerUpMenu() - EndIf - + EndIf End Sub -Sub makerUpMenu() +Private Sub makerUpMenu + Dim dialog As Object + DialogLibraries.LoadLibrary("Redaction") + 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("Чистка документа начата, подождите",100) + doNotTrack + If dialog.getControl("fontsInStyles").state = 1 Then + statusIndicator.Start("Заменяем шрифты в стилях",100) + replaceStyleFonts + EndIf + If dialog.getControl("symbolsConversion").state = 1 Then + statusIndicator.Start("Конвертируем символы в целевые шрифты",100) + unicodeSymbolsConversion + EndIf + If dialog.getControl("cleanFormatting").state = 1 Then + statusIndicator.Start("Чистим ручное форматирование",100) + cleanFormatting + EndIf + If dialog.getControl("removeLinks").state = 1 Then + statusIndicator.Start("Удаляем гиперссылки",100) + removeHyperlinks + EndIf + If dialog.getControl("removeBookmarks").state = 1 Then + statusIndicator.Start("Удаляем закладки",100) + disposeAllBookmarks + EndIf + If dialog.getControl("configTables").state = 1 Then + statusIndicator.Start("Настраиваем таблицы",100) + fixTableWidth + EndIf + If dialog.getControl("configAnchors").state = 1 Then + statusIndicator.Start("Настраиваем привязку изображений",100) + fixDrawingAnchors + EndIf + If dialog.getControl("fixMistakes").state = 1 Then + statusIndicator.Start("Исправляем часто встречающиеся ошибки",100) + fixFrequentMistakes + EndIf + If dialog.getControl("removeInitPageBreak").state = 1 Then + statusIndicator.Start("Удаляем разрыв страницы, если он задан в начале документа",100) + removeFirstElementPageBreak + EndIf + If dialog.getControl("removePageStyles").state = 1 Then + statusIndicator.Start("Удаляем пользовательские стили страниц",100) + removeUserPageStyles + EndIf + If dialog.getControl("loadStandardStyles").state = 1 Then + statusIndicator.Start("Загружаем стили из шаблона",100) + loadArticleStyles + EndIf + statusIndicator.end() + saveAndreload() + MsgBox "Чистка завершена." + End Sub Private Sub quietCleaning diff --git a/Redaction/CleaningDialog.xdl b/Redaction/CleaningDialog.xdl new file mode 100644 index 0000000..3c6b320 --- /dev/null +++ b/Redaction/CleaningDialog.xdl @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Redaction/dialog.xlb b/Redaction/dialog.xlb index 074778b..1eb9870 100644 --- a/Redaction/dialog.xlb +++ b/Redaction/dialog.xlb @@ -2,4 +2,5 @@ + \ No newline at end of file