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: flditem.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 ************************************************************************/
30 #ifndef _SVX_FLDITEM_HXX
31 #define _SVX_FLDITEM_HXX
33 #include <i18npool/lang.h>
34 #include <tools/time.hxx>
35 #include <tools/date.hxx>
36 #include <tools/pstm.hxx>
37 #include <bf_svtools/poolitem.hxx>
38 #include <bf_svx/itemdata.hxx>
43 class SvNumberFormatter
;
49 // class SvxFieldItem ---------------------------------------------------
53 class SvxFieldData
: public SvPersistBase
56 SV_DECL_PERSIST1( SvxFieldData
, SvPersistBase
, 1 )
59 virtual ~SvxFieldData();
61 virtual SvxFieldData
* Clone() const;
62 virtual int operator==( const SvxFieldData
& ) const;
64 virtual MetaAction
* createBeginComment() const;
65 virtual MetaAction
* createEndComment() const;
70 In diesem Item wird ein Feld (SvxFieldData) gespeichert.
71 Das Feld gehoert dem Item.
72 Das Feld selbst wird durch eine Ableitung von SvxFieldData bestimmt. (RTTI)
75 class SvxFieldItem
: public SfxPoolItem
80 SvxFieldItem( SvxFieldData
* pField
, const USHORT nId
);
85 SvxFieldItem( const SvxFieldData
& rField
, const USHORT nId
= ITEMID_FIELD
);
86 SvxFieldItem( const SvxFieldItem
& rItem
);
89 virtual int operator==( const SfxPoolItem
& ) const;
90 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
91 virtual SfxPoolItem
* Create( SvStream
&, USHORT nVer
) const;
92 virtual SvStream
& Store( SvStream
& , USHORT nItemVersion
) const;
94 const SvxFieldData
* GetField() const { return pField
; }
95 static SvClassManager
& GetClassManager() { return ITEMDATA()->GetClassManager(); }
98 // =================================================================
99 // Es folgen die Ableitungen von SvxFieldData...
100 // =================================================================
102 #define SVX_DATEFIELD 2
103 #define SVX_URLFIELD 3
105 #define SVX_PAGEFIELD 100 // Ex-Calc-Felder
106 #define SVX_PAGESFIELD 101
107 #define SVX_TIMEFIELD 102
108 #define SVX_FILEFIELD 103
109 #define SVX_TABLEFIELD 104
110 #define SVX_EXT_TIMEFIELD 105
111 #define SVX_EXT_FILEFIELD 106
112 #define SVX_AUTHORFIELD 107
114 #define SVX_USERFIELD 200 // Ab hier eigene Felder, nicht im SVX
116 enum SvxDateType
{ SVXDATETYPE_FIX
, SVXDATETYPE_VAR
};
117 enum SvxDateFormat
{ SVXDATEFORMAT_APPDEFAULT
, // Wie in App eingestellt
118 SVXDATEFORMAT_SYSTEM
, // Wie im System eingestellt
119 SVXDATEFORMAT_STDSMALL
,
120 SVXDATEFORMAT_STDBIG
,
121 SVXDATEFORMAT_A
, // 13.02.96
122 SVXDATEFORMAT_B
, // 13.02.1996
123 SVXDATEFORMAT_C
, // 13.Feb 1996
124 SVXDATEFORMAT_D
, // 13.Februar 1996
125 SVXDATEFORMAT_E
, // Die, 13.Februar 1996
126 SVXDATEFORMAT_F
// Dienstag, 13.Februar 1996
129 class SvxDateField
: public SvxFieldData
133 SvxDateFormat eFormat
;
136 SV_DECL_PERSIST1( SvxDateField
, SvxFieldData
, SVX_DATEFIELD
)
139 SvxDateField( const Date
& rDate
,
140 SvxDateType eType
= SVXDATETYPE_VAR
,
141 SvxDateFormat eFormat
= SVXDATEFORMAT_STDSMALL
);
143 sal_uInt32
GetFixDate() const { return nFixDate
; }
144 void SetFixDate( const Date
& rDate
) { nFixDate
= rDate
.GetDate(); }
146 SvxDateType
GetType() const { return eType
; }
147 void SetType( SvxDateType eTp
) { eType
= eTp
; }
149 SvxDateFormat
GetFormat() const { return eFormat
; }
150 void SetFormat( SvxDateFormat eFmt
) { eFormat
= eFmt
; }
152 // deprecated, to be removed
153 String
GetFormatted( LanguageType eLanguage
, LanguageType eFormat
) const;
156 virtual SvxFieldData
* Clone() const;
157 virtual int operator==( const SvxFieldData
& ) const;
161 enum SvxURLFormat
{ SVXURLFORMAT_APPDEFAULT
, // Wie in App eingestellt
162 SVXURLFORMAT_URL
, // URL darstellen
163 SVXURLFORMAT_REPR
// Repraesentation darstellen
166 class SvxURLField
: public SvxFieldData
169 SvxURLFormat eFormat
;
170 XubString aURL
; // URL-Adresse
171 XubString aRepresentation
; // Was wird dargestellt
172 XubString aTargetFrame
; // In welchem Frame
175 SV_DECL_PERSIST1( SvxURLField
, SvxFieldData
, SVX_URLFIELD
)
178 SvxURLField( const XubString
& rURL
, const XubString
& rRepres
, SvxURLFormat eFmt
= SVXURLFORMAT_URL
);
180 const XubString
& GetURL() const { return aURL
; }
181 void SetURL( const XubString
& rURL
) { aURL
= rURL
; }
183 const XubString
& GetRepresentation() const { return aRepresentation
; }
184 void SetRepresentation( const XubString
& rRep
) { aRepresentation
= rRep
; }
186 const XubString
& GetTargetFrame() const { return aTargetFrame
; }
187 void SetTargetFrame( const XubString
& rFrm
) { aTargetFrame
= rFrm
; }
189 SvxURLFormat
GetFormat() const { return eFormat
; }
190 void SetFormat( SvxURLFormat eFmt
) { eFormat
= eFmt
; }
192 virtual SvxFieldData
* Clone() const;
193 virtual int operator==( const SvxFieldData
& ) const;
197 class SvxPageField
: public SvxFieldData
200 SV_DECL_PERSIST1( SvxPageField
, SvxFieldData
, SVX_PAGEFIELD
)
202 virtual SvxFieldData
* Clone() const;
203 virtual int operator==( const SvxFieldData
& ) const;
207 class SvxPagesField
: public SvxFieldData
210 SV_DECL_PERSIST1( SvxPagesField
, SvxFieldData
, SVX_PAGESFIELD
)
212 virtual SvxFieldData
* Clone() const;
213 virtual int operator==( const SvxFieldData
& ) const;
216 class SvxTimeField
: public SvxFieldData
219 SV_DECL_PERSIST1( SvxTimeField
, SvxFieldData
, SVX_TIMEFIELD
)
221 virtual SvxFieldData
* Clone() const;
222 virtual int operator==( const SvxFieldData
& ) const;
226 class SvxFileField
: public SvxFieldData
229 SV_DECL_PERSIST1( SvxFileField
, SvxFieldData
, SVX_FILEFIELD
)
231 virtual SvxFieldData
* Clone() const;
232 virtual int operator==( const SvxFieldData
& ) const;
235 class SvxTableField
: public SvxFieldData
238 SV_DECL_PERSIST1( SvxTableField
, SvxFieldData
, SVX_TABLEFIELD
)
240 virtual SvxFieldData
* Clone() const;
241 virtual int operator==( const SvxFieldData
& ) const;
244 enum SvxTimeType
{ SVXTIMETYPE_FIX
, SVXTIMETYPE_VAR
};
245 enum SvxTimeFormat
{ SVXTIMEFORMAT_APPDEFAULT
, // Wie in App eingestellt
246 SVXTIMEFORMAT_SYSTEM
, // Wie im System eingestellt
247 SVXTIMEFORMAT_STANDARD
,
248 SVXTIMEFORMAT_24_HM
, // 13:49
249 SVXTIMEFORMAT_24_HMS
, // 13:49:38
250 SVXTIMEFORMAT_24_HMSH
, // 13:49:38.78
251 SVXTIMEFORMAT_12_HM
, // 01:49
252 SVXTIMEFORMAT_12_HMS
, // 01:49:38
253 SVXTIMEFORMAT_12_HMSH
, // 01:49:38.78
254 SVXTIMEFORMAT_AM_HM
, // 01:49 PM
255 SVXTIMEFORMAT_AM_HMS
, // 01:49:38 PM
256 SVXTIMEFORMAT_AM_HMSH
// 01:49:38.78 PM
259 class SvxExtTimeField
: public SvxFieldData
264 SvxTimeFormat eFormat
;
267 SV_DECL_PERSIST1( SvxExtTimeField
, SvxFieldData
, SVX_EXT_TIMEFIELD
)
269 SvxExtTimeField( const Time
& rTime
,
270 SvxTimeType eType
= SVXTIMETYPE_VAR
,
271 SvxTimeFormat eFormat
= SVXTIMEFORMAT_STANDARD
);
273 sal_uInt32
GetFixTime() const { return nFixTime
; }
274 void SetFixTime( const Time
& rTime
) { nFixTime
= rTime
.GetTime(); }
276 SvxTimeType
GetType() const { return eType
; }
277 void SetType( SvxTimeType eTp
) { eType
= eTp
; }
279 SvxTimeFormat
GetFormat() const { return eFormat
; }
280 void SetFormat( SvxTimeFormat eFmt
) { eFormat
= eFmt
; }
283 // If eLanguage==LANGUAGE_DONTKNOW the language/country
284 // used in number formatter initialization is taken.
285 String
GetFormatted( SvNumberFormatter
& rFormatter
,
286 LanguageType eLanguage
) const;
288 virtual SvxFieldData
* Clone() const;
289 virtual int operator==( const SvxFieldData
& ) const;
293 enum SvxFileType
{ SVXFILETYPE_FIX
, SVXFILETYPE_VAR
};
294 enum SvxFileFormat
{ SVXFILEFORMAT_NAME_EXT
, // Dateiname mit Extension
295 SVXFILEFORMAT_FULLPATH
, // vollst„ndiger Pfad
296 SVXFILEFORMAT_PATH
, // nur Pfad
297 SVXFILEFORMAT_NAME
// nur Dateiname
300 class SvxExtFileField
: public SvxFieldData
305 SvxFileFormat eFormat
;
308 SV_DECL_PERSIST1( SvxExtFileField
, SvxFieldData
, SVX_EXT_FILEFIELD
)
310 SvxExtFileField( const XubString
& rString
,
311 SvxFileType eType
= SVXFILETYPE_VAR
,
312 SvxFileFormat eFormat
= SVXFILEFORMAT_FULLPATH
);
314 String
GetFile() const { return aFile
; }
315 void SetFile( const XubString
& rString
) { aFile
= rString
; }
317 SvxFileType
GetType() const { return eType
; }
318 void SetType( SvxFileType eTp
) { eType
= eTp
; }
320 SvxFileFormat
GetFormat() const { return eFormat
; }
321 void SetFormat( SvxFileFormat eFmt
) { eFormat
= eFmt
; }
323 virtual SvxFieldData
* Clone() const;
324 virtual int operator==( const SvxFieldData
& ) const;
327 enum SvxAuthorType
{ SVXAUTHORTYPE_FIX
, SVXAUTHORTYPE_VAR
};
328 enum SvxAuthorFormat
{ SVXAUTHORFORMAT_FULLNAME
, // vollst„ndiger Name
329 SVXAUTHORFORMAT_NAME
, // nur Nachname
330 SVXAUTHORFORMAT_FIRSTNAME
, // nur Vorname
331 SVXAUTHORFORMAT_SHORTNAME
// Initialen
334 class SvxAuthorField
: public SvxFieldData
338 XubString aFirstName
;
339 XubString aShortName
;
341 SvxAuthorFormat eFormat
;
344 SV_DECL_PERSIST1( SvxAuthorField
, SvxFieldData
, SVX_AUTHORFIELD
)
346 SvxAuthorField( const SvxAddressItem
& rAdrItem
,
347 SvxAuthorType eType
= SVXAUTHORTYPE_VAR
,
348 SvxAuthorFormat eFormat
= SVXAUTHORFORMAT_FULLNAME
);
350 XubString
GetName() const { return aName
; }
351 void SetName( const XubString
& rString
) { aName
= rString
; }
353 XubString
GetFirstName() const { return aFirstName
; }
354 void SetFirstName( const XubString
& rString
) { aFirstName
= rString
; }
356 XubString
GetShortName() const { return aShortName
; }
357 void SetShortName( const XubString
& rString
) { aShortName
= rString
; }
359 SvxAuthorType
GetType() const { return eType
; }
360 void SetType( SvxAuthorType eTp
) { eType
= eTp
; }
362 SvxAuthorFormat
GetFormat() const { return eFormat
; }
363 void SetFormat( SvxAuthorFormat eFmt
) { eFormat
= eFmt
; }
365 XubString
GetFormatted() const;
367 virtual SvxFieldData
* Clone() const;
368 virtual int operator==( const SvxFieldData
& ) const;
373 }//end of namespace binfilter