update dev300-m57
[ooovba.git] / sw / inc / bookmrk.hxx
blob991b40176873d399b2f4fe9b16f5b828678c96bc
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: bookmrk.hxx,v $
10 * $Revision: 1.11 $
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 ************************************************************************/
30 #ifndef _BOOKMRK_HXX
31 #define _BOOKMRK_HXX
33 #include "hintids.hxx" //die Ids der Attribute, vor macitem damit die
34 //die Attribut richtig angezogen werden.
35 #include <svtools/macitem.hxx>
37 #ifndef _KEYCOD_HXX //autogen
38 #include <vcl/keycod.hxx>
39 #endif
40 #ifndef _TOOLS_REF_HXX
41 #include <tools/ref.hxx>
42 #endif
43 #include <IDocumentBookmarkAccess.hxx>
44 #include <calbck.hxx>
45 #include <pam.hxx>
47 #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
48 #define SW_DECL_SWSERVEROBJECT_DEFINED
49 SV_DECL_REF( SwServerObject )
50 #endif
53 struct SwPosition; // fwd Decl. wg. UI
55 class SwBookmark : public SwModify
57 SwPosition *pPos1, *pPos2; // wird im CTOR gesetzt, im DTOR geloescht
58 // pPos1 is always != 0, pPos2 may be 0
59 SwServerObjectRef refObj; // falls DataServer -> Pointer gesetzt
61 protected:
62 String aName;
63 String aShortName;
64 KeyCode aCode;
65 IDocumentBookmarkAccess::BookmarkType eMarkType;
67 SwBookmark( const SwPosition& aPos,
68 const KeyCode& rCode,
69 const String& rName, const String& rShortName);
71 public:
72 TYPEINFO();
74 SwBookmark( const SwPosition& aPos );
75 // --> OD 2007-09-26 #i81002#
76 SwBookmark( const SwPaM& aPaM,
77 const KeyCode& rCode,
78 const String& rName, const String& rShortName);
79 // <--
81 // Beim Loeschen von Text werden Bookmarks mitgeloescht!
82 virtual ~SwBookmark();
84 // --> OD 2007-10-10 #i81002#
85 // made virtual and thus no longer inline
86 virtual const SwPosition& GetBookmarkPos() const;
87 virtual const SwPosition* GetOtherBookmarkPos() const;
88 // <--
90 // nicht undofaehig
91 const String& GetName() const { return aName; }
92 // nicht undofaehig
93 const String& GetShortName() const { return aShortName; }
94 // nicht undofaehig
95 const KeyCode& GetKeyCode() const { return aCode; }
97 // Vergleiche auf Basis der Dokumentposition
98 BOOL operator < (const SwBookmark &) const;
99 BOOL operator ==(const SwBookmark &) const;
100 // falls man wirklich auf gleiche Position abfragen will.
101 BOOL IsEqualPos( const SwBookmark &rBM ) const;
103 BOOL IsFormFieldMark() const { return IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT == eMarkType; }
104 BOOL IsBookMark() const { return IDocumentBookmarkAccess::BOOKMARK == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT == eMarkType; }
105 // // --> OD 2007-10-17 #TESTING#
106 // BOOL IsBookMark() const
107 // {
108 // return IDocumentBookmarkAccess::BOOKMARK == eMarkType ||
109 // IsCrossRefMark();
110 // }
111 // // <--
112 BOOL IsMark() const { return IDocumentBookmarkAccess::MARK == eMarkType; }
113 BOOL IsUNOMark() const { return IDocumentBookmarkAccess::UNO_BOOKMARK == eMarkType; }
114 // --> OD 2007-10-11 #i81002# - bookmark type for cross-references
115 BOOL IsCrossRefMark() const { return IDocumentBookmarkAccess::CROSSREF_BOOKMARK == eMarkType; }
116 // <--
117 void SetType( IDocumentBookmarkAccess::BookmarkType eNewType ) { eMarkType = eNewType; }
118 IDocumentBookmarkAccess::BookmarkType GetType() const { return eMarkType; }
120 // Daten Server-Methoden
121 void SetRefObject( SwServerObject* pObj );
122 const SwServerObject* GetObject() const { return &refObj; }
123 SwServerObject* GetObject() { return &refObj; }
124 BOOL IsServer() const { return refObj.Is(); }
126 // --> OD 2007-10-10 #i81002#
127 // made virtual and thus no longer inline
128 // to access start and end of a bookmark.
129 // start and end may be the same
130 virtual const SwPosition* BookmarkStart() const;
131 virtual const SwPosition* BookmarkEnd() const;
132 // <--
134 // --> OD 2007-09-26 #i81002#
135 virtual void SetBookmarkPos( const SwPosition* pNewPos1 );
136 virtual void SetOtherBookmarkPos( const SwPosition* pNewPos2 );
137 // <--
139 private:
140 // fuer METWARE:
141 // es wird (vorerst) nicht kopiert und nicht zugewiesen
142 SwBookmark(const SwBookmark &);
143 SwBookmark &operator=(const SwBookmark &);
146 class SwMark: public SwBookmark
148 public:
149 SwMark( const SwPosition& aPos,
150 const KeyCode& rCode,
151 const String& rName, const String& rShortName);
154 class SW_DLLPUBLIC SwFieldBookmark : public SwBookmark
156 private:
157 int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List
158 int ffres;
159 bool ffprot;
160 bool ffsize; // 0 = Auto, 1=Exact (see ffhps)
161 int fftypetxt; // Type of text field: 0 = Regular text, 1 = Number, 2 = Date, 3 = Current date, 4 = Current time, 5 = Calculation
162 bool ffrecalc;
163 int ffmaxlen; // Number of characters for text field. Zero means unlimited.
164 int ffhps; // Check box size (half-point sizes).
166 String ffname;
167 String ffhelptext;
169 public:
170 SwFieldBookmark(const SwPosition& aPos,
171 const KeyCode& rCode,
172 const String& rName, const String& rShortName,
173 IDocumentBookmarkAccess::BookmarkType eMark);
175 void SetFieldType(int fftype);
176 int GetFieldType();
178 void SetChecked(bool checked);
179 bool IsChecked();
181 void SetFFName(String aNewName) {
182 this->ffname=aNewName;
185 String GetFFName()
187 return ffname;
190 int GetFFRes() {
191 return ffres;
194 void SetFFRes(int nNew) {
195 this->ffres=nNew;
198 void SetFFHelpText(String newffhelptext) {
199 this->ffhelptext=newffhelptext;
202 String GetFFHelpText() {
203 return ffhelptext;
207 class SwUNOMark: public SwBookmark
209 public:
210 // --> OD 2007-09-26 #i81002#
211 SwUNOMark( const SwPaM& aPaM,
212 const KeyCode& rCode,
213 const String& rName, const String& rShortName);
214 // <--
218 #endif