From e309243d38fa503cc7cb932ff8c380371d0106d1 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Fri, 13 Mar 2020 10:27:26 +0100 Subject: [PATCH] New option to replace white character background with transparent --- Redaction/Clean.xba | 31 +++++++++++++++++++++++++++++-- Redaction/CleaningDialog.xdl | 36 +++++++++++++++++++----------------- 2 files changed, 48 insertions(+), 19 deletions(-) diff --git a/Redaction/Clean.xba b/Redaction/Clean.xba index 01a1f10..4920839 100644 --- a/Redaction/Clean.xba +++ b/Redaction/Clean.xba @@ -1,6 +1,6 @@ -Sub mark31 +Sub mark32 End Sub @@ -51,7 +51,10 @@ Private Sub cleanAccordingTo(dialog) statusIndicator.Start("Очищаем стили сносок",100) resetFootnotesStyle EndIf - + If dialog.getControl("replaceWhiteBackground").state = 1 Then + statusIndicator.Start("Заменяем белый фон на прозрачный",100) + replaceWhiteBackgroundWithTransparent + EndIf If dialog.getControl("removeUnusedStyles").state = 1 Then removeUnusedStyles EndIf @@ -1124,6 +1127,30 @@ Private Function getStyleNames(oFamily,bLocalized as Boolean, _ xArray(iUB) = vNextElement End Sub +Private Sub replaceWhiteBackgroundWithTransparent + Dim description As String + Dim searchPattern As String + searchPattern = "" + ' description = "Вы уверены, что хотите заменить белый фон на прозрачный в текущем документе?" + ' If NOT confirm(description) Then + ' Exit Sub + ' EndIf + Dim statusIndicator as Object + statusIndicator = ThisComponent.getCurrentController.statusIndicator + statusIndicator.Start("Замена белого фона на прозрачный начата",100) + Dim SrchAttributes(1) as new com.sun.star.beans.PropertyValue + Dim ReplAttributes(1) as new com.sun.star.beans.PropertyValue + SrchAttributes(0).Name = "CharBackTransparent" + SrchAttributes(0).Value = False + SrchAttributes(1).Name = "CharBackColor" + SrchAttributes(1).Value = 16777215 + ReplAttributes(0).Name = "CharBackTransparent" + ReplAttributes(0).Value = True + ReplAttributes(1).Name = "CharBackColor" + ReplAttributes(1).Value = -1 + setAttributesBySearchPattern(searchPattern,ReplAttributes,SrchAttributes) + statusIndicator.end() +End Sub Private Sub convertWLLatin2IPHAstra Dim newFontName As String diff --git a/Redaction/CleaningDialog.xdl b/Redaction/CleaningDialog.xdl index 1ad87aa..01f84d0 100644 --- a/Redaction/CleaningDialog.xdl +++ b/Redaction/CleaningDialog.xdl @@ -1,22 +1,24 @@ - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file