diff --git a/IPHRedaction/Clean.xba b/IPHRedaction/Clean.xba
index 9e4ba43..8dead38 100644
--- a/IPHRedaction/Clean.xba
+++ b/IPHRedaction/Clean.xba
@@ -1,6 +1,7 @@
-Private Sub markFxFxF
+Sub markXXFXK
+
End Sub
Sub cleanButton
@@ -14,7 +15,7 @@ Sub cleanButton
saveDocument
doNotTrack
statusIndicator.Start("Чистка документа начата, подождите",30)
-
+ unicodeSymbolsConversion
convertFontsToCharStyles
cleanFormatting
disposeAllLinks
@@ -27,6 +28,54 @@ Sub cleanButton
saveAndreload()
End Sub
+Private Sub unicodeSymbolsConversion
+ Dim newFontName As String
+ newFontName = "IPH Astra Serif"
+ Dim RAtts(2) as new com.sun.star.beans.PropertyValue
+ RAtts(0).Name = "CharFontName"
+ RAtts(1).Name = "CharFontNameComplex"
+ RAtts(2).Name = "CharFontNameAsian"
+
+ 'Basic Astra
+ RAtts(0).Value = newFontName
+ RAtts(1).Value = newFontName
+ RAtts(2).Value = newFontName
+ 'Cyrillic unicode block range \u0400-\u04FF
+ 'Basic Latin \u0020-\u007E
+ 'Combining diacritical marks 0301 0304 0323 032e 0331 035f
+ 'General Punctuation \u2000-\u206f
+ unicodeConversionEverywhere("[\u0400-\u04FF,\u0020-\u007E,\u2000-\u206f,\u0301,\u0304,\u0323,\u032e,\u0331,\u035f]+",RAtts)
+
+ 'Arabic Scheherazade
+ newFontName = "Scheherazade"
+ RAtts(0).Value = newFontName
+ RAtts(1).Value = newFontName
+ RAtts(2).Value = newFontName
+ unicodeConversionEverywhere("[\u0600-\u06FF]+",RAtts)
+
+ 'Greek Tinos
+ newFontName = "Tinos"
+ RAtts(0).Value = newFontName
+ RAtts(1).Value = newFontName
+ RAtts(2).Value = newFontName
+ 'Greek and Coptic
+ unicodeConversionEverywhere("[\u0370-\u03FF]+",RAtts)
+ 'DejaVu Sans Mathematical operators
+ newFontName = "DejaVu Sans"
+ RAtts(0).Value = newFontName
+ RAtts(1).Value = newFontName
+ RAtts(2).Value = newFontName
+ '\u2200-\u22FF Mathematical operators
+ unicodeConversionEverywhere("[\u2200-\u22FF]+",RAtts)
+
+End Sub
+
+Private Sub unicodeConversionEverywhere(searchPattern,rAtts)
+ 'in text
+ setAttributesBySearchPattern(searchPattern,RAtts)
+
+End Sub
+
'Replaces manual formatting text with font into character style with assigned font
Private Sub convertFontsToCharStyles
@@ -199,7 +248,7 @@ Private Sub disposeAllLinks()
ReplAttributes(1).Value = ""
ReplAttributes(2).Name = "CharStyleName"
ReplAttributes(2).Value = ThisComponent.getStyleFamilies().getByIndex(0).ElementNames(0)
- setAttributesBySearchPattern("",SrchAttributes,ReplAttributes)
+ setAttributesBySearchPattern("",ReplAttributes,SrchAttributes)
End Sub
Private Sub disposeAllBookmarks()
@@ -236,42 +285,42 @@ Private Sub disposePageBreaks
Wend
End Sub
-Private Sub setAttributesBySearchPattern(searchPattern As String, SrchAttributes, ReplAttributes)
-
+Sub setAttributesBySearchPattern(searchPattern As String,ReplAttributes, Optional SrchAttributes)
+ turnOffTracking
+ dim stringValue1 As String
+ dim stringValue2 As String
Dim oSearch
Dim oTextCursor As Object
Dim oViewCursor As Object
Dim lineIndent
- dim stringValue1 As String
- dim stringValue2 As String
- Dim foundPatterns() As Object
- document = ThisComponent.CurrentController.Frame
+ Dim replace As Boolean
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oSearch = ThisComponent.createSearchDescriptor()
oSearch.SearchString = searchPattern
oSearch.SearchRegularExpression=True
oSearch.SearchAll = True
- oSearch.searchStyles = true
- If Not IsEmpty(SrchAttributes(0).Value) Then
- oSearch.SetSearchAttributes(SrchAttributes())
- End If
+ If Not IsMissing (SrchAttributes) Then
+ If Not IsEmpty(SrchAttributes(0).Value) Then
+ oSearch.searchStyles = true
+ oSearch.SetSearchAttributes(SrchAttributes())
+ End If
+ EndIf
oFound = ThisComponent.findFirst(oSearch)
- Dim replace As Boolean
-
Do While Not IsNull(oFound)
- replace = true
-
- For j = LBound(SrchAttributes) To Ubound(SrchAttributes)
- If oFound.getPropertySetInfo.hasPropertyByName(SrchAttributes(j).Name) Then
- stringValue1 = "" & oFound.getPropertyValue(SrchAttributes(j).Name)
- stringValue2 = "" & SrchAttributes(j).Value
- If stringValue1 <> stringValue2 Then
+ replace = true
+ If Not IsMissing(SrchAttributes) Then
+ For j = LBound(SrchAttributes) To Ubound(SrchAttributes)
+ If oFound.getPropertySetInfo.hasPropertyByName(SrchAttributes(j).Name) Then
+ stringValue1 = "" & oFound.getPropertyValue(SrchAttributes(j).Name)
+ stringValue2 = "" & SrchAttributes(j).Value
+ If stringValue1 <> stringValue2 Then
+ replace = replace AND False
+ EndIf
+ Else
replace = replace AND False
EndIf
- Else
- replace = replace AND False
- EndIf
- Next j
+ Next j
+ EndIf
If replace then
For i = LBound(ReplAttributes) To Ubound(ReplAttributes)
If oFound.getPropertySetInfo.hasPropertyByName(ReplAttributes(i).Name) Then
@@ -805,4 +854,4 @@ Private Function getStyleNames(oFamily,bLocalized as Boolean, _
Endif
xArray(iUB) = vNextElement
End Sub
-
\ No newline at end of file
+
diff --git a/description.xml b/description.xml
index 21aaa1d..ad44f53 100644
--- a/description.xml
+++ b/description.xml
@@ -3,7 +3,7 @@
xmlns:dep="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
-
+
Redaction for publishing in Institute of philosophy
diff --git a/redaction.oxt b/redaction.oxt
index a4a8afc..c16f653 100644
Binary files a/redaction.oxt and b/redaction.oxt differ