Alpha works
This commit is contained in:
parent
0843de1752
commit
da4169bcd6
4 changed files with 97 additions and 5 deletions
|
@ -41,12 +41,30 @@ Private Sub loadArticleStyles
|
||||||
ThisComponent.StyleFamilies.loadStylesFromURL( filePath, aArgs() )
|
ThisComponent.StyleFamilies.loadStylesFromURL( filePath, aArgs() )
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function CreateProperty( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
|
||||||
|
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
|
||||||
|
If Not IsMissing( cName ) Then
|
||||||
|
oPropertyValue.Name = cName
|
||||||
|
EndIf
|
||||||
|
If Not IsMissing( uValue ) Then
|
||||||
|
oPropertyValue.Value = uValue
|
||||||
|
EndIf
|
||||||
|
CreateProperty() = oPropertyValue
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Sub AskAndReplace(SearchString, oReplaceString)
|
Private Sub AskAndReplace(SearchString, oReplaceString)
|
||||||
Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
|
Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
|
||||||
Dim ReplAttributes(0) as new com.sun.star.beans.PropertyValue
|
Dim ReplAttributes(0) as new com.sun.star.beans.PropertyValue
|
||||||
ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, true)
|
ReplaceFormatting(SearchString,oReplaceString,SrchAttributes,ReplAttributes, true)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function DocHasCharStyle(oDoc, sName$) As Boolean
|
||||||
|
Dim oStyles
|
||||||
|
oStyles = oDoc.StyleFamilies.getByName("CharacterStyles")
|
||||||
|
DocHasCharStyle() = oStyles.hasByName(sName)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Private Function getTemplatePath() as String
|
Private Function getTemplatePath() as String
|
||||||
Dim ath as String
|
Dim ath as String
|
||||||
Dim settings As Object
|
Dim settings As Object
|
||||||
|
|
|
@ -1,12 +1,86 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub valButtonMark
|
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markY
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Sub validateButton
|
Sub validateButton
|
||||||
MsgBox "Validation works!"
|
removeBadCharacters
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub removeBadCharacters
|
||||||
|
StartTracking
|
||||||
|
AskAndReplace("[\uE000-\uF8FF]+","")
|
||||||
|
checkAllFootnotes
|
||||||
|
StopTracking
|
||||||
|
showTrackedChanges
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub checkAllFootnotes()
|
||||||
|
Dim footnotes As Object
|
||||||
|
Dim count as Integer
|
||||||
|
Dim charNum as Long
|
||||||
|
Dim char As Long
|
||||||
|
Dim label As String
|
||||||
|
Dim result As String
|
||||||
|
result = ""
|
||||||
|
footnotes = ThisComponent.Footnotes
|
||||||
|
count = footnotes.getCount
|
||||||
|
For i = 0 to count-1
|
||||||
|
footnote = footnotes.getByIndex(i)
|
||||||
|
' Mri footnote
|
||||||
|
label = footnote.Label
|
||||||
|
charNum = Len(label)
|
||||||
|
For j = 1 to charNum
|
||||||
|
char = Asc(Right(Left(label,j),1))
|
||||||
|
If char >= 57344 AND char <= 63743 then
|
||||||
|
result = result & "Символ "& Chr(char) &" сноски "& i &" находится в диапазоне для частного использования"& chr(10)
|
||||||
|
'Mri footnote
|
||||||
|
'footNote.setLabel(Left(label,j-1) & "*" & Right(label,charNum-j))
|
||||||
|
End If
|
||||||
|
Next j
|
||||||
|
Next i
|
||||||
|
If result <> "" then
|
||||||
|
MsgBox result
|
||||||
|
EndIf
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub showTrackedChanges
|
||||||
|
dim document as object
|
||||||
|
dim dispatcher as object
|
||||||
|
document = ThisComponent.CurrentController.Frame
|
||||||
|
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
||||||
|
dispatcher.executeDispatch(document, ".uno:AcceptTrackedChanges", "", 0, Array())
|
||||||
|
dim args2(0) as new com.sun.star.beans.PropertyValue
|
||||||
|
args2(0).Name = "ShowTrackedChanges"
|
||||||
|
args2(0).Value = true
|
||||||
|
dispatcher.executeDispatch(document, ".uno:ShowTrackedChanges", "", 0, args2())
|
||||||
|
|
||||||
|
end Sub
|
||||||
|
|
||||||
|
Private Sub StartTracking
|
||||||
|
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
||||||
|
document = ThisComponent.CurrentController.Frame
|
||||||
|
dim trackProperties(0) as new com.sun.star.beans.PropertyValue
|
||||||
|
trackProperties(0).Name = "TrackChanges"
|
||||||
|
trackProperties(0).Value = true
|
||||||
|
dispatcher.executeDispatch(document, ".uno:TrackChanges", "", 0, trackProperties())
|
||||||
|
dim args1(0) as new com.sun.star.beans.PropertyValue
|
||||||
|
args1(0).Name = "ShowTrackedChanges"
|
||||||
|
args1(0).Value = true
|
||||||
|
dispatcher.executeDispatch(document, ".uno:ShowTrackedChanges", "", 0, args1())
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub StopTracking
|
||||||
|
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
||||||
|
document = ThisComponent.CurrentController.Frame
|
||||||
|
dim trackProperties(0) as new com.sun.star.beans.PropertyValue
|
||||||
|
trackProperties(0).Name = "TrackChanges"
|
||||||
|
trackProperties(0).Value = false
|
||||||
|
dispatcher.executeDispatch(document, ".uno:TrackChanges", "", 0, trackProperties())
|
||||||
|
dim args1(0) as new com.sun.star.beans.PropertyValue
|
||||||
|
args1(0).Name = "ShowTrackedChanges"
|
||||||
|
args1(0).Value = true
|
||||||
|
dispatcher.executeDispatch(document, ".uno:ShowTrackedChanges", "", 0, args1())
|
||||||
|
End Sub
|
||||||
</script:module>
|
</script:module>
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
|
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
|
||||||
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="IPHRedaction" library:readonly="false" library:passwordprotected="false">
|
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="IPHRedaction" library:readonly="false" library:passwordprotected="false">
|
||||||
<library:element library:name="Validation"/>
|
<library:element library:name="Validation"/>
|
||||||
|
|
BIN
redaction.oxt
BIN
redaction.oxt
Binary file not shown.
Loading…
Add table
Reference in a new issue