Improving footnote/endnote configuration in progress

This commit is contained in:
Georgy Litvinov 2021-05-19 15:50:10 +02:00
parent 8087152c4a
commit 90207f01d0
4 changed files with 184 additions and 23 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Footnotes" script:language="StarBasic" script:moduleType="normal">sub footMark1
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Footnotes" script:language="StarBasic" script:moduleType="normal">sub footMark2
End Sub
Sub openFootNotesDialog
@ -14,7 +14,17 @@ Sub openFootNotesDialog
dialog.getControl(&quot;configText3&quot;).setText(getTranslation(&quot;configText3&quot;))
dialog.getControl(&quot;configText4&quot;).setText(getTranslation(&quot;configText4&quot;))
dialog.getControl(&quot;configText5&quot;).setText(getTranslation(&quot;configText5&quot;))
dialog.getControl(&quot;notesTypeLabel&quot;).setText(getTranslation(&quot;FootnotesConfigDialogNotesTypeLabel&quot;))
dialog.getControl(&quot;PerPageRangeLabel&quot;).setText(getTranslation(&quot;FootnotesConfigDialogNotesPerPageRangeLabel&quot;))
dialog.getControl(&quot;groupByPages&quot;).Model.Label = getTranslation(&quot;FootnotesConfigDialogNotesPerPage&quot;)
dialog.getControl(&quot;groupByHeadings&quot;).Model.Label = getTranslation(&quot;FootnotesConfigDialogNotesByHeadingsLabel&quot;)
dialog.Title = getTranslation(&quot;footnotesConfigDialogTitle&quot;)
Dim nCount As Integer
nCount = dialog.getControl(&quot;lb_notes_types&quot;).getItemCount()
dialog.getControl(&quot;lb_notes_types&quot;).addItem( getTranslation(&quot;FootnotesConfigDialogFootnotesName&quot;), nCount )
dialog.getControl(&quot;lb_notes_types&quot;).addItem( getTranslation(&quot;FootnotesConfigDialogEndnotesName&quot;), nCount + 1 )
dialog.getControl(&quot;lb_notes_types&quot;).selectItemPos( 0, True )
dialog.setVisible(true)
Select Case dialog.Execute()
Case 1
@ -27,22 +37,36 @@ End Sub
Sub setFootnotesNumberingFrom(dialog)
Dim statusIndicator as Object
Dim targetLevel As Integer
Dim stringLevelInput As String
Dim stringPageRangeInput As String
Dim noteType As Integer
statusIndicator = ThisComponent.getCurrentController.statusIndicator
dialog.setVisible(false)
doNotTrack
targetLevel = dialog.getControl(&quot;level&quot;).Value
stringLevelInput = dialog.getControl(&quot;level&quot;).getText
stringPageRangeInput = dialog.getControl(&quot;pageRange&quot;).getText
noteType = dialog.getControl(&quot;lb_notes_types&quot;).getSelectedItemPos()
If (stringLevelInput &lt;&gt; &quot;&quot;) Then
targetLevel = CInt(stringLevelInput)
If targetLevel &gt; -1 AND targetLevel &lt; 11 Then
statusIndicator.Start(getTranslation(&quot;statusNumberingInProcess&quot;),100)
setFootnotesNumberingLevel(targetLevel,noteType)
Else
MsgBox getTranslation(&quot;numberingInputOutOfRange&quot;)
EndIf
EndIf
If (stringPageRangeInput &lt;&gt; &quot;&quot;) Then
If targetLevel &gt; -1 AND targetLevel &lt; 11 Then
statusIndicator.Start(getTranslation(&quot;statusNumberingInProcess&quot;),100)
setFootnotesNumberingLevel(targetLevel)
Else
MsgBox getTranslation(&quot;numberingInputOutOfRange&quot;)
setNotesPaginatedNumbering(noteType, pageArray)
EndIf
statusIndicator.end()
End Sub
Sub setFootnotesNumberingLevel(level)
Sub setFootnotesNumberingLevel(level As Integer,noteType As Integer)
Dim enum1Element As Object
Dim enum1 As Object
Dim enum2 As Object
@ -50,7 +74,7 @@ Sub setFootnotesNumberingLevel(level)
Dim curNum As Integer
Dim footnoteText As Object
Dim label As String
Dim labelNum As Integer
Dim labelNum As Long
Dim i As Integer
Dim cell As Object
Dim cellEnum As Object
@ -72,7 +96,8 @@ Sub setFootnotesNumberingLevel(level)
enum2 = enum1Element.createEnumeration
While enum2.hasMoreElements
thisPortion = enum2.nextElement
If thisPortion.TextPortionType = &quot;Footnote&quot; Then
If isTargetNote(thisPortion, noteType) Then
footnoteText = thisPortion.Footnote
label = footnoteText.getLabel
If label = &quot;&quot; Then
@ -81,7 +106,7 @@ Sub setFootnotesNumberingLevel(level)
curNum = curNum + 1
EndIf
Else
labelNum = CInt(label)
labelNum = CLng(label)
If labelNum &gt; 0 Then
If level &lt; 1 Then
footnoteText.setLabel(&quot;&quot;)
@ -107,7 +132,7 @@ Sub setFootnotesNumberingLevel(level)
cellEnum2 = cellEnumElement.createEnumeration
While cellEnum2.hasMoreElements
thisPortion = cellEnum2.nextElement
If thisPortion.TextPortionType = &quot;Footnote&quot; Then
If isTargetNote(thisPortion, noteType) Then
footnoteText = thisPortion.Footnote
label = footnoteText.getLabel
If label = &quot;&quot; Then
@ -116,7 +141,7 @@ Sub setFootnotesNumberingLevel(level)
curNum = curNum + 1
EndIf
Else
labelNum = CInt(label)
labelNum = CLng(label)
If labelNum &gt; 0 Then
If level &lt; 1 Then
footnoteText.setLabel(&quot;&quot;)
@ -137,6 +162,24 @@ Sub setFootnotesNumberingLevel(level)
MsgBox getTranslation(&quot;statusNumberingFinished&quot;)
End Sub
Function isTargetNote(portion As Object, noteType As Integer) As Boolean
If ( portion.TextPortionType = &quot;Footnote&quot; And isEndNote(portion) = CBool(noteType) ) Then
isTargetNote = true
Else
isTargetNote = false
EndIf
End Function
Function isEndNote(portion As Object) As Boolean
If (IsEmpty(portion.Start.EndNote)) Then
isEndNote = false
Else
isEndNote = true
EndIf
End Function
Private Sub doNotTrack
Dim dispatcher As Object
Dim document As Object

View file

@ -1,20 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="FootnotesConfig" dlg:left="99" dlg:top="62" dlg:width="160" dlg:height="98" dlg:closeable="true" dlg:moveable="true">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="FootnotesConfig" dlg:left="99" dlg:top="62" dlg:width="157" dlg:height="170" dlg:closeable="true" dlg:moveable="true">
<dlg:styles>
<dlg:style dlg:style-id="0" dlg:border="none"/>
</dlg:styles>
<dlg:bulletinboard>
<dlg:text dlg:id="Label2" dlg:tab-index="1" dlg:left="158" dlg:top="132" dlg:width="0" dlg:height="2" dlg:value="Label2"/>
<dlg:button dlg:id="CommandButton2" dlg:tab-index="3" dlg:left="77" dlg:top="122" dlg:width="2" dlg:height="0" dlg:value="CommandButton2"/>
<dlg:text dlg:id="Label2" dlg:tab-index="2" dlg:left="158" dlg:top="132" dlg:width="0" dlg:height="2" dlg:value="Label2"/>
<dlg:button dlg:id="CommandButton2" dlg:tab-index="4" dlg:left="77" dlg:top="122" dlg:width="2" dlg:height="0" dlg:value="CommandButton2"/>
<dlg:text dlg:id="Label6" dlg:tab-index="9" dlg:left="9" dlg:top="120" dlg:width="2" dlg:height="0" dlg:value="Label6"/>
<dlg:numericfield dlg:style-id="0" dlg:id="level" dlg:tab-index="6" dlg:left="77" dlg:top="54" dlg:width="17" dlg:height="10"/>
<dlg:button dlg:id="buttonOK" dlg:tab-index="2" dlg:left="5" dlg:top="78" dlg:width="69" dlg:height="17" dlg:value="OK" dlg:button-type="ok"/>
<dlg:button dlg:id="buttonCancel" dlg:tab-index="4" dlg:left="86" dlg:top="78" dlg:width="69" dlg:height="17" dlg:value="Отмена" dlg:button-type="cancel"/>
<dlg:text dlg:id="configText1" dlg:tab-index="8" dlg:left="16" dlg:top="15" dlg:width="109" dlg:height="10" dlg:value="Введите в поле число от 0 до 10"/>
<dlg:text dlg:id="configText3" dlg:tab-index="0" dlg:left="16" dlg:top="41" dlg:width="112" dlg:height="10" dlg:value="Начинать нумерацию сносок заново "/>
<dlg:text dlg:id="configText2" dlg:tab-index="10" dlg:left="16" dlg:top="28" dlg:width="122" dlg:height="10" dlg:value="0 - возврат к стандартной нумерации"/>
<dlg:text dlg:id="configText4" dlg:tab-index="7" dlg:left="16" dlg:top="54" dlg:width="58" dlg:height="10" dlg:value="после заголовков"/>
<dlg:text dlg:id="configText5" dlg:tab-index="5" dlg:left="96" dlg:top="54" dlg:width="24" dlg:height="10" dlg:value="уровня"/>
<dlg:textfield dlg:style-id="0" dlg:id="level" dlg:tab-index="6" dlg:left="75" dlg:top="78" dlg:width="17" dlg:height="10"/>
<dlg:button dlg:id="buttonOK" dlg:tab-index="3" dlg:left="11" dlg:top="146" dlg:width="60" dlg:height="17" dlg:value="OK" dlg:button-type="ok"/>
<dlg:button dlg:id="buttonCancel" dlg:tab-index="0" dlg:left="85" dlg:top="146" dlg:width="60" dlg:height="17" dlg:value="Отмена" dlg:button-type="cancel"/>
<dlg:text dlg:id="configText1" dlg:tab-index="8" dlg:left="14" dlg:top="38" dlg:width="109" dlg:height="10" dlg:value="Введите в поле число от 0 до 10"/>
<dlg:text dlg:id="configText3" dlg:tab-index="1" dlg:left="14" dlg:top="64" dlg:width="112" dlg:height="10" dlg:value="Начинать нумерацию сносок заново "/>
<dlg:text dlg:id="configText2" dlg:tab-index="10" dlg:left="14" dlg:top="52" dlg:width="122" dlg:height="10" dlg:value="0 - возврат к стандартной нумерации"/>
<dlg:text dlg:id="configText4" dlg:tab-index="7" dlg:left="14" dlg:top="78" dlg:width="58" dlg:height="10" dlg:value="после заголовков"/>
<dlg:text dlg:id="configText5" dlg:tab-index="5" dlg:left="94" dlg:top="78" dlg:width="24" dlg:height="10" dlg:value="уровня"/>
<dlg:text dlg:id="notesTypeLabel" dlg:tab-index="11" dlg:left="14" dlg:top="9" dlg:width="39" dlg:height="10" dlg:value="Тип сносок"/>
<dlg:menulist dlg:id="lb_notes_types" dlg:tab-index="12" dlg:left="53" dlg:top="9" dlg:width="91" dlg:height="10" dlg:spin="true"/>
<dlg:titledbox dlg:id="groupByHeadings" dlg:tab-index="13" dlg:left="11" dlg:top="24" dlg:width="134" dlg:height="69">
<dlg:title dlg:value="По заголовкам"/>
</dlg:titledbox>
<dlg:titledbox dlg:id="groupByPages" dlg:tab-index="14" dlg:left="11" dlg:top="100" dlg:width="134" dlg:height="40">
<dlg:title dlg:value="По страницам"/>
</dlg:titledbox>
<dlg:text dlg:id="PerPageRangeLabel" dlg:tab-index="15" dlg:left="14" dlg:top="113" dlg:width="109" dlg:height="10" dlg:value="Задайте диапазон страниц"/>
<dlg:textfield dlg:style-id="0" dlg:id="pageRange" dlg:tab-index="16" dlg:left="14" dlg:top="126" dlg:width="70" dlg:height="10"/>
</dlg:bulletinboard>
</dlg:window>

