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: bookmrk.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 ************************************************************************/
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>
40 #ifndef _TOOLS_REF_HXX
41 #include <tools/ref.hxx>
43 #include <IDocumentBookmarkAccess.hxx>
47 #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
48 #define SW_DECL_SWSERVEROBJECT_DEFINED
49 SV_DECL_REF( SwServerObject
)
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
65 IDocumentMarkAccess::BookmarkType eMarkType
;
67 SwBookmark( const SwPosition
& aPos
,
69 const String
& rName
, const String
& rShortName
);
74 SwBookmark( const SwPosition
& aPos
);
75 // --> OD 2007-09-26 #i81002#
76 SwBookmark( const SwPaM
& aPaM
,
78 const String
& rName
, const String
& rShortName
);
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;
91 const String
& GetName() const { return aName
; }
93 const String
& GetShortName() const { return aShortName
; }
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
108 // return IDocumentBookmarkAccess::BOOKMARK == eMarkType ||
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
; }
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;
134 // --> OD 2007-09-26 #i81002#
135 virtual void SetBookmarkPos( const SwPosition
* pNewPos1
);
136 virtual void SetOtherBookmarkPos( const SwPosition
* pNewPos2
);
141 // es wird (vorerst) nicht kopiert und nicht zugewiesen
142 SwBookmark(const SwBookmark
&);
143 SwBookmark
&operator=(const SwBookmark
&);
146 class SwMark
: public SwBookmark
149 SwMark( const SwPosition
& aPos
,
150 const KeyCode
& rCode
,
151 const String
& rName
, const String
& rShortName
);
154 class SW_DLLPUBLIC SwFieldBookmark
: public SwBookmark
157 int fftype
; // Type: 0 = Text, 1 = Check Box, 2 = List
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
163 int ffmaxlen
; // Number of characters for text field. Zero means unlimited.
164 int ffhps
; // Check box size (half-point sizes).
170 SwFieldBookmark(const SwPosition
& aPos
,
171 const KeyCode
& rCode
,
172 const String
& rName
, const String
& rShortName
,
173 IDocumentMarkAccess::BookmarkType eMark
);
175 void SetFieldType(int fftype
);
178 void SetChecked(bool checked
);
181 void SetFFName(String aNewName
) {
182 this->ffname
=aNewName
;
194 void SetFFRes(int nNew
) {
198 void SetFFHelpText(String newffhelptext
) {
199 this->ffhelptext
=newffhelptext
;
202 String
GetFFHelpText() {
207 class SwUNOMark
: public SwBookmark
210 // --> OD 2007-09-26 #i81002#
211 SwUNOMark( const SwPaM
& aPaM
,
212 const KeyCode
& rCode
,
213 const String
& rName
, const String
& rShortName
);