Replaced some reports with navigatable problems
This commit is contained in:
parent
cd9266e83d
commit
ce738866ec
3 changed files with 168 additions and 51 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markval29
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue