diff --git a/description.xml b/description.xml index 186ca80..10a71f7 100644 --- a/description.xml +++ b/description.xml @@ -3,7 +3,7 @@ xmlns:dep="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> - + Инструменты для создания электронных изданий diff --git a/ePublishing/Archive.xba b/ePublishing/Archive.xba index 2bcf2e3..70f1c6a 100644 --- a/ePublishing/Archive.xba +++ b/ePublishing/Archive.xba @@ -1,6 +1,6 @@ -Sub archMark27 +Sub archMark29 End Sub @@ -1118,8 +1118,10 @@ End Sub Sub replaceParaStyle dim oldStyleName As String + dim oldStyleNameLocalized As String dim oldStyle As Object dim newStyleName As String + dim newStyleNameLocalized As String dim paragraphStyles As Object dim userInput As Integer Dim listBox As Object @@ -1151,11 +1153,11 @@ Sub replaceParaStyle listBox.addItems(sortedDPSN , 0) oDialog.Title = getTranslation("replaceParaStyleDialogTitle") oDialog.Execute() - newStyleName = oDialog.model.Tag - If newStyleName="0" or newStyleName="" Then + newStyleNameLocalized = oDialog.model.Tag + If newStyleNameLocalized="0" or newStyleNameLocalized="" Then Exit sub EndIf - foundIndex = getIndex(displayParaStyleNames, newStyleName) + foundIndex = getIndex(displayParaStyleNames, newStyleNameLocalized) 'set style system name instead of display name newStyleName = paraStyleNames(foundIndex) @@ -1163,11 +1165,10 @@ Sub replaceParaStyle MsgBox getTranslation("replaceParaStyleStylesEqualsNotification") Exit sub EndIf - If oldStyleName <> "" Then oldStyle = paraStyles.getByName(oldStyleName) If NOT oldStyle.isUserDefined Then - MsgBox getTranslation("replaceParaStyleCurrentStyleIsStandard") + replaceDefaultParaStyle(getLocalizedParaStyleName(oldStyleName), newStyleNameLocalized) Exit sub EndIf oldStyle.ParentStyle = newStyleName @@ -1185,10 +1186,70 @@ Sub replaceParaStyle EndIf EndIf Wend - - End Sub +Function getLocalizedParaStyleName(styleName as String) As String + Dim style As Object + Dim styles As Object + styles = ThisComponent.StyleFamilies + style = styles.getByName(styles.elementNames(1)).getByName(styleName) + getLocalizedParaStyleName = style.DisplayName +End Function + +sub replaceDefaultParaStyle(fromStyle As String, toStyle As String) + + dim document as object + dim dispatcher as object + document = ThisComponent.CurrentController.Frame + dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") + dim args1(21) as new com.sun.star.beans.PropertyValue + args1(0).Name = "SearchItem.StyleFamily" + args1(0).Value = 2 + args1(1).Name = "SearchItem.CellType" + args1(1).Value = 0 + args1(2).Name = "SearchItem.RowDirection" + args1(2).Value = true + args1(3).Name = "SearchItem.AllTables" + args1(3).Value = false + args1(4).Name = "SearchItem.SearchFiltered" + args1(4).Value = false + args1(5).Name = "SearchItem.Backward" + args1(5).Value = false + args1(6).Name = "SearchItem.Pattern" + args1(6).Value = true + args1(7).Name = "SearchItem.Content" + args1(7).Value = false + args1(8).Name = "SearchItem.AsianOptions" + args1(8).Value = false + args1(9).Name = "SearchItem.AlgorithmType" + args1(9).Value = 0 + args1(10).Name = "SearchItem.SearchFlags" + args1(10).Value = 65536 + args1(11).Name = "SearchItem.SearchString" + args1(11).Value = fromStyle + args1(12).Name = "SearchItem.ReplaceString" + args1(12).Value = toStyle + args1(13).Name = "SearchItem.Locale" + args1(13).Value = 255 + args1(14).Name = "SearchItem.ChangedChars" + args1(14).Value = 2 + args1(15).Name = "SearchItem.DeletedChars" + args1(15).Value = 2 + args1(16).Name = "SearchItem.InsertedChars" + args1(16).Value = 2 + args1(17).Name = "SearchItem.TransliterateFlags" + args1(17).Value = 1280 + args1(18).Name = "SearchItem.Command" + args1(18).Value = 3 + args1(19).Name = "SearchItem.SearchFormatted" + args1(19).Value = false + args1(20).Name = "SearchItem.AlgorithmType2" + args1(20).Value = 1 + args1(21).Name = "Quiet" + args1(21).Value = true + dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1()) +end sub + Function getIndex(array As variant, value As variant) As Integer Dim id As Integer Dim nRight As Integer diff --git a/ePublishing/PageStyles.xba b/ePublishing/PageStyles.xba index c45f0f3..b36956c 100644 --- a/ePublishing/PageStyles.xba +++ b/ePublishing/PageStyles.xba @@ -378,4 +378,4 @@ Function customReplace(Source As String, Search As String, NewPart As String) As customReplace = Result End Function - + \ No newline at end of file diff --git a/ePublishing/TOCLinks.xba b/ePublishing/TOCLinks.xba index 1781e80..e8dc25a 100644 --- a/ePublishing/TOCLinks.xba +++ b/ePublishing/TOCLinks.xba @@ -18,6 +18,7 @@ Sub makeLinksWithLevel(level) Dim outline() As Object Dim oAnchor1Name As String Dim oAnchor2Name As String + Dim message As String Dim i As Integer heading = getHeadingWithLevel(level) outline = getOutlineWithLevel(level) @@ -31,7 +32,10 @@ Sub makeLinksWithLevel(level) createLink(outline(i),"",oAnchor2Name) Next i 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 ElseIf Ubound(outline) = -1 Then ' MsgBox (getTranslation("TOCErrorNoContents1") & " " & level & " " & getTranslation("TOCErrorNoContents2")) @@ -131,6 +135,95 @@ Function getOutlineWithLevel(curNum) getOutlineWithLevel = par() 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 rect 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 = True + 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) + rect = pDialog.getPosSize() + oGridControl.setPosSize(10,60,rect.Width - 20,rect.Height - 120, com.sun.star.awt.PosSize.POSSIZE) + + + + + 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) Dim iUB As Integer Dim iLB As Integer diff --git a/ePublishing/Translations.xba b/ePublishing/Translations.xba index a47b9e3..fac044c 100644 --- a/ePublishing/Translations.xba +++ b/ePublishing/Translations.xba @@ -29,7 +29,7 @@ End Function Function getRussian(identifier As String) As String Select Case identifier Case "buttonOk" - getRussian = "Применить" + getRussian = "OK" Exit Function Case "buttonCancel" getRussian = "Отмена" @@ -140,10 +140,10 @@ Function getRussian(identifier As String) As String getRussian = "Число параграфов со стилем Оглавление " Exit Function Case "TOCErrorContentsNotMatchHeadings2" - getRussian = ") не кратно числу Заголовоков" + getRussian = " не кратно числу Заголовоков" Exit Function Case "TOCErrorContentsNotMatchHeadings3" - getRussian = "уровня (" + getRussian = "уровня " Exit Function Case "complileJournalIssueConfirmation" getRussian = "Вы уверены, что хотите запустить сборку выпуска ?" @@ -295,6 +295,15 @@ Function getRussian(identifier As String) As String Case "EndnotesConversionTwoOptions" getRussian = "Найдены и стандартные и ручные концевые сноски. Можно сконвертировать стандартные в ручные (установите курсор в нужном параграфе) или ручные в стандартные" Exit Function + Case "tocDialogLabel" + getRussian = "Ошибка" + Exit Function + Case "tocItemText" + getRussian = "Текст оглавления" + Exit Function + Case "headingItemText" + getRussian = "Текст заголовка" + Exit Function Case Else getRussian = "Перевод не найден" End Select @@ -415,10 +424,10 @@ Function getEnglish(identifier As String) As String getEnglish = "Number of paras with style Contents " Exit Function Case "TOCErrorContentsNotMatchHeadings2" - getEnglish = ") dosn't match number of headings with " + getEnglish = " dosn't match number of headings with " Exit Function Case "TOCErrorContentsNotMatchHeadings3" - getEnglish = "level (" + getEnglish = "level " Exit Function Case "complileJournalIssueConfirmation" getEnglish = "Compile journal issue from articles?" @@ -570,6 +579,15 @@ Function getEnglish(identifier As String) As String 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" 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 getEnglish = "No translation" End Select @@ -689,10 +707,10 @@ Function getFrench(identifier As String) As String getFrench = "Nombre de paragraphes avec style Table des matières." Exit Function Case "TOCErrorContentsNotMatchHeadings2" - getFrench = ") n'est pas un multiple du nombre de titres" + getFrench = " n'est pas un multiple du nombre de titres" Exit Function Case "TOCErrorContentsNotMatchHeadings3" - getFrench = "au niveau (" + getFrench = "au niveau " Exit Function Case "complileJournalIssueConfirmation" 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" 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 + 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 getFrench = "No translation" End Select @@ -963,10 +990,10 @@ Function getCroatian(identifier As String) As String getCroatian = "Broj paragrafa sa stilom Sadržaj" Exit Function Case "TOCErrorContentsNotMatchHeadings2" - getCroatian = ") nije višestruko od broja Zaglavlja" + getCroatian = " nije višestruko od broja Zaglavlja" Exit Function Case "TOCErrorContentsNotMatchHeadings3" - getCroatian = "Nivoa (" + getCroatian = "Nivoa " Exit Function Case "complileJournalIssueConfirmation" getCroatian = "Da li ste sigurni da želite da pokrenete gradnju izdanja ?" @@ -1118,6 +1145,15 @@ Function getCroatian(identifier As String) As String 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" 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 getCroatian = "No translation" End Select @@ -1237,10 +1273,10 @@ Function getSerbian(identifier As String) As String getSerbian = "Број параграфа са стилом Садржај" Exit Function Case "TOCErrorContentsNotMatchHeadings2" - getSerbian = ") није вишеструко од броја Заглавља" + getSerbian = " није вишеструко од броја Заглавља" Exit Function Case "TOCErrorContentsNotMatchHeadings3" - getSerbian = "Нивоа (" + getSerbian = "Нивоа " Exit Function Case "complileJournalIssueConfirmation" getSerbian = "Да ли сте сигурни да желите да покренете градњу издања ?" @@ -1392,6 +1428,15 @@ Function getSerbian(identifier As String) As String Case "EndnotesConversionTwoOptions" getSerbian = "Пронађене су и стандардне и ручне белешке. Можете претворити стандардни у ручни (поставите курсор у жељени одломак) или ручни у стандардни" Exit Function + Case "tocDialogLabel" + getSerbian = "Грешка" + Exit Function + Case "tocItemText" + getSerbian = "Садржај текста ставке" + Exit Function + Case "headingItemText" + getSerbian = "Текст заглавља" + Exit Function Case Else getSerbian = "No translation" End Select @@ -1511,10 +1556,10 @@ Function getBosnian(identifier As String) As String getBosnian = "Broj paragrafa sa stilom Sadržaj" Exit Function Case "TOCErrorContentsNotMatchHeadings2" - getBosnian = ") nije višestruko od broja Zaglavlja" + getBosnian = " nije višestruko od broja Zaglavlja" Exit Function Case "TOCErrorContentsNotMatchHeadings3" - getBosnian = "Nivoa (" + getBosnian = "Nivoa " Exit Function Case "complileJournalIssueConfirmation" getBosnian = "Da li ste sigurni da želite da pokrenete gradnju izdanja ?" @@ -1666,6 +1711,15 @@ Function getBosnian(identifier As String) As String 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" 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 getBosnian = "No translation" End Select diff --git a/ePublishing/dialog.xlb b/ePublishing/dialog.xlb index a461644..9d58d22 100644 --- a/ePublishing/dialog.xlb +++ b/ePublishing/dialog.xlb @@ -5,4 +5,5 @@ + \ No newline at end of file diff --git a/ePublishing/toc_links.xdl b/ePublishing/toc_links.xdl new file mode 100644 index 0000000..9e0bff5 --- /dev/null +++ b/ePublishing/toc_links.xdl @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epublishing.update.xml b/epublishing.update.xml index c356687..d535c91 100644 --- a/epublishing.update.xml +++ b/epublishing.update.xml @@ -2,9 +2,9 @@ - + - + diff --git a/translations.ods b/translations.ods index b7b2ce0..b56e958 100644 Binary files a/translations.ods and b/translations.ods differ