Added line length limit to subscript and superscript for cleaning
This commit is contained in:
parent
7694a8911a
commit
d9b458210a
5 changed files with 71 additions and 2 deletions
|
@ -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 mark75
|
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark76
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
@ -1482,6 +1482,8 @@ End Function
|
||||||
|
|
||||||
|
|
||||||
Private Sub convertFormatToUserFields(identifier As String, styleNames, styleValues)
|
Private Sub convertFormatToUserFields(identifier As String, styleNames, styleValues)
|
||||||
|
Dim maxLength As Integer
|
||||||
|
maxLength = getMaxLength(identifier)
|
||||||
Dim leftField As String
|
Dim leftField As String
|
||||||
Dim rightField As String
|
Dim rightField As String
|
||||||
Dim i As Integer
|
Dim i As Integer
|
||||||
|
@ -1505,15 +1507,31 @@ Private Sub convertFormatToUserFields(identifier As String, styleNames, styleVal
|
||||||
i = 0
|
i = 0
|
||||||
Do While not isNull(found)
|
Do While not isNull(found)
|
||||||
If Len(found.String) <> 0 AND NOT IsNull(found.Text) Then
|
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.End,rightField & i,"")
|
||||||
insertUserField(found.start,leftField & i,"")
|
insertUserField(found.start,leftField & i,"")
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
found = Thiscomponent.findNext(found.End, SDesc)
|
found = Thiscomponent.findNext(found.End, SDesc)
|
||||||
|
|
||||||
Loop
|
Loop
|
||||||
End Sub
|
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)
|
Private Sub convertUserFieldsToFormat(identifier As String, styleNames , styleValues)
|
||||||
Dim oTextCursor As Object
|
Dim oTextCursor As Object
|
||||||
Dim oMasters As Object
|
Dim oMasters As Object
|
||||||
|
|
|
@ -7,5 +7,9 @@
|
||||||
<dlg:button dlg:id="CommandButton1" dlg:tab-index="2" dlg:left="-132" dlg:top="41" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
|
<dlg:button dlg:id="CommandButton1" dlg:tab-index="2" dlg:left="-132" dlg:top="41" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
|
||||||
<dlg:button dlg:id="CANCEL" dlg:tab-index="3" dlg:left="83" dlg:top="85" dlg:width="59" dlg:height="13" dlg:value="Отмена" dlg:button-type="cancel"/>
|
<dlg:button dlg:id="CANCEL" dlg:tab-index="3" dlg:left="83" dlg:top="85" dlg:width="59" dlg:height="13" dlg:value="Отмена" dlg:button-type="cancel"/>
|
||||||
<dlg:checkbox dlg:id="cb_russian_fixes_iph" dlg:tab-index="4" dlg:left="5" dlg:top="26" dlg:width="150" dlg:height="11" dlg:value="Исправления для института философии" dlg:checked="true"/>
|
<dlg:checkbox dlg:id="cb_russian_fixes_iph" dlg:tab-index="4" dlg:left="5" dlg:top="26" dlg:width="150" dlg:height="11" dlg:value="Исправления для института философии" dlg:checked="true"/>
|
||||||
|
<dlg:textfield dlg:id="tf_max_subscript" dlg:tab-index="7" dlg:left="5" dlg:top="52" dlg:width="24" dlg:height="12" dlg:value="10000"/>
|
||||||
|
<dlg:text dlg:id="label_max_subscript" dlg:tab-index="8" dlg:left="32" dlg:top="52" dlg:width="123" dlg:height="11" dlg:value="Label1"/>
|
||||||
|
<dlg:text dlg:id="label_max_superscript" dlg:tab-index="6" dlg:left="32" dlg:top="39" dlg:width="123" dlg:height="11" dlg:value="Label1"/>
|
||||||
|
<dlg:textfield dlg:id="tf_max_superscript" dlg:tab-index="5" dlg:left="5" dlg:top="38" dlg:width="24" dlg:height="12" dlg:value="10000"/>
|
||||||
</dlg:bulletinboard>
|
</dlg:bulletinboard>
|
||||||
</dlg:window>
|
</dlg:window>
|
|
@ -13,6 +13,12 @@ Function initRedactionConfiguration()
|
||||||
reg = regFactory.createPropertySetRegistry(redactionExtensionName)
|
reg = regFactory.createPropertySetRegistry(redactionExtensionName)
|
||||||
redactionProps = reg.openPropertySet(redactionExtensionName, TRUE)
|
redactionProps = reg.openPropertySet(redactionExtensionName, TRUE)
|
||||||
propSetInfo = redactionProps.getPropertySetInfo()
|
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
|
If Not propSetInfo.hasPropertyByName("fixes_russian_iph") Then
|
||||||
redactionProps.addProperty("fixes_russian_iph", 128, "true")
|
redactionProps.addProperty("fixes_russian_iph", 128, "true")
|
||||||
EndIf
|
EndIf
|
||||||
|
@ -46,6 +52,9 @@ Private Sub setConfigFromDialog(dialog As Object)
|
||||||
config.setPropertyValue("fixes_russian_iph", "false")
|
config.setPropertyValue("fixes_russian_iph", "false")
|
||||||
EndIf
|
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
|
End Sub
|
||||||
|
|
||||||
Private Sub loadConfigToDialog(dialog As Object)
|
Private Sub loadConfigToDialog(dialog As Object)
|
||||||
|
@ -63,6 +72,10 @@ Private Sub loadConfigToDialog(dialog As Object)
|
||||||
dialog.getControl("cb_russian_fixes_iph").state = 0
|
dialog.getControl("cb_russian_fixes_iph").state = 0
|
||||||
EndIf
|
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
|
End Sub
|
||||||
|
|
||||||
|
@ -73,6 +86,10 @@ Private Sub configurationDialog
|
||||||
loadConfigToDialog(dialog)
|
loadConfigToDialog(dialog)
|
||||||
dialog.getControl("CB_complexity").Label = getTranslation("dialogConfigComplexity")
|
dialog.getControl("CB_complexity").Label = getTranslation("dialogConfigComplexity")
|
||||||
dialog.getControl("cb_russian_fixes_iph").Label = getTranslation("dialogRussianFixesIPH")
|
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.Title = getTranslation("dialogConfigTitle")
|
||||||
dialog.getControl("OK").Label = getTranslation("buttonYes")
|
dialog.getControl("OK").Label = getTranslation("buttonYes")
|
||||||
dialog.getControl("CANCEL").Label = getTranslation("buttonStop")
|
dialog.getControl("CANCEL").Label = getTranslation("buttonStop")
|
||||||
|
|
|
@ -272,6 +272,12 @@ Function getRussian(identifier As String) As String
|
||||||
Case "advancedMenuResetChapterNumberingRules"
|
Case "advancedMenuResetChapterNumberingRules"
|
||||||
getRussian = "Сбросить настройки нумерации глав"
|
getRussian = "Сбросить настройки нумерации глав"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "dialogConfigMaxSuperscript"
|
||||||
|
getRussian = "Макс. длина текста в верхнем индексе"
|
||||||
|
Exit Function
|
||||||
|
Case "dialogConfigMaxSubscript"
|
||||||
|
getRussian = "Макс. длина текста в нижнем индексе"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getRussian = "Перевод не найден"
|
getRussian = "Перевод не найден"
|
||||||
End Select
|
End Select
|
||||||
|
@ -526,6 +532,12 @@ Function getEnglish(identifier As String) As String
|
||||||
Case "advancedMenuResetChapterNumberingRules"
|
Case "advancedMenuResetChapterNumberingRules"
|
||||||
getEnglish = "Reset chapter numbering settings"
|
getEnglish = "Reset chapter numbering settings"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "dialogConfigMaxSuperscript"
|
||||||
|
getEnglish = "Max line length in superscript"
|
||||||
|
Exit Function
|
||||||
|
Case "dialogConfigMaxSubscript"
|
||||||
|
getEnglish = "Max line length in subscript"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getEnglish = "No translation"
|
getEnglish = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -779,6 +791,12 @@ Function getCroatian(identifier As String) As String
|
||||||
Case "advancedMenuResetChapterNumberingRules"
|
Case "advancedMenuResetChapterNumberingRules"
|
||||||
getCroatian = "Resetirajte postavke numeriranja poglavlja"
|
getCroatian = "Resetirajte postavke numeriranja poglavlja"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "dialogConfigMaxSuperscript"
|
||||||
|
getCroatian = "Maksimalna duljina retka u natpisu"
|
||||||
|
Exit Function
|
||||||
|
Case "dialogConfigMaxSubscript"
|
||||||
|
getCroatian = "Maksimalna duljina retka u indeksu"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getCroatian = "No translation"
|
getCroatian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -1032,6 +1050,12 @@ Function getSerbian(identifier As String) As String
|
||||||
Case "advancedMenuResetChapterNumberingRules"
|
Case "advancedMenuResetChapterNumberingRules"
|
||||||
getSerbian = "Ресетујте поставке нумерисања поглавља"
|
getSerbian = "Ресетујте поставке нумерисања поглавља"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "dialogConfigMaxSuperscript"
|
||||||
|
getSerbian = "Максимална дужина реда у натпису"
|
||||||
|
Exit Function
|
||||||
|
Case "dialogConfigMaxSubscript"
|
||||||
|
getSerbian = "Максимална дужина реда у индексу"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getSerbian = "No translation"
|
getSerbian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -1285,6 +1309,12 @@ Function getBosnian(identifier As String) As String
|
||||||
Case "advancedMenuResetChapterNumberingRules"
|
Case "advancedMenuResetChapterNumberingRules"
|
||||||
getBosnian = "Resetirajte postavke numeriranja poglavlja"
|
getBosnian = "Resetirajte postavke numeriranja poglavlja"
|
||||||
Exit Function
|
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
|
Case Else
|
||||||
getBosnian = "No translation"
|
getBosnian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
|
BIN
translations.ods
BIN
translations.ods
Binary file not shown.
Loading…
Add table
Reference in a new issue