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

Binary file not shown.