Forbid creating bidirectional links with empty text
This commit is contained in:
parent
795ce507b7
commit
03b6c75cf3
3 changed files with 24 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Archive" script:language="StarBasic" script:moduleType="normal">Sub archMark17
|
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Archive" script:language="StarBasic" script:moduleType="normal">Sub archMark18
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
@ -53,6 +53,11 @@ Sub createBidirectLink
|
||||||
|
|
||||||
oAnchor1 = oSelections.getByIndex(1)
|
oAnchor1 = oSelections.getByIndex(1)
|
||||||
oAnchor2 = oSelections.getByIndex(2)
|
oAnchor2 = oSelections.getByIndex(2)
|
||||||
|
If isAnchorEmpty(oAnchor1) Or isAnchorEmpty(oAnchor2) Then
|
||||||
|
MsgBox getTranslation("bidirectLinkSuggestion")
|
||||||
|
Exit Sub
|
||||||
|
EndIf
|
||||||
|
|
||||||
oAnchor1Name = RND_String()
|
oAnchor1Name = RND_String()
|
||||||
oAnchor2Name = RND_String()
|
oAnchor2Name = RND_String()
|
||||||
createAnchor(oAnchor1,oAnchor1Name)
|
createAnchor(oAnchor1,oAnchor1Name)
|
||||||
|
@ -61,6 +66,22 @@ Sub createBidirectLink
|
||||||
createLink(oAnchor2,oAnchor2.String,oAnchor1Name)
|
createLink(oAnchor2,oAnchor2.String,oAnchor1Name)
|
||||||
End Sub
|
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)
|
Sub createAnchor(targetRange as Object,anchorName as String)
|
||||||
dim oViewCursor as object
|
dim oViewCursor as object
|
||||||
dim document as object
|
dim document as object
|
||||||
|
|
|
@ -65,7 +65,7 @@ Function getRussian(identifier As String) As String
|
||||||
getRussian = "Заменить стиль параграфа (с удалением) на выбранный стиль"
|
getRussian = "Заменить стиль параграфа (с удалением) на выбранный стиль"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "bidirectLinkSuggestion"
|
Case "bidirectLinkSuggestion"
|
||||||
getRussian = "Нужно выделить два объекта для связывания"
|
getRussian = "Выделите два непустых отрывка текста для связывания"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "convertIndesignPageBreaksConfirmation"
|
Case "convertIndesignPageBreaksConfirmation"
|
||||||
getRussian = "Запустить восстановление разрывов страниц?"
|
getRussian = "Запустить восстановление разрывов страниц?"
|
||||||
|
@ -298,7 +298,7 @@ Function getEnglish(identifier As String) As String
|
||||||
getEnglish = "Replace paragraph style (with removal) by choosen one"
|
getEnglish = "Replace paragraph style (with removal) by choosen one"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "bidirectLinkSuggestion"
|
Case "bidirectLinkSuggestion"
|
||||||
getEnglish = "You should select two objects to link"
|
getEnglish = "Select two not empty text excerpts to create bidirectional links"
|
||||||
Exit Function
|
Exit Function
|
||||||
Case "convertIndesignPageBreaksConfirmation"
|
Case "convertIndesignPageBreaksConfirmation"
|
||||||
getEnglish = "Start page break conversion from text?"
|
getEnglish = "Start page break conversion from text?"
|
||||||
|
|
BIN
translations.ods
BIN
translations.ods
Binary file not shown.
Loading…
Add table
Reference in a new issue