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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark60 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark61
End Sub End Sub
@ -531,13 +531,13 @@ End Function
Private Sub removeHyperlinks() Private Sub removeHyperlinks()
Dim aNote As Object Dim aNote As Object
Dim i As Long Dim x As Long
removeHLInText(ThisComponent.Text) removeHLInText(ThisComponent.Text)
For i = 0 to ThisComponent.FootNotes.Count -1 For x = 0 to ThisComponent.FootNotes.Count -1
aNote = ThisComponent.FootNotes.getByIndex(x) aNote = ThisComponent.FootNotes.getByIndex(x)
removeHLInText(aNote.Text) removeHLInText(aNote.Text)
Next Next
For i = 0 to ThisComponent.EndNotes.Count -1 For x = 0 to ThisComponent.EndNotes.Count -1
aNote = ThisComponent.EndNotes.getByIndex(x) aNote = ThisComponent.EndNotes.getByIndex(x)
removeHLInText(aNote.Text) removeHLInText(aNote.Text)
Next Next

View file

@ -208,6 +208,9 @@ Function getRussian(identifier As String) As String
Exit Function Exit Function
Case &quot;validateEndnotes1&quot; Case &quot;validateEndnotes1&quot;
getRussian = &quot;в концевой сноске (абсолютный номер)&quot; getRussian = &quot;в концевой сноске (абсолютный номер)&quot;
Exit Function
Case &quot;setOutlineLevel&quot;
getRussian = &quot;задан уровень структуры документа&quot;
Exit Function Exit Function
Case Else Case Else
getRussian = &quot;Перевод не найден&quot; getRussian = &quot;Перевод не найден&quot;
@ -399,6 +402,9 @@ Function getEnglish(identifier As String) As String
Exit Function Exit Function
Case &quot;validateEndnotes1&quot; Case &quot;validateEndnotes1&quot;
getEnglish = &quot;in endnote (absolute number)&quot; getEnglish = &quot;in endnote (absolute number)&quot;
Exit Function
Case &quot;setOutlineLevel&quot;
getEnglish = &quot;set document structure level&quot;
Exit Function Exit Function
Case Else Case Else
getEnglish = &quot;No translation&quot; getEnglish = &quot;No translation&quot;
@ -590,6 +596,9 @@ Function getCroatian(identifier As String) As String
Case &quot;validateEndnotes1&quot; Case &quot;validateEndnotes1&quot;
getCroatian = &quot;u end fusnoti (apsolutni broj)&quot; getCroatian = &quot;u end fusnoti (apsolutni broj)&quot;
Exit Function Exit Function
Case &quot;setOutlineLevel&quot;
getCroatian = &quot;zadati uroven strukturni dokument&quot;
Exit Function
Case Else Case Else
getCroatian = &quot;No translation&quot; getCroatian = &quot;No translation&quot;
End Select End Select
@ -780,6 +789,9 @@ Function getSerbian(identifier As String) As String
Case &quot;validateEndnotes1&quot; Case &quot;validateEndnotes1&quot;
getSerbian = &quot;у end фусноти (апсолутни број)&quot; getSerbian = &quot;у end фусноти (апсолутни број)&quot;
Exit Function Exit Function
Case &quot;setOutlineLevel&quot;
getSerbian = &quot;задатен уровен структури документа&quot;
Exit Function
Case Else Case Else
getSerbian = &quot;No translation&quot; getSerbian = &quot;No translation&quot;
End Select End Select
@ -970,6 +982,9 @@ Function getBosnian(identifier As String) As String
Case &quot;validateEndnotes1&quot; Case &quot;validateEndnotes1&quot;
getBosnian = &quot;u end fusnoti (apsolutni broj)&quot; getBosnian = &quot;u end fusnoti (apsolutni broj)&quot;
Exit Function Exit Function
Case &quot;setOutlineLevel&quot;
getBosnian = &quot;zadati uroven strukturni dokument&quot;
Exit Function
Case Else Case Else
getBosnian = &quot;No translation&quot; getBosnian = &quot;No translation&quot;
End Select End Select

View file

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

Binary file not shown.