diff --git a/ePublishing/Archive.xba b/ePublishing/Archive.xba index 361af96..c397e67 100644 --- a/ePublishing/Archive.xba +++ b/ePublishing/Archive.xba @@ -1,6 +1,6 @@ -Sub archMark17 +Sub archMark18 End Sub @@ -53,6 +53,11 @@ Sub createBidirectLink oAnchor1 = oSelections.getByIndex(1) oAnchor2 = oSelections.getByIndex(2) + If isAnchorEmpty(oAnchor1) Or isAnchorEmpty(oAnchor2) Then + MsgBox getTranslation("bidirectLinkSuggestion") + Exit Sub + EndIf + oAnchor1Name = RND_String() oAnchor2Name = RND_String() createAnchor(oAnchor1,oAnchor1Name) @@ -61,6 +66,22 @@ Sub createBidirectLink createLink(oAnchor2,oAnchor2.String,oAnchor1Name) End Sub +Function isAnchorEmpty(anchor As Object) As Boolean + Dim anchorName As String + anchorName = trim(anchor.String) + If Len(anchorName) = 0 Then + isAnchorEmpty = true + Exit Function + EndIf + If Len(anchorName) = 1 AND Chr(10) = anchorName Then + isAnchorEmpty = true + Exit Function + EndIf + + isAnchorEmpty = false +End Function + + Sub createAnchor(targetRange as Object,anchorName as String) dim oViewCursor as object dim document as object diff --git a/ePublishing/Translations.xba b/ePublishing/Translations.xba index 49c867c..740eb63 100644 --- a/ePublishing/Translations.xba +++ b/ePublishing/Translations.xba @@ -65,7 +65,7 @@ Function getRussian(identifier As String) As String getRussian = "Заменить стиль параграфа (с удалением) на выбранный стиль" Exit Function Case "bidirectLinkSuggestion" - getRussian = "Нужно выделить два объекта для связывания" + getRussian = "Выделите два непустых отрывка текста для связывания" Exit Function Case "convertIndesignPageBreaksConfirmation" getRussian = "Запустить восстановление разрывов страниц?" @@ -298,7 +298,7 @@ Function getEnglish(identifier As String) As String getEnglish = "Replace paragraph style (with removal) by choosen one" Exit Function Case "bidirectLinkSuggestion" - getEnglish = "You should select two objects to link" + getEnglish = "Select two not empty text excerpts to create bidirectional links" Exit Function Case "convertIndesignPageBreaksConfirmation" getEnglish = "Start page break conversion from text?" diff --git a/translations.ods b/translations.ods index 4fc4b7a..c5c781c 100644 Binary files a/translations.ods and b/translations.ods differ