diff --git a/Redaction/Clean.xba b/Redaction/Clean.xba
index dc9f99c..d5b272a 100644
--- a/Redaction/Clean.xba
+++ b/Redaction/Clean.xba
@@ -1,6 +1,6 @@
-Sub mark83
+Sub mark85
End Sub
@@ -13,6 +13,9 @@ Sub cleanButton
MsgBox(getTranslation("documentIsReadOnly"))
Exit Sub
EndIf
+ If config.getPropertyValue("predefined_template") = "false" Then
+ configureStyleFileDialog()
+ EndIf
If config.getPropertyValue("complexity") = "user" then
quietStartDialog()
Else
@@ -531,17 +534,17 @@ Private Sub loadArticleStyles
Dim dispatcher As Object
Dim filePath As String
Dim fileTest As Object
- Dim fileName As String
+ Dim predefined As String
Dim aArgs(0) As New com.sun.star.beans.PropertyValue
Dim config As Object
config = initRedactionConfiguration()
- fileName = config.getPropertyValue("defaultTemplate")
- filePath = getTemplatePath() & "/" & fileName
+ predefined = config.getPropertyValue("predefined_template")
+ filePath = getTemplateFile(predefined)
fileTest = CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
If NOT fileTest.exists(filePath) Then
- noStylesFileDialog()
- fileName = config.getPropertyValue("defaultTemplate")
- filePath = getTemplatePath() & "/" & fileName
+ configureStyleFileDialog()
+ predefined = config.getPropertyValue("predefined_template")
+ filePath = getTemplateFile(predefined)
If NOT fileTest.exists(filePath) Then
'MsgBox "Файл стилей " & fileName & " не добавлен в Мои шаблоны. Не могу загрузить стили в текущий файл."
Exit Sub
@@ -2097,4 +2100,4 @@ Function fixColoredBackgroundInDoc() As Boolean
EndIf
End Function
-
+
\ No newline at end of file
diff --git a/Redaction/Configuration.xba b/Redaction/Configuration.xba
index 00fd516..8995c29 100644
--- a/Redaction/Configuration.xba
+++ b/Redaction/Configuration.xba
@@ -1,7 +1,20 @@
-Public Const redactionExtensionName As String = "cleanAndValidate"
-Public Const redactionExtensionVersion = "0.9.30"
+Public Const redactionExtensionName = "cleanAndValidate"
+Public Const redactionExtensionVersion = "0.9.38"
+Public Const template_name_monography = "Монография"
+Public Const template_name_pj = "Философский журнал"
+Public Const template_name_pq = "Вопросы философии"
+Public Const template_name_hp = "История философии"
+Public Const template_name_hpe = "Историко-философский ежегодник"
+Public Const template_name_pr = "Философия религии"
+Public Const template_name_fnit = "Философия науки и техники"
+Public Const template_name_pa = "Философская антропология"
+Public Const template_name_pcr = "Путь цивилизационного развития"
+Public Const template_name_eifn = "Эпистемология и философия науки"
+Public Const template_name_et = "Этическая мысль"
+Public Const template_manual = "custom_selected_template"
+
Function initRedactionConfiguration()
On Error Goto exceptionHandler
Dim regFactory As Object
@@ -21,6 +34,9 @@ Function initRedactionConfiguration()
EndIf
If Not propSetInfo.hasPropertyByName("fixes_russian_iph") Then
redactionProps.addProperty("fixes_russian_iph", 128, "true")
+ EndIf
+ If Not propSetInfo.hasPropertyByName("predefined_template") Then
+ redactionProps.addProperty("predefined_template", 128, "false")
EndIf
If Not propSetInfo.hasPropertyByName("complexity") Then
redactionProps.addProperty("complexity", 128, "user")
@@ -30,7 +46,10 @@ Function initRedactionConfiguration()
On Error Goto exceptionHandler2
If Not propSetInfo.hasPropertyByName("defaultTemplate") Then
redactionProps.addProperty("defaultTemplate", 128, "Статья.ott")
- EndIf
+ EndIf
+ If Not propSetInfo.hasPropertyByName("predefined_template") Then
+ redactionProps.addProperty("predefined_template", 128, "false")
+ EndIf
exceptionHandler2:
Resume Next
initRedactionConfiguration = redactionProps
@@ -137,38 +156,71 @@ Private Sub quietStartDialog
Exit sub
End Sub
-Private Sub noStylesFileDialog
+Dim styleFileDialog As Object
+
+Private Sub configureStyleFileDialog
'Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
+ Dim config As Object
Dim dialog As Object
+ Dim predefined As String
+ Dim description As String
+ Dim customFile As String
DialogLibraries.LoadLibrary("Redaction")
- dialog = CreateUnoDialog(DialogLibraries.Redaction.NoStyleFile)
- Dim description As String
- Dim buttonName As String
- Dim dialogTitle As String
- Dim buttonTemplateNotFoundSkip As String
- dialogTitle = getTranslation("noStylesFileDialogTitle")
- description = getTranslation("noFileWithStylesFound")
- buttonName = getTranslation("buttonNameToSelectFileWithStyles")
- buttonTemplateNotFoundSkip = getTranslation("buttonTemplateNotFoundSkip")
- dialog.Title = dialogTitle
- dialog.getControl("Description").setText(description)
- dialog.getControl("FileSelection").Label = buttonName
- dialog.getControl("buttonOk").Label = buttonTemplateNotFoundSkip
- dialog.setVisible(true)
- Select Case dialog.Execute()
- Case 1
- setDeafultTemplate()
+ styleFileDialog = CreateUnoDialog(DialogLibraries.Redaction.NoStyleFile)
+ config = initRedactionConfiguration()
+ predefined = config.getPropertyValue("predefined_template")
+ customFile = config.getPropertyValue("defaultTemplate")
+ If predefined = "false" Then
+ description = getTranslation("noFileWithStylesFound")
+ ElseIf predefined = template_manual Then
+ description = getTranslation("manualStyleFileSet") & " «" & customFile & "»"
+ Else
+ description = getTranslation("predefiendTemplateSelected") & " «" & predefined & "»"
+ EndIf
+ styleFileDialog.Title = getTranslation("noStylesFileDialogTitle")
+ styleFileDialog.getControl("Description").setText(description)
+ styleFileDialog.getControl("FileSelection").Label = getTranslation("buttonNameToSelectFileWithStyles")
+ styleFileDialog.getControl("buttonOk").Label = getTranslation("buttonTemplateNotFoundSkip")
+ styleFileDialog.setVisible(true)
+ Select Case styleFileDialog.Execute()
Case 0
-
End Select
- dialog.setVisible(false)
- dialog.dispose()
- Exit sub
+ styleFileDialog.setVisible(false)
+ styleFileDialog.dispose()
End Sub
+Sub selectTemplateDialog()
+ Dim config As Object
+ Dim description As String
+ Dim templateName As String
+ Dim templateNames() As String
+ Dim i As Integer
+ Dim listComponent As Object
+ config = initRedactionConfiguration()
+ Dim dialog As Object
+ DialogLibraries.LoadLibrary("Redaction")
+ dialog = CreateUnoDialog(DialogLibraries.Redaction.SelectTemplate)
+ listComponent = dialog.getControl("ListBox")
+ templateNames = getTemplateNames()
+ listComponent.addItems(templateNames , 0)
+ dialog.setVisible(true)
+ Select Case dialog.Execute()
+ Case 1
+ templateName = listComponent.SelectedItem
+ If NOT (templateName="0" or templateName="") Then
+ config.setPropertyValue("predefined_template", templateName)
+ description = getTranslation("predefiendTemplateSelected") & " «" & templateName & "»"
+ styleFileDialog.getControl("Description").setText(description)
+ EndIf
+ Case 0
+ End Select
+ dialog.setVisible(false)
+ dialog.dispose()
+End Sub
-Sub setDeafultTemplate()
+Sub setManualTemplate()
+ Dim description As String
Dim selectedTemplate As String
selectedTemplate = getFileURLDialog()
oSimpleFileAccess = CreateUnoService( "com.sun.star.ucb.SimpleFileAccess" )
@@ -180,13 +232,16 @@ Sub setDeafultTemplate()
config = initRedactionConfiguration()
fileName = Dir(selectedTemplate)
config.setPropertyValue("defaultTemplate",fileName)
+ config.setPropertyValue("predefined_template", template_manual)
Dim templatePath As String
templatePath = getTemplatePath()
MkDir(templatePath)
- FileCopy(selectedTemplate, templatePath & "/" & fileName)
+ FileCopy(selectedTemplate, templatePath & "/" & fileName)
+ description = getTranslation("manualStyleFileSet") & " «" & fileName & "»"
+ styleFileDialog.getControl("Description").setText(description)
End Sub
- Function getFileURLDialog() As String
+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
@@ -215,5 +270,48 @@ End Sub
End If
End If
getFileURLDialog = ""
- End Function
+End Function
+
+
+Function getTemplateNames() As Variant
+ Dim names() As String
+ AddToArray(names, template_name_monography)
+ AddToArray(names, template_name_pq)
+ AddToArray(names, template_name_hp)
+ AddToArray(names, template_name_hpe)
+ AddToArray(names, template_name_pr)
+ AddToArray(names, template_name_fnit)
+ AddToArray(names, template_name_pa)
+ AddToArray(names, template_name_pcr)
+ AddToArray(names, template_name_eifn)
+ AddToArray(names, template_name_et)
+ getTemplateNames = names
+End Function
+
+Function extensionPath() As String
+ Dim oPackageInfoProvider As Object
+ oPackageInfoProvider = GetDefaultContext.getByName("/singletons/com.sun.star.deployment.PackageInformationProvider")
+ extensionPath = oPackageInfoProvider.getPackageLocation("pro.litvinovg.Redaction")
+End Function
+
+Function getTemplateFile(templateName As String) As String
+ Dim config As Object
+ Dim fileName As String
+ Select Case templateName
+ Case template_manual
+ config = initRedactionConfiguration()
+ fileName = config.getPropertyValue("defaultTemplate")
+ getTemplateFile = getTemplatePath() & "/" & fileName
+ Exit Function
+ Case template_name_pj
+ getTemplateFile = extensionPath() & "/templates/articles/default_article_template_ru.ott"
+ Exit Function
+ Case template_name_eifn
+ getTemplateFile = extensionPath() & "/templates/articles/статья_журнала_ЭиФН.ott"
+ Exit Function
+ Case Else
+ getTemplateFile = extensionPath() & "/templates/articles/default_article_template_ru.ott"
+ Exit Function
+ End Select
+End Function
\ No newline at end of file
diff --git a/Redaction/NoStyleFile.xdl b/Redaction/NoStyleFile.xdl
index c4d6d8e..a110c78 100644
--- a/Redaction/NoStyleFile.xdl
+++ b/Redaction/NoStyleFile.xdl
@@ -3,8 +3,13 @@
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Redaction/SelectTemplate.xdl b/Redaction/SelectTemplate.xdl
new file mode 100644
index 0000000..9ebf6a5
--- /dev/null
+++ b/Redaction/SelectTemplate.xdl
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Redaction/StartQuietCleaning.xdl b/Redaction/StartQuietCleaning.xdl
index b091f5c..8155db7 100644
--- a/Redaction/StartQuietCleaning.xdl
+++ b/Redaction/StartQuietCleaning.xdl
@@ -2,11 +2,11 @@
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/Redaction/Translations.xba b/Redaction/Translations.xba
index 2c8f45b..562249e 100644
--- a/Redaction/Translations.xba
+++ b/Redaction/Translations.xba
@@ -27,7 +27,7 @@ End Function
Function getRussian(identifier As String) As String
Select Case identifier
Case "noFileWithStylesFound"
- getRussian = "Файл-шаблон, содержащий стили для загрузки в документ не был задан. " & chr(10) &"Вы можете выбрать новый файл-шаблон. " & chr(10) & "Если файл-шаблон не будет выбран, то данный этап чистки будет пропущен."
+ getRussian = "Файл-шаблон, содержащий стили для загрузки в документ не был задан. " & chr(10) &"Вы можете выбрать новый файл-шаблон. " & chr(10) & "Если файл-шаблон не будет выбран, то загрузка стилей из шаблона при чистке не будет выполняться."
Exit Function
Case "startQuietCleaningDescription"
getRussian = "Вы хотите запустить чистку документа? " & chr(10) & "Здесь Вы можете также указать новый файл-шаблон." & chr(10) & "Стили из шаблона будут загружены в документ."
@@ -39,7 +39,7 @@ Function getRussian(identifier As String) As String
getRussian = "Подтверждение запуска чистки"
Exit Function
Case "noStylesFileDialogTitle"
- getRussian = "Файл со стилями не найден"
+ getRussian = "Выбор файла со стилями"
Exit Function
Case "buttonTemplateNotFoundSkip"
getRussian = "Продолжить"
@@ -48,7 +48,7 @@ Function getRussian(identifier As String) As String
getRussian = "Нет"
Exit Function
Case "buttonLoad"
- getRussian = "Указать шаблон"
+ getRussian = "Выбрать шаблон"
Exit Function
Case "buttonNameToSelectFileWithStyles"
getRussian = "Указать файл"
@@ -326,6 +326,12 @@ Function getRussian(identifier As String) As String
Case "removeNotTransparentBackgrounds"
getRussian = "Удалить непрозрачные фоны в тексте"
Exit Function
+ Case "manualStyleFileSet"
+ getRussian = "При чистке будет использоваться указанный вручную шаблон"
+ Exit Function
+ Case "predefiendTemplateSelected"
+ getRussian = "При чистке будет использоваться выбранный из списка шаблон"
+ Exit Function
Case Else
getRussian = "Перевод не найден"
End Select
@@ -347,7 +353,7 @@ Function getEnglish(identifier As String) As String
getEnglish = "Confirmation"
Exit Function
Case "noStylesFileDialogTitle"
- getEnglish = "Template file not found"
+ getEnglish = "Configure a style file"
Exit Function
Case "buttonTemplateNotFoundSkip"
getEnglish = "Proceed"
@@ -634,6 +640,12 @@ Function getEnglish(identifier As String) As String
Case "removeNotTransparentBackgrounds"
getEnglish = "Remove not transparent backgrounds in text"
Exit Function
+ Case "manualStyleFileSet"
+ getEnglish = "For cleaning will be used manually specified template "
+ Exit Function
+ Case "predefiendTemplateSelected"
+ getEnglish = "For cleaning will be used template selected from the list"
+ Exit Function
Case Else
getEnglish = "No translation"
End Select
@@ -654,7 +666,7 @@ Function getCroatian(identifier As String) As String
getCroatian = "Potvrda pokretanja čišćenja"
Exit Function
Case "noStylesFileDialogTitle"
- getCroatian = "Šablon sa stilovima nije pronađen"
+ getCroatian = "Konfigurišite datoteku stila"
Exit Function
Case "buttonTemplateNotFoundSkip"
getCroatian = "Nastavite"
@@ -941,6 +953,12 @@ Function getCroatian(identifier As String) As String
Case "removeNotTransparentBackgrounds"
getCroatian = "Uklonite netransparentne pozadine u tekstu"
Exit Function
+ Case "manualStyleFileSet"
+ getCroatian = "Prilikom čišćenja koristit će se ručno naveden predložak"
+ Exit Function
+ Case "predefiendTemplateSelected"
+ getCroatian = "Prilikom čišćenja koristit će se predložak odabran s popisa"
+ Exit Function
Case Else
getCroatian = "No translation"
End Select
@@ -961,7 +979,7 @@ Function getSerbian(identifier As String) As String
getSerbian = "Потврда покретања чишћења"
Exit Function
Case "noStylesFileDialogTitle"
- getSerbian = "Šablon са стиловима није пронађен"
+ getSerbian = "Конфигуришите датотеку стила"
Exit Function
Case "buttonTemplateNotFoundSkip"
getSerbian = "Наставите"
@@ -1248,6 +1266,12 @@ Function getSerbian(identifier As String) As String
Case "removeNotTransparentBackgrounds"
getSerbian = "Уклоните нетранспарентне позадине у тексту"
Exit Function
+ Case "manualStyleFileSet"
+ getSerbian = "Приликом чишћења користиће се ручно наведен шаблон"
+ Exit Function
+ Case "predefiendTemplateSelected"
+ getSerbian = "Приликом чишћења користиће се шаблон изабран са листе"
+ Exit Function
Case Else
getSerbian = "No translation"
End Select
@@ -1268,7 +1292,7 @@ Function getBosnian(identifier As String) As String
getBosnian = "Potvrda čišćenja"
Exit Function
Case "noStylesFileDialogTitle"
- getBosnian = "Datoteka predloška nije pronađena"
+ getBosnian = "Konfigurišite datoteku stila"
Exit Function
Case "buttonTemplateNotFoundSkip"
getBosnian = "Nastavite"
@@ -1555,6 +1579,12 @@ Function getBosnian(identifier As String) As String
Case "removeNotTransparentBackgrounds"
getBosnian = "Uklonite netransparentne pozadine u tekstu"
Exit Function
+ Case "manualStyleFileSet"
+ getBosnian = "Prilikom čišćenja koristit će se ručno naveden predložak"
+ Exit Function
+ Case "predefiendTemplateSelected"
+ getBosnian = "Prilikom čišćenja koristit će se predložak odabran s popisa"
+ Exit Function
Case Else
getBosnian = "No translation"
End Select
diff --git a/Redaction/dialog.xlb b/Redaction/dialog.xlb
index 9f687a7..2d2cb52 100644
--- a/Redaction/dialog.xlb
+++ b/Redaction/dialog.xlb
@@ -7,4 +7,5 @@
+
\ No newline at end of file
diff --git a/description.xml b/description.xml
index 2052f34..cd68b33 100644
--- a/description.xml
+++ b/description.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/gradle.properties b/gradle.properties
index 1a720ac..bc5a0b9 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1 +1 @@
-version=0.9.36
+version=0.9.38
diff --git a/templates/articles/default_article_template_ru.ott b/templates/articles/default_article_template_ru.ott
new file mode 100644
index 0000000..6fbbd62
Binary files /dev/null and b/templates/articles/default_article_template_ru.ott differ
diff --git a/templates/articles/статья_журнала_ЭиФН.ott b/templates/articles/статья_журнала_ЭиФН.ott
new file mode 100644
index 0000000..f5d7384
Binary files /dev/null and b/templates/articles/статья_журнала_ЭиФН.ott differ
diff --git a/translations.ods b/translations.ods
index c426682..583ecab 100644
Binary files a/translations.ods and b/translations.ods differ