diff --git a/Redaction/Clean.xba b/Redaction/Clean.xba index d5d0768..3f14331 100644 --- a/Redaction/Clean.xba +++ b/Redaction/Clean.xba @@ -1,6 +1,6 @@ -Sub mark75 +Sub mark76 End Sub @@ -1482,6 +1482,8 @@ End Function Private Sub convertFormatToUserFields(identifier As String, styleNames, styleValues) + Dim maxLength As Integer + maxLength = getMaxLength(identifier) Dim leftField As String Dim rightField As String Dim i As Integer @@ -1505,15 +1507,31 @@ Private Sub convertFormatToUserFields(identifier As String, styleNames, styleVal i = 0 Do While not isNull(found) If Len(found.String) <> 0 AND NOT IsNull(found.Text) Then + If maxLength < 0 Or Len(found.String) < maxLength Then insertUserField(found.End,rightField & i,"") insertUserField(found.start,leftField & i,"") i = i + 1 + EndIf EndIf found = Thiscomponent.findNext(found.End, SDesc) Loop End Sub +Function getMaxLength(identifier As String) As Integer + Dim config As Object + config = initRedactionConfiguration() + If identifier = "SubScript" Then + getMaxLength = CInt(config.getPropertyValue("subscript_max_length")) + Exit Function + EndIf + If identifier = "SuperScript" Then + getMaxLength = CInt(config.getPropertyValue("superscript_max_length")) + Exit Function + EndIf + getMaxLength = -1 +End Function + Private Sub convertUserFieldsToFormat(identifier As String, styleNames , styleValues) Dim oTextCursor As Object Dim oMasters As Object diff --git a/Redaction/ConfigDialog.xdl b/Redaction/ConfigDialog.xdl index 2d1b792..9898327 100644 --- a/Redaction/ConfigDialog.xdl +++ b/Redaction/ConfigDialog.xdl @@ -7,5 +7,9 @@ + + + + \ No newline at end of file diff --git a/Redaction/Configuration.xba b/Redaction/Configuration.xba index 3a67e77..59eb334 100644 --- a/Redaction/Configuration.xba +++ b/Redaction/Configuration.xba @@ -13,6 +13,12 @@ Function initRedactionConfiguration() reg = regFactory.createPropertySetRegistry(redactionExtensionName) redactionProps = reg.openPropertySet(redactionExtensionName, TRUE) propSetInfo = redactionProps.getPropertySetInfo() + If Not propSetInfo.hasPropertyByName("superscript_max_length") Then + redactionProps.addProperty("superscript_max_length", 128, "10") + EndIf + If Not propSetInfo.hasPropertyByName("subscript_max_length") Then + redactionProps.addProperty("subscript_max_length", 128, "10") + EndIf If Not propSetInfo.hasPropertyByName("fixes_russian_iph") Then redactionProps.addProperty("fixes_russian_iph", 128, "true") EndIf @@ -46,6 +52,9 @@ Private Sub setConfigFromDialog(dialog As Object) config.setPropertyValue("fixes_russian_iph", "false") EndIf + config.setPropertyValue("superscript_max_length", dialog.getControl("tf_max_superscript").getText()) + config.setPropertyValue("subscript_max_length", dialog.getControl("tf_max_subscript").getText()) + End Sub Private Sub loadConfigToDialog(dialog As Object) @@ -62,7 +71,11 @@ Private Sub loadConfigToDialog(dialog As Object) Else dialog.getControl("cb_russian_fixes_iph").state = 0 EndIf - + + dialog.getControl("tf_max_superscript").setText(config.getPropertyValue("superscript_max_length")) + dialog.getControl("tf_max_subscript").setText(config.getPropertyValue("subscript_max_length")) + + End Sub @@ -73,6 +86,10 @@ Private Sub configurationDialog loadConfigToDialog(dialog) dialog.getControl("CB_complexity").Label = getTranslation("dialogConfigComplexity") dialog.getControl("cb_russian_fixes_iph").Label = getTranslation("dialogRussianFixesIPH") + + dialog.getControl("label_max_superscript").setText(getTranslation("dialogConfigMaxSuperscript")) + dialog.getControl("label_max_subscript").setText(getTranslation("dialogConfigMaxSubscript")) + dialog.Title = getTranslation("dialogConfigTitle") dialog.getControl("OK").Label = getTranslation("buttonYes") dialog.getControl("CANCEL").Label = getTranslation("buttonStop") diff --git a/Redaction/Translations.xba b/Redaction/Translations.xba index 857420e..65b49db 100644 --- a/Redaction/Translations.xba +++ b/Redaction/Translations.xba @@ -272,6 +272,12 @@ Function getRussian(identifier As String) As String Case "advancedMenuResetChapterNumberingRules" getRussian = "Сбросить настройки нумерации глав" Exit Function + Case "dialogConfigMaxSuperscript" + getRussian = "Макс. длина текста в верхнем индексе" + Exit Function + Case "dialogConfigMaxSubscript" + getRussian = "Макс. длина текста в нижнем индексе" + Exit Function Case Else getRussian = "Перевод не найден" End Select @@ -526,6 +532,12 @@ Function getEnglish(identifier As String) As String Case "advancedMenuResetChapterNumberingRules" getEnglish = "Reset chapter numbering settings" Exit Function + Case "dialogConfigMaxSuperscript" + getEnglish = "Max line length in superscript" + Exit Function + Case "dialogConfigMaxSubscript" + getEnglish = "Max line length in subscript" + Exit Function Case Else getEnglish = "No translation" End Select @@ -779,6 +791,12 @@ Function getCroatian(identifier As String) As String Case "advancedMenuResetChapterNumberingRules" getCroatian = "Resetirajte postavke numeriranja poglavlja" Exit Function + Case "dialogConfigMaxSuperscript" + getCroatian = "Maksimalna duljina retka u natpisu" + Exit Function + Case "dialogConfigMaxSubscript" + getCroatian = "Maksimalna duljina retka u indeksu" + Exit Function Case Else getCroatian = "No translation" End Select @@ -1032,6 +1050,12 @@ Function getSerbian(identifier As String) As String Case "advancedMenuResetChapterNumberingRules" getSerbian = "Ресетујте поставке нумерисања поглавља" Exit Function + Case "dialogConfigMaxSuperscript" + getSerbian = "Максимална дужина реда у натпису" + Exit Function + Case "dialogConfigMaxSubscript" + getSerbian = "Максимална дужина реда у индексу" + Exit Function Case Else getSerbian = "No translation" End Select @@ -1285,6 +1309,12 @@ Function getBosnian(identifier As String) As String Case "advancedMenuResetChapterNumberingRules" getBosnian = "Resetirajte postavke numeriranja poglavlja" Exit Function + Case "dialogConfigMaxSuperscript" + getBosnian = "Maksimalna dužina retka u natpisu" + Exit Function + Case "dialogConfigMaxSubscript" + getBosnian = "Maksimalna dužina retka u indeksu" + Exit Function Case Else getBosnian = "No translation" End Select diff --git a/translations.ods b/translations.ods index 12b5adf..9dbc62b 100644 Binary files a/translations.ods and b/translations.ods differ