Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_svx / flditem.hxx
blob61b91011a0d3b2dfb0968ed8806fc9d9571538af
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: flditem.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 _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>
40 class MetaAction;
42 namespace binfilter {
43 class SvNumberFormatter;
45 class SfxItemPool;
47 class SvxAddressItem;
49 // class SvxFieldItem ---------------------------------------------------
51 #ifdef ITEMID_FIELD
53 class SvxFieldData : public SvPersistBase
55 public:
56 SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, 1 )
58 SvxFieldData();
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;
69 [Beschreibung]
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
77 private:
78 SvxFieldData* pField;
80 SvxFieldItem( SvxFieldData* pField, const USHORT nId );
82 public:
83 TYPEINFO();
85 SvxFieldItem( const SvxFieldData& rField, const USHORT nId = ITEMID_FIELD );
86 SvxFieldItem( const SvxFieldItem& rItem );
87 ~SvxFieldItem();
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
131 sal_uInt32 nFixDate;
132 SvxDateType eType;
133 SvxDateFormat eFormat;
135 public:
136 SV_DECL_PERSIST1( SvxDateField, SvxFieldData, SVX_DATEFIELD )
138 SvxDateField();
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;
154 // use this instead
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
168 private:
169 SvxURLFormat eFormat;
170 XubString aURL; // URL-Adresse
171 XubString aRepresentation; // Was wird dargestellt
172 XubString aTargetFrame; // In welchem Frame
174 public:
175 SV_DECL_PERSIST1( SvxURLField, SvxFieldData, SVX_URLFIELD )
177 SvxURLField();
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
199 public:
200 SV_DECL_PERSIST1( SvxPageField, SvxFieldData, SVX_PAGEFIELD )
201 SvxPageField() {}
202 virtual SvxFieldData* Clone() const;
203 virtual int operator==( const SvxFieldData& ) const;
207 class SvxPagesField : public SvxFieldData
209 public:
210 SV_DECL_PERSIST1( SvxPagesField, SvxFieldData, SVX_PAGESFIELD )
211 SvxPagesField() {}
212 virtual SvxFieldData* Clone() const;
213 virtual int operator==( const SvxFieldData& ) const;
216 class SvxTimeField : public SvxFieldData
218 public:
219 SV_DECL_PERSIST1( SvxTimeField, SvxFieldData, SVX_TIMEFIELD )
220 SvxTimeField() {}
221 virtual SvxFieldData* Clone() const;
222 virtual int operator==( const SvxFieldData& ) const;
226 class SvxFileField : public SvxFieldData
228 public:
229 SV_DECL_PERSIST1( SvxFileField, SvxFieldData, SVX_FILEFIELD )
230 SvxFileField() {}
231 virtual SvxFieldData* Clone() const;
232 virtual int operator==( const SvxFieldData& ) const;
235 class SvxTableField : public SvxFieldData
237 public:
238 SV_DECL_PERSIST1( SvxTableField, SvxFieldData, SVX_TABLEFIELD )
239 SvxTableField() {}
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
261 private:
262 sal_uInt32 nFixTime;
263 SvxTimeType eType;
264 SvxTimeFormat eFormat;
266 public:
267 SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, SVX_EXT_TIMEFIELD )
268 SvxExtTimeField();
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; }
282 // use this instead
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
302 private:
303 XubString aFile;
304 SvxFileType eType;
305 SvxFileFormat eFormat;
307 public:
308 SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, SVX_EXT_FILEFIELD )
309 SvxExtFileField();
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
336 private:
337 XubString aName;
338 XubString aFirstName;
339 XubString aShortName;
340 SvxAuthorType eType;
341 SvxAuthorFormat eFormat;
343 public:
344 SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, SVX_AUTHORFIELD )
345 SvxAuthorField();
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;
371 #endif
373 }//end of namespace binfilter
374 #endif