feat: provide more info if headings linking with TOC gone wrong
This commit is contained in:
parent
82dc861e82
commit
05041fc38b
5 changed files with 169 additions and 15 deletions
|
@ -18,6 +18,7 @@ Sub makeLinksWithLevel(level)
|
||||||
Dim outline() As Object
|
Dim outline() As Object
|
||||||
Dim oAnchor1Name As String
|
Dim oAnchor1Name As String
|
||||||
Dim oAnchor2Name As String
|
Dim oAnchor2Name As String
|
||||||
|
Dim message As String
|
||||||
Dim i As Integer
|
Dim i As Integer
|
||||||
heading = getHeadingWithLevel(level)
|
heading = getHeadingWithLevel(level)
|
||||||
outline = getOutlineWithLevel(level)
|
outline = getOutlineWithLevel(level)
|
||||||
|
@ -31,7 +32,10 @@ Sub makeLinksWithLevel(level)
|
||||||
createLink(outline(i),"",oAnchor2Name)
|
createLink(outline(i),"",oAnchor2Name)
|
||||||
Next i
|
Next i
|
||||||
Else
|
Else
|
||||||
MsgBox getTranslation("TOCErrorContentsNotMatchHeadings1") & " " & level & " (" & (Ubound(outline)+1) & getTranslation("TOCErrorContentsNotMatchHeadings2") & " " & level & " " & getTranslation("TOCErrorContentsNotMatchHeadings3") & (Ubound(heading)+1) & ")"
|
message = getTranslation("TOCErrorContentsNotMatchHeadings1") & " " & level & " (" & (Ubound(outline)+1) &") " & _
|
||||||
|
getTranslation("TOCErrorContentsNotMatchHeadings2") & " " & level & " " & _
|
||||||
|
getTranslation("TOCErrorContentsNotMatchHeadings3") & " (" & (Ubound(heading)+1) & ")"
|
||||||
|
showTOCLinksDialog(message, heading(), outline() )
|
||||||
EndIf
|
EndIf
|
||||||
ElseIf Ubound(outline) = -1 Then
|
ElseIf Ubound(outline) = -1 Then
|
||||||
' MsgBox (getTranslation("TOCErrorNoContents1") & " " & level & " " & getTranslation("TOCErrorNoContents2"))
|
' MsgBox (getTranslation("TOCErrorNoContents1") & " " & level & " " & getTranslation("TOCErrorNoContents2"))
|
||||||
|
@ -131,6 +135,93 @@ Function getOutlineWithLevel(curNum)
|
||||||
getOutlineWithLevel = par()
|
getOutlineWithLevel = par()
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Sub showTOCLinksDialog(message As String, heading() As Object, outline() As Object)
|
||||||
|
Dim pDialog As Object
|
||||||
|
Dim grid As Object
|
||||||
|
Dim headingsColumn As Object
|
||||||
|
Dim tocColumn As Object
|
||||||
|
Dim oGridControl As Object
|
||||||
|
Dim oColumnModel As Object
|
||||||
|
Dim oDataModel As Object
|
||||||
|
Dim i As Integer
|
||||||
|
Dim j As Integer
|
||||||
|
Dim outlineCell As String
|
||||||
|
Dim headingCell As String
|
||||||
|
DialogLibraries.LoadLibrary("ePublishing")
|
||||||
|
pDialog = CreateUnoDialog( DialogLibraries.ePublishing.toc_links )
|
||||||
|
|
||||||
|
'grid = pDialog.getControl("grid")
|
||||||
|
grid = pDialog.Model.createInstance("com.sun.star.awt.grid.UnoControlGridModel")
|
||||||
|
grid.Name = "tocGrid"
|
||||||
|
grid.ShowColumnHeader = True
|
||||||
|
grid.ShowRowHeader = false
|
||||||
|
grid.VScroll = true
|
||||||
|
grid.Sizeable = true
|
||||||
|
grid.Step = 0
|
||||||
|
|
||||||
|
oColumnModel = createUnoService( "com.sun.star.awt.grid.DefaultGridColumnModel")
|
||||||
|
|
||||||
|
tocColumn = createUnoService( "com.sun.star.awt.grid.GridColumn")
|
||||||
|
tocColumn.Title = getTranslation("tocItemText")
|
||||||
|
tocColumn.ColumnWidth = 100
|
||||||
|
tocColumn.Resizeable = true
|
||||||
|
'tocColumn.Flexibility = true
|
||||||
|
|
||||||
|
oColumnModel.addColumn( tocColumn )
|
||||||
|
|
||||||
|
headingsColumn = createUnoService( "com.sun.star.awt.grid.GridColumn")
|
||||||
|
headingsColumn.Title = getTranslation("headingItemText")
|
||||||
|
headingsColumn.ColumnWidth = 100
|
||||||
|
headingsColumn.Resizeable = true
|
||||||
|
'headingsColumn.Flexibility = true
|
||||||
|
|
||||||
|
oColumnModel.addColumn( headingsColumn )
|
||||||
|
|
||||||
|
grid.ColumnModel = oColumnModel
|
||||||
|
'grid.Sizeable = False
|
||||||
|
'gridStep = 0
|
||||||
|
|
||||||
|
oDataModel = createUnoService( "com.sun.star.awt.grid.DefaultGridDataModel")
|
||||||
|
If Ubound(outline) > Ubound(heading) Then
|
||||||
|
For i = 0 To (Ubound(outline))
|
||||||
|
outlineCell = outline(i).getString()
|
||||||
|
j = i MOD (Ubound(heading) + 1)
|
||||||
|
headingCell = heading(j).getString()
|
||||||
|
oDataModel.addRow ( i+1 , Array(outlineCell, headingCell) )
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
For i = 0 To (Ubound(heading))
|
||||||
|
headingCell = heading(i).getString()
|
||||||
|
If i > Ubound(outline) Then
|
||||||
|
outlineCell = ""
|
||||||
|
Else
|
||||||
|
outlineCell = outline(i).getString()
|
||||||
|
EndIf
|
||||||
|
oDataModel.addRow ( i+1 , Array(outlineCell, headingCell) )
|
||||||
|
Next i
|
||||||
|
EndIf
|
||||||
|
grid.GridDataModel = oDataModel
|
||||||
|
|
||||||
|
oGridControl = createUnoService("com.sun.star.awt.grid.UnoControlGrid")
|
||||||
|
oGridControl.setModel(grid)
|
||||||
|
pDialog.addControl("gridtab", oGridControl)
|
||||||
|
oGridControl.setPosSize(10,40,850,550, 15)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pDialog.getControl("Ok").Label = getTranslation("buttonOk")
|
||||||
|
pDialog.getControl("message").SetText(message)
|
||||||
|
pDialog.Title = getTranslation("tocDialogLabel")
|
||||||
|
pDialog.Execute()
|
||||||
|
pDialog.dispose()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Sub addToArray(xArray(),vNextElement)
|
Sub addToArray(xArray(),vNextElement)
|
||||||
Dim iUB As Integer
|
Dim iUB As Integer
|
||||||
Dim iLB As Integer
|
Dim iLB As Integer
|
||||||
|
|
|
@ -29,7 +29,7 @@ End Function
|
||||||
Function getRussian(identifier As String) As String
|
Function getRussian(identifier As String) As String
|
||||||
Select Case identifier
|
Select Case identifier
|
||||||
Case "buttonOk"
|
Case "buttonOk"
|
||||||
getRussian = "Применить"
|
getRussian = "OK"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "buttonCancel"
|
Case "buttonCancel"
|
||||||
getRussian = "Отмена"
|
getRussian = "Отмена"
|
||||||
|
@ -140,10 +140,10 @@ Function getRussian(identifier As String) As String
|
||||||
getRussian = "Число параграфов со стилем Оглавление "
|
getRussian = "Число параграфов со стилем Оглавление "
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings2"
|
Case "TOCErrorContentsNotMatchHeadings2"
|
||||||
getRussian = ") не кратно числу Заголовоков"
|
getRussian = " не кратно числу Заголовоков"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings3"
|
Case "TOCErrorContentsNotMatchHeadings3"
|
||||||
getRussian = "уровня ("
|
getRussian = "уровня "
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "complileJournalIssueConfirmation"
|
Case "complileJournalIssueConfirmation"
|
||||||
getRussian = "Вы уверены, что хотите запустить сборку выпуска ?"
|
getRussian = "Вы уверены, что хотите запустить сборку выпуска ?"
|
||||||
|
@ -295,6 +295,15 @@ Function getRussian(identifier As String) As String
|
||||||
Case "EndnotesConversionTwoOptions"
|
Case "EndnotesConversionTwoOptions"
|
||||||
getRussian = "Найдены и стандартные и ручные концевые сноски. Можно сконвертировать стандартные в ручные (установите курсор в нужном параграфе) или ручные в стандартные"
|
getRussian = "Найдены и стандартные и ручные концевые сноски. Можно сконвертировать стандартные в ручные (установите курсор в нужном параграфе) или ручные в стандартные"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "tocDialogLabel"
|
||||||
|
getRussian = "Ошибка"
|
||||||
|
Exit Function
|
||||||
|
Case "tocItemText"
|
||||||
|
getRussian = "Текст оглавления"
|
||||||
|
Exit Function
|
||||||
|
Case "headingItemText"
|
||||||
|
getRussian = "Текст заголовка"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getRussian = "Перевод не найден"
|
getRussian = "Перевод не найден"
|
||||||
End Select
|
End Select
|
||||||
|
@ -415,10 +424,10 @@ Function getEnglish(identifier As String) As String
|
||||||
getEnglish = "Number of paras with style Contents "
|
getEnglish = "Number of paras with style Contents "
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings2"
|
Case "TOCErrorContentsNotMatchHeadings2"
|
||||||
getEnglish = ") dosn't match number of headings with "
|
getEnglish = " dosn't match number of headings with "
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings3"
|
Case "TOCErrorContentsNotMatchHeadings3"
|
||||||
getEnglish = "level ("
|
getEnglish = "level "
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "complileJournalIssueConfirmation"
|
Case "complileJournalIssueConfirmation"
|
||||||
getEnglish = "Compile journal issue from articles?"
|
getEnglish = "Compile journal issue from articles?"
|
||||||
|
@ -570,6 +579,15 @@ Function getEnglish(identifier As String) As String
|
||||||
Case "EndnotesConversionTwoOptions"
|
Case "EndnotesConversionTwoOptions"
|
||||||
getEnglish = "Both standard and manual endnotes are found. You can convert standard to manual (place the cursor in the desired paragraph) or manual to standard"
|
getEnglish = "Both standard and manual endnotes are found. You can convert standard to manual (place the cursor in the desired paragraph) or manual to standard"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "tocDialogLabel"
|
||||||
|
getEnglish = "Error"
|
||||||
|
Exit Function
|
||||||
|
Case "tocItemText"
|
||||||
|
getEnglish = "Contents item text"
|
||||||
|
Exit Function
|
||||||
|
Case "headingItemText"
|
||||||
|
getEnglish = "Heading text"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getEnglish = "No translation"
|
getEnglish = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -689,10 +707,10 @@ Function getFrench(identifier As String) As String
|
||||||
getFrench = "Nombre de paragraphes avec style Table des matières."
|
getFrench = "Nombre de paragraphes avec style Table des matières."
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings2"
|
Case "TOCErrorContentsNotMatchHeadings2"
|
||||||
getFrench = ") n'est pas un multiple du nombre de titres"
|
getFrench = " n'est pas un multiple du nombre de titres"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings3"
|
Case "TOCErrorContentsNotMatchHeadings3"
|
||||||
getFrench = "au niveau ("
|
getFrench = "au niveau "
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "complileJournalIssueConfirmation"
|
Case "complileJournalIssueConfirmation"
|
||||||
getFrench = "Êtes-vous sûr de vouloir compiler un journal à partir d'articles ?"
|
getFrench = "Êtes-vous sûr de vouloir compiler un journal à partir d'articles ?"
|
||||||
|
@ -844,6 +862,15 @@ Function getFrench(identifier As String) As String
|
||||||
Case "EndnotesConversionTwoOptions"
|
Case "EndnotesConversionTwoOptions"
|
||||||
getFrench = "Des notes de fin standard et manuelles sont trouvées. Vous pouvez convertir standard en manuel (placez le curseur dans le paragraphe souhaité) ou manuel en standard"
|
getFrench = "Des notes de fin standard et manuelles sont trouvées. Vous pouvez convertir standard en manuel (placez le curseur dans le paragraphe souhaité) ou manuel en standard"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "tocDialogLabel"
|
||||||
|
getFrench = "Erreur"
|
||||||
|
Exit Function
|
||||||
|
Case "tocItemText"
|
||||||
|
getFrench = "Texte de l'élément de contenu"
|
||||||
|
Exit Function
|
||||||
|
Case "headingItemText"
|
||||||
|
getFrench = "Texte d'en-tête"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getFrench = "No translation"
|
getFrench = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -963,10 +990,10 @@ Function getCroatian(identifier As String) As String
|
||||||
getCroatian = "Broj paragrafa sa stilom Sadržaj"
|
getCroatian = "Broj paragrafa sa stilom Sadržaj"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings2"
|
Case "TOCErrorContentsNotMatchHeadings2"
|
||||||
getCroatian = ") nije višestruko od broja Zaglavlja"
|
getCroatian = " nije višestruko od broja Zaglavlja"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings3"
|
Case "TOCErrorContentsNotMatchHeadings3"
|
||||||
getCroatian = "Nivoa ("
|
getCroatian = "Nivoa "
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "complileJournalIssueConfirmation"
|
Case "complileJournalIssueConfirmation"
|
||||||
getCroatian = "Da li ste sigurni da želite da pokrenete gradnju izdanja ?"
|
getCroatian = "Da li ste sigurni da želite da pokrenete gradnju izdanja ?"
|
||||||
|
@ -1118,6 +1145,15 @@ Function getCroatian(identifier As String) As String
|
||||||
Case "EndnotesConversionTwoOptions"
|
Case "EndnotesConversionTwoOptions"
|
||||||
getCroatian = "Pronađene su i standardne i ručne bilješke. Možete pretvoriti standardni u ručni (postavite kursor u željeni odlomak) ili ručni u standardni"
|
getCroatian = "Pronađene su i standardne i ručne bilješke. Možete pretvoriti standardni u ručni (postavite kursor u željeni odlomak) ili ručni u standardni"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "tocDialogLabel"
|
||||||
|
getCroatian = "Pogreška"
|
||||||
|
Exit Function
|
||||||
|
Case "tocItemText"
|
||||||
|
getCroatian = "Sadržaj teksta stavke"
|
||||||
|
Exit Function
|
||||||
|
Case "headingItemText"
|
||||||
|
getCroatian = "Tekst zaglavlja"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getCroatian = "No translation"
|
getCroatian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -1237,10 +1273,10 @@ Function getSerbian(identifier As String) As String
|
||||||
getSerbian = "Број параграфа са стилом Садржај"
|
getSerbian = "Број параграфа са стилом Садржај"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings2"
|
Case "TOCErrorContentsNotMatchHeadings2"
|
||||||
getSerbian = ") није вишеструко од броја Заглавља"
|
getSerbian = " није вишеструко од броја Заглавља"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings3"
|
Case "TOCErrorContentsNotMatchHeadings3"
|
||||||
getSerbian = "Нивоа ("
|
getSerbian = "Нивоа "
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "complileJournalIssueConfirmation"
|
Case "complileJournalIssueConfirmation"
|
||||||
getSerbian = "Да ли сте сигурни да желите да покренете градњу издања ?"
|
getSerbian = "Да ли сте сигурни да желите да покренете градњу издања ?"
|
||||||
|
@ -1392,6 +1428,15 @@ Function getSerbian(identifier As String) As String
|
||||||
Case "EndnotesConversionTwoOptions"
|
Case "EndnotesConversionTwoOptions"
|
||||||
getSerbian = "Пронађене су и стандардне и ручне белешке. Можете претворити стандардни у ручни (поставите курсор у жељени одломак) или ручни у стандардни"
|
getSerbian = "Пронађене су и стандардне и ручне белешке. Можете претворити стандардни у ручни (поставите курсор у жељени одломак) или ручни у стандардни"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "tocDialogLabel"
|
||||||
|
getSerbian = "Грешка"
|
||||||
|
Exit Function
|
||||||
|
Case "tocItemText"
|
||||||
|
getSerbian = "Садржај текста ставке"
|
||||||
|
Exit Function
|
||||||
|
Case "headingItemText"
|
||||||
|
getSerbian = "Текст заглавља"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getSerbian = "No translation"
|
getSerbian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -1511,10 +1556,10 @@ Function getBosnian(identifier As String) As String
|
||||||
getBosnian = "Broj paragrafa sa stilom Sadržaj"
|
getBosnian = "Broj paragrafa sa stilom Sadržaj"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings2"
|
Case "TOCErrorContentsNotMatchHeadings2"
|
||||||
getBosnian = ") nije višestruko od broja Zaglavlja"
|
getBosnian = " nije višestruko od broja Zaglavlja"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "TOCErrorContentsNotMatchHeadings3"
|
Case "TOCErrorContentsNotMatchHeadings3"
|
||||||
getBosnian = "Nivoa ("
|
getBosnian = "Nivoa "
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "complileJournalIssueConfirmation"
|
Case "complileJournalIssueConfirmation"
|
||||||
getBosnian = "Da li ste sigurni da želite da pokrenete gradnju izdanja ?"
|
getBosnian = "Da li ste sigurni da želite da pokrenete gradnju izdanja ?"
|
||||||
|
@ -1666,6 +1711,15 @@ Function getBosnian(identifier As String) As String
|
||||||
Case "EndnotesConversionTwoOptions"
|
Case "EndnotesConversionTwoOptions"
|
||||||
getBosnian = "Pronađene su i standardne i ručne bilješke. Možete pretvoriti standardni u ručni (postavite kursor u željeni odlomak) ili ručni u standardni"
|
getBosnian = "Pronađene su i standardne i ručne bilješke. Možete pretvoriti standardni u ručni (postavite kursor u željeni odlomak) ili ručni u standardni"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "tocDialogLabel"
|
||||||
|
getBosnian = "Greška"
|
||||||
|
Exit Function
|
||||||
|
Case "tocItemText"
|
||||||
|
getBosnian = "Sadržaj teksta stavke"
|
||||||
|
Exit Function
|
||||||
|
Case "headingItemText"
|
||||||
|
getBosnian = "Tekst zaglavlja"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getBosnian = "No translation"
|
getBosnian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
|
|
@ -5,4 +5,5 @@
|
||||||
<library:element library:name="replaceParaStyle"/>
|
<library:element library:name="replaceParaStyle"/>
|
||||||
<library:element library:name="PageConfig"/>
|
<library:element library:name="PageConfig"/>
|
||||||
<library:element library:name="EndnotesConversion"/>
|
<library:element library:name="EndnotesConversion"/>
|
||||||
|
<library:element library:name="toc_links"/>
|
||||||
</library:library>
|
</library:library>
|
8
ePublishing/toc_links.xdl
Normal file
8
ePublishing/toc_links.xdl
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?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="toc_links" dlg:left="74" dlg:top="15" dlg:width="346" dlg:height="284" dlg:closeable="true" dlg:moveable="true">
|
||||||
|
<dlg:bulletinboard>
|
||||||
|
<dlg:button dlg:id="Ok" dlg:tab-index="0" dlg:left="125" dlg:top="265" dlg:width="96" dlg:height="17" dlg:value="CommandButton1" dlg:button-type="ok"/>
|
||||||
|
<dlg:text dlg:id="message" dlg:tab-index="1" dlg:left="5" dlg:top="4" dlg:width="334" dlg:height="24" dlg:value="message" dlg:align="center" dlg:multiline="true"/>
|
||||||
|
</dlg:bulletinboard>
|
||||||
|
</dlg:window>
|
BIN
translations.ods
BIN
translations.ods
Binary file not shown.
Loading…
Add table
Reference in a new issue