Added validation for headings in footnotes and endnotes.

This commit is contained in:
Georgy Litvinov 2020-07-03 16:48:29 +02:00
parent 4a9611ce1a
commit ed6bb42085
4 changed files with 69 additions and 21 deletions

View file

@ -25,42 +25,39 @@ End Function
Sub validateButton
Dim footnotesReport As String
Dim graphicsReport As String
Dim outlineInNotesReport As String
Dim badText As Boolean
Dim badNumberings As Boolean
Dim badFootnoteSigns As Boolean
Dim badGraphics As Boolean
Dim needExtendedInfo As Boolean
badGraphics = false
Dim config As Object
config = initRedactionConfiguration()
badText = false
badFootnoteSigns = false
badNumberings = false
footnotesReport = noteSingsCheck
graphicsReport = checkGraphics
If footnotesReport <> "" Then
badFootnoteSigns = true
outlineInNotesReport = checkNotesOutline()
If outlineInNotesReport <> "" Then
MsgBox outlineInNotesReport
EndIf
If footnotesReport <> "" Then
MsgBox footnotesReport
EndIf
If graphicsReport <> "" Then
badGraphics = true
MsgBox graphicsReport
EndIf
If isInDoc("[\uE000-\uF8FF]") Then
badText = true
EndIf
If badFootnoteSigns Then
MsgBox footnotesReport
EndIf
If badGraphics Then
MsgBox graphicsReport
EndIf
Dim config As Object
config = initRedactionConfiguration()
If config.getPropertyValue("complexity") = "makerUp" then
needExtendedInfo = true
Else
needExtendedInfo = false
EndIf
printNumberingSymbols(needExtendedInfo)
If badText OR badNumberings OR badFootnoteSigns OR badGraphics Then
printNumberingSymbols(needExtendedInfo)
If badText OR badNumberings OR footnotesReport <> "" OR graphicsReport <> "" Or outlineInNotesReport <> "" Then
MsgBox getTranslation("validationWarning")
If badText Then
MsgBox getTranslation("validationBadSymbolsNotification")
@ -165,6 +162,42 @@ Private Function noteSingsCheck() As String
noteSingsCheck = result
End Function
Function checkNotesOutline As String
Dim oDescriptor As Object
Dim footNotes As Object
Dim x As Integer
Dim aNote As Object
Dim oEnum As Object
Dim oCurPar As Object
Dim result As String
result = ""
footNotes = thisComponent.footNotes
endNotes = thisComponent.footNotes
for x = 0 to footNotes.Count -1
aNote = footNotes.getByIndex(x)
aNote.Anchor.CharStyleName="Footnote anchor"
oEnum = aNote.Text.createEnumeration()
Do While oEnum.hasMoreElements()
oCurPar = oEnum.nextElement()
If oCurPar.OutlineLevel > 0 Then
result = result & getTranslation("validateFootnotes2") & " " & x & " " & getTranslation("setOutlineLevel") & " " & oCurPar.OutlineLevel & chr(10)
EndIf
Loop
Next
for x = 0 to endNotes.Count -1
aNote = endNotes.getByIndex(x)
aNote.Anchor.CharStyleName="Footnote anchor"
oEnum = aNote.Text.createEnumeration()
Do While oEnum.hasMoreElements()
oCurPar = oEnum.nextElement()
If oCurPar.OutlineLevel > 0 Then
result = result & getTranslation("validateEndnotes1") & " " & x & " " & getTranslation("setOutlineLevel") & " " & oCurPar.OutlineLevel & chr(10)
EndIf
Loop
Next
checkNotesOutline = result
End Function
Private Sub printNumberingSymbols(needExtendedInfo)
Dim families As Object
Dim numStyles As Object