update ooo310-m15
[ooovba.git] / sw / inc / IDocumentBookmarkAccess.hxx
blobfbecd8ce8eaa7ea13492bc0103cdfe1208cb69ce
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: IDocumentBookmarkAccess.hxx,v $
10 * $Revision: 1.6 $
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>
36 class SwBookmark;
37 class SwFieldBookmark;
38 class SwBookmarks;
39 class SwPaM;
40 class KeyCode;
41 class String;
42 struct SwPosition;
43 class SwTxtNode;
45 /** Provides access to the bookmarks of a document.
47 class IDocumentBookmarkAccess
49 public:
50 enum BookmarkType
52 BOOKMARK,
53 MARK,
54 DDE_BOOKMARK,
55 UNO_BOOKMARK,
56 // --> OD 2007-10-11 #i81002# - bookmark type for cross-references
57 CROSSREF_BOOKMARK,
58 // <--
59 // FIELDMARK, // for future use...
60 FORM_FIELDMARK_TEXT,
61 FORM_FIELDMARK_NO_TEXT
64 // --> OD 2007-11-16 #i83479#
65 enum CrossReferenceBookmarkSubType
67 HEADING,
68 NUMITEM
70 // <--
72 public:
73 /** Returns all bookmarks set at the document.
75 @returns
76 the bookmarks set at the document.
78 virtual const SwBookmarks& getBookmarks() const = 0;
80 /** Generates a new bookmark in the document.
82 @param rPaM
83 [in] the location of the new bookmark.
85 @param rKC
86 [in] ???
88 @param rName
89 [in] the name of the new bookmark.
91 @param rShortName
92 [in] the short name of the new bookmark.
94 @param eMark
95 [in] the type of the new bookmark.
97 @returns
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.
106 @param nPos
107 [in] the position of the bookmark to be deleted.
109 virtual void deleteBookmark( /*[in]*/sal_uInt16 nPos ) = 0;
111 /** Deletes a bookmark.
113 @param rName
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
119 name schema
121 OD 2007-10-24 #i81002#
123 @author OD
125 @param rName
126 [in] the name to be checked.
128 @returns
129 boolean indicating , if the name fits or not
131 virtual bool isCrossRefBookmarkName( /*[in]*/const String& rName ) = 0;
133 /** Find a bookmark.
135 @param rName
136 [in] the name of the bookmark to be found.
138 @returns
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
145 used.
147 @param rName
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.
154 @param bBkmrk
155 [in] if set, only "real" bookmarks are considered.
157 @returns
158 the number of bookmarks.
160 virtual sal_uInt16 getBookmarkCount( /*[in]*/bool bBkmrk) const = 0;
162 /** Get a bookmark.
164 @param nPos
165 [in] the position of the bookmark in the bookmark container.
167 @param bBkmrk
168 [in] if set, only "real" bookmarks are considered.
170 @returns
171 the bookmark.
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#
179 @author OD
181 @param rTxtNode
182 [in] reference to text node, whose cross-reference bookmark name has to be returned.
184 @param nCrossRefType
185 [in] sub type of cross-reference bookmark, whose name has to be returned.
187 @returns
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#
200 @author OD
202 @param rTxtNode
203 [in] reference to text node, at which the cross-reference bookmark has to be generated.
205 @param nCrossRefType
206 [in] sub type of cross-reference bookmark.
208 @returns
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;
221 protected:
222 virtual ~IDocumentBookmarkAccess() {};
225 namespace bookmarkfunc
227 /** return the prefix used for cross-reference bookmark for headings
229 OD 2007-11-16 #i83479#
231 @author OD
233 const String getHeadingCrossRefBookmarkNamePrefix();
235 /** return the prefix used for cross-reference bookmark for numbered items
237 OD 2007-11-16 #i83479#
239 @author OD
241 const String getNumItemCrossRefBookmarkNamePrefix();
243 /** Checks, if the given name fits to the heading cross-reference bookmark
244 name schema
246 OD 2007-11-09 #i81002#
248 @author OD
250 @param rName
251 [in] the name to be checked.
253 @returns
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
259 bookmark name schema
261 OD 2007-11-09 #i81002#
263 @author OD
265 @param rName
266 [in] the name to be checked.
268 @returns
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#
277 @author OD
279 String generateNewCrossRefBookmarkName(
280 /*[in]*/const IDocumentBookmarkAccess::CrossReferenceBookmarkSubType nSubType );
282 #endif // IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED