Replaced graphics report with navigator

This commit is contained in:
Georgy Litvinov 2021-06-07 14:27:39 +02:00
parent 962a6fe83f
commit cd9266e83d
2 changed files with 48 additions and 50 deletions

View file

@ -1,43 +1,50 @@
<?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="Validation" script:language="StarBasic">Sub markval28 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markval29
End Sub End Sub
Sub validateButton Sub validateButton
Dim footnotesReport As Boolean Dim badFootnoteSigns As Boolean
Dim graphicsReport As String Dim badGraphics As Boolean
Dim sectionsReport As String Dim sectionsReport As String
Dim outlinePageStylesReport As String Dim outlinePageStylesReport As String
Dim outlineInNotesReport As String Dim outlineInNotesReport As String
Dim oulineInTablesReport As String Dim oulineInTablesReport As String
Dim badText As Boolean Dim badText As Boolean
Dim badNumberings As Boolean
Dim needExtendedInfo As Boolean Dim needExtendedInfo As Boolean
Dim config As Object Dim config As Object
Dim needFixColoredText As Boolean Dim needFixColoredText As Boolean
Dim brokenCharBackTransparent As Boolean Dim brokenCharBackTransparent As Boolean
config = initRedactionConfiguration() config = initRedactionConfiguration()
Dim statusIndicator as Object Dim statusIndicator as Object
statusIndicator = ThisComponent.getCurrentController.statusIndicator statusIndicator = ThisComponent.getCurrentController.statusIndicator
statusIndicator.Start(getTranslation(&quot;validationStarted&quot;),100) statusIndicator.Start(getTranslation(&quot;validationStarted&quot;),100)
badText = false badFootnoteSigns = noteSingsCheck()
badNumberings = false
footnotesReport = noteSingsCheck()
statusIndicator.setValue(10) statusIndicator.setValue(10)
graphicsReport = checkGraphics
badGraphics = checkGraphics()
badText = findBadCharacters()
needFixColoredText = findColoredBackgroundInDoc()
statusIndicator.setValue(20) statusIndicator.setValue(20)
sectionsReport = checkSectionsInTables &apos;
sectionsReport = checkSectionsInTables()
statusIndicator.setValue(30) statusIndicator.setValue(30)
&apos;
outlineInNotesReport = checkNotesOutline() outlineInNotesReport = checkNotesOutline()
statusIndicator.setValue(40) statusIndicator.setValue(40)
outlinePageStylesReport = checkHeadingsInHeadersFooters &apos;
outlinePageStylesReport = checkHeadingsInHeadersFooters()
statusIndicator.setValue(50) statusIndicator.setValue(50)
oulineInTablesReport = checkHeadingsInTextTables &apos;
oulineInTablesReport = checkHeadingsInTextTables()
statusIndicator.setValue(60) statusIndicator.setValue(60)
If outlineInNotesReport &lt;&gt; &quot;&quot; Then If outlineInNotesReport &lt;&gt; &quot;&quot; Then
MsgBox outlineInNotesReport MsgBox outlineInNotesReport
@ -49,66 +56,56 @@ Sub validateButton
MsgBox outlinePageStylesReport MsgBox outlinePageStylesReport
EndIf EndIf
If graphicsReport &lt;&gt; &quot;&quot; Then
MsgBox graphicsReport
EndIf
If sectionsReport &lt;&gt; &quot;&quot; Then If sectionsReport &lt;&gt; &quot;&quot; Then
MsgBox sectionsReport MsgBox sectionsReport
EndIf EndIf
badText = findBadCharacters()
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
brokenCharBackTransparent = hasbrokenCharBackTransparent brokenCharBackTransparent = hasbrokenCharBackTransparent()
If (brokenCharBackTransparent) Then If (brokenCharBackTransparent) Then
MsgBox getTranslation(&quot;invalidParagraphFormattingFound&quot;) MsgBox getTranslation(&quot;invalidParagraphFormattingFound&quot;)
EndIf EndIf
needFixColoredText = findColoredBackgroundInDoc
numberingsErros = printNumberingSymbols(needExtendedInfo) numberingsErros = printNumberingSymbols(needExtendedInfo)
statusIndicator.setValue(80) statusIndicator.setValue(80)
If brokenCharBackTransparent OR needFixColoredText OR numberingsErros OR badText OR badNumberings OR footnotesReport OR graphicsReport &lt;&gt; &quot;&quot; Or outlineInNotesReport &lt;&gt; &quot;&quot; Or sectionsReport &lt;&gt; &quot;&quot; OR oulineInTablesReport &lt;&gt; &quot;&quot; OR outlinePageStylesReport &lt;&gt; &quot;&quot; Then If brokenCharBackTransparent OR needFixColoredText OR numberingsErros OR badText OR badFootnoteSigns OR badGraphics Or outlineInNotesReport &lt;&gt; &quot;&quot; Or sectionsReport &lt;&gt; &quot;&quot; OR oulineInTablesReport &lt;&gt; &quot;&quot; OR outlinePageStylesReport &lt;&gt; &quot;&quot; Then
MsgBox getTranslation(&quot;validationWarning&quot;) MsgBox getTranslation(&quot;validationWarning&quot;)
Else Else
MsgBox getTranslation(&quot;validationSuccess&quot;) MsgBox getTranslation(&quot;validationSuccess&quot;)
EndIf EndIf
statusIndicator.end() statusIndicator.end()
End Sub End Sub
Private Function checkGraphics() As String Function checkGraphics() As Boolean
Dim drawPages As Object Dim drawPages As Object
Dim count as Integer Dim count as Integer
Dim draw As Object Dim draw As Object
Dim result As String
result = &quot;&quot;
Dim shapeType As String Dim shapeType As String
Dim embeededObject As Object Dim embeededObject As Object
Dim badFrame As Long
badFrame = 0
Dim drawingN As Long
drawingN = 0
drawPages = ThisComponent.DrawPage drawPages = ThisComponent.DrawPage
Dim i As Integer Dim i As Long
Dim badDrawings() As Object
Dim badFrames() As Object
count = drawPages.getCount() count = drawPages.getCount()
For i = 0 to count-1 For i = 0 to count - 1
draw = drawPages.getByIndex(i) draw = drawPages.getByIndex(i)
shapeType = draw.ShapeType shapeType = draw.ShapeType
If InStr(shapeType,&quot;com.sun.star.drawing&quot;) = 1 Then If InStr(shapeType,&quot;com.sun.star.drawing&quot;) = 1 Then
drawingN = drawingN + 1 addToArray(badDrawings, draw.Anchor)
EndIf EndIf
If InStr(shapeType,&quot;FrameShape&quot;) = 1 Then If InStr(shapeType,&quot;FrameShape&quot;) = 1 Then
If draw.supportsService(&quot;com.sun.star.text.TextEmbeddedObject&quot;) Then If draw.supportsService(&quot;com.sun.star.text.TextEmbeddedObject&quot;) Then
embeededObject = draw.getEmbeddedObject() embeededObject = draw.getEmbeddedObject()
If IsNull(embeededObject) Then If IsNull(embeededObject) Then
badFrame = badFrame + 1 addToArray(badFrames, draw.Anchor)
Else Else
If Not embeededObject.supportsService(&quot;com.sun.star.formula.FormulaProperties&quot;) Then If Not embeededObject.supportsService(&quot;com.sun.star.formula.FormulaProperties&quot;) Then
badFrame = badFrame + 1 addToArray(badFrames, draw.Anchor)
Else Else
&apos;Formula &apos;Formula
EndIf EndIf
@ -116,13 +113,15 @@ Private Function checkGraphics() As String
EndIf EndIf
EndIf EndIf
Next i Next i
If drawingN &lt;&gt; 0 Then checkGraphics = false
result = result &amp; getTranslation(&quot;validationBadDrawings&quot;) &amp; drawingN &amp; getTranslation(&quot;validationExcerptNotSuitable&quot;) &amp; chr(10) If UBound(badDrawings) &gt; -1 Then
startNavigatorDialog(getTranslation(&quot;validationBadDrawings&quot;) &amp; (UBound(badDrawings) + 1) &amp; getTranslation(&quot;validationExcerptNotSuitable&quot;),badDrawings)
checkGraphics = true
EndIf EndIf
If badFrame &lt;&gt; 0 Then If UBound(badFrames) &gt; -1 Then
result = result &amp; getTranslation(&quot;validationBadEmbeededObjects&quot;) &amp; badFrame &amp; getTranslation(&quot;validationExcerptNotSuitable&quot;) &amp; chr(10) startNavigatorDialog(getTranslation(&quot;validationBadEmbeededObjects&quot;) &amp; (UBound(badFrames) + 1) &amp; getTranslation(&quot;validationExcerptNotSuitable&quot;),badFrames)
checkGraphics = true
EndIf EndIf
checkGraphics = result
End Function End Function
Private Sub fixDOI Private Sub fixDOI
@ -418,9 +417,9 @@ Function isHeadingsInText(oText As Object) As Boolean
End Function End Function
Function hasBrokenCharBackTransparent As Boolean Function hasBrokenCharBackTransparent As Boolean
Dim foonNotes As Object Dim footNotes As Object
Dim endNotes As Object Dim endNotes As Object
Dim i As Integer Dim i As Long
Dim oStyles As Object Dim oStyles As Object
Dim pageStyles As Object Dim pageStyles As Object
Dim pageStyle As Object Dim pageStyle As Object
@ -428,8 +427,8 @@ Function hasBrokenCharBackTransparent As Boolean
If (hasBrokenCharBackTransparent) Then If (hasBrokenCharBackTransparent) Then
Exit Function Exit Function
EndIf EndIf
footNotes = thisComponent.footNotes footNotes = ThisComponent.FootNotes
For i = 0 to footNotes.Count -1 For i = 0 to footNotes.getCount - 1
hasBrokenCharBackTransparent = isBackColorInText(footNotes.getByIndex(i).Text) hasBrokenCharBackTransparent = isBackColorInText(footNotes.getByIndex(i).Text)
If (hasBrokenCharBackTransparent) Then If (hasBrokenCharBackTransparent) Then
Exit Function Exit Function
@ -1002,8 +1001,6 @@ Sub startNavigatorDialog(objectsDescription As String,foundObjects() As Object)
Dim curNum As Long Dim curNum As Long
Dim maxNum As Long Dim maxNum As Long
Dim found As Object Dim found As Object
Dim oViewCursor As Object
oViewCursor = ThisComponent.CurrentController.getViewCursor()
waitingForDialog = true waitingForDialog = true
maxNum = UBound(foundObjects) maxNum = UBound(foundObjects)
dialog = notModalDialog(&quot;Navigator&quot;) dialog = notModalDialog(&quot;Navigator&quot;)
@ -1022,7 +1019,9 @@ Sub startNavigatorDialog(objectsDescription As String,foundObjects() As Object)
dialog.getControl(&quot;next&quot;).model.imageURL = rightImageURL dialog.getControl(&quot;next&quot;).model.imageURL = rightImageURL
&apos;dialog.getControl(&quot;next&quot;).model.ScaleMode = 2 &apos;dialog.getControl(&quot;next&quot;).model.ScaleMode = 2
dialog.setvisible(true) dialog.setvisible(true)
oViewCursor.goToRange(found,false) &apos;select first found &apos;
&apos;not using view cursor as if shape was prevously selected runtime exception will appear
Thiscomponent.CurrentController.select(found)
Do While waitingForDialog Do While waitingForDialog
If dialog.getControl(&quot;close&quot;).model.state = 1 then If dialog.getControl(&quot;close&quot;).model.state = 1 then
exit Do exit Do
@ -1030,14 +1029,14 @@ Sub startNavigatorDialog(objectsDescription As String,foundObjects() As Object)
If dialog.getControl(&quot;prev&quot;).model.state = 1 then If dialog.getControl(&quot;prev&quot;).model.state = 1 then
curNum = getPrevFound(curNum, maxNum) curNum = getPrevFound(curNum, maxNum)
found = foundObjects(curNum) found = foundObjects(curNum)
oViewCursor.goToRange(found,false) Thiscomponent.CurrentController.select(found)
dialog.getControl(&quot;current&quot;).SetText(CStr(curNum+1)) dialog.getControl(&quot;current&quot;).SetText(CStr(curNum+1))
dialog.getControl(&quot;prev&quot;).model.state = 0 dialog.getControl(&quot;prev&quot;).model.state = 0
EndIf EndIf
If dialog.getControl(&quot;next&quot;).model.state = 1 then If dialog.getControl(&quot;next&quot;).model.state = 1 then
curNum = getNextFound(curNum, maxNum) curNum = getNextFound(curNum, maxNum)
found = foundObjects(curNum) found = foundObjects(curNum)
oViewCursor.goToRange(found,false) Thiscomponent.CurrentController.select(found)
dialog.getControl(&quot;current&quot;).SetText(CStr(curNum+1)) dialog.getControl(&quot;current&quot;).SetText(CStr(curNum+1))
dialog.getControl(&quot;next&quot;).model.state = 0 dialog.getControl(&quot;next&quot;).model.state = 0
EndIf EndIf
@ -1118,7 +1117,6 @@ sub openReport(fileName As String)
End If End If
End Sub End Sub
Function isInDoc(searchString As String) As Boolean Function isInDoc(searchString As String) As Boolean
Dim founds As Variant Dim founds As Variant
founds = findInDoc(searchString) founds = findInDoc(searchString)

Binary file not shown.