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 <sfx2/Metadatable.hxx>
37 #include <boost/scoped_ptr.hpp>
38 #include <boost/noncopyable.hpp>
40 struct SwPosition
; // fwd Decl. wg. UI
43 namespace sw
{ namespace mark
46 : virtual public IMark
47 , private ::boost::noncopyable
51 virtual SwPosition
& GetMarkPos() const
53 virtual const ::rtl::OUString
& GetName() const
55 virtual bool IsCoveringPosition(const SwPosition
& rPos
) const;
56 virtual SwPosition
& GetOtherMarkPos() const
58 OSL_PRECOND(IsExpanded(), "<SwPosition::GetOtherMarkPos(..)> - I have no other Pos set." );
61 virtual SwPosition
& GetMarkStart() const
63 if( !IsExpanded() ) return GetMarkPos( );
64 if ( GetMarkPos( ) < GetOtherMarkPos( ) )
67 return GetOtherMarkPos( );
69 virtual SwPosition
& GetMarkEnd() const
71 if( !IsExpanded() ) return GetMarkPos();
72 if ( GetMarkPos( ) > GetOtherMarkPos( ) )
75 return GetOtherMarkPos( );
77 virtual bool IsExpanded() const
81 virtual void SetName(const ::rtl::OUString
& rName
)
83 virtual void SetMarkPos(const SwPosition
& rNewPos
);
84 virtual void SetOtherMarkPos(const SwPosition
& rNewPos
);
85 virtual void ClearOtherMarkPos()
88 virtual rtl::OUString
toString( ) const;
93 m_pPos1
.swap(m_pPos2
);
96 virtual void InitDoc(SwDoc
* const)
101 MarkBase(const SwPaM
& rPaM
,
102 const ::rtl::OUString
& rName
);
103 ::boost::scoped_ptr
<SwPosition
> m_pPos1
;
104 ::boost::scoped_ptr
<SwPosition
> m_pPos2
;
105 ::rtl::OUString m_aName
;
106 static ::rtl::OUString
GenerateNewName(const ::rtl::OUString
& rPrefix
);
109 class NavigatorReminder
111 , virtual public IMark
114 NavigatorReminder(const SwPaM
& rPaM
);
116 static const ::rtl::OUString our_sNamePrefix
;
123 UnoMark(const SwPaM
& rPaM
);
125 static const ::rtl::OUString our_sNamePrefix
;
132 DdeBookmark(const SwPaM
& rPaM
);
135 const SwServerObject
* GetRefObject() const
136 { return &m_aRefObj
; }
137 SwServerObject
* GetRefObject()
138 { return &m_aRefObj
; }
140 bool IsServer() const
141 { return m_aRefObj
.Is(); }
144 void SetRefObject( SwServerObject
* pObj
);
146 void DeregisterFromDoc(SwDoc
* const pDoc
);
147 virtual ~DdeBookmark();
149 SwServerObjectRef m_aRefObj
;
150 static const ::rtl::OUString our_sNamePrefix
;
154 : virtual public IBookmark
156 , public ::sfx2::Metadatable
159 Bookmark(const SwPaM
& rPaM
,
160 const KeyCode
& rCode
,
161 const ::rtl::OUString
& rName
,
162 const ::rtl::OUString
& rShortName
);
163 virtual void InitDoc(SwDoc
* const io_Doc
);
165 virtual const ::rtl::OUString
& GetShortName() const
166 { return m_sShortName
; }
167 virtual const KeyCode
& GetKeyCode() const
169 virtual void SetShortName(const ::rtl::OUString
& rShortName
)
170 { m_sShortName
= rShortName
; }
171 virtual void SetKeyCode(const KeyCode
& rCode
)
174 // ::sfx2::Metadatable
175 virtual ::sfx2::IXmlIdRegistry
& GetRegistry();
176 virtual bool IsInClipboard() const;
177 virtual bool IsInUndo() const;
178 virtual bool IsInContent() const;
179 virtual ::com::sun::star::uno::Reference
<
180 ::com::sun::star::rdf::XMetadatable
> MakeUnoObject();
184 ::rtl::OUString m_sShortName
;
188 : virtual public IFieldmark
192 Fieldmark(const SwPaM
& rPaM
);
195 ::rtl::OUString
GetFieldname() const
196 { return m_aFieldname
; }
197 ::rtl::OUString
GetFieldHelptext() const
198 { return m_aFieldHelptext
; }
200 void addParam( rtl::OUString rParamName
,
201 rtl::OUString rParamValue
,
202 bool bReplaceExisting
= true );
203 void addParam( const char* paramName
, int value
);
204 void addParams(std::vector
<ParamPair_t
>& params
);
205 int getNumOfParams() const;
206 ParamPair_t
getParam(int pos
) const;
207 ParamPair_t
getParam(const char *name
, const char *defaultValue
) const;
210 void SetFieldname(const ::rtl::OUString
& aFieldname
)
211 { m_aFieldname
= aFieldname
; }
212 void SetFieldHelptext(const ::rtl::OUString
& aFieldHelptext
)
213 { m_aFieldHelptext
= aFieldHelptext
; }
216 virtual rtl::OUString
toString( ) const;
218 //int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List
221 ::rtl::OUString m_aFieldname
;
222 ::rtl::OUString m_aFieldHelptext
;
223 static const ::rtl::OUString our_sNamePrefix
;
224 std::vector
<ParamPair_t
> m_params
;
231 TextFieldmark(const SwPaM
& rPaM
);
232 virtual void InitDoc(SwDoc
* const io_pDoc
);
234 //int fftypetxt; // Type of text field: 0 = Regular text, 1 = Number, 2 = Date, 3 = Current date, 4 = Current time, 5 = Calculation
235 //int ffmaxlen; // Number of characters for text field. Zero means unlimited.
238 class CheckboxFieldmark
239 : virtual public ICheckboxFieldmark
243 CheckboxFieldmark(const SwPaM
& rPaM
);
244 virtual void InitDoc(SwDoc
* const io_pDoc
);
245 bool IsChecked() const;
246 void SetChecked(bool checked
);
249 //bool ffsize; // 0 = Auto, 1=Exact (see ffhps)
251 //int ffhps; // Check box size (half-point sizes).