diff --git a/Redaction/Configuration.xba b/Redaction/Configuration.xba index 2972813..5d3e8b7 100644 --- a/Redaction/Configuration.xba +++ b/Redaction/Configuration.xba @@ -1,7 +1,7 @@ Public Const redactionExtensionName As String = "cleanAndValidate" -Public Const redactionExtensionVersion = "0.9.1" +Public Const redactionExtensionVersion = "0.9.2" Function initRedactionConfiguration() On Error Goto exceptionHandler Dim regFactory As Object diff --git a/Redaction/Translations.xba b/Redaction/Translations.xba index a303c0b..2d1707e 100644 --- a/Redaction/Translations.xba +++ b/Redaction/Translations.xba @@ -242,6 +242,21 @@ Function getRussian(identifier As String) As String Case "chooseFontNameDialogDescription" getRussian = "Дважды кликните левой клавишей мыши на имя шрифта" Exit Function + Case "fontReportInProgress" + getRussian = "Составление отчёта о шрифте. Пожалуйста, подождите." + Exit Function + Case "symbolsInFontHeading" + getRussian = "Символы в шрифте" + Exit Function + Case "symbolsInFontNotFound1" + getRussian = "Символов в шрифте" + Exit Function + Case "symbolsInFontNotFound2" + getRussian = "найдено не было." + Exit Function + Case "charFirstPage" + getRussian = "Найден на стр." + Exit Function Case Else getRussian = "Перевод не найден" End Select @@ -466,6 +481,21 @@ Function getEnglish(identifier As String) As String Case "chooseFontNameDialogDescription" getEnglish = "Double-click the font name with the left mouse button." Exit Function + Case "fontReportInProgress" + getEnglish = "Preparing report. Please wait." + Exit Function + Case "symbolsInFontHeading" + getEnglish = "Characters in font" + Exit Function + Case "symbolsInFontNotFound1" + getEnglish = "No characters in font" + Exit Function + Case "symbolsInFontNotFound2" + getEnglish = "found." + Exit Function + Case "charFirstPage" + getEnglish = "Found on page" + Exit Function Case Else getEnglish = "No translation" End Select @@ -689,6 +719,21 @@ Function getCroatian(identifier As String) As String Case "chooseFontNameDialogDescription" getCroatian = "Dvaput kliknite naziv fonta lijevom tipkom miša." Exit Function + Case "fontReportInProgress" + getCroatian = "Izvještavanje o fontu. Molimo pričekajte." + Exit Function + Case "symbolsInFontHeading" + getCroatian = "Znakovi fonta" + Exit Function + Case "symbolsInFontNotFound1" + getCroatian = "Znakovi fonta" + Exit Function + Case "symbolsInFontNotFound2" + getCroatian = "nije pronađeno" + Exit Function + Case "charFirstPage" + getCroatian = "Pronađeno na stranici" + Exit Function Case Else getCroatian = "No translation" End Select @@ -912,6 +957,21 @@ Function getSerbian(identifier As String) As String Case "chooseFontNameDialogDescription" getSerbian = "Двапут кликните на назив фонта левим дугметом миша." Exit Function + Case "fontReportInProgress" + getSerbian = "Припрема извештаја. Сачекајте." + Exit Function + Case "symbolsInFontHeading" + getSerbian = "Знакови фонта" + Exit Function + Case "symbolsInFontNotFound1" + getSerbian = "Знакови фонта" + Exit Function + Case "symbolsInFontNotFound2" + getSerbian = "није пронађено" + Exit Function + Case "charFirstPage" + getSerbian = "Пронађено на страници" + Exit Function Case Else getSerbian = "No translation" End Select @@ -1135,6 +1195,21 @@ Function getBosnian(identifier As String) As String Case "chooseFontNameDialogDescription" getBosnian = "Dvaput kliknite naziv fonta lijevom tipkom miša." Exit Function + Case "fontReportInProgress" + getBosnian = "Izvještavanje o fontu. Molimo pričekajte." + Exit Function + Case "symbolsInFontHeading" + getBosnian = "Znakovi fonta" + Exit Function + Case "symbolsInFontNotFound1" + getBosnian = "Znakovi fonta" + Exit Function + Case "symbolsInFontNotFound2" + getBosnian = "nije pronađeno" + Exit Function + Case "charFirstPage" + getBosnian = "Pronađeno na stranici" + Exit Function Case Else getBosnian = "No translation" End Select diff --git a/Redaction/Validation.xba b/Redaction/Validation.xba index 211e9a9..3810a2f 100644 --- a/Redaction/Validation.xba +++ b/Redaction/Validation.xba @@ -1,6 +1,6 @@ -Sub markval11 +Sub markval12 End Sub @@ -562,10 +562,15 @@ Sub fontReportButton Dim targetFontName As String targetFontName = fontDialog.model.Tag If targetFontName="0" or targetFontName="" Then + statusIndicator.end() Exit sub EndIf - getCharsInFont(targetFontName) + Dim FileName As String + FileName = getCharsInFont(targetFontName) statusIndicator.end() + If FileName <> "" Then + openReport(FileName) + EndIf End Sub Sub onSelectFont(oEvent) @@ -605,9 +610,11 @@ Function getODGFontNames() As Variant enum2 = enum1Element.createEnumeration While enum2.hasMoreElements thisPortion = enum2.nextElement - fontName = thisPortion.CharFontName - If NOT fontIsAlreadyFound(fontNames, fontName) Then + If Len(thisPortion.String) > 0 Then + fontName = thisPortion.CharFontName + If NOT fontIsAlreadyFound(fontNames, fontName) Then AddToArray(fontNames, fontName) + EndIf EndIf Wend EndIf @@ -673,8 +680,9 @@ Sub addToArray(xArray(),vNextElement) xArray(iUB) = vNextElement End Sub -Sub getCharsInFont(fontName As String) +Function getCharsInFont(fontName As String) As String Dim resultArray() As String + Dim pageNums() As Long Dim firstPages() As Long Dim resultString As String Dim pages As Object @@ -712,6 +720,7 @@ Sub getCharsInFont(fontName As String) fontChar = Hex(Asc(Mid(resultString,k+1,1))) If NOT IsInArray(resultArray,fontChar) Then AddToArray(resultArray(), fontChar) + AddToArray(pageNums(), i + 1) EndIf Next k EndIf @@ -722,7 +731,7 @@ Sub getCharsInFont(fontName As String) Next i resultString = "" For i = LBound(resultArray) To UBound(resultArray) - resultString = resultString & "<a href='https://unicode-table.com/ru/" & resultArray(i) & "'" & ">https://unicode-table.com/ru/" & resultArray(i) & "</a><br>" & Chr(10) + resultString = resultString & "<a href='https://unicode-table.com/ru/" & resultArray(i) & "'" & ">https://unicode-table.com/ru/" & resultArray(i) & "</a> " & getTranslation("charFirstPage") & " " & pageNums(i) & "<br>" & Chr(10) Next i If resultString <> "" Then @@ -737,12 +746,35 @@ Sub getCharsInFont(fontName As String) FileName = path & "/symbolsInFont" & fontName & ".html" n = FreeFile() 'Next free file number Open FileName For Output Access Read Write As #n 'Open for read/write - Print #n, "<html><body><p>Symbols in font "& fontName &":</p>"&resultString &"</body><html>" + Print #n, "<html><head><title>" & getTranslation("symbolsInFontHeading") & " "& fontName & "</title></head><body><h2>" & getTranslation("symbolsInFontHeading") & " "& fontName &":</h2>"&resultString &"</body></html>" Close #n - MsgBox "Отчёт о найденных символах в шрифте "& fontName &" можно открыть в " & FileName - Else - MsgBox "Символов в шрифте " & fontName & " найдено не было" - EndIf -End Sub + getCharsInFont = FileName + Exit Function + Else + MsgBox getTranslation("symbolsInFontNotFound1") & " " & fontName & " " & getTranslation("symbolsInFontNotFound2") + getCharsInFont = "" + Exit Function + EndIf +End Function + + +sub openReport(fileName As String) + dim document as object + dim dispatcher as object + Dim path As String + Dim tmpName As String + Dim oldName As String + document = ThisComponent.CurrentController.Frame + dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") + dim args1(1) as new com.sun.star.beans.PropertyValue + args1(0).Name = "URL" + args1(0).Value = fileName + args1(1).Name = "FilterName" + args1(1).Value = "HTML (StarWriter)" + dispatcher.executeDispatch(document, ".uno:Open", "", 0, args1()) + If FileExists(tmpName) Then + Kill(tmpName) + End If +End Sub \ No newline at end of file diff --git a/build.gradle b/build.gradle index c057cd6..220ce13 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -def releaseVersion = "0.9.1" +def releaseVersion = "0.9.2" task oxt(type: Zip) { dependsOn = [ 'setVersion','setVersionInBasicCode' ] from './' diff --git a/description.xml b/description.xml index 7c2989e..0aa423b 100644 --- a/description.xml +++ b/description.xml @@ -1,7 +1,7 @@ - + Cleaning and validation documents for publishing in html and epub with pagination diff --git a/translations.ods b/translations.ods index 026d3b3..9acf00d 100644 Binary files a/translations.ods and b/translations.ods differ