Added check and clean strategy for broken paragraph setting charBackTransparent
This commit is contained in:
parent
07ae3e7d9c
commit
7c5aadcaad
6 changed files with 250 additions and 10 deletions
|
@ -35,6 +35,7 @@ Sub validateButton
|
|||
Dim needExtendedInfo As Boolean
|
||||
Dim config As Object
|
||||
Dim needFixColoredText As Boolean
|
||||
Dim brokenCharBackTransparent As Boolean
|
||||
config = initRedactionConfiguration()
|
||||
|
||||
Dim statusIndicator as Object
|
||||
|
@ -84,11 +85,15 @@ Sub validateButton
|
|||
needExtendedInfo = false
|
||||
EndIf
|
||||
|
||||
brokenCharBackTransparent = hasbrokenCharBackTransparent
|
||||
If (brokenCharBackTransparent) Then
|
||||
MsgBox getTranslation("invalidParagraphFormattingFound")
|
||||
EndIf
|
||||
needFixColoredText = findColoredBackgroundInDoc
|
||||
|
||||
numberingsErros = printNumberingSymbols(needExtendedInfo)
|
||||
statusIndicator.setValue(80)
|
||||
If 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 badNumberings OR footnotesReport <> "" OR graphicsReport <> "" Or outlineInNotesReport <> "" Or sectionsReport <> "" OR oulineInTablesReport <> "" OR outlinePageStylesReport <> "" Then
|
||||
MsgBox getTranslation("validationWarning")
|
||||
If badText Then
|
||||
MsgBox getTranslation("validationBadSymbolsNotification")
|
||||
|
@ -321,7 +326,7 @@ Function checkHeadingsInHeadersFooters As String
|
|||
checkHeadingsInHeadersFooters = result
|
||||
End Function
|
||||
|
||||
Function checkHeadingsInTextTables(oText As Object) As String
|
||||
Function checkHeadingsInTextTables() As String
|
||||
Dim enum1Element As Object
|
||||
Dim enum1 As Object
|
||||
Dim enum2 As Object
|
||||
|
@ -436,6 +441,126 @@ Function isHeadingsInText(oText As Object) As Boolean
|
|||
isHeadingsInText = false
|
||||
End Function
|
||||
|
||||
Function hasBrokenCharBackTransparent As Boolean
|
||||
Dim foonNotes As Object
|
||||
Dim endNotes As Object
|
||||
Dim i As Integer
|
||||
Dim oStyles As Object
|
||||
Dim pageStyles As Object
|
||||
Dim pageStyle As Object
|
||||
hasBrokenCharBackTransparent = isBackColorInText(ThisComponent.Text)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
footNotes = thisComponent.footNotes
|
||||
For i = 0 to footNotes.Count -1
|
||||
hasBrokenCharBackTransparent = isBackColorInText(footNotes.getByIndex(i).Text)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
Next i
|
||||
endNotes = thisComponent.footNotes
|
||||
For i = 0 to footNotes.Count -1
|
||||
hasBrokenCharBackTransparent = isBackColorInText(endNotes.getByIndex(i).Text)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
Next i
|
||||
oStyles = ThisComponent.StyleFamilies
|
||||
pageStyles = oStyles.getByName(oStyles.elementNames(2))
|
||||
For i = 0 to pageStyles.Count -1
|
||||
pageStyle = pageStyles.getByIndex(i)
|
||||
If Not IsEmpty(pageStyle.FooterText) Then
|
||||
hasBrokenCharBackTransparent = isBackColorInText(pageStyle.FooterText)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.FooterTextFirst) Then
|
||||
hasBrokenCharBackTransparent = isBackColorInText(pageStyle.FooterTextFirst)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.FooterTextRight) Then
|
||||
hasBrokenCharBackTransparent = isBackColorInText(pageStyle.FooterTextRight)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.FooterTextLeft) Then
|
||||
hasBrokenCharBackTransparent = isBackColorInText(pageStyle.FooterTextLeft)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.HeaderText) Then
|
||||
hasBrokenCharBackTransparent = isBackColorInText(pageStyle.HeaderText)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.HeaderTextFirst) Then
|
||||
hasBrokenCharBackTransparent = isBackColorInText(pageStyle.HeaderTextFirst)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.HeaderTextRight) Then
|
||||
hasBrokenCharBackTransparent = isBackColorInText(pageStyle.HeaderTextRight)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.HeaderTextLeft) Then
|
||||
hasBrokenCharBackTransparent = isBackColorInText(pageStyle.HeaderTextLeft)
|
||||
If (hasBrokenCharBackTransparent) Then
|
||||
Exit Function
|
||||
EndIf
|
||||
EndIf
|
||||
Next i
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function isBackColorInText(oText As Object) As Boolean
|
||||
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.CharBackTransparent = false Then
|
||||
isBackColorInText = true
|
||||
Exit Function
|
||||
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()
|
||||
If isBackColorInText(cellText) Then
|
||||
isBackColorInText = true
|
||||
Exit Function
|
||||
EndIf
|
||||
Next i
|
||||
EndIf
|
||||
Wend
|
||||
isBackColorInText = false
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function printNumberingSymbols(needExtendedInfo) As Boolean
|
||||
Dim families As Object
|
||||
Dim numStyles As Object
|
||||
|
@ -864,7 +989,6 @@ Function findColoredBackgroundInDoc() As Boolean
|
|||
sDesc.SearchAll = true
|
||||
sDesc.ValueSearch = false
|
||||
sDesc.SearchRegularExpression = true
|
||||
sDesc.SearchString = searchString
|
||||
sDesc.searchStyles = true
|
||||
sDesc.SetSearchAttributes(SrchAttributes())
|
||||
founds = Thiscomponent.findAll(sDesc)
|
||||
|
@ -990,4 +1114,4 @@ sub openReport(fileName As String)
|
|||
Kill(tmpName)
|
||||
End If
|
||||
End Sub
|
||||
</script:module>
|
||||
</script:module>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue