diff --git a/Addons.xcu b/Addons.xcu
index 151473a..372c60e 100644
--- a/Addons.xcu
+++ b/Addons.xcu
@@ -116,6 +116,22 @@
_self
+
+
+ com.sun.star.text.TextDocument,com.sun.star.text.WebDocument
+
+
+ Footnotes numbering configuration
+ Настройка нумерации сносок
+
+
+ macro:///ePublishing.Footnotes.openFootNotesDialog
+
+
+ _self
+
+
+
diff --git a/ePublishing/Footnotes.xba b/ePublishing/Footnotes.xba
new file mode 100644
index 0000000..e900fc0
--- /dev/null
+++ b/ePublishing/Footnotes.xba
@@ -0,0 +1,127 @@
+
+
+Sub openFootNotesDialog
+ 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()
+End Sub
+
\ No newline at end of file
diff --git a/ePublishing/FootnotesConfig.xdl b/ePublishing/FootnotesConfig.xdl
new file mode 100644
index 0000000..4c932d1
--- /dev/null
+++ b/ePublishing/FootnotesConfig.xdl
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ePublishing/dialog.xlb b/ePublishing/dialog.xlb
index 87a843b..2024bb0 100644
--- a/ePublishing/dialog.xlb
+++ b/ePublishing/dialog.xlb
@@ -1,4 +1,5 @@
-
+
+
\ No newline at end of file
diff --git a/ePublishing/journals.xba b/ePublishing/journals.xba
index f7bb089..905049b 100644
--- a/ePublishing/journals.xba
+++ b/ePublishing/journals.xba
@@ -60,7 +60,7 @@ Private Sub makeUpIssue
' Add article for each section
'Go to article first page
- page = findFirstPageWithStyle("Первая страница статьи")
+ page = findFirstPageNumberWithStyle("Первая страница статьи")
firstPage = page
oViewCursor.jumpToPage(page)
oTextCursor = oViewCursor.Text.createTextCursorByRange(oViewCursor)
@@ -152,7 +152,7 @@ Private Sub setPageNumbersDeprecated()
Dim firstPage as String
oViewCursor = ThisComponent.CurrentController.getViewCursor()
oViewCursor.jumpToFirstPage()
- firstPage = findFirstPageWithStyle("Статья 1 стр.1")
+ firstPage = findFirstPageNumberWithStyle("Статья 1 стр.1")
oViewCursor.jumpToPage(firstPage)
For i = 1 To 25
pageNum = lastPageNum(i)
@@ -539,13 +539,13 @@ Private Sub setAritclePageHeaders(i)
Dim leftHeaderCell As Object
Dim curStyleName As String
Dim curStyle As Object
- Dim page As String
+ Dim page As Integer
Dim pageStyles As Object
Dim articleStartPosition As Object
oViewCursor = ThisComponent.CurrentController.getViewCursor()
oSavePosition = oViewCursor.Text.createTextCursorByRange(oViewCursor)
pageStyles = ThisComponent.StyleFamilies.getByName("PageStyles")
- page = findFirstPageWithStyle("Статья " + i + " стр.1")
+ page = findFirstPageNumberWithStyle("Статья " + i + " стр.1")
oViewCursor.jumpToPage(page)
articleStartPosition = oViewCursor.Text.createTextCursorByRange(oViewCursor)
diff --git a/ePublishing/script.xlb b/ePublishing/script.xlb
index b42dbce..5953b87 100644
--- a/ePublishing/script.xlb
+++ b/ePublishing/script.xlb
@@ -4,5 +4,5 @@
+
-