View file

@ -253,6 +253,24 @@ Function getRussian(identifier As String) As String
Case &quot;OutlineLinksFinished&quot;
getRussian = &quot;Создание ссылок в оглавлении завершено. Если этому сообщению предшествовали предупреждения об ошибках, то после исправления ошибок запустите создание ссылок заново.&quot;
Exit Function
Case &quot;FootnotesConfigDialogFootnotesName&quot;
getRussian = &quot;Обычные сноски&quot;
Exit Function
Case &quot;FootnotesConfigDialogEndnotesName&quot;
getRussian = &quot;Концевые сноски&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesTypeLabel&quot;
getRussian = &quot;Настроить&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesByHeadingsLabel&quot;
getRussian = &quot;По заголовкам&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPage&quot;
getRussian = &quot;По страницам&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPageRangeLabel&quot;
getRussian = &quot;Введите диапазон страниц&quot;
Exit Function
Case Else
getRussian = &quot;Перевод не найден&quot;
End Select
@ -486,6 +504,24 @@ Function getEnglish(identifier As String) As String
Case &quot;OutlineLinksFinished&quot;
getEnglish = &quot;Creating links in the table of contents is complete. If this message was preceded by error warnings, then after correcting the errors, restart creating links in table of contents.&quot;
Exit Function
Case &quot;FootnotesConfigDialogFootnotesName&quot;
getEnglish = &quot;Footnotes&quot;
Exit Function
Case &quot;FootnotesConfigDialogEndnotesName&quot;
getEnglish = &quot;Endnotes&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesTypeLabel&quot;
getEnglish = &quot;Set&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesByHeadingsLabel&quot;
getEnglish = &quot;Per chapter&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPage&quot;
getEnglish = &quot;Per page&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPageRangeLabel&quot;
getEnglish = &quot;Enter the page range &quot;
Exit Function
Case Else
getEnglish = &quot;No translation&quot;
End Select
@ -718,6 +754,24 @@ Function getFrench(identifier As String) As String
Case &quot;OutlineLinksFinished&quot;
getFrench = &quot;La création de liens dans la table des matières est terminée. Si ce message a été précédé d&apos;avertissements d&apos;erreur, après avoir corrigé les erreurs, recommencez à créer des liens.&quot;
Exit Function
Case &quot;FootnotesConfigDialogFootnotesName&quot;
getFrench = &quot;Notes de bas de page &quot;
Exit Function
Case &quot;FootnotesConfigDialogEndnotesName&quot;
getFrench = &quot;Notes de fin &quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesTypeLabel&quot;
getFrench = &quot;Ensemble &quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesByHeadingsLabel&quot;
getFrench = &quot;Par chapitre&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPage&quot;
getFrench = &quot;Par page &quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPageRangeLabel&quot;
getFrench = &quot;Entrez la plage de pages &quot;
Exit Function
Case Else
getFrench = &quot;No translation&quot;
End Select
@ -950,6 +1004,24 @@ Function getCroatian(identifier As String) As String
Case &quot;OutlineLinksFinished&quot;
getCroatian = &quot;Stvaranje veza u sadržaju je završeno. Ako su ovoj poruci prethodila upozorenja o pogrešci, počnite stvarati veze nakon ispravljanja pogrešaka.&quot;
Exit Function
Case &quot;FootnotesConfigDialogFootnotesName&quot;
getCroatian = &quot;Fusnote &quot;
Exit Function
Case &quot;FootnotesConfigDialogEndnotesName&quot;
getCroatian = &quot;Bilješke &quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesTypeLabel&quot;
getCroatian = &quot;Postavi&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesByHeadingsLabel&quot;
getCroatian = &quot;Po poglavlju&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPage&quot;
getCroatian = &quot;Po stranici &quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPageRangeLabel&quot;
getCroatian = &quot;Unesite raspon stranica &quot;
Exit Function
Case Else
getCroatian = &quot;No translation&quot;
End Select
@ -1182,6 +1254,24 @@ Function getSerbian(identifier As String) As String
Case &quot;OutlineLinksFinished&quot;
getSerbian = &quot;Стварање веза у табели садржаја је завршено. Ако су овој поруци претходила упозорења о грешци, након исправљања грешака поново почните стварати везе.&quot;
Exit Function
Case &quot;FootnotesConfigDialogFootnotesName&quot;
getSerbian = &quot;Фусноте&quot;
Exit Function
Case &quot;FootnotesConfigDialogEndnotesName&quot;
getSerbian = &quot;Енднотес &quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesTypeLabel&quot;
getSerbian = &quot;Комплет&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesByHeadingsLabel&quot;
getSerbian = &quot;По поглављу&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPage&quot;
getSerbian = &quot;По страни &quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPageRangeLabel&quot;
getSerbian = &quot;Унесите опсег страница &quot;
Exit Function
Case Else
getSerbian = &quot;No translation&quot;
End Select
@ -1414,6 +1504,24 @@ Function getBosnian(identifier As String) As String
Case &quot;OutlineLinksFinished&quot;
getBosnian = &quot;Stvaranje veza u sadržaju je završeno. Ako su ovoj poruci prethodila upozorenja o pogrešci, počnite stvarati veze nakon ispravljanja pogrešaka.&quot;
Exit Function
Case &quot;FootnotesConfigDialogFootnotesName&quot;
getBosnian = &quot;Fusnote &quot;
Exit Function
Case &quot;FootnotesConfigDialogEndnotesName&quot;
getBosnian = &quot;Bilješke &quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesTypeLabel&quot;
getBosnian = &quot;Set&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesByHeadingsLabel&quot;
getBosnian = &quot;Po poglavlju&quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPage&quot;
getBosnian = &quot;Po stranici &quot;
Exit Function
Case &quot;FootnotesConfigDialogNotesPerPageRangeLabel&quot;
getBosnian = &quot;Unesite raspon stranica &quot;
Exit Function
Case Else
getBosnian = &quot;No translation&quot;
End Select

Binary file not shown.