diff --git a/Redaction/Clean.xba b/Redaction/Clean.xba
index 861c4ab..eb66848 100644
--- a/Redaction/Clean.xba
+++ b/Redaction/Clean.xba
@@ -1,6 +1,6 @@
-Sub mark41
+Sub mark43
End Sub
@@ -8,7 +8,7 @@ Sub cleanButton
Dim config As Object
config = initRedactionConfiguration()
If config.getPropertyValue("complexity") = "user" then
- quietCleaning()
+ quietStartDialog()
Else
makerUpMenu()
EndIf
@@ -116,10 +116,6 @@ Private Sub quietCleaning
Dim description As String
Dim statusIndicator As Object
statusIndicator = ThisComponent.getCurrentController.statusIndicator
- description = "Вы уверены, что хотите выполнить чистку документа?"
- If NOT confirm(description) Then
- Exit Sub
- EndIf
saveDocument
statusIndicator.Start("Чистка документа начата, подождите",100)
doNotTrack
@@ -409,12 +405,19 @@ Private Sub loadArticleStyles
Dim fileTest As Object
Dim fileName As String
Dim aArgs(0) As New com.sun.star.beans.PropertyValue
- fileName = "Статья.ott"
+ Dim config As Object
+ config = initRedactionConfiguration()
+ fileName = config.getPropertyValue("defaultTemplate")
filePath = getTemplatePath() & "/" & fileName
fileTest = CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
If NOT fileTest.exists(filePath) Then
- MsgBox "Файл стилей " & fileName & " не добавлен в Мои шаблоны. Не могу загрузить стили в текущий файл."
- Exit Sub
+ noStylesFileDialog()
+ fileName = config.getPropertyValue("defaultTemplate")
+ filePath = getTemplatePath() & "/" & fileName
+ If NOT fileTest.exists(filePath) Then
+ 'MsgBox "Файл стилей " & fileName & " не добавлен в Мои шаблоны. Не могу загрузить стили в текущий файл."
+ Exit Sub
+ EndIf
EndIf
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
aArgs(0).Name = "OverwriteStyles"
@@ -1674,4 +1677,4 @@ Private Function insertUserField(cursor As Object,fieldName As String,fieldValue
cursor.Text.insertTextContent(cursor, oField, False)
oField.IsVisible = false
End Function
-
+
\ No newline at end of file
diff --git a/Redaction/CleaningDialog.xdl b/Redaction/CleaningDialog.xdl
index 8b85a07..f7462e6 100644
--- a/Redaction/CleaningDialog.xdl
+++ b/Redaction/CleaningDialog.xdl
@@ -1,6 +1,6 @@
-
+
diff --git a/Redaction/ConfigDialog.xdl b/Redaction/ConfigDialog.xdl
index 6c6d7e3..c259a3b 100644
--- a/Redaction/ConfigDialog.xdl
+++ b/Redaction/ConfigDialog.xdl
@@ -1,6 +1,6 @@
-
+
diff --git a/Redaction/Configuration.xba b/Redaction/Configuration.xba
index 697d8bc..1e5cea4 100644
--- a/Redaction/Configuration.xba
+++ b/Redaction/Configuration.xba
@@ -14,9 +14,12 @@ Function initRedactionConfiguration()
redactionProps = reg.openPropertySet(redactionExtensionName, TRUE)
redactionProps.addProperty("complexity", 128, "user")
- initRedactionConfiguration = redactionProps
- exceptionHandler:
+ exceptionHandler:
Resume Next
+ On Error Goto exceptionHandler2
+ redactionProps.addProperty("defaultTemplate", 128, "Статья.ott")
+ exceptionHandler2:
+ Resume Next
initRedactionConfiguration = redactionProps
End Function
@@ -56,4 +59,111 @@ Private Sub configurationDialog
dialog.dispose()
Exit sub
End Sub
+
+Private Sub quietStartDialog
+ 'Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
+ Dim dialog As Object
+ DialogLibraries.LoadLibrary("Redaction")
+ dialog = CreateUnoDialog(DialogLibraries.Redaction.StartQuietCleaning)
+ Dim lang As String
+ lang = GetStarOfficeLocale().Language
+ Dim description As String
+ Dim buttonNameOk As String
+ Dim buttonNameStop As String
+ Dim buttonNameLoad As String
+ description = getTranslation(lang,"startQuietCleaningDescription")
+ buttonNameOk = getTranslation(lang,"buttonOk")
+ buttonNameStop = getTranslation(lang,"buttonStop")
+ buttonNameLoad = getTranslation(lang,"buttonLoad")
+ dialog.getControl("Description").setText(description)
+ dialog.getControl("buttonOk").Label = buttonNameOk
+ dialog.getControl("buttonStop").Label = buttonNameStop
+ dialog.getControl("buttonLoad").Label = buttonNameLoad
+ dialog.setVisible(true)
+ Select Case dialog.Execute()
+ Case 1
+ dialog.setVisible(false)
+ dialog.dispose()
+ quietCleaning
+ Case 0
+ dialog.setVisible(false)
+ dialog.dispose()
+ End Select
+
+ Exit sub
+End Sub
+
+Private Sub noStylesFileDialog
+ 'Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
+ Dim dialog As Object
+ DialogLibraries.LoadLibrary("Redaction")
+ dialog = CreateUnoDialog(DialogLibraries.Redaction.NoStyleFile)
+ Dim lang As String
+ lang = GetStarOfficeLocale().Language
+ Dim description As String
+ Dim buttonName As String
+ description = getTranslation(lang,"noFileWithStylesFound")
+ buttonName = getTranslation(lang,"buttonNameToSelectFileWithStyles")
+ dialog.getControl("Description").setText(description)
+ dialog.getControl("FileSelection").Label = buttonName
+ dialog.setVisible(true)
+ Select Case dialog.Execute()
+ Case 1
+ setDeafultTemplate(selectedTemplate)
+ Case 0
+
+ End Select
+ dialog.setVisible(false)
+ dialog.dispose()
+ Exit sub
+End Sub
+
+
+
+Sub setDeafultTemplate()
+ Dim selectedTemplate As String
+ selectedTemplate = getFileURLDialog()
+ If IsEmpty(selectedTemplate) Then
+ Exit sub
+ EndIf
+ Dim fileName As String
+ Dim config As Object
+ config = initRedactionConfiguration()
+ fileName = Dir(selectedTemplate)
+ config.setPropertyValue("defaultTemplate",fileName)
+ Dim templatePath As String
+ templatePath = getTemplatePath()
+ FileCopy(selectedTemplate, templatePath & "/" & fileName)
+End Sub
+
+ Function getFileURLDialog() As String
+ Dim oFilePicker As Object, oSimpleFileAccess As Object
+ Dim oSettings As Object, oPathSettings As Object
+ Dim oTextField As Object, oTextFieldModel As Object
+ Dim sFileURL As String
+ Dim sFiles As Variant
+ oFilePicker = CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" )
+ oFilePicker.AppendFilter( "All files (*.*)", "*.*" )
+ oFilePicker.AppendFilter( "Open Document Text", "*.odt;*.ott" )
+ oFilePicker.SetCurrentFilter( "Open Document Text" )
+ If sFileURL = "" Then
+ oPathSettings = CreateUnoService( "com.sun.star.util.PathSettings" )
+ sFileURL = oPathSettings.Work
+ End If
+ REM set display directory
+ oSimpleFileAccess = CreateUnoService( "com.sun.star.ucb.SimpleFileAccess" )
+ If oSimpleFileAccess.exists( sFileURL ) And oSimpleFileAccess.isFolder( sFileURL ) Then
+ oFilePicker.setDisplayDirectory( sFileURL )
+ End If
+
+ If oFilePicker.execute() Then
+ sFiles = oFilePicker.getFiles()
+ sFileURL = sFiles(0)
+ If oSimpleFileAccess.exists( sFileURL ) Then
+ getFileURLDialog = sFileURL
+ Exit Function
+ End If
+ End If
+ getFileURLDialog = ""
+ End Function
\ No newline at end of file
diff --git a/Redaction/NoStyleFile.xdl b/Redaction/NoStyleFile.xdl
new file mode 100644
index 0000000..49a47f4
--- /dev/null
+++ b/Redaction/NoStyleFile.xdl
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Redaction/StartQuietCleaning.xdl b/Redaction/StartQuietCleaning.xdl
new file mode 100644
index 0000000..1534978
--- /dev/null
+++ b/Redaction/StartQuietCleaning.xdl
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Redaction/Translations.xba b/Redaction/Translations.xba
new file mode 100644
index 0000000..d708934
--- /dev/null
+++ b/Redaction/Translations.xba
@@ -0,0 +1,67 @@
+
+
+
+Function getTranslation(lang As String, identifier As String) As String
+ Select Case lang
+ Case "ru"
+ getTranslation = getRussian(identifier)
+ Exit Function
+ Case Else
+ getTranslation = getEnglish(identifier)
+ Exit Function
+ End Select
+End Function
+
+Function getRussian(identifier As String) As String
+ Select Case identifier
+ Case "noFileWithStylesFound"
+ getRussian = "Файл-шаблон, содержащий стили для загрузки в документ не был задан. " & chr(10) &"Вы можете выбрать новый файл-шаблон. " & chr(10) & "Если файл-шаблон не будет выбран, то данный этап чистки будет пропущен."
+ Exit Function
+ Case "startQuietCleaningDescription"
+ getRussian = "Вы хотите запустить чистку документа? " & chr(10) & "Здесь Вы можете также указать новый файл-шаблон." & chr(10) & "Стили из шаблона будут загружены в документ."
+ Exit Function
+ Case "buttonOk"
+ getRussian = "Да"
+ Exit Function
+ Case "buttonStop"
+ getRussian = "Нет"
+ Exit Function
+ Case "buttonLoad"
+ getRussian = "Указать шаблон"
+ Exit Function
+ Case "buttonNameToSelectFileWithStyles"
+ getRussian = "Указать файл"
+ Exit Function
+ Case Else
+ getRussian = getEnglish(identifier)
+ End Select
+
+End Function
+
+Function getEnglish(identifier As String) As String
+ Select Case identifier
+ Case "noFileWithStylesFound"
+ getEnglish = "Template with styles wasn't found. You can choose template on your computer. This stage of cleaning will be skipped if no file chosen."
+ Exit Function
+ Case "startQuietCleaningDescription"
+ getEnglish = "Do you want to start document cleaning?" & chr(10) & "You can choose template with styles to load them in process of the cleaning."
+ Exit Function
+ Case "buttonOk"
+ getEnglish = "Ok"
+ Exit Function
+ Case "buttonStop"
+ getEnglish = "Cancel"
+ Exit Function
+ Case "buttonLoad"
+ getEnglish = "Set template"
+ Exit Function
+ Case "buttonNameToSelectFileWithStyles"
+ getEnglish = "Select file"
+ Exit Function
+ Case Else
+ getEnglish = "No translation"
+ End Select
+End Function
+
+
+
\ No newline at end of file
diff --git a/Redaction/Validation.xba b/Redaction/Validation.xba
index e9818d3..31911ec 100644
--- a/Redaction/Validation.xba
+++ b/Redaction/Validation.xba
@@ -269,4 +269,5 @@ Private Sub StopTracking
args1(0).Value = true
dispatcher.executeDispatch(document, ".uno:ShowTrackedChanges", "", 0, args1())
End Sub
+
\ No newline at end of file
diff --git a/Redaction/dialog.xlb b/Redaction/dialog.xlb
index 1eb9870..3f33e13 100644
--- a/Redaction/dialog.xlb
+++ b/Redaction/dialog.xlb
@@ -3,4 +3,6 @@
+
+
\ No newline at end of file
diff --git a/Redaction/script.xlb b/Redaction/script.xlb
index 9cbed8d..0951c1a 100644
--- a/Redaction/script.xlb
+++ b/Redaction/script.xlb
@@ -4,4 +4,5 @@
+
\ No newline at end of file
diff --git a/description.xml b/description.xml
index a96eee3..33bce08 100644
--- a/description.xml
+++ b/description.xml
@@ -3,7 +3,7 @@
xmlns:dep="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
-
+
Cleaning and validation documents for publishing in html and epub with pagination