1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: IDocumentBookmarkAccess.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED
32 #define IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED
34 #include <sal/types.h>
37 class SwFieldBookmark
;
45 /** Provides access to the bookmarks of a document.
47 class IDocumentBookmarkAccess
56 // --> OD 2007-10-11 #i81002# - bookmark type for cross-references
59 // FIELDMARK, // for future use...
61 FORM_FIELDMARK_NO_TEXT
64 // --> OD 2007-11-16 #i83479#
65 enum CrossReferenceBookmarkSubType
73 /** Returns all bookmarks set at the document.
76 the bookmarks set at the document.
78 virtual const SwBookmarks
& getBookmarks() const = 0;
80 /** Generates a new bookmark in the document.
83 [in] the location of the new bookmark.
89 [in] the name of the new bookmark.
92 [in] the short name of the new bookmark.
95 [in] the type of the new bookmark.
98 a pointer to the new bookmark.
100 virtual SwBookmark
* makeBookmark( /*[in]*/const SwPaM
& rPaM
, /*[in]*/const KeyCode
& rKC
,
101 /*[in]*/const String
& rName
, /*[in]*/const String
& rShortName
,
102 /*[in]*/BookmarkType eMark
) = 0;
104 /** Deletes a bookmark.
107 [in] the position of the bookmark to be deleted.
109 virtual void deleteBookmark( /*[in]*/sal_uInt16 nPos
) = 0;
111 /** Deletes a bookmark.
114 [in] the name of the bookmark to be deleted.
116 virtual void deleteBookmark( /*[in]*/const String
& rName
) = 0;
118 /** Checks, if the given name fits to the cross-reference bookmark
121 OD 2007-10-24 #i81002#
126 [in] the name to be checked.
129 boolean indicating , if the name fits or not
131 virtual bool isCrossRefBookmarkName( /*[in]*/const String
& rName
) = 0;
136 [in] the name of the bookmark to be found.
139 the position of the bookmark in the bookmark container.
141 virtual sal_uInt16
findBookmark( /*[in]*/const String
& rName
) = 0;
143 /** Generates a unique bookmark name. The name has to be passed to the
144 function, a number will be added to the name if the name is already
148 [in/out] the name of the bookmark.
150 virtual void makeUniqueBookmarkName( /*[in/out]*/String
& rName
) = 0;
152 /** Get the number of ::com::sun::star::text::Bookmarks.
155 [in] if set, only "real" bookmarks are considered.
158 the number of bookmarks.
160 virtual sal_uInt16
getBookmarkCount( /*[in]*/bool bBkmrk
) const = 0;
165 [in] the position of the bookmark in the bookmark container.
168 [in] if set, only "real" bookmarks are considered.
173 virtual SwBookmark
& getBookmark( /*[in]*/sal_uInt16 nPos
, /*[in]*/bool bBkmrk
) = 0;
175 /** Get cross-reference bookmark name for certain text node
177 OD 2007-11-16 #i83479#
182 [in] reference to text node, whose cross-reference bookmark name has to be returned.
185 [in] sub type of cross-reference bookmark, whose name has to be returned.
188 name of cross-reference bookmark of given cross-reference sub type,
189 if such a cross-reference bookmark exists at given textnode.
190 otherwise, empty string
192 virtual String
getCrossRefBookmarkName(
193 /*[in]*/const SwTxtNode
& rTxtNode
,
194 /*[in]*/const CrossReferenceBookmarkSubType nCrossRefType
) const = 0;
196 /** Generates new cross-reference bookmark for given text node of given sub type
198 OD 2007-11-16 #i83479#
203 [in] reference to text node, at which the cross-reference bookmark has to be generated.
206 [in] sub type of cross-reference bookmark.
209 name of generated cross-reference bookmark.
210 If empty, cross-reference bookmark is not generated.
212 virtual String
makeCrossRefBookmark(
213 /*[in]*/const SwTxtNode
& rTxtNode
,
214 /*[in]*/const CrossReferenceBookmarkSubType nCrossRefType
) = 0;
216 virtual SwBookmark
* getFieldBookmarkFor(const SwPosition
&pos
) const = 0;
217 virtual SwFieldBookmark
* getFormFieldBookmarkFor(const SwPosition
&pos
) const = 0;
218 virtual SwBookmark
* getNextFieldBookmarkFor(const SwPosition
&pos
) const = 0;
219 virtual SwBookmark
* getPrevFieldBookmarkFor(const SwPosition
&pos
) const = 0;
222 virtual ~IDocumentBookmarkAccess() {};
225 namespace bookmarkfunc
227 /** return the prefix used for cross-reference bookmark for headings
229 OD 2007-11-16 #i83479#
233 const String
getHeadingCrossRefBookmarkNamePrefix();
235 /** return the prefix used for cross-reference bookmark for numbered items
237 OD 2007-11-16 #i83479#
241 const String
getNumItemCrossRefBookmarkNamePrefix();
243 /** Checks, if the given name fits to the heading cross-reference bookmark
246 OD 2007-11-09 #i81002#
251 [in] the name to be checked.
254 boolean indicating , if the name fits or not
256 bool isHeadingCrossRefBookmarkName( /*[in]*/const String
& rName
);
258 /** Checks, if the given name fits to the numbered item cross-reference
261 OD 2007-11-09 #i81002#
266 [in] the name to be checked.
269 boolean indicating , if the name fits or not
271 bool isNumItemCrossRefBookmarkName( /*[in]*/const String
& rName
);
273 /** generate new name for a cross-reference bookmark of given sub type
275 OD 2007-11-16 #i83479#
279 String
generateNewCrossRefBookmarkName(
280 /*[in]*/const IDocumentBookmarkAccess::CrossReferenceBookmarkSubType nSubType
);
282 #endif // IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED