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
|
@ -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="Clean" script:language="StarBasic">Sub mark81
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark82
|
||||
|
||||
End Sub
|
||||
|
||||
|
@ -45,6 +45,7 @@ Private Sub makerUpMenu
|
|||
dialog.getControl("removeBasic").Label = getTranslation("advancedMenuRemoveBasic")
|
||||
dialog.getControl("resetChapterNumberingRules").Label = getTranslation("advancedMenuResetChapterNumberingRules")
|
||||
dialog.getControl("convertFontsToCharStyles").Label = getTranslation("advancedMenuconvertFontsToCharStyles")
|
||||
dialog.getControl("fixBrokenCharBackTransparent").Label = getTranslation("fixBrokenCharBackTransparentMenuItem")
|
||||
dialog.getControl("Cancel").Label = getTranslation("buttonCancel")
|
||||
dialog.getControl("OK").Label = getTranslation("buttonOK")
|
||||
dialog.getControl("buttonLoad").Label = getTranslation("buttonLoad")
|
||||
|
@ -152,6 +153,10 @@ Private Sub cleanAccordingTo(dialog As Object)
|
|||
If dialog.getControl("convertFontsToCharStyles").state = 1 Then
|
||||
convertFontsToCharStyles()
|
||||
EndIf
|
||||
If dialog.getControl("fixBrokenCharBackTransparent").state = 1 Then
|
||||
fixBrokenCharBackTransparent()
|
||||
EndIf
|
||||
|
||||
|
||||
statusIndicator.end()
|
||||
saveAndreload()
|
||||
|
@ -1982,4 +1987,84 @@ Sub replaceNumHyphenRegExp
|
|||
AskAndReplace("(?<!DOI[0-9. /XVI:-‒–—−-]{1,50})(?<=[:digit:])(?:[:space:])?[-‒–—−](?:[:space:])?(?=[:digit:])","‒")
|
||||
End sub
|
||||
|
||||
Sub fixBrokenCharBackTransparent
|
||||
Dim foonNotes As Object
|
||||
Dim endNotes As Object
|
||||
Dim i As Integer
|
||||
Dim oStyles As Object
|
||||
Dim pageStyles As Object
|
||||
Dim pageStyle As Object
|
||||
footNotes = thisComponent.footNotes
|
||||
For i = 0 to footNotes.Count -1
|
||||
setDefaultBackColorInText(footNotes.getByIndex(i).Text)
|
||||
Next i
|
||||
endNotes = thisComponent.footNotes
|
||||
For i = 0 to footNotes.Count -1
|
||||
setDefaultBackColorInText(endNotes.getByIndex(i).Text)
|
||||
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
|
||||
setDefaultBackColorInText(pageStyle.FooterText)
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.FooterTextFirst) Then
|
||||
setDefaultBackColorInText(pageStyle.FooterTextFirst)
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.FooterTextRight) Then
|
||||
setDefaultBackColorInText(pageStyle.FooterTextRight)
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.FooterTextLeft) Then
|
||||
setDefaultBackColorInText(pageStyle.FooterTextLeft)
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.HeaderText) Then
|
||||
setDefaultBackColorInText(pageStyle.HeaderText)
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.HeaderTextFirst) Then
|
||||
setDefaultBackColorInText(pageStyle.HeaderTextFirst)
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.HeaderTextRight) Then
|
||||
setDefaultBackColorInText(pageStyle.HeaderTextRight)
|
||||
EndIf
|
||||
If Not IsEmpty(pageStyle.HeaderTextLeft) Then
|
||||
setDefaultBackColorInText(pageStyle.HeaderTextLeft)
|
||||
EndIf
|
||||
Next i
|
||||
setDefaultBackColorInText(ThisComponent.Text)
|
||||
End Sub
|
||||
|
||||
Sub setDefaultBackColorInText(oText As Object)
|
||||
If IsMissing(oText) Then
|
||||
Exit sub
|
||||
End If
|
||||
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
|
||||
enum1Element.setPropertyToDefault("CharBackTransparent")
|
||||
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()
|
||||
setDefaultBackColorInText(cellText)
|
||||
Next i
|
||||
EndIf
|
||||
Wend
|
||||
End Sub
|
||||
</script:module>
|
Loading…
Add table
Add a link
Reference in a new issue