diff --git a/Addons.xcu b/Addons.xcu index 2afa219..67d87a0 100644 --- a/Addons.xcu +++ b/Addons.xcu @@ -1,6 +1,6 @@  - + @@ -10,23 +10,40 @@ ePublishing - + - com.sun.star.text.GlobalDocument,com.sun.star.text.TextDocument,com.sun.star.text.WebDocument + com.sun.star.text.TextDocument,com.sun.star.text.WebDocument - Convert authHyphenations to manual - Конвертация автоматических переносов в ручные + Configure clean + Настройка чистки - macro:///ePublishing.Hyphenations.convertAutoHyphToManual + macro:///Redaction.Configuration.ConfigurationDialog _self + + + com.sun.star.text.TextDocument,com.sun.star.text.WebDocument + + + Convert auto hyphenations to manual + Конвертация автоматических переносов в ручные + + + macro:///ePublishing.Hyphenations.convertHyphInDoc + + + _self + + + + diff --git a/description.xml b/description.xml index 90b1ba8..9ae4d17 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"> - + Инструменты для создания электронных изданий diff --git a/ePublishing/Hyphenations.xba b/ePublishing/Hyphenations.xba index 58e29e1..8e218e0 100644 --- a/ePublishing/Hyphenations.xba +++ b/ePublishing/Hyphenations.xba @@ -1,15 +1,25 @@ -sub markHyph1 +Private Sub markHyph2 End sub -Sub convertHyphInDoc() + +Private Sub convertHyphInDoc() + + Dim description As String + Dim allNotes As Object + dim aNote As Object + description = "Запустить конвертацию автоматических переносов в ручные?" + If NOT confirm(description) Then + Exit Sub + EndIf Dim statusIndicator as Object statusIndicator = ThisComponent.getCurrentController.StatusIndicator - statusIndicator.Start("Конвертация переносов, подождите",10) + statusIndicator.Start("Произвожу конвертацию, подождите",10) + turnOffTracking AcceptAllTrackedChanges convertHyphInText(ThisComponent.Text) ' Globalscope.BasicLibraries.LoadLibrary( "MRILib" ) - statusIndicator.Start("Конвертация переносов, подождите",70) + statusIndicator.Start("Произвожу конвертацию, подождите",70) allNotes = ThisComponent.FootNotes For x = 0 to allNotes.Count -1 aNote = allNotes.getByIndex(x) @@ -18,9 +28,10 @@ Sub convertHyphInDoc() 'disableAutoHyph() statusIndicator.end() MsgBox "Конвертация переносов успешно завершена." + End Sub -sub disableAutoHyph() +Private sub disableAutoHyph() Dim propertySetInfo As Object Dim oPositionOfMatch As Long oFamilies = ThisComponent.StyleFamilies @@ -35,7 +46,7 @@ sub disableAutoHyph() Next End Sub -Sub convertHyphInText(textElement) +Private Sub convertHyphInText(textElement) Dim enum1Element As Object Dim enum1 As Object Dim i As Integer @@ -57,7 +68,7 @@ Sub convertHyphInText(textElement) Wend End Sub -Sub convertParaHyphens(para) +Private Sub convertParaHyphens(para) Dim lineEnd As String Dim autoHyphens() As Object Dim autoBreaks() As Object @@ -121,23 +132,24 @@ Sub convertParaHyphens(para) End Sub -Sub insertBreak(tCursor As Object) +Private Sub insertBreak(tCursor As Object) 'U+200B Zero length space tCursor.String = "​" End Sub -Function getPrevChar(tCurs As Object) +Private Function getPrevChar(tCurs As Object) tCurs.goLeft(1,true) getPrevChar = tCurs.getString() tCurs.goRight(1,false) End Function -Function getNextChar(tCurs As Object) +Private Function getNextChar(tCurs As Object) tCurs.goRight(1,true) getNextChar = tCurs.getString() tCurs.goLeft(1,false) End Function -Sub replaceHyphen(tCurs As Object,lineNumber As Integer) + +Private Sub replaceHyphen(tCurs As Object,lineNumber As Integer) Dim curLineNum As Integer Dim vCurs As Object Dim tLine As Object @@ -160,7 +172,7 @@ Sub replaceHyphen(tCurs As Object,lineNumber As Integer) EndIf End Sub -Sub compressLine(tCurs As Object) +Private Sub compressLine(tCurs As Object) Dim vCurs As Object Dim tLine As Object Dim kerning As Integer @@ -222,7 +234,7 @@ Sub compressLine(tCurs As Object) End Sub -Sub stretchLine(tCurs As Object) +Private Sub stretchLine(tCurs As Object) Dim vCurs As Object Dim tLine As Object Dim kerning As Integer @@ -244,7 +256,7 @@ Sub stretchLine(tCurs As Object) End Sub -Function getParaLineNumber(vCursor As Object) +Private Function getParaLineNumber(vCursor As Object) Dim lineNumber As Integer Dim oSavePosition As Object Dim tCursor As Object @@ -263,7 +275,7 @@ Function getParaLineNumber(vCursor As Object) getParaLineNumber = lineNumber End Function -Function needLineBreak(before,after) +Private Function needLineBreak(before,after) needLineBreak = false If before = "/" Then If after <> " " AND after <> Chr(10) Then @@ -278,7 +290,7 @@ End Sub -Function needHyphen(before As String, after As String,lineLength As Integer) +Private Function needHyphen(before As String, after As String,lineLength As Integer) Dim charNumBefore as Integer Dim charNumAfter as Integer needHyphen = true @@ -338,19 +350,38 @@ Dim charNumAfter as Integer End Function -sub AcceptAllTrackedChanges -rem ---------------------------------------------------------------------- -rem define variables -dim document as object -dim dispatcher as object -rem ---------------------------------------------------------------------- -rem get access to the document -document = ThisComponent.CurrentController.Frame -dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") +Private sub AcceptAllTrackedChanges + rem ---------------------------------------------------------------------- + rem define variables + dim document as object + dim dispatcher as object + rem ---------------------------------------------------------------------- + rem get access to the document + document = ThisComponent.CurrentController.Frame + dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") + + rem ---------------------------------------------------------------------- + dispatcher.executeDispatch(document, ".uno:AcceptAllTrackedChanges", "", 0, Array()) + -rem ---------------------------------------------------------------------- -dispatcher.executeDispatch(document, ".uno:AcceptAllTrackedChanges", "", 0, Array()) +End sub +Private Sub turnOffTracking + document = ThisComponent.CurrentController.Frame + dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") + Dim args(0) as new com.sun.star.beans.PropertyValue + args(0).Name = "TrackChanges" + args(0).Value = false + dispatcher.executeDispatch(document, ".uno:TrackChanges", "", 0, args()) + +End Sub -end sub +Private Function confirm(description) + If MsgBox (description, 4) =6 Then + confirm = true + Else + confirm = false + EndIf + +End Function \ No newline at end of file