diff --git a/Redaction/Navigator.xdl b/Redaction/Navigator.xdl index da0ae6f..ed46244 100644 --- a/Redaction/Navigator.xdl +++ b/Redaction/Navigator.xdl @@ -2,11 +2,11 @@ - + - - + + \ No newline at end of file diff --git a/Redaction/Translations.xba b/Redaction/Translations.xba index 0d214ad..3d1c5df 100644 --- a/Redaction/Translations.xba +++ b/Redaction/Translations.xba @@ -293,6 +293,12 @@ Function getRussian(identifier As String) As String Case "navigatorFound" getRussian = "Всего найдено: " Exit Function + Case "coloredTextDescription" + getRussian = "Навигация по выделенному цветом тексту" + Exit Function + Case "foundColoredTextMessage" + getRussian = "Найден текст c непрозрачным фоном. Обычно это не подходит для электронных публикаций. Вместо белого цвета фона используйте «Без заливки»" + Exit Function Case Else getRussian = "Перевод не найден" End Select @@ -568,6 +574,12 @@ Function getEnglish(identifier As String) As String Case "navigatorFound" getEnglish = "Total found: " Exit Function + Case "coloredTextDescription" + getEnglish = "Navigation over highlighted text" + Exit Function + Case "foundColoredTextMessage" + getEnglish = "Found text with an opaque background. This is usually not suitable for electronic publishing. Use „No Fill“ instead of a white background " + Exit Function Case Else getEnglish = "No translation" End Select @@ -842,6 +854,12 @@ Function getCroatian(identifier As String) As String Case "navigatorFound" getCroatian = "Ukupno pronađeno: " Exit Function + Case "coloredTextDescription" + getCroatian = "Navigacija istaknutim tekstom " + Exit Function + Case "foundColoredTextMessage" + getCroatian = "Pronađen tekst s neprozirnom pozadinom. To obično nije prikladno za elektroničko izdavanje. Upotrijebite „Bez popunjavanja“ umjesto bijele pozadine " + Exit Function Case Else getCroatian = "No translation" End Select @@ -1116,6 +1134,12 @@ Function getSerbian(identifier As String) As String Case "navigatorFound" getSerbian = "Укупно пронађено: " Exit Function + Case "coloredTextDescription" + getSerbian = "Навигација по истакнутом тексту " + Exit Function + Case "foundColoredTextMessage" + getSerbian = "Пронађен је текст са непрозирном позадином. Ово обично није погодно за електронско издавање. Користите „Без попуњавања“ уместо беле позадине " + Exit Function Case Else getSerbian = "No translation" End Select @@ -1390,6 +1414,12 @@ Function getBosnian(identifier As String) As String Case "navigatorFound" getBosnian = "Ukupno pronađeno: " Exit Function + Case "coloredTextDescription" + getBosnian = "Navigacija istaknutim tekstom " + Exit Function + Case "foundColoredTextMessage" + getBosnian = "Pronađen tekst s neprozirnom pozadinom. To obično nije prikladno za elektroničko izdavanje. Upotrijebite „Bez popunjavanja“ umjesto bijele pozadine " + Exit Function Case Else getBosnian = "No translation" End Select diff --git a/Redaction/Validation.xba b/Redaction/Validation.xba index d220ebe..7fd60a1 100644 --- a/Redaction/Validation.xba +++ b/Redaction/Validation.xba @@ -1,6 +1,6 @@ -Sub markval24 +Sub markval25 End Sub @@ -34,6 +34,7 @@ Sub validateButton Dim badNumberings As Boolean Dim needExtendedInfo As Boolean Dim config As Object + Dim needFixColoredText As Boolean config = initRedactionConfiguration() Dim statusIndicator as Object @@ -83,9 +84,11 @@ Sub validateButton needExtendedInfo = false EndIf + needFixColoredText = findColoredBackgroundInDoc + numberingsErros = printNumberingSymbols(needExtendedInfo) statusIndicator.setValue(80) - If numberingsErros OR badText OR badNumberings OR footnotesReport <> "" OR graphicsReport <> "" Or outlineInNotesReport <> "" Or sectionsReport <> "" OR oulineInTablesReport <> "" OR outlinePageStylesReport <> "" Then + If needFixColoredText OR numberingsErros OR badText OR badNumberings OR footnotesReport <> "" OR graphicsReport <> "" Or outlineInNotesReport <> "" Or sectionsReport <> "" OR oulineInTablesReport <> "" OR outlinePageStylesReport <> "" Then MsgBox getTranslation("validationWarning") If badText Then MsgBox getTranslation("validationBadSymbolsNotification") @@ -851,8 +854,7 @@ Function getCharsInFont(fontName As String) As String EndIf End Function - Sub findColoredBackgroundInDoc() - +Function findColoredBackgroundInDoc() As Boolean Dim founds As Object Dim sDesc As Object Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue @@ -866,22 +868,36 @@ End Function sDesc.searchStyles = true sDesc.SetSearchAttributes(SrchAttributes()) founds = Thiscomponent.findAll(sDesc) + findColoredBackgroundInDoc = false If founds.count <> 0 Then - MsgBox founds.count - Else - MsgBox getTranslation("No colored text excerpts found") + MsgBox getTranslation("foundColoredTextMessage") + startNavigatorDialog(getTranslation("coloredTextDescription"),founds) + findColoredBackgroundInDoc = true 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 leftImageURL As String Dim rightImageURL As String + Dim curNum As Long + Dim maxNum As Long + Dim found As Object + Dim oViewCursor As Object + 'Globalscope.BasicLibraries.LoadLibrary( "MRILib" ) + 'Mri founds + oViewCursor = ThisComponent.CurrentController.getViewCursor() waitingForDialog = true + maxNum = founds.count - 1 dialog = notModalDialog("Navigator") -' dialog.getControl("found").SetText(getTranslation("EndnotesNativeDialogFound") & CStr(UBound(foundEndNotes)+1)) -' dialog.getControl("description").SetText(getTranslation("EndnotesNativeDialogDescriptionSelect")) + dialog.getControl("found").SetText(getTranslation("navigatorFound") & CStr(maxNum+1)) + curNum = 0 + found = founds.getByIndex(curNum) + dialog.getControl("current").SetText(CStr(curNum+1)) + + dialog.getControl("description").SetText(objectsDescription) ' dialog.getControl("cancel").Label = getTranslation("buttonCancel") dialog.getControl("close").Label = getTranslation("buttonClose") leftImageURL = convertToURL(getExtensionPath() & "/images/left-navigator.svg") @@ -891,13 +907,24 @@ Sub starNavigatorDialog(objectsDescription As Text,founds As Object) dialog.getControl("next").model.imageURL = rightImageURL 'dialog.getControl("next").model.ScaleMode = 2 dialog.setvisible(true) + oViewCursor.goToRange(found,false) Do While waitingForDialog If dialog.getControl("close").model.state = 1 then exit Do EndIf If dialog.getControl("prev").model.state = 1 then + curNum = getPrevFound(curNum, maxNum) + found = founds.getByIndex(curNum) + oViewCursor.goToRange(found,false) + dialog.getControl("current").SetText(CStr(curNum+1)) + dialog.getControl("prev").model.state = 0 EndIf If dialog.getControl("next").model.state = 1 then + curNum = getNextFound(curNum, maxNum) + found = founds.getByIndex(curNum) + oViewCursor.goToRange(found,false) + dialog.getControl("current").SetText(CStr(curNum+1)) + dialog.getControl("next").model.state = 0 EndIf wait (100) @@ -905,6 +932,24 @@ Sub starNavigatorDialog(objectsDescription As Text,founds As Object) dialog.dispose End Sub +Function getNextFound(curNum As Long, max As Long) As Long + If curNum < 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 Dim extensionIdentifier As String Dim pip As Object diff --git a/translations.ods b/translations.ods index 1c00c31..e85db2c 100644 Binary files a/translations.ods and b/translations.ods differ