Added check for colored text areas

This commit is contained in:
Georgy Litvinov 2021-06-04 22:28:27 +02:00
parent 9846e2933c
commit fae0f0b494
4 changed files with 89 additions and 14 deletions

View file

@ -2,11 +2,11 @@
<!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="Navigator" dlg:left="0" dlg:top="50" dlg:width="100" dlg:height="123" dlg:closeable="true" dlg:moveable="true"> <dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Navigator" dlg:left="0" dlg:top="50" dlg:width="100" dlg:height="123" dlg:closeable="true" dlg:moveable="true">
<dlg:bulletinboard> <dlg:bulletinboard>
<dlg:text dlg:id="description" dlg:tab-index="1" dlg:left="2" dlg:top="5" dlg:width="96" dlg:height="47" dlg:value="описание объектов для навигации" dlg:multiline="true"/> <dlg:text dlg:id="description" dlg:tab-index="1" dlg:left="2" dlg:top="5" dlg:width="96" dlg:height="47" dlg:value="описание объектов для навигации" dlg:align="center" dlg:multiline="true"/>
<dlg:button dlg:id="close" dlg:tab-index="2" dlg:left="2" dlg:top="105" dlg:width="96" dlg:height="15" dlg:value="Закрыть навигатор" dlg:toggled="1"/> <dlg:button dlg:id="close" dlg:tab-index="2" dlg:left="2" dlg:top="105" dlg:width="96" dlg:height="15" dlg:value="Закрыть навигатор" dlg:toggled="1"/>
<dlg:button dlg:id="next" dlg:tab-index="0" dlg:left="67" dlg:top="70" dlg:width="30" dlg:height="30" dlg:toggled="1"/> <dlg:button dlg:id="next" dlg:tab-index="0" dlg:left="67" dlg:top="70" dlg:width="30" dlg:height="30" dlg:toggled="1"/>
<dlg:text dlg:id="current" dlg:tab-index="4" dlg:left="36" dlg:top="81" dlg:width="28" dlg:height="15" dlg:value="current"/> <dlg:text dlg:id="current" dlg:tab-index="4" dlg:left="36" dlg:top="81" dlg:width="28" dlg:height="15" dlg:value="current" dlg:align="center"/>
<dlg:text dlg:id="found" dlg:tab-index="5" dlg:left="2" dlg:top="55" dlg:width="96" dlg:height="12" dlg:value="Всего найдено"/> <dlg:text dlg:id="found" dlg:tab-index="5" dlg:left="2" dlg:top="55" dlg:width="96" dlg:height="12" dlg:value="Всего найдено" dlg:align="center"/>
<dlg:button dlg:id="prev" dlg:tab-index="3" dlg:left="3" dlg:top="70" dlg:width="30" dlg:height="30" dlg:valign="center" dlg:toggled="1"/> <dlg:button dlg:id="prev" dlg:tab-index="3" dlg:left="3" dlg:top="70" dlg:width="30" dlg:height="30" dlg:valign="center" dlg:toggled="1"/>
</dlg:bulletinboard> </dlg:bulletinboard>
</dlg:window> </dlg:window>

View file

