xref: /trunk/main/sw/inc/fldbas.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef SW_FLDBAS_HXX
24cdf0e10cSrcweir #define SW_FLDBAS_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <i18npool/lang.h>
27cdf0e10cSrcweir #include <tools/debug.hxx>
28cdf0e10cSrcweir #include <tools/string.hxx>
29cdf0e10cSrcweir #include "swdllapi.h"
30cdf0e10cSrcweir #include <calbck.hxx>
31cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class SwDoc;
34cdf0e10cSrcweir class SvStringsDtor;
35cdf0e10cSrcweir class SvNumberFormatter;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 
38cdf0e10cSrcweir /*--------------------------------------------------------------------
39cdf0e10cSrcweir     Beschreibung:   die ID's fuer die Feldtypen
40cdf0e10cSrcweir  --------------------------------------------------------------------*/
41cdf0e10cSrcweir 
42cdf0e10cSrcweir enum RES_FIELDS
43cdf0e10cSrcweir {
44cdf0e10cSrcweir // Fuer die alten Dokumente muessen die Field-Which IDS erhalten bleiben !!!!
45cdf0e10cSrcweir     RES_FIELDS_BEGIN,
46cdf0e10cSrcweir     RES_DBFLD = RES_FIELDS_BEGIN,
47cdf0e10cSrcweir     RES_USERFLD,
48cdf0e10cSrcweir     RES_FILENAMEFLD,
49cdf0e10cSrcweir     RES_DBNAMEFLD,
50cdf0e10cSrcweir     RES_DATEFLD,
51cdf0e10cSrcweir     RES_TIMEFLD,
52cdf0e10cSrcweir     RES_PAGENUMBERFLD,
53cdf0e10cSrcweir     RES_AUTHORFLD,
54cdf0e10cSrcweir     RES_CHAPTERFLD,
55cdf0e10cSrcweir     RES_DOCSTATFLD,
56cdf0e10cSrcweir     RES_GETEXPFLD,
57cdf0e10cSrcweir     RES_SETEXPFLD,
58cdf0e10cSrcweir     RES_GETREFFLD,
59cdf0e10cSrcweir     RES_HIDDENTXTFLD,
60cdf0e10cSrcweir     RES_POSTITFLD,
61cdf0e10cSrcweir     RES_FIXDATEFLD,
62cdf0e10cSrcweir     RES_FIXTIMEFLD,
63cdf0e10cSrcweir     RES_REGFLD,
64cdf0e10cSrcweir     RES_VARREGFLD,
65cdf0e10cSrcweir     RES_SETREFFLD,
66cdf0e10cSrcweir     RES_INPUTFLD,
67cdf0e10cSrcweir     RES_MACROFLD,
68cdf0e10cSrcweir     RES_DDEFLD,
69cdf0e10cSrcweir     RES_TABLEFLD,
70cdf0e10cSrcweir     RES_HIDDENPARAFLD,
71cdf0e10cSrcweir     RES_DOCINFOFLD,
72cdf0e10cSrcweir     RES_TEMPLNAMEFLD,
73cdf0e10cSrcweir     RES_DBNEXTSETFLD,
74cdf0e10cSrcweir     RES_DBNUMSETFLD,
75cdf0e10cSrcweir     RES_DBSETNUMBERFLD,
76cdf0e10cSrcweir     RES_EXTUSERFLD,
77cdf0e10cSrcweir     RES_REFPAGESETFLD,
78cdf0e10cSrcweir     RES_REFPAGEGETFLD,
79cdf0e10cSrcweir     RES_INTERNETFLD,
80cdf0e10cSrcweir     RES_JUMPEDITFLD,
81cdf0e10cSrcweir     RES_SCRIPTFLD,
82cdf0e10cSrcweir     RES_DATETIMEFLD,
83cdf0e10cSrcweir     RES_AUTHORITY,  //Table of authorities
84cdf0e10cSrcweir     RES_COMBINED_CHARS,
85cdf0e10cSrcweir     RES_DROPDOWN,
86cdf0e10cSrcweir     RES_FIELDS_END
87cdf0e10cSrcweir };
88cdf0e10cSrcweir 
89cdf0e10cSrcweir /*--------------------------------------------------------------------
90cdf0e10cSrcweir     Beschreibung: Liste der FieldTypes am UI
91cdf0e10cSrcweir  --------------------------------------------------------------------*/
92cdf0e10cSrcweir 
93cdf0e10cSrcweir enum SwFldTypesEnum
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     TYP_BEGIN,
96cdf0e10cSrcweir     TYP_DATEFLD = TYP_BEGIN,    // 0
97cdf0e10cSrcweir     TYP_TIMEFLD,
98cdf0e10cSrcweir     TYP_FILENAMEFLD,
99cdf0e10cSrcweir     TYP_DBNAMEFLD,
100cdf0e10cSrcweir     TYP_CHAPTERFLD,
101cdf0e10cSrcweir     TYP_PAGENUMBERFLD,
102cdf0e10cSrcweir     TYP_DOCSTATFLD,
103cdf0e10cSrcweir     TYP_AUTHORFLD,
104cdf0e10cSrcweir     TYP_SETFLD,
105cdf0e10cSrcweir     TYP_GETFLD,
106cdf0e10cSrcweir     TYP_FORMELFLD,              // 10
107cdf0e10cSrcweir     TYP_HIDDENTXTFLD,
108cdf0e10cSrcweir     TYP_SETREFFLD,
109cdf0e10cSrcweir     TYP_GETREFFLD,
110cdf0e10cSrcweir     TYP_DDEFLD,
111cdf0e10cSrcweir     TYP_MACROFLD,
112cdf0e10cSrcweir     TYP_INPUTFLD,
113cdf0e10cSrcweir     TYP_HIDDENPARAFLD,
114cdf0e10cSrcweir     TYP_DOCINFOFLD,
115cdf0e10cSrcweir     TYP_DBFLD,
116cdf0e10cSrcweir     TYP_USERFLD,                // 20
117cdf0e10cSrcweir     TYP_POSTITFLD,
118cdf0e10cSrcweir     TYP_TEMPLNAMEFLD,
119cdf0e10cSrcweir     TYP_SEQFLD,
120cdf0e10cSrcweir     TYP_DBNEXTSETFLD,
121cdf0e10cSrcweir     TYP_DBNUMSETFLD,
122cdf0e10cSrcweir     TYP_DBSETNUMBERFLD,
123cdf0e10cSrcweir     TYP_CONDTXTFLD,
124cdf0e10cSrcweir     TYP_NEXTPAGEFLD,
125cdf0e10cSrcweir     TYP_PREVPAGEFLD,
126cdf0e10cSrcweir     TYP_EXTUSERFLD,             // 30
127cdf0e10cSrcweir     TYP_FIXDATEFLD,
128cdf0e10cSrcweir     TYP_FIXTIMEFLD,
129cdf0e10cSrcweir     TYP_SETINPFLD,
130cdf0e10cSrcweir     TYP_USRINPFLD,
131cdf0e10cSrcweir     TYP_SETREFPAGEFLD,
132cdf0e10cSrcweir     TYP_GETREFPAGEFLD,
133cdf0e10cSrcweir     TYP_INTERNETFLD,
134cdf0e10cSrcweir     TYP_JUMPEDITFLD,
135cdf0e10cSrcweir     TYP_SCRIPTFLD,              // 40
136cdf0e10cSrcweir     TYP_AUTHORITY,
137cdf0e10cSrcweir     TYP_COMBINED_CHARS,
138cdf0e10cSrcweir     TYP_DROPDOWN,
139cdf0e10cSrcweir     TYP_END
140cdf0e10cSrcweir };
141ca62e2c2SSteve Yin enum SwAttrFieldTYpe
142ca62e2c2SSteve Yin {
143ca62e2c2SSteve Yin     ATTR_NONE,
144ca62e2c2SSteve Yin     ATTR_DATEFLD,
145ca62e2c2SSteve Yin     ATTR_TIMEFLD,
146ca62e2c2SSteve Yin     ATTR_PAGENUMBERFLD,
147ca62e2c2SSteve Yin     ATTR_PAGECOOUNTFLD,
148ca62e2c2SSteve Yin     ATTR_BOOKMARKFLD,
149ca62e2c2SSteve Yin     ATTR_SETREFATTRFLD
150ca62e2c2SSteve Yin };
151cdf0e10cSrcweir enum SwFileNameFormat
152cdf0e10cSrcweir {
153cdf0e10cSrcweir     FF_BEGIN,
154cdf0e10cSrcweir     FF_NAME = FF_BEGIN,
155cdf0e10cSrcweir     FF_PATHNAME,
156cdf0e10cSrcweir     FF_PATH,
157cdf0e10cSrcweir     FF_NAME_NOEXT,
158cdf0e10cSrcweir     FF_UI_NAME,
159cdf0e10cSrcweir     FF_UI_RANGE,
160cdf0e10cSrcweir     FF_END,
161cdf0e10cSrcweir     FF_FIXED = 0x8000
162cdf0e10cSrcweir };
163cdf0e10cSrcweir 
164cdf0e10cSrcweir enum SwVarFormat
165cdf0e10cSrcweir {
166cdf0e10cSrcweir     VVF_CMD         = 0x0010,   // Kommando anzeigen
167cdf0e10cSrcweir     VVF_INVISIBLE   = 0x0040,   // unsichtbar
168cdf0e10cSrcweir     VVF_XXP         = 0x0400,   // 1234%
169cdf0e10cSrcweir     VVF_XX_XXP      = 0x0800,   // 1.234,56%
170cdf0e10cSrcweir     VVF_CLEAR       = 0x000f,
171cdf0e10cSrcweir 
172cdf0e10cSrcweir // ab hier neue Formate
173cdf0e10cSrcweir     VVF_SYS         = 0x2000,   //Zahlenformat aus der Systemeinstellung
174cdf0e10cSrcweir     VVF_X           = 0x2100,   // 1234
175cdf0e10cSrcweir     VVF_X_X         = 0x2200,   // 1234,5
176cdf0e10cSrcweir     VVF_X_XX        = 0x2300,   // 1245,56
177cdf0e10cSrcweir     VVF_XX_X        = 0x2400,   // 1.234,5
178cdf0e10cSrcweir     VVF_XX_XX       = 0x2500,   // 1.234,56
179cdf0e10cSrcweir     VVF_XX_XXX      = 0x2600,   // 1.234,567
180cdf0e10cSrcweir     VVF_SYS_CUR     = 0x2700,   // W???hrungsformat aus der Systemeinstellung
181cdf0e10cSrcweir     VVF_CUR_X       = 0x2800,   // DM 1234
182cdf0e10cSrcweir     VVF_CUR_XX_XX   = 0x2900,   // DM 1234,56 DM 1234,00
183cdf0e10cSrcweir     VVF_CUR_XX_X0   = 0x2a00,   // DM 1234,56 DM 1234,--
184cdf0e10cSrcweir     VVF_X_CUR       = 0x2b00,   // 1234 DM
185cdf0e10cSrcweir     VVF_XX_XX_CUR   = 0x2c00,   // 1234,56 DM 1234,00 DM
186cdf0e10cSrcweir     VVF_XX_X0_CUR   = 0x2d00,    // 1234,56 DM 1234,-- DM
187cdf0e10cSrcweir // Kompatibilitaet:
188cdf0e10cSrcweir     VF_CMD          = VVF_CMD,
189cdf0e10cSrcweir     VF_INVISIBLE    = VVF_INVISIBLE,
190cdf0e10cSrcweir     VF_XXP          = VVF_XXP,
191cdf0e10cSrcweir     VF_XX_XXP       = VVF_XX_XXP,
192cdf0e10cSrcweir     VF_VISIBLE      = VVF_SYS,
193cdf0e10cSrcweir     VF_XX           = VVF_X,
194cdf0e10cSrcweir     VF_XX_XX        = VVF_XX_XX,
195cdf0e10cSrcweir     VF_XX_XX_CUR    = VVF_SYS_CUR,
196cdf0e10cSrcweir     VF_CLEAR        = VVF_CLEAR
197cdf0e10cSrcweir 
198cdf0e10cSrcweir };
199cdf0e10cSrcweir 
200cdf0e10cSrcweir typedef sal_uInt16 SwGetSetExpType;
201cdf0e10cSrcweir namespace nsSwGetSetExpType
202cdf0e10cSrcweir {
203cdf0e10cSrcweir     const SwGetSetExpType GSE_STRING  = 0x0001; // String
204cdf0e10cSrcweir     const SwGetSetExpType GSE_EXPR    = 0x0002; // Expression
205cdf0e10cSrcweir     const SwGetSetExpType GSE_INP     = 0x0004; // InputField
206cdf0e10cSrcweir     const SwGetSetExpType GSE_SEQ     = 0x0008; // Sequence
207cdf0e10cSrcweir     const SwGetSetExpType GSE_FORMULA = 0x0010; // Formel
208cdf0e10cSrcweir }
209cdf0e10cSrcweir 
210cdf0e10cSrcweir typedef sal_uInt16 SwExtendedSubType;
211cdf0e10cSrcweir namespace nsSwExtendedSubType
212cdf0e10cSrcweir {
213cdf0e10cSrcweir     const SwExtendedSubType SUB_CMD         = 0x0100;   // Kommando anzeigen
214cdf0e10cSrcweir     const SwExtendedSubType SUB_INVISIBLE   = 0x0200;   // unsichtbar
215cdf0e10cSrcweir     const SwExtendedSubType SUB_OWN_FMT     = 0x0400;   // SwDBField: Uebernimmt Formatierung nicht
216cdf0e10cSrcweir                                                         // aus Datenbank
217cdf0e10cSrcweir }
218cdf0e10cSrcweir 
219cdf0e10cSrcweir enum SwInputFieldSubType
220cdf0e10cSrcweir {
221cdf0e10cSrcweir     INP_TXT     = 0x01,
222cdf0e10cSrcweir     INP_USR     = 0x02,
223cdf0e10cSrcweir     INP_VAR     = 0x03
224cdf0e10cSrcweir };
225cdf0e10cSrcweir 
226cdf0e10cSrcweir 
227cdf0e10cSrcweir enum SwUserType
228cdf0e10cSrcweir {
229cdf0e10cSrcweir     UF_STRING   = 0x01,
230cdf0e10cSrcweir     UF_EXPR     = 0x02
231cdf0e10cSrcweir };
232cdf0e10cSrcweir 
233cdf0e10cSrcweir enum SwDateTimeSubType
234cdf0e10cSrcweir {
235cdf0e10cSrcweir     FIXEDFLD = 1,
236cdf0e10cSrcweir     DATEFLD  = 2,
237cdf0e10cSrcweir     TIMEFLD  = 4
238cdf0e10cSrcweir };
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 
241cdf0e10cSrcweir extern sal_uInt16 __FAR_DATA aTypeTab[];
242cdf0e10cSrcweir 
243cdf0e10cSrcweir /*--------------------------------------------------------------------
244cdf0e10cSrcweir     Beschreibung: Allgemeine Tools
245cdf0e10cSrcweir  --------------------------------------------------------------------*/
246cdf0e10cSrcweir 
247cdf0e10cSrcweir String  GetResult(double nVal, sal_uInt32 nNumFmt, sal_uInt16 nLang = LANGUAGE_SYSTEM);
248cdf0e10cSrcweir void    SetErrorStr(const String& rStr);
249cdf0e10cSrcweir //String    ExpandDate(const Date& rDate, sal_uLong nFmt, sal_uInt16 nLang);
250cdf0e10cSrcweir //String    ExpandTime(const Time& rTime, sal_uLong nFmt, sal_uInt16 nLang);
251cdf0e10cSrcweir String  FormatNumber(sal_uInt16 nNum, sal_uInt32 nFormat);
252cdf0e10cSrcweir 
253cdf0e10cSrcweir /*--------------------------------------------------------------------
254cdf0e10cSrcweir     Beschreibung:   Instanzen von SwFields und Abgeleiteten kommen 0-n mal vor.
255cdf0e10cSrcweir                     Zu jeder Klasse SwFields existiert
256cdf0e10cSrcweir                     1 Instanz der zugehoerigen Typenklasse
257cdf0e10cSrcweir                     Basisklasse aller Feldtypen ist SwFieldType
258cdf0e10cSrcweir  --------------------------------------------------------------------*/
259cdf0e10cSrcweir 
260cdf0e10cSrcweir DBG_NAMEEX(SwFieldType)
261cdf0e10cSrcweir 
262cdf0e10cSrcweir class SW_DLLPUBLIC SwFieldType : public SwModify
263cdf0e10cSrcweir {
264cdf0e10cSrcweir     sal_uInt16 nWhich;
265cdf0e10cSrcweir 
266cdf0e10cSrcweir     friend void _FinitUI();     // um den Pointer zu loeschen!
267cdf0e10cSrcweir     static  SvStringsDtor*  pFldNames;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     static void _GetFldName();          // legt die FldNames an, fldmgr.cxx!
270cdf0e10cSrcweir 
271cdf0e10cSrcweir protected:
272cdf0e10cSrcweir     // single argument ctors shall be explicit.
273cdf0e10cSrcweir     explicit SwFieldType( sal_uInt16 nWhichId );
274cdf0e10cSrcweir 
275cdf0e10cSrcweir public:
276cdf0e10cSrcweir 
277cdf0e10cSrcweir #ifdef DBG_UTIL
278cdf0e10cSrcweir     virtual ~SwFieldType();
279cdf0e10cSrcweir #endif
280cdf0e10cSrcweir     static  const String&   GetTypeStr( sal_uInt16 nTypeId );
281cdf0e10cSrcweir 
282cdf0e10cSrcweir     // nur in abgeleiteten Klassen
283cdf0e10cSrcweir     virtual const String&   GetName() const;
284cdf0e10cSrcweir     virtual SwFieldType*    Copy()    const = 0;
285cdf0e10cSrcweir     virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
286cdf0e10cSrcweir     virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
287cdf0e10cSrcweir 
Which() const288cdf0e10cSrcweir             sal_uInt16          Which() const { return nWhich; }
289cdf0e10cSrcweir 
290cdf0e10cSrcweir     inline  void            UpdateFlds() const;
291cdf0e10cSrcweir };
292cdf0e10cSrcweir 
UpdateFlds() const293cdf0e10cSrcweir inline void SwFieldType::UpdateFlds() const
294cdf0e10cSrcweir {
295cdf0e10cSrcweir     ((SwFieldType*)this)->ModifyNotification( 0, 0 );
296cdf0e10cSrcweir }
297cdf0e10cSrcweir 
298cdf0e10cSrcweir /*--------------------------------------------------------------------
299cdf0e10cSrcweir     Beschreibung:  Basisklasse aller Felder.
300cdf0e10cSrcweir                    Ueber Which wird der Typ des Feldes abgefragt.
301cdf0e10cSrcweir                    Ueber Expand() wird der expandierte Inhalt
302cdf0e10cSrcweir                    des Feldes in Erfahrung gebracht.
303cdf0e10cSrcweir  --------------------------------------------------------------------*/
304cdf0e10cSrcweir 
305cdf0e10cSrcweir class SW_DLLPUBLIC SwField
306cdf0e10cSrcweir {
307cdf0e10cSrcweir private:
308cdf0e10cSrcweir     mutable String      m_Cache; /// #i85766# cached expansion (for clipboard)
309*69a74367SOliver-Rainer Wittmann     bool m_bUseFieldValueCache; /// control the usage of the cached field value
310*69a74367SOliver-Rainer Wittmann 
311cdf0e10cSrcweir     sal_uInt16              nLang;  // Immer ueber SetLanguage aendern!
312cdf0e10cSrcweir     sal_Bool                bIsAutomaticLanguage;
313cdf0e10cSrcweir     sal_uInt32          nFormat;
314cdf0e10cSrcweir 
315cdf0e10cSrcweir     SwFieldType*        pType;
316cdf0e10cSrcweir 
317cdf0e10cSrcweir     virtual String      Expand() const = 0;
318cdf0e10cSrcweir     virtual SwField*    Copy() const = 0;
319cdf0e10cSrcweir 
320cdf0e10cSrcweir protected:
SetFormat(sal_uInt32 nSet)321cdf0e10cSrcweir     void                SetFormat(sal_uInt32 nSet) {nFormat = nSet;}
322cdf0e10cSrcweir 
323*69a74367SOliver-Rainer Wittmann     SwField( SwFieldType* pTyp,
324*69a74367SOliver-Rainer Wittmann              sal_uInt32 nFmt = 0,
325*69a74367SOliver-Rainer Wittmann              sal_uInt16 nLang = LANGUAGE_SYSTEM,
326*69a74367SOliver-Rainer Wittmann              bool m_bUseFieldValueCache = true );
327cdf0e10cSrcweir 
328cdf0e10cSrcweir public:
329cdf0e10cSrcweir     virtual             ~SwField();
330cdf0e10cSrcweir 
331cdf0e10cSrcweir     // Typ feststellen
332cdf0e10cSrcweir     inline SwFieldType* GetTyp() const;
333cdf0e10cSrcweir 
334cdf0e10cSrcweir     // neuen Typ setzen (wird fuer das Kopieren zwischen Dokumenten benutzt)
335cdf0e10cSrcweir     virtual SwFieldType* ChgTyp( SwFieldType* );
336cdf0e10cSrcweir 
337cdf0e10cSrcweir     /** expand the field.
338cdf0e10cSrcweir         @param  bCached     return cached field value.
339cdf0e10cSrcweir         @remark     most callers should use the cached field value.
340cdf0e10cSrcweir                     this is because various fields need special handing
341cdf0e10cSrcweir                     (ChangeExpansion()) to return correct values, and only
342cdf0e10cSrcweir                     SwTxtFormatter::NewFldPortion() sets things up properly.
343cdf0e10cSrcweir         @return     the generated text (suitable for display)
344cdf0e10cSrcweir       */
345cdf0e10cSrcweir     String              ExpandField(bool const bCached) const;
346cdf0e10cSrcweir 
347cdf0e10cSrcweir     virtual String      GetFieldName() const;
348cdf0e10cSrcweir 
349cdf0e10cSrcweir     SwField *           CopyField() const;
350cdf0e10cSrcweir 
351cdf0e10cSrcweir     // ResId
Which() const352cdf0e10cSrcweir     sal_uInt16              Which() const
353cdf0e10cSrcweir #ifndef DBG_UTIL
354cdf0e10cSrcweir         { return pType->Which(); }
355cdf0e10cSrcweir #else
356cdf0e10cSrcweir         ;       // in fldbas.cxx implementiert
357cdf0e10cSrcweir #endif
358cdf0e10cSrcweir 
359cdf0e10cSrcweir     // TYP_ID
360cdf0e10cSrcweir             sal_uInt16      GetTypeId() const;
361cdf0e10cSrcweir     virtual sal_uInt16      GetSubType() const;
362cdf0e10cSrcweir     virtual void        SetSubType(sal_uInt16);
363cdf0e10cSrcweir 
364cdf0e10cSrcweir     // Sprache an der Feldposition
365cdf0e10cSrcweir     inline sal_uInt16       GetLanguage() const;
366cdf0e10cSrcweir     virtual void        SetLanguage(sal_uInt16 nLng);
367cdf0e10cSrcweir 
368cdf0e10cSrcweir     // Parameter fuer Dialog und BASIC erfragen
369cdf0e10cSrcweir     inline sal_uInt32   GetFormat() const;
370cdf0e10cSrcweir     virtual const String& GetPar1() const;
371cdf0e10cSrcweir     virtual String      GetPar2()   const;
372cdf0e10cSrcweir 
373cdf0e10cSrcweir     virtual String      GetFormula() const;
374cdf0e10cSrcweir 
375cdf0e10cSrcweir     virtual void        ChangeFormat(sal_uInt32 n);
376cdf0e10cSrcweir     virtual void        SetPar1(const String& rStr);
377cdf0e10cSrcweir     virtual void        SetPar2(const String& rStr);
378cdf0e10cSrcweir 
379cdf0e10cSrcweir     virtual sal_Bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const;
380cdf0e10cSrcweir     virtual sal_Bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId );
381cdf0e10cSrcweir     // hat das Feld eine Action auf dem ClickHandler ? (z.B. INetFelder,..)
382cdf0e10cSrcweir     sal_Bool            HasClickHdl() const;
383cdf0e10cSrcweir     // ist es ein Fix-Feld?
384cdf0e10cSrcweir     sal_Bool            IsFixed() const;
385cdf0e10cSrcweir 
IsAutomaticLanguage() const386cdf0e10cSrcweir     sal_Bool                IsAutomaticLanguage() const { return bIsAutomaticLanguage;}
SetAutomaticLanguage(sal_Bool bSet)387cdf0e10cSrcweir     void                SetAutomaticLanguage(sal_Bool bSet){bIsAutomaticLanguage = bSet;}
388cdf0e10cSrcweir 
389cdf0e10cSrcweir     virtual String      GetDescription() const;
390cdf0e10cSrcweir };
391cdf0e10cSrcweir 
GetTyp() const392cdf0e10cSrcweir inline SwFieldType* SwField::GetTyp() const
393cdf0e10cSrcweir     { return pType;     }
394cdf0e10cSrcweir 
GetFormat() const395cdf0e10cSrcweir inline sal_uInt32 SwField::GetFormat() const
396cdf0e10cSrcweir     { return nFormat;   }
397cdf0e10cSrcweir 
GetLanguage() const398cdf0e10cSrcweir inline sal_uInt16 SwField::GetLanguage() const
399cdf0e10cSrcweir     { return nLang;     }
400cdf0e10cSrcweir 
401cdf0e10cSrcweir /*--------------------------------------------------------------------
402cdf0e10cSrcweir     Beschreibung:   Felder mit Values, die ueber der Numberformatter
403cdf0e10cSrcweir                     formatiert werden muessen
404cdf0e10cSrcweir  --------------------------------------------------------------------*/
405cdf0e10cSrcweir 
406cdf0e10cSrcweir class SwValueFieldType : public SwFieldType
407cdf0e10cSrcweir {
408cdf0e10cSrcweir     SwDoc*  pDoc;
409cdf0e10cSrcweir     sal_Bool    bUseFormat; // Numberformatter verwenden
410cdf0e10cSrcweir 
411cdf0e10cSrcweir protected:
412cdf0e10cSrcweir     SwValueFieldType( SwDoc* pDocPtr, sal_uInt16 nWhichId );
413cdf0e10cSrcweir     SwValueFieldType( const SwValueFieldType& rTyp );
414cdf0e10cSrcweir 
415cdf0e10cSrcweir public:
GetDoc() const416cdf0e10cSrcweir     inline SwDoc*   GetDoc() const                      { return pDoc; }
SetDoc(SwDoc * pNewDoc)417cdf0e10cSrcweir     inline void     SetDoc(SwDoc* pNewDoc)              { pDoc = pNewDoc; }
418cdf0e10cSrcweir 
UseFormat() const419cdf0e10cSrcweir     inline sal_Bool     UseFormat() const                   { return bUseFormat; }
EnableFormat(sal_Bool bFormat=sal_True)420cdf0e10cSrcweir     inline void     EnableFormat(sal_Bool bFormat = sal_True)   { bUseFormat = bFormat; }
421cdf0e10cSrcweir 
422cdf0e10cSrcweir     String          ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const;
423cdf0e10cSrcweir     void            DoubleToString(String &rValue, const double &rVal, LanguageType eLng) const;
424cdf0e10cSrcweir     void            DoubleToString(String &rValue, const double &rVal, sal_uInt32 nFmt) const;
425cdf0e10cSrcweir };
426cdf0e10cSrcweir 
427cdf0e10cSrcweir class SW_DLLPUBLIC SwValueField : public SwField
428cdf0e10cSrcweir {
429cdf0e10cSrcweir     double fValue;
430cdf0e10cSrcweir //  String sExpand;
431cdf0e10cSrcweir 
432cdf0e10cSrcweir protected:
433cdf0e10cSrcweir     SwValueField( SwValueFieldType* pFldType, sal_uInt32 nFmt = 0, sal_uInt16 nLang = LANGUAGE_SYSTEM, const double fVal = 0.0 );
434cdf0e10cSrcweir     SwValueField( const SwValueField& rFld );
435cdf0e10cSrcweir 
436cdf0e10cSrcweir public:
437cdf0e10cSrcweir     virtual                 ~SwValueField();
438cdf0e10cSrcweir 
439cdf0e10cSrcweir     virtual SwFieldType*    ChgTyp( SwFieldType* );
440cdf0e10cSrcweir     virtual void            SetLanguage(sal_uInt16 nLng);
441cdf0e10cSrcweir //  os: wozu war das denn da?
442cdf0e10cSrcweir //  virtual void            ChangeFormat(sal_uLong n);
443cdf0e10cSrcweir 
GetDoc() const444cdf0e10cSrcweir     inline SwDoc*           GetDoc() const          { return ((SwValueFieldType*)GetTyp())->GetDoc(); }
445cdf0e10cSrcweir 
446cdf0e10cSrcweir     virtual double          GetValue() const;
447cdf0e10cSrcweir     virtual void            SetValue( const double& rVal );
448cdf0e10cSrcweir 
ExpandValue(const double & rVal,sal_uInt32 nFmt,sal_uInt16 nLng=0) const449cdf0e10cSrcweir     inline String   ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const
450cdf0e10cSrcweir         { return ((SwValueFieldType*)GetTyp())->ExpandValue(rVal, nFmt, nLng); }
451cdf0e10cSrcweir 
452cdf0e10cSrcweir     static sal_uInt32       GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFmt);
453cdf0e10cSrcweir };
454cdf0e10cSrcweir 
455cdf0e10cSrcweir class SW_DLLPUBLIC SwFormulaField : public SwValueField
456cdf0e10cSrcweir {
457cdf0e10cSrcweir     String sFormula;
458cdf0e10cSrcweir 
459cdf0e10cSrcweir protected:
460cdf0e10cSrcweir     SwFormulaField( SwValueFieldType* pFldType, sal_uInt32 nFmt = 0, const double fVal = 0.0 );
461cdf0e10cSrcweir     SwFormulaField( const SwFormulaField& rFld );
462cdf0e10cSrcweir 
463cdf0e10cSrcweir public:
464cdf0e10cSrcweir     virtual String          GetFormula() const;
465cdf0e10cSrcweir     void                    SetFormula(const String& rStr);
466cdf0e10cSrcweir 
467cdf0e10cSrcweir     void                    SetExpandedFormula(const String& rStr);
468cdf0e10cSrcweir     String                  GetExpandedFormula() const;
469cdf0e10cSrcweir };
470cdf0e10cSrcweir 
471cdf0e10cSrcweir #endif // SW_FLDBAS_HXX
472