Replaced graphics report with navigator
This commit is contained in:
parent
962a6fe83f
commit
cd9266e83d
2 changed files with 48 additions and 50 deletions
|
@ -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("validationStarted"),100)
|
statusIndicator.Start(getTranslation("validationStarted"),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
|
'
|
||||||
|
sectionsReport = checkSectionsInTables()
|
||||||
statusIndicator.setValue(30)
|
statusIndicator.setValue(30)
|
||||||
|
'
|
||||||
outlineInNotesReport = checkNotesOutline()
|
outlineInNotesReport = checkNotesOutline()
|
||||||
statusIndicator.setValue(40)
|
statusIndicator.setValue(40)
|
||||||
outlinePageStylesReport = checkHeadingsInHeadersFooters
|
'
|
||||||
|
outlinePageStylesReport = checkHeadingsInHeadersFooters()
|
||||||
statusIndicator.setValue(50)
|
statusIndicator.setValue(50)
|
||||||
oulineInTablesReport = checkHeadingsInTextTables
|
'
|
||||||
|
oulineInTablesReport = checkHeadingsInTextTables()
|
||||||
|
|
||||||
statusIndicator.setValue(60)
|
statusIndicator.setValue(60)
|
||||||
If outlineInNotesReport <> "" Then
|
If outlineInNotesReport <> "" Then
|
||||||
MsgBox outlineInNotesReport
|
MsgBox outlineInNotesReport
|
||||||
|
@ -49,66 +56,56 @@ Sub validateButton
|
||||||
MsgBox outlinePageStylesReport
|
MsgBox outlinePageStylesReport
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
If graphicsReport <> "" Then
|
|
||||||
MsgBox graphicsReport
|
|
||||||
EndIf
|
|
||||||
If sectionsReport <> "" Then
|
If sectionsReport <> "" Then
|
||||||
MsgBox sectionsReport
|
MsgBox sectionsReport
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
badText = findBadCharacters()
|
|
||||||
|
|
||||||
If config.getPropertyValue("complexity") = "makerUp" then
|
If config.getPropertyValue("complexity") = "makerUp" 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("invalidParagraphFormattingFound")
|
MsgBox getTranslation("invalidParagraphFormattingFound")
|
||||||
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 <> "" Or outlineInNotesReport <> "" Or sectionsReport <> "" OR oulineInTablesReport <> "" OR outlinePageStylesReport <> "" Then
|
If brokenCharBackTransparent OR needFixColoredText OR numberingsErros OR badText OR badFootnoteSigns OR badGraphics Or outlineInNotesReport <> "" Or sectionsReport <> "" OR oulineInTablesReport <> "" OR outlinePageStylesReport <> "" Then
|
||||||
MsgBox getTranslation("validationWarning")
|
MsgBox getTranslation("validationWarning")
|
||||||
Else
|
Else
|
||||||
MsgBox getTranslation("validationSuccess")
|
MsgBox getTranslation("validationSuccess")
|
||||||
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 = ""
|
|
||||||
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,"com.sun.star.drawing") = 1 Then
|
If InStr(shapeType,"com.sun.star.drawing") = 1 Then
|
||||||
drawingN = drawingN + 1
|
addToArray(badDrawings, draw.Anchor)
|
||||||
EndIf
|
EndIf
|
||||||
If InStr(shapeType,"FrameShape") = 1 Then
|
If InStr(shapeType,"FrameShape") = 1 Then
|
||||||
If draw.supportsService("com.sun.star.text.TextEmbeddedObject") Then
|
If draw.supportsService("com.sun.star.text.TextEmbeddedObject") 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("com.sun.star.formula.FormulaProperties") Then
|
If Not embeededObject.supportsService("com.sun.star.formula.FormulaProperties") Then
|
||||||
badFrame = badFrame + 1
|
addToArray(badFrames, draw.Anchor)
|
||||||
Else
|
Else
|
||||||
'Formula
|
'Formula
|
||||||
EndIf
|
EndIf
|
||||||
|
@ -116,13 +113,15 @@ Private Function checkGraphics() As String
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
Next i
|
Next i
|
||||||
If drawingN <> 0 Then
|
checkGraphics = false
|
||||||
result = result & getTranslation("validationBadDrawings") & drawingN & getTranslation("validationExcerptNotSuitable") & chr(10)
|
If UBound(badDrawings) > -1 Then
|
||||||
|
startNavigatorDialog(getTranslation("validationBadDrawings") & (UBound(badDrawings) + 1) & getTranslation("validationExcerptNotSuitable"),badDrawings)
|
||||||
|
checkGraphics = true
|
||||||
EndIf
|
EndIf
|
||||||
If badFrame <> 0 Then
|
If UBound(badFrames) > -1 Then
|
||||||
result = result & getTranslation("validationBadEmbeededObjects") & badFrame & getTranslation("validationExcerptNotSuitable") & chr(10)
|
startNavigatorDialog(getTranslation("validationBadEmbeededObjects") & (UBound(badFrames) + 1) & getTranslation("validationExcerptNotSuitable"),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("Navigator")
|
dialog = notModalDialog("Navigator")
|
||||||
|
@ -1022,7 +1019,9 @@ Sub startNavigatorDialog(objectsDescription As String,foundObjects() As Object)
|
||||||
dialog.getControl("next").model.imageURL = rightImageURL
|
dialog.getControl("next").model.imageURL = rightImageURL
|
||||||
'dialog.getControl("next").model.ScaleMode = 2
|
'dialog.getControl("next").model.ScaleMode = 2
|
||||||
dialog.setvisible(true)
|
dialog.setvisible(true)
|
||||||
oViewCursor.goToRange(found,false)
|
'select first found '
|
||||||
|
'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("close").model.state = 1 then
|
If dialog.getControl("close").model.state = 1 then
|
||||||
exit Do
|
exit Do
|
||||||
|
@ -1030,14 +1029,14 @@ Sub startNavigatorDialog(objectsDescription As String,foundObjects() As Object)
|
||||||
If dialog.getControl("prev").model.state = 1 then
|
If dialog.getControl("prev").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("current").SetText(CStr(curNum+1))
|
dialog.getControl("current").SetText(CStr(curNum+1))
|
||||||
dialog.getControl("prev").model.state = 0
|
dialog.getControl("prev").model.state = 0
|
||||||
EndIf
|
EndIf
|
||||||
If dialog.getControl("next").model.state = 1 then
|
If dialog.getControl("next").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("current").SetText(CStr(curNum+1))
|
dialog.getControl("current").SetText(CStr(curNum+1))
|
||||||
dialog.getControl("next").model.state = 0
|
dialog.getControl("next").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)
|
||||||
|
|
BIN
translations.ods
BIN
translations.ods
Binary file not shown.
Loading…
Add table
Reference in a new issue