Compare commits

...

18 commits

27 changed files with 415 additions and 107 deletions

View file

@ -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 mark87 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark96
End Sub End Sub
@ -50,6 +50,7 @@ Private Sub makerUpMenu
advancedCleaningDialog.getControl(&quot;convertFontsToCharStyles&quot;).Label = getTranslation(&quot;advancedMenuconvertFontsToCharStyles&quot;) advancedCleaningDialog.getControl(&quot;convertFontsToCharStyles&quot;).Label = getTranslation(&quot;advancedMenuconvertFontsToCharStyles&quot;)
advancedCleaningDialog.getControl(&quot;fixBrokenCharBackTransparent&quot;).Label = getTranslation(&quot;fixBrokenCharBackTransparentMenuItem&quot;) advancedCleaningDialog.getControl(&quot;fixBrokenCharBackTransparent&quot;).Label = getTranslation(&quot;fixBrokenCharBackTransparentMenuItem&quot;)
advancedCleaningDialog.getControl(&quot;removeNotTransparentBackgrounds&quot;).Label = getTranslation(&quot;removeNotTransparentBackgrounds&quot;) advancedCleaningDialog.getControl(&quot;removeNotTransparentBackgrounds&quot;).Label = getTranslation(&quot;removeNotTransparentBackgrounds&quot;)
advancedCleaningDialog.getControl(&quot;fixDiacriticKerning&quot;).Label = getTranslation(&quot;fixDiacriticKerning&quot;)
advancedCleaningDialog.getControl(&quot;Cancel&quot;).Label = getTranslation(&quot;buttonCancel&quot;) advancedCleaningDialog.getControl(&quot;Cancel&quot;).Label = getTranslation(&quot;buttonCancel&quot;)
advancedCleaningDialog.getControl(&quot;OK&quot;).Label = getTranslation(&quot;buttonOK&quot;) advancedCleaningDialog.getControl(&quot;OK&quot;).Label = getTranslation(&quot;buttonOK&quot;)
advancedCleaningDialog.getControl(&quot;buttonLoad&quot;).Label = getTranslation(&quot;buttonLoad&quot;) advancedCleaningDialog.getControl(&quot;buttonLoad&quot;).Label = getTranslation(&quot;buttonLoad&quot;)
@ -58,7 +59,7 @@ Private Sub makerUpMenu
advancedCleaningDialog.setVisible(true) advancedCleaningDialog.setVisible(true)
Select Case advancedCleaningDialog.Execute() Select Case advancedCleaningDialog.Execute()
Case 1 Case 1
cleanAccordingTo(dialog) cleanAccordingTo(advancedCleaningDialog)
Case 0 Case 0
End Select End Select
advancedCleaningDialog.dispose() advancedCleaningDialog.dispose()
@ -164,7 +165,9 @@ Private Sub cleanAccordingTo(dialog As Object)
If dialog.getControl(&quot;removeNotTransparentBackgrounds&quot;).state = 1 Then If dialog.getControl(&quot;removeNotTransparentBackgrounds&quot;).state = 1 Then
fixColoredBackgroundInDoc() fixColoredBackgroundInDoc()
EndIf EndIf
If dialog.getControl(&quot;fixDiacriticKerning&quot;).state = 1 Then
fixDiacriticKerning()
EndIf
statusIndicator.end() statusIndicator.end()
saveAndreload() saveAndreload()
@ -203,6 +206,8 @@ Private Sub quietCleaning
saveAndreload() saveAndreload()
statusIndicator = ThisComponent.getCurrentController.statusIndicator statusIndicator = ThisComponent.getCurrentController.statusIndicator
unicodeSymbolsConversion unicodeSymbolsConversion
statusIndicator.Start(getTranslation(&quot;statusFixingDiacriticCharactersKerning&quot;),100)
fixDiacriticKerning
statusIndicator.Start(getTranslation(&quot;statusCleaningManualFormatting&quot;),100) statusIndicator.Start(getTranslation(&quot;statusCleaningManualFormatting&quot;),100)
cleanFormatting cleanFormatting
statusIndicator.Start(getTranslation(&quot;statusReplaceWhiteBackground&quot;),100) statusIndicator.Start(getTranslation(&quot;statusReplaceWhiteBackground&quot;),100)
@ -329,12 +334,18 @@ Private Sub unicodeSymbolsConversion
&apos;Extended latin-1 0080—00FF &apos;Extended latin-1 0080—00FF
&apos;Cyrillic unicode block range \u0400-\u04FF &apos;Cyrillic unicode block range \u0400-\u04FF
&apos;Basic Latin \u0020-\u007E &apos;Basic Latin \u0020-\u007E
&apos;Combining diacritical marks 0301 0304 0323 032e 0331 035f &apos;Combining diacritical marks 0301 0304 0303 0323 032e 0331 035f
combiningDiacritic_Astra = &quot;\u0301\u0303\u0304\u0308\u0323\u032e\u0331\u0341\u035f&quot;
Dim extendedLatinA_Astra As String
extendedLatinA_Astra = &quot;\u1e15\u1e17\u1e53\u0129\u0169&quot;
&apos;
&apos;
&apos;
&apos;General Punctuation \u2000-\u206f &apos;General Punctuation \u2000-\u206f
&apos;Latin Extended A \u0100-\u017f &apos;Latin Extended A \u0100-\u017f
&apos;\u02bb Modifier Letter Turned Comma is in IPH Astra &apos;\u02bb Modifier Letter Turned Comma is in IPH Astra
&apos; unicodeConversionEverywhere(&quot;[\u0020-\u007F]+&quot;,RAtts) &apos; unicodeConversionEverywhere(&quot;[\u0020-\u007F]+&quot;,RAtts)
unicodeConversionEverywhere(&quot;[\u0020-\u007f\u0080-\u00ff\u0400-\u04ff\u2000-\u206f\u2100-\u214f\u0301\u0304\u0323\u032e\u0331\u0341\u035f\u02bb\u0100-\u017f]+&quot;,RAtts) unicodeConversionEverywhere(&quot;[\u0020-\u007f\u0080-\u00ff\u0400-\u04ff\u2000-\u206f\u2100-\u214f\u02bb\u0100-\u017f&quot; &amp; combiningDiacritic_Astra &amp; extendedLatinA_Astra &amp;&quot;]+&quot;,RAtts)
&apos;Arabic Scheherazade &apos;Arabic Scheherazade
&apos;Arabic Presentation Forms-A fb50-fdff &apos;Arabic Presentation Forms-A fb50-fdff
&apos;Arabic Presentation Forms-B fe70-feff &apos;Arabic Presentation Forms-B fe70-feff
@ -459,15 +470,24 @@ Sub removeAllFields()
field = fieldEnum.nextElement() field = fieldEnum.nextElement()
field.dispose() field.dispose()
Wend Wend
End sub End Sub
Public Const RX_Greek_letters = &quot;\u0388-\u03ce&quot;
Public Const RX_Latin_up_alphabet = &quot;\u0041-\u005a&quot;
Public Const RX_Latin_low_alphabet = &quot;\u0061-\u007a&quot;
Public Const RX_Cyrillic_alphabet = &quot;\u0410-\u044f&quot;
Public Const RX_Comma = &quot;\u002c&quot;
Public Const RX_Digits = &quot;\u0030-\u0039&quot;
Public Const RX_Roman_numbers = &quot;MDCLXVI&quot;
Public Const RX_Letters_Dash = &quot;[&quot; &amp; RX_Latin_up_alphabet &amp; RX_Latin_low_alphabet &amp; RX_Cyrillic_alphabet &amp; RX_Greek_letters &amp; &quot;]&quot;
Public Const RX_Letters = &quot;[&quot; &amp; RX_Latin_up_alphabet &amp; RX_Latin_low_alphabet &amp; RX_Cyrillic_alphabet &amp; RX_Greek_letters &amp; &quot;]&quot;
Private Sub fixFrequentMistakes Private Sub fixFrequentMistakes
Dim config As Object Dim config As Object
config = initRedactionConfiguration() config = initRedactionConfiguration()
Dim NBSP As String Dim NBSP As String
Dim space As String Dim space As String
Dim latinPlusCyrillicLettersRegExp As String
latinPlusCyrillicLettersRegExp = &quot;[\u0041-\u005a\u0061-\u007a\u0410-\u044f]&quot;
NBSP = &quot; &quot; NBSP = &quot; &quot;
space = &quot; &quot; space = &quot; &quot;
&apos;Не должно быть символов табуляции &apos;Не должно быть символов табуляции
@ -484,19 +504,21 @@ Private Sub fixFrequentMistakes
AskAndReplace(&quot;[:space:]+(?=[\.,;:?!\)\]\}»¡¿”’])&quot;,&quot;&quot;) AskAndReplace(&quot;[:space:]+(?=[\.,;:?!\)\]\}»¡¿”’])&quot;,&quot;&quot;)
&apos;Не должно быть пробелов после скобок [({ и кавычек «„ &apos;Не должно быть пробелов после скобок [({ и кавычек «„
AskAndReplace(&quot;(?&lt;=[\(\[\{«„])[:space:]&quot;,&quot;&quot;) AskAndReplace(&quot;(?&lt;=[\(\[\{«„])[:space:]&quot;,&quot;&quot;)
&apos;Между буквами среднее тире должно обрамляться пробелами &apos;Между буквами среднее или длинное тире должно быть замененено на среднее и обрамлено пробелами
AskAndReplace(&quot;(?&lt;=&quot; &amp; latinPlusCyrillicLettersRegExp &amp; &quot;)(?=&quot; &amp; latinPlusCyrillicLettersRegExp &amp; &quot;)&quot;,NBSP &amp; &quot;&quot; &amp; NBSP) AskAndReplace(&quot;(?&lt;=&quot; &amp; RX_Letters_Dash &amp; &quot;)[—–]+(?=.)&quot;,NBSP &amp; &quot;&quot; &amp; NBSP)
&apos;Между буквами дефис-минус, цифровое тире и длинное тире заменяется на среднее тире AskAndReplace(&quot;(?&lt;=.)[—–]+(?=&quot; &amp; RX_Letters_Dash &amp; &quot;)&quot;,NBSP &amp; &quot;&quot; &amp; NBSP)
AskAndReplace(&quot;(?&lt;=&quot; &amp; latinPlusCyrillicLettersRegExp &amp; &quot;[:space:])[-‒—−](?=[:space:]&quot; &amp; latinPlusCyrillicLettersRegExp &amp; &quot;)&quot;,&quot;&quot;) &apos;Между буквами дефисы-минусы, цифровые тире, средние тире и длинные тире заменяются на одно среднее тире
AskAndReplace(&quot;(?&lt;=&quot; &amp; RX_Letters_Dash &amp; &quot;[:space:])[-‒—−–]+(?=[:space:].)&quot;,&quot;&quot;)
AskAndReplace(&quot;(?&lt;=.[:space:])[-‒—−–]+(?=[:space:]&quot; &amp; RX_Letters_Dash &amp; &quot;)&quot;,&quot;&quot;)
&apos;Между двумя цифрами и тире не долнжо быть пробелов. А также тире должно быть цифровым. &apos;Между двумя цифрами и тире не долнжо быть пробелов. А также тире должно быть цифровым.
&apos;Также проверяем, что перед искомым тире нет DOI &apos;Также проверяем, что перед искомым тире нет DOI
&apos;&apos;&apos;&apos;&apos;AskAndReplace(&quot;(?&lt;!DOI[0-9. /XVI:-‒–—−-]{1,50})(?&lt;=[:digit:])(?:[:space:])?[-‒–—−](?:[:space:])?(?=[:digit:])&quot;,&quot;&quot;) &apos;&apos;&apos;&apos;&apos;AskAndReplace(&quot;(?&lt;!DOI[0-9. /XVI:-‒–—−-]{1,50})(?&lt;=[:digit:])(?:[:space:])?[-‒–—−](?:[:space:])?(?=[:digit:])&quot;,&quot;&quot;)
&apos;Между двумя римскими цифрами и тире между ними не долнжо быть пробелов. А также тире должно быть средним &apos;Между двумя римскими цифрами и тире между ними не долнжо быть пробелов. А также тире должно быть средним
AskAndReplace(&quot;(?&lt;=[MDCLXVI])(?:[:space:])?[-‒–—−](?:[:space:])?(?=[MDCLXVI])&quot;,&quot;&quot;) AskAndReplace(&quot;(?&lt;=[&quot; &amp; RX_Roman_numbers &amp; &quot;])(?:[:space:])?[-‒–—−]+(?:[:space:])?(?=[&quot; &amp; RX_Roman_numbers &amp; &quot;])&quot;,&quot;&quot;)
&apos;Между буквой и угловой открывающейся скобкой должен быть пробел &apos;Между буквой и угловой открывающейся скобкой должен быть пробел
AskAndReplace(&quot;(?&lt;=&quot; &amp; latinPlusCyrillicLettersRegExp &amp; &quot;)&lt;(?=…&gt;)&quot;,space &amp; &quot;&lt;&quot;) AskAndReplace(&quot;(?&lt;=&quot; &amp; RX_Letters &amp; &quot;)&lt;(?=…&gt;)&quot;,space &amp; &quot;&lt;&quot;)
&apos;Между угловой закрывающейся скобкой и буквой должен быть пробел &apos;Между угловой закрывающейся скобкой и буквой должен быть пробел
AskAndReplace(&quot;(?&lt;=&lt;…)&gt;(?=&quot; &amp; latinPlusCyrillicLettersRegExp &amp; &quot;)&quot;,&quot;&gt;&quot; &amp; space) AskAndReplace(&quot;(?&lt;=&lt;…)&gt;(?=&quot; &amp; RX_Letters &amp; &quot;)&quot;,&quot;&gt;&quot; &amp; space)
If config.getPropertyValue(&quot;fixes_russian_iph&quot;) = &quot;true&quot; Then If config.getPropertyValue(&quot;fixes_russian_iph&quot;) = &quot;true&quot; Then
&apos;между N. Y. не должно быть пробела &apos;между N. Y. не должно быть пробела
@ -2101,4 +2123,67 @@ Function fixColoredBackgroundInDoc() As Boolean
EndIf EndIf
End Function End Function
Sub fixDiacriticKerning
Dim oSearch As Object
Dim oFound As Object
Dim oPara As Object
oSearch = ThisComponent.createSearchDescriptor()
oSearch.SearchString = &quot;[\u0300-\u036F]&quot;
oSearch.SearchRegularExpression=True
oSearch.searchAll=True
oFound = ThisComponent.findFirst(oSearch)
Do While Not IsNull(oFound)
oPara = oFound.TextParagraph
fixDiacriticKerningInPara(oPara)
oFound = ThisComponent.findNext(oFound.End, oSearch)
Loop
End Sub
Sub fixDiacriticKerningInPara(oPara As Object)
Dim paraEnum As Object
Dim portion As Object
Dim prevPortion As Object
paraEnum = oPara.createEnumeration
If paraEnum.hasMoreElements Then
prevPortion = paraEnum.nextElement
While paraEnum.hasMoreElements
portion = paraEnum.nextElement
While isFirstCharDiacritic(portion)
moveFirstCharacter(portion, prevPortion)
Wend
prevPortion = portion
Wend
EndIf
End Sub
Function isFirstCharDiacritic(portion As Object) As Boolean
isFirstCharDiacritic = false
Dim portionText As String
Dim diaLowBound As Long
Dim diaHighBound As Long
Dim charNum As Long
diaLowBound = 768
diaHighBound = 879
portionText = portion.String
If Len(portionText) = 0 Then
Exit Function
EndIf
charNum = Asc(portionText)
If charNum &gt;= diaLowBound And charNum &lt;= diaHighBound Then
isFirstCharDiacritic = true
EndIf
End Function
Sub moveFirstCharacter(portion As Object, prevPortion As Object)
Dim prevEnd As Object
Dim nextStart As Object
prevEnd = prevPortion.getEnd()
prevEnd.String = Left(portion.String,1)
nextStart = portion.Text.createTextCursorByRange(portion.Start)
nextStart.goRight(1,true)
nextStart.setString(&quot;&quot;)
End Sub
</script:module> </script:module>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd"> <!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="CleaningDialog" dlg:left="107" dlg:top="22" dlg:width="237" dlg:height="265" dlg:help-text="&amp;21.CleaningDialog.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&amp;22.CleaningDialog.Title"> <dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="CleaningDialog" dlg:left="107" dlg:top="22" dlg:width="237" dlg:height="285" dlg:help-text="&amp;21.CleaningDialog.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&amp;22.CleaningDialog.Title">
<dlg:bulletinboard> <dlg:bulletinboard>
<dlg:button dlg:id="Cancel" dlg:tab-index="0" dlg:left="28" dlg:top="251" dlg:width="40" dlg:height="12" dlg:value="Отмена" dlg:button-type="cancel"/> <dlg:button dlg:id="Cancel" dlg:tab-index="0" dlg:left="28" dlg:top="271" dlg:width="40" dlg:height="12" dlg:value="Отмена" dlg:button-type="cancel"/>
<dlg:button dlg:id="CommandButton1" dlg:tab-index="1" dlg:left="24" dlg:top="180" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/> <dlg:button dlg:id="CommandButton1" dlg:tab-index="1" dlg:left="24" dlg:top="180" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
<dlg:button dlg:id="OK" dlg:tab-index="2" dlg:left="92" dlg:top="251" dlg:width="40" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/> <dlg:button dlg:id="OK" dlg:tab-index="2" dlg:left="92" dlg:top="271" dlg:width="40" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/>
<dlg:checkbox dlg:id="fontsInStyles" dlg:tab-index="3" dlg:left="11" dlg:top="10" dlg:width="218" dlg:height="7" dlg:value="Заменить названия шрифтов в стилях" dlg:checked="false"/> <dlg:checkbox dlg:id="fontsInStyles" dlg:tab-index="3" dlg:left="11" dlg:top="10" dlg:width="218" dlg:height="7" dlg:value="Заменить названия шрифтов в стилях" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeLinks" dlg:tab-index="6" dlg:left="11" dlg:top="60" dlg:width="218" dlg:height="7" dlg:value="Удалить гиперссылки" dlg:checked="false"/> <dlg:checkbox dlg:id="removeLinks" dlg:tab-index="6" dlg:left="11" dlg:top="60" dlg:width="218" dlg:height="7" dlg:value="Удалить гиперссылки" dlg:checked="false"/>
<dlg:checkbox dlg:id="cleanFormatting" dlg:tab-index="5" dlg:left="11" dlg:top="30" dlg:width="218" dlg:height="7" dlg:value="Очистить форматирование" dlg:checked="false"/> <dlg:checkbox dlg:id="cleanFormatting" dlg:tab-index="5" dlg:left="11" dlg:top="30" dlg:width="218" dlg:height="7" dlg:value="Очистить форматирование" dlg:checked="false"/>
@ -20,7 +20,7 @@
<dlg:checkbox dlg:id="removeManualPageBreaks" dlg:tab-index="15" dlg:left="11" dlg:top="160" dlg:width="218" dlg:height="7" dlg:value="Удалить все разрывы страниц" dlg:checked="false"/> <dlg:checkbox dlg:id="removeManualPageBreaks" dlg:tab-index="15" dlg:left="11" dlg:top="160" dlg:width="218" dlg:height="7" dlg:value="Удалить все разрывы страниц" dlg:checked="false"/>
<dlg:checkbox dlg:id="replaceWhiteBackground" dlg:tab-index="16" dlg:left="11" dlg:top="40" dlg:width="218" dlg:height="7" dlg:value="Заменить белый фон символов на прозрачный" dlg:checked="false"/> <dlg:checkbox dlg:id="replaceWhiteBackground" dlg:tab-index="16" dlg:left="11" dlg:top="40" dlg:width="218" dlg:height="7" dlg:value="Заменить белый фон символов на прозрачный" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeBasic" dlg:tab-index="17" dlg:left="11" dlg:top="170" dlg:width="218" dlg:height="7" dlg:value="Удалить макросы" dlg:checked="false"/> <dlg:checkbox dlg:id="removeBasic" dlg:tab-index="17" dlg:left="11" dlg:top="170" dlg:width="218" dlg:height="7" dlg:value="Удалить макросы" dlg:checked="false"/>
<dlg:button dlg:id="buttonLoad" dlg:tab-index="18" dlg:left="158" dlg:top="251" dlg:width="65" dlg:height="12" dlg:value="loadTemplate"> <dlg:button dlg:id="buttonLoad" dlg:tab-index="18" dlg:left="158" dlg:top="271" dlg:width="65" dlg:height="12" dlg:value="loadTemplate">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Redaction.Configuration.configureStyleFileDialog?language=Basic&amp;location=application" script:language="Script"/> <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Redaction.Configuration.configureStyleFileDialog?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button> </dlg:button>
<dlg:checkbox dlg:id="removeAllFields" dlg:tab-index="19" dlg:left="11" dlg:top="180" dlg:width="218" dlg:height="7" dlg:value="Удалить все поля" dlg:checked="false"/> <dlg:checkbox dlg:id="removeAllFields" dlg:tab-index="19" dlg:left="11" dlg:top="180" dlg:width="218" dlg:height="7" dlg:value="Удалить все поля" dlg:checked="false"/>
@ -30,6 +30,7 @@
<dlg:checkbox dlg:id="convertFontsToCharStyles" dlg:tab-index="23" dlg:left="11" dlg:top="210" dlg:width="218" dlg:height="7" dlg:value="Конвертировать шрифты в стили символов" dlg:checked="false"/> <dlg:checkbox dlg:id="convertFontsToCharStyles" dlg:tab-index="23" dlg:left="11" dlg:top="210" dlg:width="218" dlg:height="7" dlg:value="Конвертировать шрифты в стили символов" dlg:checked="false"/>
<dlg:checkbox dlg:id="fixBrokenCharBackTransparent" dlg:tab-index="24" dlg:left="11" dlg:top="220" dlg:width="218" dlg:height="7" dlg:value="fixBrokenCharBackTransparent" dlg:checked="false"/> <dlg:checkbox dlg:id="fixBrokenCharBackTransparent" dlg:tab-index="24" dlg:left="11" dlg:top="220" dlg:width="218" dlg:height="7" dlg:value="fixBrokenCharBackTransparent" dlg:checked="false"/>
<dlg:checkbox dlg:id="removeNotTransparentBackgrounds" dlg:tab-index="25" dlg:left="11" dlg:top="50" dlg:width="218" dlg:height="7" dlg:value="Удалить непрозрачные фоны в тексте" dlg:checked="false"/> <dlg:checkbox dlg:id="removeNotTransparentBackgrounds" dlg:tab-index="25" dlg:left="11" dlg:top="50" dlg:width="218" dlg:height="7" dlg:value="Удалить непрозрачные фоны в тексте" dlg:checked="false"/>
<dlg:text dlg:id="description" dlg:tab-index="26" dlg:left="11" dlg:top="231" dlg:width="217" dlg:height="16" dlg:value="Label1" dlg:multiline="true"/> <dlg:text dlg:id="description" dlg:tab-index="26" dlg:left="11" dlg:top="251" dlg:width="217" dlg:height="16" dlg:value="Label1" dlg:multiline="true"/>
<dlg:checkbox dlg:id="fixDiacriticKerning" dlg:tab-index="27" dlg:left="11" dlg:top="230" dlg:width="218" dlg:height="7" dlg:value="Fix diacritic kerning" dlg:checked="false"/>
</dlg:bulletinboard> </dlg:bulletinboard>
</dlg:window> </dlg:window>

View file

@ -1,7 +1,7 @@
<?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="Configuration" script:language="StarBasic" script:moduleType="normal">Public Const redactionExtensionName = &quot;cleanAndValidate&quot; <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Configuration" script:language="StarBasic" script:moduleType="normal">Public Const redactionExtensionName = &quot;cleanAndValidate&quot;
Public Const redactionExtensionVersion = &quot;0.10.0&quot; Public Const redactionExtensionVersion = &quot;0.10.11&quot;
Public Const template_name_monography = &quot;Монография&quot; Public Const template_name_monography = &quot;Монография&quot;
Public Const template_name_pj = &quot;Философский журнал&quot; Public Const template_name_pj = &quot;Философский журнал&quot;
Public Const template_name_pq = &quot;Вопросы философии&quot; Public Const template_name_pq = &quot;Вопросы философии&quot;
@ -10,10 +10,13 @@ Public Const template_name_hpe = &quot;Историко-философский
Public Const template_name_pr = &quot;Философия религии&quot; Public Const template_name_pr = &quot;Философия религии&quot;
Public Const template_name_fnit = &quot;Философия науки и техники&quot; Public Const template_name_fnit = &quot;Философия науки и техники&quot;
Public Const template_name_pa = &quot;Философская антропология&quot; Public Const template_name_pa = &quot;Философская антропология&quot;
Public Const template_name_pcr = &quot;Путь цивилизационного развития&quot; Public Const template_name_pcr = &quot;Проблемы цивилизационного развития&quot;
Public Const template_name_eifn = &quot;Эпистемология и философия науки&quot; Public Const template_name_eifn = &quot;Эпистемология и философия науки&quot;
Public Const template_name_et = &quot;Этическая мысль&quot; Public Const template_name_et = &quot;Этическая мысль&quot;
Public Const template_name_ephe = &quot;Электронная философская энциклопедия&quot;
Public Const template_name_iph_big = &quot;Большой формат издания&quot;
Public Const template_manual = &quot;custom_selected_template&quot; Public Const template_manual = &quot;custom_selected_template&quot;
Public Const articles_path = &quot;/templates/articles/&quot;
Function initRedactionConfiguration() Function initRedactionConfiguration()
On Error Goto exceptionHandler On Error Goto exceptionHandler
@ -323,16 +326,19 @@ End Function
Function getTemplateNames() As Variant Function getTemplateNames() As Variant
Dim names() As String Dim names() As String
AddToArray(names, template_name_monography) &apos; AddToArray(names, template_name_monography)
AddToArray(names, template_name_pq) AddToArray(names, template_name_pq)
AddToArray(names, template_name_hp) AddToArray(names, template_name_hp)
AddToArray(names, template_name_hpe) AddToArray(names, template_name_hpe)
AddToArray(names, template_name_pr) AddToArray(names, template_name_pr)
AddToArray(names, template_name_fnit) AddToArray(names, template_name_fnit)
AddToArray(names, template_name_pa) AddToArray(names, template_name_pa)
AddToArray(names, template_name_pj)
AddToArray(names, template_name_pcr) AddToArray(names, template_name_pcr)
AddToArray(names, template_name_eifn) AddToArray(names, template_name_eifn)
AddToArray(names, template_name_et) AddToArray(names, template_name_et)
AddToArray(names, template_name_ephe)
AddToArray(names, template_name_iph_big)
getTemplateNames = names getTemplateNames = names
End Function End Function
@ -351,14 +357,44 @@ Function getTemplateFile(templateName As String) As String
fileName = config.getPropertyValue(&quot;defaultTemplate&quot;) fileName = config.getPropertyValue(&quot;defaultTemplate&quot;)
getTemplateFile = getTemplatePath() &amp; &quot;/&quot; &amp; fileName getTemplateFile = getTemplatePath() &amp; &quot;/&quot; &amp; fileName
Exit Function Exit Function
Case template_name_pj
getTemplateFile = extensionPath() &amp; &quot;/templates/articles/default_article_template_ru.ott&quot;
Exit Function
Case template_name_eifn Case template_name_eifn
getTemplateFile = extensionPath() &amp; &quot;/templates/articles/статья_журнала_ЭиФН.ott&quot; getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_эифн.ott&quot;
Exit Function
Case template_name_fnit
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_фнит.ott&quot;
Exit Function
Case template_name_pa
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_фа.ott&quot;
Exit Function
Case template_name_pj
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_фж.ott&quot;
Exit Function
Case template_name_et
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_эм.ott&quot;
Exit Function
Case template_name_pq
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_вф.ott&quot;
Exit Function
Case template_name_pr
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_фр.ott&quot;
Exit Function
Case template_name_pcr
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_пцр.ott&quot;
Exit Function
Case template_name_hp
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_иф.ott&quot;
Exit Function
Case template_name_hpe
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_ифе.ott&quot;
Exit Function
Case template_name_ephe
getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья_эфэ.ott&quot;
Exit Function
Case template_name_iph_big
getTemplateFile = extensionPath() &amp; &quot;/templates/books/большой_формат_для_архива.ott&quot;
Exit Function Exit Function
Case Else Case Else
getTemplateFile = extensionPath() &amp; &quot;/templates/articles/default_article_template_ru.ott&quot; getTemplateFile = extensionPath() &amp; articles_path &amp; &quot;статья.ott&quot;
Exit Function Exit Function
End Select End Select
End Function End Function

View file

@ -344,6 +344,12 @@ Function getRussian(identifier As String) As String
Case &quot;templateChosen&quot; Case &quot;templateChosen&quot;
getRussian = &quot;Выбран шаблон&quot; getRussian = &quot;Выбран шаблон&quot;
Exit Function Exit Function
Case &quot;statusFixingDiacriticCharactersKerning&quot;
getRussian = &quot;Исправляем комбинирование с диакритическими символами&quot;
Exit Function
Case &quot;fixDiacriticKerning&quot;
getRussian = &quot;Исправить комбинирование с диакритическими символами&quot;
Exit Function
Case Else Case Else
getRussian = &quot;Перевод не найден&quot; getRussian = &quot;Перевод не найден&quot;
End Select End Select
@ -670,6 +676,12 @@ Function getEnglish(identifier As String) As String
Case &quot;templateChosen&quot; Case &quot;templateChosen&quot;
getEnglish = &quot;Selected template&quot; getEnglish = &quot;Selected template&quot;
Exit Function Exit Function
Case &quot;statusFixingDiacriticCharactersKerning&quot;
getEnglish = &quot;Fixing the combination with diacritics &quot;
Exit Function
Case &quot;fixDiacriticKerning&quot;
getEnglish = &quot;Fix combining with diacritic characters&quot;
Exit Function
Case Else Case Else
getEnglish = &quot;No translation&quot; getEnglish = &quot;No translation&quot;
End Select End Select
@ -995,6 +1007,12 @@ Function getCroatian(identifier As String) As String
Case &quot;templateChosen&quot; Case &quot;templateChosen&quot;
getCroatian = &quot;Izabrani šablon&quot; getCroatian = &quot;Izabrani šablon&quot;
Exit Function Exit Function
Case &quot;statusFixingDiacriticCharactersKerning&quot;
getCroatian = &quot;Popravljanje kombinacije s dijakritičkim znakovima&quot;
Exit Function
Case &quot;fixDiacriticKerning&quot;
getCroatian = &quot;Ispravite kombiniranje s naglašenim likovima&quot;
Exit Function
Case Else Case Else
getCroatian = &quot;No translation&quot; getCroatian = &quot;No translation&quot;
End Select End Select
@ -1320,6 +1338,12 @@ Function getSerbian(identifier As String) As String
Case &quot;templateChosen&quot; Case &quot;templateChosen&quot;
getSerbian = &quot;Изабрани шаблон&quot; getSerbian = &quot;Изабрани шаблон&quot;
Exit Function Exit Function
Case &quot;statusFixingDiacriticCharactersKerning&quot;
getSerbian = &quot;Ispravljanje kombinacije sa dijakritičkim znacima &quot;
Exit Function
Case &quot;fixDiacriticKerning&quot;
getSerbian = &quot;Ispravite kombiniranje s naglašenim likovima&quot;
Exit Function
Case Else Case Else
getSerbian = &quot;No translation&quot; getSerbian = &quot;No translation&quot;
End Select End Select
@ -1645,6 +1669,12 @@ Function getBosnian(identifier As String) As String
Case &quot;templateChosen&quot; Case &quot;templateChosen&quot;
getBosnian = &quot;Izabrani šablon&quot; getBosnian = &quot;Izabrani šablon&quot;
Exit Function Exit Function
Case &quot;statusFixingDiacriticCharactersKerning&quot;
getBosnian = &quot;Popravljanje kombinacije s dijakritičkim znakovima&quot;
Exit Function
Case &quot;fixDiacriticKerning&quot;
getBosnian = &quot;Ispravite kombiniranje s naglašenim likovima&quot;
Exit Function
Case Else Case Else
getBosnian = &quot;No translation&quot; getBosnian = &quot;No translation&quot;
End Select End Select

View file

@ -1,7 +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="Validation" script:language="StarBasic">Sub markval30 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markval31
End Sub End Sub
@ -770,11 +769,9 @@ Sub fontReportButton
Exit sub Exit sub
EndIf EndIf
Dim FileName As String Dim FileName As String
FileName = getCharsInFont(targetFontName) getCharsInFont(targetFontName)
statusIndicator.end() statusIndicator.end()
If FileName &lt;&gt; &quot;&quot; Then
openReport(FileName)
EndIf
End Sub End Sub
Sub onSelectFont(oEvent) Sub onSelectFont(oEvent)
@ -914,7 +911,7 @@ Sub addToArray(xArray(),vNextElement)
xArray(iUB) = vNextElement xArray(iUB) = vNextElement
End Sub End Sub
Function getCharsInFont(fontName As String) As String Sub getCharsInFont(fontName As String)
Dim resultArray() As String Dim resultArray() As String
Dim pageNums() As Long Dim pageNums() As Long
Dim firstPages() As Long Dim firstPages() As Long
@ -1000,43 +997,30 @@ Function getCharsInFont(fontName As String) As String
EndIf EndIf
Next j Next j
Next i Next i
resultString = &quot;&quot;
For i = LBound(resultArray) To UBound(resultArray)
resultString = resultString &amp; &quot;&lt;a href=&apos;https://unicode-table.com/ru/&quot; &amp; resultArray(i) &amp; &quot;&apos;&quot; &amp; &quot;&gt;https://unicode-table.com/ru/&quot; &amp; resultArray(i) &amp; &quot;&lt;/a&gt; &quot; &amp; getTranslation(&quot;charFirstPage&quot;) &amp; &quot; &quot; &amp; pageNums(i) &amp; &quot;&lt;br&gt;&quot; &amp; Chr(10)
Next i
If resultString &lt;&gt; &quot;&quot; Then If resultString &lt;&gt; &quot;&quot; Then
&apos;MsgBox &quot;Символы в шрифте &quot;&amp; fontName &amp;Chr(10)&amp;resultString Dim newDocCursor As Object
Dim FileName As String &apos;Holds the file name Dim newDoc As Object
Dim n As Integer &apos;Holds the file number newDoc = starDesktop.loadComponentFromURL(&quot;private:factory/swriter&quot;, &quot;_blank&quot;, 0, Array())
Dim f As Integer &apos;Index variable newDocCursor = newDoc.getCurrentController().getViewCursor()
Dim s As String &apos;Temporary string for input newDocCursor.String = getTranslation(&quot;symbolsInFontHeading&quot;) &amp; &quot; &quot; &amp; fontName
Dim fileaccess As Object newDocCursor.ParaStyleName = &quot;Heading 1&quot;
Dim outtextstream As Object newDocCursor.collapseToEnd()
Dim out As Object newDocCursor.Text.insertControlCharacter(newDocCursor.End,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
For i = LBound(resultArray) To UBound(resultArray)
Dim sTemp$ newDocCursor.ParaStyleName = &quot;Text body&quot;
GlobalScope.BasicLibraries.loadLibrary(&quot;Tools&quot;) newDocCursor.String = &quot;https://unicode-table.com/ru/&quot; &amp; resultArray(i)
path=DirectoryNameoutofPath(ThisComponent.getURL(),&quot;/&quot;) newDocCursor.HyperLinkURL = &quot;https://unicode-table.com/ru/&quot; &amp; resultArray(i)
FileName = path &amp; &quot;/symbolsInFont&quot; &amp; fontName &amp; &quot;.html&quot; newDocCursor.collapseToEnd()
&apos;n = FreeFile() &apos;Next free file number newDocCursor.String = &quot; &quot; &amp; getTranslation(&quot;charFirstPage&quot;) &amp; &quot; &quot; &amp; pageNums(i)
&apos;Open FileName For Output Access Read Write As #n &apos;Open for read/write newDocCursor.collapseToEnd()
fileaccess = createUnoService (&quot;com.sun.star.ucb.SimpleFileAccess&quot;) newDocCursor.Text.insertControlCharacter(newDocCursor.End,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
outtextstream = createUnoService (&quot;com.sun.star.io.TextOutputStream&quot;) Next i
outtextstream.setEncoding( &quot;UTF-8&quot; ) Exit Sub
out = fileaccess.openFileWrite( FileName )
outtextstream.setOutputStream( out )
outtextstream.writeString( &quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;&quot; &amp; getTranslation(&quot;symbolsInFontHeading&quot;) &amp; &quot; &quot;&amp; fontName &amp; &quot;&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h2&gt;&quot; &amp; getTranslation(&quot;symbolsInFontHeading&quot;) &amp; &quot; &quot;&amp; fontName &amp;&quot;:&lt;/h2&gt;&quot;&amp;resultString &amp;&quot;&lt;/body&gt;&lt;/html&gt;&quot; )
outtextstream.closeOutput()
getCharsInFont = FileName
Exit Function
Else Else
MsgBox getTranslation(&quot;symbolsInFontNotFound1&quot;) &amp; &quot; &quot; &amp; fontName &amp; &quot; &quot; &amp; getTranslation(&quot;symbolsInFontNotFound2&quot;) MsgBox getTranslation(&quot;symbolsInFontNotFound1&quot;) &amp; &quot; &quot; &amp; fontName &amp; &quot; &quot; &amp; getTranslation(&quot;symbolsInFontNotFound2&quot;)
getCharsInFont = &quot;&quot;
Exit Function
EndIf EndIf
End Function End Sub
Function findBadCharacters() As Boolean Function findBadCharacters() As Boolean

View file

@ -1,6 +1,8 @@
apply plugin: 'java'
task oxt(type: Zip) { task oxt(type: Zip) {
dependsOn = [ 'setVersion','setVersionInBasicCode' ] dependsOn = [ 'setVersion','setVersionInBasicCode' ]
archiveName 'cleanAndValidate.oxt' archiveFileName = 'cleanAndValidate.oxt'
destinationDirectory = file("./")
from './' from './'
include '*' include '*'
include '*/*' include '*/*'

View file

@ -2,9 +2,9 @@
<description xmlns="http://openoffice.org/extensions/update/2006" <description xmlns="http://openoffice.org/extensions/update/2006"
xmlns:xlink="http://www.w3.org/1999/xlink"> xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="pro.litvinovg.Redaction"/> <identifier value="pro.litvinovg.Redaction"/>
<version value="0.9.37" /> <version value="0.10.11" />
<update-download> <update-download>
<src xlink:href="https://dev.litvinovg.pro/litvinovg/cleanandvalidate/uploads/1e0dc8e6899835eca2ba546c22725eba/cleanAndValidate.oxt" /> <src xlink:href="https://dev.litvinovg.pro/litvinovg/cleanandvalidate/uploads/330066acb026243a8a0eab002de1a1f3/cleanAndValidate.oxt" />
</update-download> </update-download>
<release-notes> <release-notes>
<src xlink:href="https://dev.litvinovg.pro/litvinovg/cleanandvalidate/-/raw/master/releasenotes.txt" lang="en" /> <src xlink:href="https://dev.litvinovg.pro/litvinovg/cleanandvalidate/-/raw/master/releasenotes.txt" lang="en" />

View file

@ -5,13 +5,28 @@
<identifier value="pro.litvinovg.Redaction"/> <identifier value="pro.litvinovg.Redaction"/>
<version value="0.10.0"/>
<version value="0.10.11"/>
@ -23,156 +38,286 @@
<display-name> <display-name>
<name lang="en">Cleaning and validation documents for publishing in html and epub with pagination</name> <name lang="en">Cleaning and validation documents for publishing in html and epub with pagination</name>
<name lang="ru">Чистка и проверка документов для издания в html и epub с сохранением пагинации</name> <name lang="ru">Чистка и проверка документов для издания в html и epub с сохранением пагинации</name>
</display-name> </display-name>
<registration> <registration>
<simple-license accept-by="admin" suppress-if-required="true" suppress-on-update="true"> <simple-license accept-by="admin" suppress-if-required="true" suppress-on-update="true">
<license-text lang="en" xlink:href="license_en.txt"/> <license-text lang="en" xlink:href="license_en.txt"/>
<license-text lang="ru" xlink:href="license_ru.txt"/> <license-text lang="ru" xlink:href="license_ru.txt"/>
</simple-license> </simple-license>
</registration> </registration>
<dependencies> <dependencies>
<OpenOffice.org-minimal-version dep:name="OpenOffice.org, LibreOffice 4.1 or later" value="4.1"/> <OpenOffice.org-minimal-version dep:name="OpenOffice.org, LibreOffice 4.1 or later" value="4.1"/>
</dependencies> </dependencies>
<update-information> <update-information>
<src xlink:href="https://dev.litvinovg.pro/litvinovg/cleanandvalidate/-/raw/master/cleanandvalidate.update.xml"/> <src xlink:href="https://dev.litvinovg.pro/litvinovg/cleanandvalidate/-/raw/master/cleanandvalidate.update.xml"/>
</update-information> </update-information>
<publisher> <publisher>
<name lang="en" xlink:href="mailto:public@litvinovg.pro">Georgy Litvinov</name> <name lang="en" xlink:href="mailto:public@litvinovg.pro">Georgy Litvinov</name>
</publisher> </publisher>
<release-notes> <release-notes>
<src lang="en" xlink:href="releasenotes.txt"/> <src lang="en" xlink:href="releasenotes.txt"/>
</release-notes> </release-notes>
<extension-description> <extension-description>
<src lang="ru" xlink:href="description/description_ru.txt"/> <src lang="ru" xlink:href="description/description_ru.txt"/>
<src lang="en" xlink:href="description/description_en.txt"/> <src lang="en" xlink:href="description/description_en.txt"/>
</extension-description> </extension-description>
@ -180,28 +325,53 @@
<icon> <icon>
<default xlink:href="icons/addon_icon.svg"/> <default xlink:href="icons/addon_icon.svg"/>
<high-contrast xlink:href="icons/addon_icon.svg"/> <high-contrast xlink:href="icons/addon_icon.svg"/>
</icon> </icon>
</description> </description>

View file

@ -1 +1 @@
version=0.10.0 version=0.10.11

View file

@ -1,6 +1,6 @@
The author of this extension is: The author of this extension is:
Georgy Litvinov (public@litvinovg.pro) Georgy Litvinov (public@litvinovg.pro)
Copyright 20212121212121212121212121212121212121212121n redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3 of the License. Copyright 2021 redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3 of the License.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.