Fixed bidirectional link macro

This commit is contained in:
Georgy Litvinov 2020-03-17 16:15:31 +01:00
parent 4c94a4486b
commit aed6ba6300
2 changed files with 15 additions and 16 deletions

View file

@ -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 archMark7 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Archive" script:language="StarBasic" script:moduleType="normal">Sub archMark8
End Sub End Sub
@ -25,9 +25,11 @@ Sub resetNotesStyle
End Sub End Sub
Sub createBidirectLink Sub createBidirectLink
Dim oSelections &apos;Contains all of the selections Dim oSelections As Object
Dim oAnchor1 Dim oAnchor1 As Object
Dim oAnchor2 Dim oAnchor2 As Object
Dim oAnchor1Name As String
Dim oAnchor2Name As String
If IsNull(ThisComponent) Then If IsNull(ThisComponent) Then
MsgBox &quot;Ничего не выбрано&quot; MsgBox &quot;Ничего не выбрано&quot;
@ -39,18 +41,9 @@ Sub createBidirectLink
Exit Sub Exit Sub
End If End If
objectsCount = oSelections.getCount() - 1 objectsCount = oSelections.getCount() - 1
If oSelections.getCount() = 0 Then If objectsCount &lt; 2 OR objectsCount &gt; 2 Then
MsgBox &quot;Ничего не выбрано&quot; MsgBox &quot;Нужно выделить два объекта&quot;
Exit Sub Exit Sub End If
End If
If oSelections.getCount() &lt;= 2 Then
MsgBox &quot;Нужно выделить два объекта, а не &quot; + objectsCount
Exit Sub
End If
If oSelections.getCount() &gt; 3 Then
MsgBox &quot;Нужно выделить только два объекта, а не &quot; + objectsCount
Exit Sub
End If
oAnchor1 = oSelections.getByIndex(1) oAnchor1 = oSelections.getByIndex(1)
oAnchor2 = oSelections.getByIndex(2) oAnchor2 = oSelections.getByIndex(2)
@ -464,8 +457,13 @@ Sub replaceParaStyle
MsgBox &quot;Стили не различаются&quot; MsgBox &quot;Стили не различаются&quot;
Exit sub Exit sub
EndIf EndIf
If oldStyleName &lt;&gt; &quot;&quot; Then If oldStyleName &lt;&gt; &quot;&quot; Then
oldStyle = paraStyles.getByName(oldStyleName) oldStyle = paraStyles.getByName(oldStyleName)
If NOT oldStyle.isUserDefined Then
MsgBox &quot;Невозвожно заменять встроенные стили&quot;
Exit sub
EndIf
oldStyle.ParentStyle = newStyleName oldStyle.ParentStyle = newStyleName
paraStyles.removeByName(oldStyleName) paraStyles.removeByName(oldStyleName)
EndIf EndIf

View file

@ -9,4 +9,5 @@
<library:element library:name="Album"/> <library:element library:name="Album"/>
<library:element library:name="Archive"/> <library:element library:name="Archive"/>
<library:element library:name="MakeUp"/> <library:element library:name="MakeUp"/>
<library:element library:name="PageStyles"/>
</library:library> </library:library>