2020-03-13 16:36:45 +01:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
2020-03-13 16:40:24 +01:00
|
|
|
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Footnotes" script:language="StarBasic" script:moduleType="normal">sub footMark1
|
2020-03-13 16:42:10 +01:00
|
|
|
End Sub
|
|
|
|
|
2020-03-13 16:40:24 +01:00
|
|
|
Sub openFootNotesDialog
|
2020-03-13 16:36:45 +01:00
|
|
|
Dim dialog As Object
|
|
|
|
DialogLibraries.LoadLibrary("ePublishing")
|
|
|
|
dialog = CreateUnoDialog(DialogLibraries.ePublishing.FootnotesConfig)
|
|
|
|
dialog.setVisible(true)
|
|
|
|
Select Case dialog.Execute()
|
|
|
|
Case 1
|
|
|
|
setFootnotesNumberingFrom(dialog)
|
|
|
|
Case 0
|
|
|
|
End Select
|
|
|
|
dialog.dispose()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Sub setFootnotesNumberingFrom(dialog)
|
|
|
|
Dim statusIndicator as Object
|
|
|
|
Dim targetLevel As Integer
|
|
|
|
statusIndicator = ThisComponent.getCurrentController.statusIndicator
|
|
|
|
dialog.setVisible(false)
|
|
|
|
doNotTrack
|
|
|
|
targetLevel = dialog.getControl("level").Value
|
|
|
|
|
|
|
|
If targetLevel > -1 AND targetLevel < 11 Then
|
|
|
|
statusIndicator.Start("Нумерую сноски",100)
|
|
|
|
setFootnotesNumberingLevel(targetLevel)
|
|
|
|
Else
|
|
|
|
MsgBox "Значение уровня заголовков вне допустимого диапазона. Введите число от 0 до 10."
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
statusIndicator.end()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Sub setFootnotesNumberingLevel(level)
|
|
|
|
Dim enum1Element As Object
|
|
|
|
Dim enum1 As Object
|
|
|
|
Dim enum2 As Object
|
|
|
|
Dim thisPortion As Object
|
|
|
|
Dim curNum As Integer
|
|
|
|
Dim footnoteText As Object
|
|
|
|
Dim label As String
|
|
|
|
Dim labelNum As Integer
|
|
|
|
Dim i As Integer
|
|
|
|
Dim cell As Object
|
|
|
|
Dim cellEnum As Object
|
|
|
|
Dim cellEnum2 As Object
|
|
|
|
|
|
|
|
Dim statusIndicator as Object
|
|
|
|
statusIndicator = ThisComponent.getCurrentController.statusIndicator
|
|
|
|
statusIndicator.Start("Нумерация сносок запущена, подождите",30)
|
|
|
|
|
|
|
|
|
|
|
|
curNum = 1
|
|
|
|
enum1 = ThisComponent.Text.createEnumeration
|
|
|
|
While enum1.hasMoreElements
|
|
|
|
enum1Element = enum1.nextElement
|
|
|
|
If enum1Element.supportsService("com.sun.star.text.Paragraph") Then
|
|
|
|
If enum1Element.OutlineLevel = level Then
|
|
|
|
curNum = 1
|
|
|
|
EndIf
|
|
|
|
enum2 = enum1Element.createEnumeration
|
|
|
|
While enum2.hasMoreElements
|
|
|
|
thisPortion = enum2.nextElement
|
|
|
|
If thisPortion.TextPortionType = "Footnote" Then
|
|
|
|
footnoteText = thisPortion.Footnote
|
|
|
|
label = footnoteText.getLabel
|
|
|
|
If label = "" Then
|
|
|
|
If level > 0 Then
|
|
|
|
footnoteText.setLabel(CStr(curNum))
|
|
|
|
curNum = curNum + 1
|
|
|
|
EndIf
|
|
|
|
Else
|
|
|
|
labelNum = CInt(label)
|
|
|
|
If labelNum > 0 Then
|
|
|
|
If level < 1 Then
|
|
|
|
footnoteText.setLabel("")
|
|
|
|
Else
|
|
|
|
footnoteText.setLabel(CStr(curNum))
|
|
|
|
EndIf
|
|
|
|
curNum = curNum + 1
|
|
|
|
EndIf
|
|
|
|
EndIf
|
|
|
|
EndIf
|
|
|
|
Wend
|
|
|
|
ElseIf enum1Element.supportsService("com.sun.star.text.TextTable") Then
|
|
|
|
cellNames = enum1Element.cellNames
|
|
|
|
For i = LBound(cellNames) To Ubound(cellNames)
|
|
|
|
cell = enum1Element.getCellByName(cellNames(i))
|
|
|
|
cellEnum = cell.getText().createEnumeration()
|
|
|
|
While cellEnum.hasMoreElements
|
|
|
|
cellEnumElement = cellEnum.nextElement
|
|
|
|
If cellEnumElement.supportsService("com.sun.star.text.Paragraph") Then
|
|
|
|
If cellEnumElement.OutlineLevel = level Then
|
|
|
|
curNum = 1
|
|
|
|
EndIf
|
|
|
|
cellEnum2 = cellEnumElement.createEnumeration
|
|
|
|
While cellEnum2.hasMoreElements
|
|
|
|
thisPortion = cellEnum2.nextElement
|
|
|
|
If thisPortion.TextPortionType = "Footnote" Then
|
|
|
|
footnoteText = thisPortion.Footnote
|
|
|
|
label = footnoteText.getLabel
|
|
|
|
If label = "" Then
|
|
|
|
If level > 0 Then
|
|
|
|
footnoteText.setLabel(CStr(curNum))
|
|
|
|
curNum = curNum + 1
|
|
|
|
EndIf
|
|
|
|
Else
|
|
|
|
labelNum = CInt(label)
|
|
|
|
If labelNum > 0 Then
|
|
|
|
If level < 1 Then
|
|
|
|
footnoteText.setLabel("")
|
|
|
|
Else
|
|
|
|
footnoteText.setLabel(CStr(curNum))
|
|
|
|
EndIf
|
|
|
|
curNum = curNum + 1
|
|
|
|
EndIf
|
|
|
|
EndIf
|
|
|
|
EndIf
|
|
|
|
Wend
|
|
|
|
EndIf
|
|
|
|
Wend
|
|
|
|
Next i
|
|
|
|
EndIf
|
|
|
|
Wend
|
|
|
|
statusIndicator.end()
|
2020-03-13 16:40:24 +01:00
|
|
|
MsgBox "Нумерация сносок успешно завершена."
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub doNotTrack
|
|
|
|
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())
|
2020-03-13 16:36:45 +01:00
|
|
|
End Sub
|
2020-03-13 16:42:10 +01:00
|
|
|
</script:module>
|