diff --git a/Redaction/Configuration.xba b/Redaction/Configuration.xba index 0b43673..caca05c 100644 --- a/Redaction/Configuration.xba +++ b/Redaction/Configuration.xba @@ -1,7 +1,7 @@ Public Const redactionExtensionName As String = "cleanAndValidate" -Public Const redactionExtensionVersion = "0.8.4" +Public Const redactionExtensionVersion = "0.8.5" Function initRedactionConfiguration() On Error Goto exceptionHandler Dim regFactory As Object diff --git a/Redaction/Translations.xba b/Redaction/Translations.xba index a61d3b3..172da14 100644 --- a/Redaction/Translations.xba +++ b/Redaction/Translations.xba @@ -230,6 +230,9 @@ Function getRussian(identifier As String) As String Case "inPageStyle" getRussian = "стиля страниц" Exit Function + Case "table" + getRussian = "таблице" + Exit Function Case Else getRussian = "Перевод не найден" End Select @@ -442,6 +445,9 @@ Function getEnglish(identifier As String) As String Case "inPageStyle" getEnglish = "of page style" Exit Function + Case "table" + getEnglish = "table" + Exit Function Case Else getEnglish = "No translation" End Select @@ -653,6 +659,9 @@ Function getCroatian(identifier As String) As String Case "inPageStyle" getCroatian = "stil stranice" Exit Function + Case "table" + getCroatian = "stola" + Exit Function Case Else getCroatian = "No translation" End Select @@ -864,6 +873,9 @@ Function getSerbian(identifier As String) As String Case "inPageStyle" getSerbian = "стил странице" Exit Function + Case "table" + getSerbian = "стола" + Exit Function Case Else getSerbian = "No translation" End Select @@ -1075,6 +1087,9 @@ Function getBosnian(identifier As String) As String Case "inPageStyle" getBosnian = "stil stranice" Exit Function + Case "table" + getBosnian = "stola" + Exit Function Case Else getBosnian = "No translation" End Select diff --git a/Redaction/Validation.xba b/Redaction/Validation.xba index 30d75bb..a6e03d3 100644 --- a/Redaction/Validation.xba +++ b/Redaction/Validation.xba @@ -1,6 +1,6 @@ -Sub markval7 +Sub markval9 End Sub @@ -28,6 +28,7 @@ Sub validateButton Dim sectionsReport As String Dim outlinePageStylesReport As String Dim outlineInNotesReport As String + Dim oulineInTablesReport As String Dim badText As Boolean Dim badNumberings As Boolean Dim needExtendedInfo As Boolean @@ -40,9 +41,13 @@ Sub validateButton sectionsReport = checkSectionsInTables outlineInNotesReport = checkNotesOutline() outlinePageStylesReport = checkHeadingsInHeadersFooters + oulineInTablesReport = checkHeadingsInTextTables If outlineInNotesReport <> "" Then MsgBox outlineInNotesReport EndIf + If oulineInTablesReport <> "" Then + MsgBox oulineInTablesReport + EndIf If outlinePageStylesReport <> "" Then MsgBox outlinePageStylesReport EndIf @@ -68,7 +73,7 @@ Sub validateButton printNumberingSymbols(needExtendedInfo) - If badText OR badNumberings OR footnotesReport <> "" OR graphicsReport <> "" Or outlineInNotesReport <> "" Or sectionsReport <> "" OR outlinePageStylesReport <> "" Then + If 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") @@ -286,6 +291,85 @@ Function checkHeadingsInHeadersFooters As String checkHeadingsInHeadersFooters = result End Function +Function checkHeadingsInTextTables(oText As Object) As String + Dim enum1Element As Object + Dim enum1 As Object + Dim enum2 As Object + Dim thisPortion As Object + Dim footnoteText As Object + Dim label As String + Dim labelNum As Integer + Dim i As Integer + Dim count As Integer + Dim cell As Object + Dim cellText As Object + Dim firstCellName As String + Dim result As String + result = "" + enum1 = ThisComponent.Text.createEnumeration + While enum1.hasMoreElements + enum1Element = enum1.nextElement + If enum1Element.supportsService("com.sun.star.text.TextTable") Then + firstCellName = enum1Element.getCellByPosition(0,0).cellName + cellNames = enum1Element.cellNames + For i = LBound(cellNames) To Ubound(cellNames) + cell = enum1Element.getCellByName(cellNames(i)) + cellText = cell.getText() + If cellNames(i) = firstCellName Then + If isHeadingNotFirstInText(cellText) Then + result = result & getTranslation("foundHeadingIn") & " " & getTranslation("table") & " " & enum1Element.TableName & chr(10) + EndIf + Else + If isHeadingsInText(cellText) Then + result = result & getTranslation("foundHeadingIn") & " " & getTranslation("table") & " " & enum1Element.TableName & chr(10) + EndIf + EndIf + Next i + EndIf + Wend + checkHeadingsInTextTables = result +End Function + +Function isHeadingNotFirstInText(oText As Object) As Boolean + Dim enum1Element As Object + Dim enum1 As Object + Dim enum2 As Object + Dim thisPortion As Object + Dim footnoteText As Object + Dim label As String + Dim labelNum As Integer + Dim i As Integer + Dim count As Integer + Dim cell As Object + Dim cellText As Object + Dim first As Boolean + first = true + enum1 = oText.createEnumeration + While enum1.hasMoreElements + enum1Element = enum1.nextElement + If enum1Element.supportsService("com.sun.star.text.Paragraph") Then + If Not first Then + If enum1Element.OutlineLevel > 0 Then + isHeadingNotFirstInText = true + Exit Function + EndIf + EndIf + ElseIf enum1Element.supportsService("com.sun.star.text.TextTable") Then + cellNames = enum1Element.cellNames + For i = LBound(cellNames) To Ubound(cellNames) + cell = enum1Element.getCellByName(cellNames(i)) + cellText = cell.getText() + If isHeadingsInText(cellText) Then + isHeadingNotFirstInText = true + Exit Function + EndIf + Next i + EndIf + first = false + Wend + isHeadingNotFirstInText = false +End Function + Function isHeadingsInText(oText As Object) As Boolean Dim enum1Element As Object Dim enum1 As Object @@ -322,7 +406,6 @@ Function isHeadingsInText(oText As Object) As Boolean isHeadingsInText = false End Function - Private Sub printNumberingSymbols(needExtendedInfo) Dim families As Object Dim numStyles As Object diff --git a/build.gradle b/build.gradle index e16a9e1..b3fb503 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -def releaseVersion = "0.8.4" +def releaseVersion = "0.8.5" task oxt(type: Zip) { dependsOn = [ 'setVersion','setVersionInBasicCode' ] from './' diff --git a/description.xml b/description.xml index 1601ebd..8be7fd4 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 9adcef2..5a3a20a 100644 Binary files a/translations.ods and b/translations.ods differ