diff --git a/Redaction/Translations.xba b/Redaction/Translations.xba index 94c73c7..ff5a091 100644 --- a/Redaction/Translations.xba +++ b/Redaction/Translations.xba @@ -314,6 +314,15 @@ Function getRussian(identifier As String) As String Case "validationBadFootnotesSymbolsNotification" getRussian = "В символах сносок обнаружены не подходящие для публикации символы." & chr(10) & " Нажимая на стрелки навигатора вы сможете перемещаться между найденными символами сносок." Exit Function + Case "badSectionsInTables" + getRussian = "Разделы, которые не должны находится внутри таблиц" + Exit Function + Case "badHeadingsInFootnotes" + getRussian = "Заголовки, которые не должны находиться в сносках" + Exit Function + Case "badHeadingsInTables" + getRussian = "Заголовки, которые нельзя размещать внутри таблиц" + Exit Function Case Else getRussian = "Перевод не найден" End Select @@ -610,6 +619,15 @@ Function getEnglish(identifier As String) As String Case "validationBadFootnotesSymbolsNotification" getEnglish = "Unsuitable for publication symbols were found in footnote symbols. "& Chr (10) &" By clicking on the navigator arrows, you can navigate between found footnote symbols. " Exit Function + Case "badSectionsInTables" + getEnglish = "Sections that shouldn't be inside tables " + Exit Function + Case "badHeadingsInFootnotes" + getEnglish = "Headings that should not be in footnotes" + Exit Function + Case "badHeadingsInTables" + getEnglish = "Headers that shouldn't be placed inside tables" + Exit Function Case Else getEnglish = "No translation" End Select @@ -905,6 +923,15 @@ Function getCroatian(identifier As String) As String Case "validationBadFootnotesSymbolsNotification" getCroatian = "U simbolima fusnota pronađeni su neprikladni za objavljivanje simboli. "& Chr (10) &" Klikom na strelice navigatora možete se kretati između pronađenih simbola fusnota. " Exit Function + Case "badSectionsInTables" + getCroatian = "Odjeljci koji ne bi trebali biti unutar tablica " + Exit Function + Case "badHeadingsInFootnotes" + getCroatian = "Naslovi koji ne bi trebali biti u fusnotama" + Exit Function + Case "badHeadingsInTables" + getCroatian = "Zaglavlja koja se ne smiju stavljati unutar tablica" + Exit Function Case Else getCroatian = "No translation" End Select @@ -1200,6 +1227,15 @@ Function getSerbian(identifier As String) As String Case "validationBadFootnotesSymbolsNotification" getSerbian = "У симболима фуснота пронађени су неприкладни за објављивање симболи. "& chr(10) &" Кликом на стрелице навигатора можете се кретати између пронађених симбола фуснота. " Exit Function + Case "badSectionsInTables" + getSerbian = "Одељци који не би требало да буду унутар табела" + Exit Function + Case "badHeadingsInFootnotes" + getSerbian = "Наслови који не смеју бити у фуснотама" + Exit Function + Case "badHeadingsInTables" + getSerbian = "Заглавља која не смеју бити смештена унутар табела" + Exit Function Case Else getSerbian = "No translation" End Select @@ -1495,6 +1531,15 @@ Function getBosnian(identifier As String) As String Case "validationBadFootnotesSymbolsNotification" getBosnian = "U simbolima fusnota pronađeni su neprikladni za objavljivanje simboli. "& Chr (10) &" Klikom na strelice navigatora možete se kretati između pronađenih simbola fusnota. " Exit Function + Case "badSectionsInTables" + getBosnian = "Odjeljci koji ne bi trebali biti unutar tablica " + Exit Function + Case "badHeadingsInFootnotes" + getBosnian = "Naslovi koji ne bi trebali biti u fusnotama" + Exit Function + Case "badHeadingsInTables" + getBosnian = "Zaglavlja koja se ne smiju stavljati unutar tablica" + Exit Function Case Else getBosnian = "No translation" End Select diff --git a/Redaction/Validation.xba b/Redaction/Validation.xba index c2b6b8a..7ee7f21 100644 --- a/Redaction/Validation.xba +++ b/Redaction/Validation.xba @@ -1,6 +1,6 @@ -Sub markval29 +Sub markval30 End Sub @@ -9,10 +9,10 @@ End Sub Sub validateButton Dim badFootnoteSigns As Boolean Dim badGraphics As Boolean - Dim sectionsReport As String + Dim badSectionsInTables As Boolean + Dim badHeadingsInFootnotes As Boolean Dim outlinePageStylesReport As String - Dim outlineInNotesReport As String - Dim oulineInTablesReport As String + Dim badHeadingsInTables As Boolean Dim badText As Boolean Dim needExtendedInfo As Boolean Dim config As Object @@ -23,7 +23,7 @@ Sub validateButton statusIndicator = ThisComponent.getCurrentController.statusIndicator statusIndicator.Start(getTranslation("validationStarted"),100) - badFootnoteSigns = noteSingsCheck() + badFootnoteSigns = noteSignsCheck() statusIndicator.setValue(10) badGraphics = checkGraphics() @@ -33,33 +33,24 @@ Sub validateButton needFixColoredText = findColoredBackgroundInDoc() statusIndicator.setValue(20) - ' - sectionsReport = checkSectionsInTables() + + badSectionsInTables = checkSectionsInTables() statusIndicator.setValue(30) - ' - outlineInNotesReport = checkNotesOutline() + + badHeadingsInFootnotes = checkNotesOutline() statusIndicator.setValue(40) - ' + outlinePageStylesReport = checkHeadingsInHeadersFooters() statusIndicator.setValue(50) - ' - oulineInTablesReport = checkHeadingsInTextTables() + + badHeadingsInTables = checkHeadingsInTextTables() statusIndicator.setValue(60) - If outlineInNotesReport <> "" Then - MsgBox outlineInNotesReport - EndIf - If oulineInTablesReport <> "" Then - MsgBox oulineInTablesReport - EndIf + If outlinePageStylesReport <> "" Then MsgBox outlinePageStylesReport EndIf - If sectionsReport <> "" Then - MsgBox sectionsReport - EndIf - If config.getPropertyValue("complexity") = "makerUp" then needExtendedInfo = true Else @@ -73,7 +64,7 @@ Sub validateButton numberingsErros = printNumberingSymbols(needExtendedInfo) statusIndicator.setValue(80) - If brokenCharBackTransparent OR needFixColoredText OR numberingsErros OR badText OR badFootnoteSigns OR badGraphics Or outlineInNotesReport <> "" Or sectionsReport <> "" OR oulineInTablesReport <> "" OR outlinePageStylesReport <> "" Then + If brokenCharBackTransparent OR needFixColoredText OR numberingsErros OR badText OR badFootnoteSigns OR badGraphics Or badHeadingsInFootnotes Or badSectionsInTables OR badHeadingsInTables OR outlinePageStylesReport <> "" Then MsgBox getTranslation("validationWarning") Else MsgBox getTranslation("validationSuccess") @@ -137,7 +128,7 @@ Sub replaceCharsInDOI AskAndReplace("(?<=DOI[0-9. /XVI:‒–—−ХOО?-]{1,50})[‒–—−]{1,5}","-") End sub -Private Function noteSingsCheck() As Boolean +Private Function noteSignsCheck() As Boolean Dim footnotes As Object Dim footnote As Object Dim endnote As Object @@ -148,7 +139,7 @@ Private Function noteSingsCheck() As Boolean Dim label As String Dim result As String Dim founds() As Object - noteSingsCheck = false + noteSignsCheck = false result = "" footnotes = ThisComponent.Footnotes endnotes = ThisComponent.Endnotes @@ -180,24 +171,24 @@ Private Function noteSingsCheck() As Boolean End If Next j Next i - If (UBound(founds) > 0) Then - noteSingsCheck = true + If (UBound(founds) > -1) Then + noteSignsCheck = true MsgBox(getTranslation("validationBadFootnotesSymbolsNotification")) startNavigatorDialog(getTranslation("badNoteSings"),founds) EndIf - 'noteSingsCheck = result + 'noteSignsCheck = result End Function -Function checkNotesOutline As String - Dim oDescriptor As Object +Function checkNotesOutline As Boolean Dim footNotes As Object Dim endNotes As Object - Dim x As Integer + Dim x As Long Dim aNote As Object Dim oEnum As Object Dim oCurPar As Object - Dim result As String - result = "" +' Dim result As String + Dim founds() As Object +' result = "" footNotes = thisComponent.footNotes endNotes = thisComponent.EndNotes for x = 0 to footNotes.Count -1 @@ -207,7 +198,8 @@ Function checkNotesOutline As String Do While oEnum.hasMoreElements() oCurPar = oEnum.nextElement() If oCurPar.OutlineLevel > 0 Then - result = result & getTranslation("validateFootnotes2") & " " & x & " " & getTranslation("setOutlineLevel") & " " & oCurPar.OutlineLevel & chr(10) + addToArray(founds,oCurPar) + ' result = result & getTranslation("validateFootnotes2") & " " & x & " " & getTranslation("setOutlineLevel") & " " & oCurPar.OutlineLevel & chr(10) EndIf Loop Next @@ -218,21 +210,29 @@ Function checkNotesOutline As String Do While oEnum.hasMoreElements() oCurPar = oEnum.nextElement() If oCurPar.OutlineLevel > 0 Then - result = result & getTranslation("validateEndnotes1") & " " & x & " " & getTranslation("setOutlineLevel") & " " & oCurPar.OutlineLevel & chr(10) + addToArray(founds,oCurPar) + ' result = result & getTranslation("validateEndnotes1") & " " & x & " " & getTranslation("setOutlineLevel") & " " & oCurPar.OutlineLevel & chr(10) EndIf Loop Next - checkNotesOutline = result + If (UBound(founds) > -1) Then + startNavigatorDialog(getTranslation("badHeadingsInFootnotes"),founds) + checkNotesOutline = true + Else + checkNotesOutline = false + EndIf + End Function -Function checkSectionsInTables As String +Function checkSectionsInTables As Boolean Dim x As Integer Dim oEnum As Object - Dim result As String + 'Dim result As String Dim sections As Object Dim section As Object Dim anchor As Object Dim anchorText As Object + Dim badSections() As Object result = "" sections = thisComponent.TextSections for x = 0 to sections.Count -1 @@ -240,10 +240,17 @@ Function checkSectionsInTables As String anchor = section.getAnchor() anchorText = anchor.getText() If anchorText.supportsService("com.sun.star.text.CellProperties") Then - result = result & getTranslation("section") & " " & section.Name & " " & getTranslation("isInTable") & chr(10) + addToArray(badSections(),anchor) + 'result = result & getTranslation("section") & " " & section.Name & " " & getTranslation("isInTable") & chr(10) EndIf Next - checkSectionsInTables = result + + If (UBound(badSections) > -1) Then + checkSectionsInTables = true + startNavigatorDialog(getTranslation("badSectionsInTables"),badSections) + Else + checkSectionsInTables = false + EndIf End Function Function checkHeadingsInHeadersFooters As String @@ -301,7 +308,7 @@ Function checkHeadingsInHeadersFooters As String checkHeadingsInHeadersFooters = result End Function -Function checkHeadingsInTextTables() As String +Function checkHeadingsInTextTables() As Boolean Dim enum1Element As Object Dim enum1 As Object Dim enum2 As Object @@ -314,8 +321,7 @@ Function checkHeadingsInTextTables() As String Dim cell As Object Dim cellText As Object Dim firstCellName As String - Dim result As String - result = "" + Dim founds() As Object enum1 = ThisComponent.Text.createEnumeration While enum1.hasMoreElements enum1Element = enum1.nextElement @@ -326,20 +332,86 @@ Function checkHeadingsInTextTables() As String 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 + addHeadingNotFirstInText(cellText,founds) Else - If isHeadingsInText(cellText) Then - result = result & getTranslation("foundHeadingIn") & " " & getTranslation("table") & " " & enum1Element.TableName & chr(10) - EndIf + addHeadingsInText(cellText,founds) EndIf Next i EndIf Wend - checkHeadingsInTextTables = result + If (UBound(founds) > -1) Then + checkHeadingsInTextTables = true + startNavigatorDialog(getTranslation("badHeadingsInTables"),founds) + Else + checkHeadingsInTextTables = false + EndIf End Function +Sub addHeadingNotFirstInText(oText As Object, founds() As Object) + 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 + addToArray(founds,enum1Element) + 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() + addHeadingsInText(cellText,founds) + Next i + EndIf + first = false + Wend +End Sub + +Sub addHeadingsInText(oText As Object, founds() As Object) + 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 + enum1 = oText.Text.createEnumeration + While enum1.hasMoreElements + enum1Element = enum1.nextElement + If enum1Element.supportsService("com.sun.star.text.Paragraph") Then + If enum1Element.OutlineLevel > 0 Then + addToArray(founds,enum1Element) + 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() + addHeadingsInText(cellText,founds) + Next i + EndIf + Wend +End Sub + Function isHeadingNotFirstInText(oText As Object) As Boolean Dim enum1Element As Object Dim enum1 As Object @@ -961,7 +1033,7 @@ Function findBadCharacters() As Boolean founds = findInDoc("[\uE000-\uF8FF]+") findBadCharacters = false If founds.count <> 0 Then - MsgBox getTranslation("validationBadSymbolsNotification") + 'MsgBox getTranslation("validationBadSymbolsNotification") foundObjects = convertXIndexAccessToArray(founds) startNavigatorDialog(getTranslation("badSymbols"),foundObjects) findBadCharacters = true diff --git a/translations.ods b/translations.ods index 19faf93..0314267 100644 Binary files a/translations.ods and b/translations.ods differ