From d0bba1db42a9db5639864d8c0fb28f06ed798bd8 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Mon, 26 Jul 2021 12:58:33 +0200 Subject: [PATCH] Push new version --- Redaction/Validation.xba | 48 +++++++++++++++++++++++-------------- cleanandvalidate.update.xml | 4 ++-- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/Redaction/Validation.xba b/Redaction/Validation.xba index 7ee7f21..2f3d98c 100644 --- a/Redaction/Validation.xba +++ b/Redaction/Validation.xba @@ -495,20 +495,20 @@ Function hasBrokenCharBackTransparent As Boolean Dim oStyles As Object Dim pageStyles As Object Dim pageStyle As Object - hasBrokenCharBackTransparent = isBackColorInText(ThisComponent.Text) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(ThisComponent.Text) If (hasBrokenCharBackTransparent) Then Exit Function EndIf footNotes = ThisComponent.FootNotes For i = 0 to footNotes.getCount - 1 - hasBrokenCharBackTransparent = isBackColorInText(footNotes.getByIndex(i).Text) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(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) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(endNotes.getByIndex(i).Text) If (hasBrokenCharBackTransparent) Then Exit Function EndIf @@ -518,49 +518,49 @@ Function hasBrokenCharBackTransparent As Boolean For i = 0 to pageStyles.Count -1 pageStyle = pageStyles.getByIndex(i) If Not IsEmpty(pageStyle.FooterText) Then - hasBrokenCharBackTransparent = isBackColorInText(pageStyle.FooterText) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(pageStyle.FooterText) If (hasBrokenCharBackTransparent) Then Exit Function EndIf EndIf If Not IsEmpty(pageStyle.FooterTextFirst) Then - hasBrokenCharBackTransparent = isBackColorInText(pageStyle.FooterTextFirst) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(pageStyle.FooterTextFirst) If (hasBrokenCharBackTransparent) Then Exit Function EndIf EndIf If Not IsEmpty(pageStyle.FooterTextRight) Then - hasBrokenCharBackTransparent = isBackColorInText(pageStyle.FooterTextRight) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(pageStyle.FooterTextRight) If (hasBrokenCharBackTransparent) Then Exit Function EndIf EndIf If Not IsEmpty(pageStyle.FooterTextLeft) Then - hasBrokenCharBackTransparent = isBackColorInText(pageStyle.FooterTextLeft) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(pageStyle.FooterTextLeft) If (hasBrokenCharBackTransparent) Then Exit Function EndIf EndIf If Not IsEmpty(pageStyle.HeaderText) Then - hasBrokenCharBackTransparent = isBackColorInText(pageStyle.HeaderText) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(pageStyle.HeaderText) If (hasBrokenCharBackTransparent) Then Exit Function EndIf EndIf If Not IsEmpty(pageStyle.HeaderTextFirst) Then - hasBrokenCharBackTransparent = isBackColorInText(pageStyle.HeaderTextFirst) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(pageStyle.HeaderTextFirst) If (hasBrokenCharBackTransparent) Then Exit Function EndIf EndIf If Not IsEmpty(pageStyle.HeaderTextRight) Then - hasBrokenCharBackTransparent = isBackColorInText(pageStyle.HeaderTextRight) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(pageStyle.HeaderTextRight) If (hasBrokenCharBackTransparent) Then Exit Function EndIf EndIf If Not IsEmpty(pageStyle.HeaderTextLeft) Then - hasBrokenCharBackTransparent = isBackColorInText(pageStyle.HeaderTextLeft) + hasBrokenCharBackTransparent = isManualCharBackTransparentInTextParas(pageStyle.HeaderTextLeft) If (hasBrokenCharBackTransparent) Then Exit Function EndIf @@ -568,9 +568,21 @@ Function hasBrokenCharBackTransparent As Boolean Next i End Function +Function isManualCharBackTransparent(para As Object) As Boolean + Dim styleName As String + Dim paraStyles As Object + isManualCharBackTransparent = false + If para.CharBackTransparent = false Then + styleName = para.ParaStyleName + paraStyles = ThisComponent.StyleFamilies.getByName("ParagraphStyles") + paraStyle = paraStyles.GetByName(styleName) + If paraStyle.CharBackTransparent = true Then + isManualCharBackTransparent = true + EndIf + EndIf +End Function - -Function isBackColorInText(oText As Object) As Boolean +Function isManualCharBackTransparentInTextParas(oText As Object) As Boolean Dim enum1Element As Object Dim enum1 As Object Dim enum2 As Object @@ -587,8 +599,8 @@ Function isBackColorInText(oText As Object) As Boolean While enum1.hasMoreElements enum1Element = enum1.nextElement If enum1Element.supportsService("com.sun.star.text.Paragraph") Then - If enum1Element.CharBackTransparent = false Then - isBackColorInText = true + If isManualCharBackTransparent(enum1Element) Then + isManualCharBackTransparentInTextParas = true Exit Function EndIf ElseIf enum1Element.supportsService("com.sun.star.text.TextTable") Then @@ -596,14 +608,14 @@ Function isBackColorInText(oText As Object) As Boolean For i = LBound(cellNames) To Ubound(cellNames) cell = enum1Element.getCellByName(cellNames(i)) cellText = cell.getText() - If isBackColorInText(cellText) Then - isBackColorInText = true + If isManualCharBackTransparentInTextParas(cellText) Then + isManualCharBackTransparentInTextParas = true Exit Function EndIf Next i EndIf Wend - isBackColorInText = false + isManualCharBackTransparentInTextParas = false End Function diff --git a/cleanandvalidate.update.xml b/cleanandvalidate.update.xml index ce18905..80f002c 100644 --- a/cleanandvalidate.update.xml +++ b/cleanandvalidate.update.xml @@ -2,9 +2,9 @@ - + - +