@ -293,6 +293,12 @@ Function getRussian(identifier As String) As String
Case &quot;navigatorFound&quot; Case &quot;navigatorFound&quot;
getRussian = &quot;Всего найдено: &quot; getRussian = &quot;Всего найдено: &quot;
Exit Function Exit Function
Case &quot;coloredTextDescription&quot;
getRussian = &quot;Навигация по выделенному цветом тексту&quot;
Exit Function
Case &quot;foundColoredTextMessage&quot;
getRussian = &quot;Найден текст c непрозрачным фоном. Обычно это не подходит для электронных публикаций. Вместо белого цвета фона используйте «Без заливки»&quot;
Exit Function
Case Else Case Else
getRussian = &quot;Перевод не найден&quot; getRussian = &quot;Перевод не найден&quot;
End Select End Select
@ -568,6 +574,12 @@ Function getEnglish(identifier As String) As String
Case &quot;navigatorFound&quot; Case &quot;navigatorFound&quot;
getEnglish = &quot;Total found: &quot; getEnglish = &quot;Total found: &quot;
Exit Function Exit Function
Case &quot;coloredTextDescription&quot;
getEnglish = &quot;Navigation over highlighted text&quot;
Exit Function
Case &quot;foundColoredTextMessage&quot;
getEnglish = &quot;Found text with an opaque background. This is usually not suitable for electronic publishing. Use „No Fill“ instead of a white background &quot;
Exit Function
Case Else Case Else
getEnglish = &quot;No translation&quot; getEnglish = &quot;No translation&quot;
End Select End Select
@ -842,6 +854,12 @@ Function getCroatian(identifier As String) As String
Case &quot;navigatorFound&quot; Case &quot;navigatorFound&quot;
getCroatian = &quot;Ukupno pronađeno: &quot; getCroatian = &quot;Ukupno pronađeno: &quot;
Exit Function Exit Function
Case &quot;coloredTextDescription&quot;
getCroatian = &quot;Navigacija istaknutim tekstom &quot;
Exit Function
Case &quot;foundColoredTextMessage&quot;
getCroatian = &quot;Pronađen tekst s neprozirnom pozadinom. To obično nije prikladno za elektroničko izdavanje. Upotrijebite „Bez popunjavanja“ umjesto bijele pozadine &quot;
Exit Function
Case Else Case Else
getCroatian = &quot;No translation&quot; getCroatian = &quot;No translation&quot;
End Select End Select
@ -1116,6 +1134,12 @@ Function getSerbian(identifier As String) As String
Case &quot;navigatorFound&quot; Case &quot;navigatorFound&quot;
getSerbian = &quot;Укупно пронађено: &quot; getSerbian = &quot;Укупно пронађено: &quot;
Exit Function Exit Function
Case &quot;coloredTextDescription&quot;
getSerbian = &quot;Навигација по истакнутом тексту &quot;
Exit Function
Case &quot;foundColoredTextMessage&quot;
getSerbian = &quot;Пронађен је текст са непрозирном позадином. Ово обично није погодно за електронско издавање. Користите „Без попуњавања“ уместо беле позадине &quot;
Exit Function
Case Else Case Else
getSerbian = &quot;No translation&quot; getSerbian = &quot;No translation&quot;
End Select End Select
@ -1390,6 +1414,12 @@ Function getBosnian(identifier As String) As String
Case &quot;navigatorFound&quot; Case &quot;navigatorFound&quot;
getBosnian = &quot;Ukupno pronađeno: &quot; getBosnian = &quot;Ukupno pronađeno: &quot;
Exit Function Exit Function
Case &quot;coloredTextDescription&quot;
getBosnian = &quot;Navigacija istaknutim tekstom &quot;
Exit Function
Case &quot;foundColoredTextMessage&quot;
getBosnian = &quot;Pronađen tekst s neprozirnom pozadinom. To obično nije prikladno za elektroničko izdavanje. Upotrijebite „Bez popunjavanja“ umjesto bijele pozadine &quot;
Exit Function
Case Else Case Else
getBosnian = &quot;No translation&quot; getBosnian = &quot;No translation&quot;
End Select End Select

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="Validation" script:language="StarBasic">Sub markval24 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markval25
End Sub End Sub
@ -34,6 +34,7 @@ Sub validateButton
Dim badNumberings As Boolean Dim badNumberings As Boolean
Dim needExtendedInfo As Boolean Dim needExtendedInfo As Boolean
Dim config As Object Dim config As Object
Dim needFixColoredText As Boolean
config = initRedactionConfiguration() config = initRedactionConfiguration()
Dim statusIndicator as Object Dim statusIndicator as Object
@ -83,9 +84,11 @@ Sub validateButton
needExtendedInfo = false needExtendedInfo = false
EndIf EndIf
needFixColoredText = findColoredBackgroundInDoc
numberingsErros = printNumberingSymbols(needExtendedInfo) numberingsErros = printNumberingSymbols(needExtendedInfo)
statusIndicator.setValue(80) statusIndicator.setValue(80)
If numberingsErros OR badText OR badNumberings OR footnotesReport &lt;&gt; &quot;&quot; OR graphicsReport &lt;&gt; &quot;&quot; Or outlineInNotesReport &lt;&gt; &quot;&quot; Or sectionsReport &lt;&gt; &quot;&quot; OR oulineInTablesReport &lt;&gt; &quot;&quot; OR outlinePageStylesReport &lt;&gt; &quot;&quot; Then If needFixColoredText OR numberingsErros OR badText OR badNumberings OR footnotesReport &lt;&gt; &quot;&quot; OR graphicsReport &lt;&gt; &quot;&quot; Or outlineInNotesReport &lt;&gt; &quot;&quot; Or sectionsReport &lt;&gt; &quot;&quot; OR oulineInTablesReport &lt;&gt; &quot;&quot; OR outlinePageStylesReport &lt;&gt; &quot;&quot; Then
MsgBox getTranslation(&quot;validationWarning&quot;) MsgBox getTranslation(&quot;validationWarning&quot;)
If badText Then If badText Then
MsgBox getTranslation(&quot;validationBadSymbolsNotification&quot;) MsgBox getTranslation(&quot;validationBadSymbolsNotification&quot;)
@ -851,8 +854,7 @@ Function getCharsInFont(fontName As String) As String
EndIf EndIf
End Function End Function
Sub findColoredBackgroundInDoc() Function findColoredBackgroundInDoc() As Boolean
Dim founds As Object Dim founds As Object
Dim sDesc As Object Dim sDesc As Object
Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
@ -866,22 +868,36 @@ End Function
sDesc.searchStyles = true sDesc.searchStyles = true
sDesc.SetSearchAttributes(SrchAttributes()) sDesc.SetSearchAttributes(SrchAttributes())
founds = Thiscomponent.findAll(sDesc) founds = Thiscomponent.findAll(sDesc)
findColoredBackgroundInDoc = false
If founds.count &lt;&gt; 0 Then If founds.count &lt;&gt; 0 Then
MsgBox founds.count MsgBox getTranslation(&quot;foundColoredTextMessage&quot;)
Else startNavigatorDialog(getTranslation(&quot;coloredTextDescription&quot;),founds)
MsgBox getTranslation(&quot;No colored text excerpts found&quot;) findColoredBackgroundInDoc = true
EndIf EndIf
End Sub
End Function
Sub starNavigatorDialog(objectsDescription As Text,founds As Object) Sub startNavigatorDialog(objectsDescription As String,founds As Object)
Dim dialog As Object Dim dialog As Object
Dim leftImageURL As String Dim leftImageURL As String
Dim rightImageURL As String Dim rightImageURL As String
Dim curNum As Long
Dim maxNum As Long
Dim found As Object
Dim oViewCursor As Object
&apos;Globalscope.BasicLibraries.LoadLibrary( &quot;MRILib&quot; )
&apos;Mri founds
oViewCursor = ThisComponent.CurrentController.getViewCursor()
waitingForDialog = true waitingForDialog = true
maxNum = founds.count - 1
dialog = notModalDialog(&quot;Navigator&quot;) dialog = notModalDialog(&quot;Navigator&quot;)
&apos; dialog.getControl(&quot;found&quot;).SetText(getTranslation(&quot;EndnotesNativeDialogFound&quot;) &amp; CStr(UBound(foundEndNotes)+1)) dialog.getControl(&quot;found&quot;).SetText(getTranslation(&quot;navigatorFound&quot;) &amp; CStr(maxNum+1))
&apos; dialog.getControl(&quot;description&quot;).SetText(getTranslation(&quot;EndnotesNativeDialogDescriptionSelect&quot;)) curNum = 0
found = founds.getByIndex(curNum)
dialog.getControl(&quot;current&quot;).SetText(CStr(curNum+1))
dialog.getControl(&quot;description&quot;).SetText(objectsDescription)
&apos; dialog.getControl(&quot;cancel&quot;).Label = getTranslation(&quot;buttonCancel&quot;) &apos; dialog.getControl(&quot;cancel&quot;).Label = getTranslation(&quot;buttonCancel&quot;)
dialog.getControl(&quot;close&quot;).Label = getTranslation(&quot;buttonClose&quot;) dialog.getControl(&quot;close&quot;).Label = getTranslation(&quot;buttonClose&quot;)
leftImageURL = convertToURL(getExtensionPath() &amp; &quot;/images/left-navigator.svg&quot;) leftImageURL = convertToURL(getExtensionPath() &amp; &quot;/images/left-navigator.svg&quot;)
@ -891,13 +907,24 @@ Sub starNavigatorDialog(objectsDescription As Text,founds As Object)
dialog.getControl(&quot;next&quot;).model.imageURL = rightImageURL dialog.getControl(&quot;next&quot;).model.imageURL = rightImageURL
&apos;dialog.getControl(&quot;next&quot;).model.ScaleMode = 2 &apos;dialog.getControl(&quot;next&quot;).model.ScaleMode = 2
dialog.setvisible(true) dialog.setvisible(true)
oViewCursor.goToRange(found,false)
Do While waitingForDialog Do While waitingForDialog
If dialog.getControl(&quot;close&quot;).model.state = 1 then If dialog.getControl(&quot;close&quot;).model.state = 1 then
exit Do exit Do
EndIf EndIf
If dialog.getControl(&quot;prev&quot;).model.state = 1 then If dialog.getControl(&quot;prev&quot;).model.state = 1 then
curNum = getPrevFound(curNum, maxNum)
found = founds.getByIndex(curNum)
oViewCursor.goToRange(found,false)
dialog.getControl(&quot;current&quot;).SetText(CStr(curNum+1))
dialog.getControl(&quot;prev&quot;).model.state = 0
EndIf EndIf
If dialog.getControl(&quot;next&quot;).model.state = 1 then If dialog.getControl(&quot;next&quot;).model.state = 1 then
curNum = getNextFound(curNum, maxNum)
found = founds.getByIndex(curNum)
oViewCursor.goToRange(found,false)
dialog.getControl(&quot;current&quot;).SetText(CStr(curNum+1))
dialog.getControl(&quot;next&quot;).model.state = 0
EndIf EndIf
wait (100) wait (100)
@ -905,6 +932,24 @@ Sub starNavigatorDialog(objectsDescription As Text,founds As Object)
dialog.dispose dialog.dispose
End Sub End Sub
Function getNextFound(curNum As Long, max As Long) As Long
If curNum &lt; max Then
getNextFound = curNum + 1
Else
getNextFound = 0
EndIf
End Function
Function getPrevFound(curNum As Long, max As Long) As Long
If curNum = 0 Then
getPrevFound = max
Else
getPrevFound = curNum - 1
EndIf
End Function
Function getExtensionPath() As String Function getExtensionPath() As String
Dim extensionIdentifier As String Dim extensionIdentifier As String
Dim pip As Object Dim pip As Object

Binary file not shown.