2019-10-16 15:42:48 +03:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
2019-10-17 00:31:08 +03:00
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markY
2019-10-16 15:42:48 +03:00
End Sub
2019-10-16 16:17:28 +03:00
Sub validateButton
2019-10-17 00:31:08 +03:00
removeBadCharacters
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
2019-10-16 15:42:48 +03:00
End Sub
2019-10-17 00:31:08 +03:00
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
2019-10-17 00:11:21 +03:00
</script:module>