From 6dbe28c2f5883c3a4711546b7365807fbe25e634 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Mon, 14 Sep 2020 22:45:01 +0200 Subject: [PATCH] Dispose bookmark before adding another one with the same name --- ePublishing/Archive.xba | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ePublishing/Archive.xba b/ePublishing/Archive.xba index c397e67..0ad7809 100644 --- a/ePublishing/Archive.xba +++ b/ePublishing/Archive.xba @@ -1,6 +1,6 @@ -Sub archMark18 +Sub archMark19 End Sub @@ -81,11 +81,23 @@ Function isAnchorEmpty(anchor As Object) As Boolean isAnchorEmpty = false End Function +Sub disposeBookmark(bookmarkName As String) + Dim bookmarks As Object + Dim bookmark As Object + Dim elementName As String + elementName = ThisComponent.Links.ElementNames(6) + bookmarks = ThisComponent.Links.getByName(elementName) + If bookmarks.hasByName(bookmarkName) Then + bookmark = bookmarks.getByName(bookmarkName) + bookmark.dispose() + EndIf +End Sub Sub createAnchor(targetRange as Object,anchorName as String) dim oViewCursor as object dim document as object - dim dispatcher as object + dim dispatcher as Object + disposeBookMark(anchorName) document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") oViewCursor = ThisComponent.CurrentController.getViewCursor()