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
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 ************************************************************************/
35 #include <boost/scoped_ptr.hpp>
36 #include <boost/noncopyable.hpp>
38 struct SwPosition
; // fwd Decl. wg. UI
41 namespace sw
{ namespace mark
44 : virtual public IMark
45 , private ::boost::noncopyable
49 virtual SwPosition
& GetMarkPos() const
51 virtual const ::rtl::OUString
& GetName() const
53 virtual bool IsCoveringPosition(const SwPosition
& rPos
) const;
54 virtual SwPosition
& GetOtherMarkPos() const
56 OSL_PRECOND(IsExpanded(), "<SwPosition::GetOtherMarkPos(..)> - I have no other Pos set." );
59 virtual SwPosition
& GetMarkStart() const
61 if( !IsExpanded() ) return GetMarkPos( );
62 if ( GetMarkPos( ) < GetOtherMarkPos( ) )
65 return GetOtherMarkPos( );
67 virtual SwPosition
& GetMarkEnd() const
69 if( !IsExpanded() ) return GetMarkPos();
70 if ( GetMarkPos( ) > GetOtherMarkPos( ) )
73 return GetOtherMarkPos( );
75 virtual bool IsExpanded() const
79 virtual void SetName(const ::rtl::OUString
& rName
)
81 virtual void SetMarkPos(const SwPosition
& rNewPos
);
82 virtual void SetOtherMarkPos(const SwPosition
& rNewPos
);
83 virtual void ClearOtherMarkPos()
86 virtual rtl::OUString
toString( ) const;
91 m_pPos1
.swap(m_pPos2
);
94 virtual void InitDoc(SwDoc
* const)
99 MarkBase(const SwPaM
& rPaM
,
100 const ::rtl::OUString
& rName
);
101 ::boost::scoped_ptr
<SwPosition
> m_pPos1
;
102 ::boost::scoped_ptr
<SwPosition
> m_pPos2
;
103 ::rtl::OUString m_aName
;
104 static ::rtl::OUString
GenerateNewName(const ::rtl::OUString
& rPrefix
);
107 class NavigatorReminder
109 , virtual public IMark
112 NavigatorReminder(const SwPaM
& rPaM
);
114 static const ::rtl::OUString our_sNamePrefix
;
121 UnoMark(const SwPaM
& rPaM
);
123 static const ::rtl::OUString our_sNamePrefix
;
130 DdeBookmark(const SwPaM
& rPaM
);
133 const SwServerObject
* GetRefObject() const
134 { return &m_aRefObj
; }
135 SwServerObject
* GetRefObject()
136 { return &m_aRefObj
; }
138 bool IsServer() const
139 { return m_aRefObj
.Is(); }
142 void SetRefObject( SwServerObject
* pObj
);
144 void DeregisterFromDoc(SwDoc
* const pDoc
);
145 virtual ~DdeBookmark();
147 SwServerObjectRef m_aRefObj
;
148 static const ::rtl::OUString our_sNamePrefix
;
152 : virtual public IBookmark
156 Bookmark(const SwPaM
& rPaM
,
157 const KeyCode
& rCode
,
158 const ::rtl::OUString
& rName
,
159 const ::rtl::OUString
& rShortName
);
160 virtual void InitDoc(SwDoc
* const io_Doc
);
162 virtual const ::rtl::OUString
& GetShortName() const
163 { return m_sShortName
; }
164 virtual const KeyCode
& GetKeyCode() const
166 virtual void SetShortName(const ::rtl::OUString
& rShortName
)
167 { m_sShortName
= rShortName
; }
168 virtual void SetKeyCode(const KeyCode
& rCode
)
172 ::rtl::OUString m_sShortName
;
176 : virtual public IFieldmark
180 Fieldmark(const SwPaM
& rPaM
);
183 ::rtl::OUString
GetFieldname() const
184 { return m_aFieldname
; }
185 ::rtl::OUString
GetFieldHelptext() const
186 { return m_aFieldHelptext
; }
188 void addParam( rtl::OUString rParamName
,
189 rtl::OUString rParamValue
,
190 bool bReplaceExisting
= true );
191 void addParam( const char* paramName
, int value
);
192 void addParams(std::vector
<ParamPair_t
>& params
);
193 int getNumOfParams() const;
194 ParamPair_t
getParam(int pos
) const;
195 ParamPair_t
getParam(const char *name
, const char *defaultValue
) const;
198 void SetFieldname(const ::rtl::OUString
& aFieldname
)
199 { m_aFieldname
= aFieldname
; }
200 void SetFieldHelptext(const ::rtl::OUString
& aFieldHelptext
)
201 { m_aFieldHelptext
= aFieldHelptext
; }
204 virtual rtl::OUString
toString( ) const;
206 //int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List
209 ::rtl::OUString m_aFieldname
;
210 ::rtl::OUString m_aFieldHelptext
;
211 static const ::rtl::OUString our_sNamePrefix
;
212 std::vector
<ParamPair_t
> m_params
;
219 TextFieldmark(const SwPaM
& rPaM
);
220 virtual void InitDoc(SwDoc
* const io_pDoc
);
222 //int fftypetxt; // Type of text field: 0 = Regular text, 1 = Number, 2 = Date, 3 = Current date, 4 = Current time, 5 = Calculation
223 //int ffmaxlen; // Number of characters for text field. Zero means unlimited.
226 class CheckboxFieldmark
227 : virtual public ICheckboxFieldmark
231 CheckboxFieldmark(const SwPaM
& rPaM
);
232 virtual void InitDoc(SwDoc
* const io_pDoc
);
233 bool IsChecked() const;
234 void SetChecked(bool checked
);
237 //bool ffsize; // 0 = Auto, 1=Exact (see ffhps)
239 //int ffhps; // Check box size (half-point sizes).