1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew 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 }; 141cdf0e10cSrcweir 142cdf0e10cSrcweir 143cdf0e10cSrcweir enum SwFileNameFormat 144cdf0e10cSrcweir { 145cdf0e10cSrcweir FF_BEGIN, 146cdf0e10cSrcweir FF_NAME = FF_BEGIN, 147cdf0e10cSrcweir FF_PATHNAME, 148cdf0e10cSrcweir FF_PATH, 149cdf0e10cSrcweir FF_NAME_NOEXT, 150cdf0e10cSrcweir FF_UI_NAME, 151cdf0e10cSrcweir FF_UI_RANGE, 152cdf0e10cSrcweir FF_END, 153cdf0e10cSrcweir FF_FIXED = 0x8000 154cdf0e10cSrcweir }; 155cdf0e10cSrcweir 156cdf0e10cSrcweir enum SwVarFormat 157cdf0e10cSrcweir { 158cdf0e10cSrcweir VVF_CMD = 0x0010, // Kommando anzeigen 159cdf0e10cSrcweir VVF_INVISIBLE = 0x0040, // unsichtbar 160cdf0e10cSrcweir VVF_XXP = 0x0400, // 1234% 161cdf0e10cSrcweir VVF_XX_XXP = 0x0800, // 1.234,56% 162cdf0e10cSrcweir VVF_CLEAR = 0x000f, 163cdf0e10cSrcweir 164cdf0e10cSrcweir // ab hier neue Formate 165cdf0e10cSrcweir VVF_SYS = 0x2000, //Zahlenformat aus der Systemeinstellung 166cdf0e10cSrcweir VVF_X = 0x2100, // 1234 167cdf0e10cSrcweir VVF_X_X = 0x2200, // 1234,5 168cdf0e10cSrcweir VVF_X_XX = 0x2300, // 1245,56 169cdf0e10cSrcweir VVF_XX_X = 0x2400, // 1.234,5 170cdf0e10cSrcweir VVF_XX_XX = 0x2500, // 1.234,56 171cdf0e10cSrcweir VVF_XX_XXX = 0x2600, // 1.234,567 172cdf0e10cSrcweir VVF_SYS_CUR = 0x2700, // W???hrungsformat aus der Systemeinstellung 173cdf0e10cSrcweir VVF_CUR_X = 0x2800, // DM 1234 174cdf0e10cSrcweir VVF_CUR_XX_XX = 0x2900, // DM 1234,56 DM 1234,00 175cdf0e10cSrcweir VVF_CUR_XX_X0 = 0x2a00, // DM 1234,56 DM 1234,-- 176cdf0e10cSrcweir VVF_X_CUR = 0x2b00, // 1234 DM 177cdf0e10cSrcweir VVF_XX_XX_CUR = 0x2c00, // 1234,56 DM 1234,00 DM 178cdf0e10cSrcweir VVF_XX_X0_CUR = 0x2d00, // 1234,56 DM 1234,-- DM 179cdf0e10cSrcweir // Kompatibilitaet: 180cdf0e10cSrcweir VF_CMD = VVF_CMD, 181cdf0e10cSrcweir VF_INVISIBLE = VVF_INVISIBLE, 182cdf0e10cSrcweir VF_XXP = VVF_XXP, 183cdf0e10cSrcweir VF_XX_XXP = VVF_XX_XXP, 184cdf0e10cSrcweir VF_VISIBLE = VVF_SYS, 185cdf0e10cSrcweir VF_XX = VVF_X, 186cdf0e10cSrcweir VF_XX_XX = VVF_XX_XX, 187cdf0e10cSrcweir VF_XX_XX_CUR = VVF_SYS_CUR, 188cdf0e10cSrcweir VF_CLEAR = VVF_CLEAR 189cdf0e10cSrcweir 190cdf0e10cSrcweir }; 191cdf0e10cSrcweir 192cdf0e10cSrcweir typedef sal_uInt16 SwGetSetExpType; 193cdf0e10cSrcweir namespace nsSwGetSetExpType 194cdf0e10cSrcweir { 195cdf0e10cSrcweir const SwGetSetExpType GSE_STRING = 0x0001; // String 196cdf0e10cSrcweir const SwGetSetExpType GSE_EXPR = 0x0002; // Expression 197cdf0e10cSrcweir const SwGetSetExpType GSE_INP = 0x0004; // InputField 198cdf0e10cSrcweir const SwGetSetExpType GSE_SEQ = 0x0008; // Sequence 199cdf0e10cSrcweir const SwGetSetExpType GSE_FORMULA = 0x0010; // Formel 200cdf0e10cSrcweir } 201cdf0e10cSrcweir 202cdf0e10cSrcweir typedef sal_uInt16 SwExtendedSubType; 203cdf0e10cSrcweir namespace nsSwExtendedSubType 204cdf0e10cSrcweir { 205cdf0e10cSrcweir const SwExtendedSubType SUB_CMD = 0x0100; // Kommando anzeigen 206cdf0e10cSrcweir const SwExtendedSubType SUB_INVISIBLE = 0x0200; // unsichtbar 207cdf0e10cSrcweir const SwExtendedSubType SUB_OWN_FMT = 0x0400; // SwDBField: Uebernimmt Formatierung nicht 208cdf0e10cSrcweir // aus Datenbank 209cdf0e10cSrcweir } 210cdf0e10cSrcweir 211cdf0e10cSrcweir enum SwInputFieldSubType 212cdf0e10cSrcweir { 213cdf0e10cSrcweir INP_TXT = 0x01, 214cdf0e10cSrcweir INP_USR = 0x02, 215cdf0e10cSrcweir INP_VAR = 0x03 216cdf0e10cSrcweir }; 217cdf0e10cSrcweir 218cdf0e10cSrcweir 219cdf0e10cSrcweir enum SwUserType 220cdf0e10cSrcweir { 221cdf0e10cSrcweir UF_STRING = 0x01, 222cdf0e10cSrcweir UF_EXPR = 0x02 223cdf0e10cSrcweir }; 224cdf0e10cSrcweir 225cdf0e10cSrcweir enum SwDateTimeSubType 226cdf0e10cSrcweir { 227cdf0e10cSrcweir FIXEDFLD = 1, 228cdf0e10cSrcweir DATEFLD = 2, 229cdf0e10cSrcweir TIMEFLD = 4 230cdf0e10cSrcweir }; 231cdf0e10cSrcweir 232cdf0e10cSrcweir 233cdf0e10cSrcweir extern sal_uInt16 __FAR_DATA aTypeTab[]; 234cdf0e10cSrcweir 235cdf0e10cSrcweir /*-------------------------------------------------------------------- 236cdf0e10cSrcweir Beschreibung: Allgemeine Tools 237cdf0e10cSrcweir --------------------------------------------------------------------*/ 238cdf0e10cSrcweir 239cdf0e10cSrcweir String GetResult(double nVal, sal_uInt32 nNumFmt, sal_uInt16 nLang = LANGUAGE_SYSTEM); 240cdf0e10cSrcweir void SetErrorStr(const String& rStr); 241cdf0e10cSrcweir //String ExpandDate(const Date& rDate, sal_uLong nFmt, sal_uInt16 nLang); 242cdf0e10cSrcweir //String ExpandTime(const Time& rTime, sal_uLong nFmt, sal_uInt16 nLang); 243cdf0e10cSrcweir String FormatNumber(sal_uInt16 nNum, sal_uInt32 nFormat); 244cdf0e10cSrcweir 245cdf0e10cSrcweir /*-------------------------------------------------------------------- 246cdf0e10cSrcweir Beschreibung: Instanzen von SwFields und Abgeleiteten kommen 0-n mal vor. 247cdf0e10cSrcweir Zu jeder Klasse SwFields existiert 248cdf0e10cSrcweir 1 Instanz der zugehoerigen Typenklasse 249cdf0e10cSrcweir Basisklasse aller Feldtypen ist SwFieldType 250cdf0e10cSrcweir --------------------------------------------------------------------*/ 251cdf0e10cSrcweir 252cdf0e10cSrcweir DBG_NAMEEX(SwFieldType) 253cdf0e10cSrcweir 254cdf0e10cSrcweir class SW_DLLPUBLIC SwFieldType : public SwModify 255cdf0e10cSrcweir { 256cdf0e10cSrcweir sal_uInt16 nWhich; 257cdf0e10cSrcweir 258cdf0e10cSrcweir friend void _FinitUI(); // um den Pointer zu loeschen! 259cdf0e10cSrcweir static SvStringsDtor* pFldNames; 260cdf0e10cSrcweir 261cdf0e10cSrcweir static void _GetFldName(); // legt die FldNames an, fldmgr.cxx! 262cdf0e10cSrcweir 263cdf0e10cSrcweir protected: 264cdf0e10cSrcweir // single argument ctors shall be explicit. 265cdf0e10cSrcweir explicit SwFieldType( sal_uInt16 nWhichId ); 266cdf0e10cSrcweir 267cdf0e10cSrcweir public: 268cdf0e10cSrcweir 269cdf0e10cSrcweir #ifdef DBG_UTIL 270cdf0e10cSrcweir virtual ~SwFieldType(); 271cdf0e10cSrcweir #endif 272cdf0e10cSrcweir static const String& GetTypeStr( sal_uInt16 nTypeId ); 273cdf0e10cSrcweir 274cdf0e10cSrcweir // nur in abgeleiteten Klassen 275cdf0e10cSrcweir virtual const String& GetName() const; 276cdf0e10cSrcweir virtual SwFieldType* Copy() const = 0; 277cdf0e10cSrcweir virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const; 278cdf0e10cSrcweir virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ); 279cdf0e10cSrcweir 280cdf0e10cSrcweir sal_uInt16 Which() const { return nWhich; } 281cdf0e10cSrcweir 282cdf0e10cSrcweir inline void UpdateFlds() const; 283cdf0e10cSrcweir }; 284cdf0e10cSrcweir 285cdf0e10cSrcweir inline void SwFieldType::UpdateFlds() const 286cdf0e10cSrcweir { 287cdf0e10cSrcweir ((SwFieldType*)this)->ModifyNotification( 0, 0 ); 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir /*-------------------------------------------------------------------- 291cdf0e10cSrcweir Beschreibung: Basisklasse aller Felder. 292cdf0e10cSrcweir Ueber Which wird der Typ des Feldes abgefragt. 293cdf0e10cSrcweir Ueber Expand() wird der expandierte Inhalt 294cdf0e10cSrcweir des Feldes in Erfahrung gebracht. 295cdf0e10cSrcweir --------------------------------------------------------------------*/ 296cdf0e10cSrcweir 297cdf0e10cSrcweir class SW_DLLPUBLIC SwField 298cdf0e10cSrcweir { 299cdf0e10cSrcweir private: 300cdf0e10cSrcweir mutable String m_Cache; /// #i85766# cached expansion (for clipboard) 301cdf0e10cSrcweir sal_uInt16 nLang; // Immer ueber SetLanguage aendern! 302cdf0e10cSrcweir sal_Bool bIsAutomaticLanguage; 303cdf0e10cSrcweir sal_uInt32 nFormat; 304cdf0e10cSrcweir 305cdf0e10cSrcweir SwFieldType* pType; 306cdf0e10cSrcweir 307cdf0e10cSrcweir virtual String Expand() const = 0; 308cdf0e10cSrcweir virtual SwField* Copy() const = 0; 309cdf0e10cSrcweir 310cdf0e10cSrcweir protected: 311cdf0e10cSrcweir void SetFormat(sal_uInt32 nSet) {nFormat = nSet;} 312cdf0e10cSrcweir 313cdf0e10cSrcweir SwField(SwFieldType* pTyp, sal_uInt32 nFmt = 0, sal_uInt16 nLang = LANGUAGE_SYSTEM); 314cdf0e10cSrcweir 315cdf0e10cSrcweir public: 316cdf0e10cSrcweir virtual ~SwField(); 317cdf0e10cSrcweir 318cdf0e10cSrcweir // Typ feststellen 319cdf0e10cSrcweir inline SwFieldType* GetTyp() const; 320cdf0e10cSrcweir 321cdf0e10cSrcweir // neuen Typ setzen (wird fuer das Kopieren zwischen Dokumenten benutzt) 322cdf0e10cSrcweir virtual SwFieldType* ChgTyp( SwFieldType* ); 323cdf0e10cSrcweir 324cdf0e10cSrcweir /** expand the field. 325cdf0e10cSrcweir @param bCached return cached field value. 326cdf0e10cSrcweir @remark most callers should use the cached field value. 327cdf0e10cSrcweir this is because various fields need special handing 328cdf0e10cSrcweir (ChangeExpansion()) to return correct values, and only 329cdf0e10cSrcweir SwTxtFormatter::NewFldPortion() sets things up properly. 330cdf0e10cSrcweir @return the generated text (suitable for display) 331cdf0e10cSrcweir */ 332cdf0e10cSrcweir String ExpandField(bool const bCached) const; 333cdf0e10cSrcweir 334cdf0e10cSrcweir virtual String GetFieldName() const; 335cdf0e10cSrcweir 336cdf0e10cSrcweir SwField * CopyField() const; 337cdf0e10cSrcweir 338cdf0e10cSrcweir // ResId 339cdf0e10cSrcweir sal_uInt16 Which() const 340cdf0e10cSrcweir #ifndef DBG_UTIL 341cdf0e10cSrcweir { return pType->Which(); } 342cdf0e10cSrcweir #else 343cdf0e10cSrcweir ; // in fldbas.cxx implementiert 344cdf0e10cSrcweir #endif 345cdf0e10cSrcweir 346cdf0e10cSrcweir // TYP_ID 347cdf0e10cSrcweir sal_uInt16 GetTypeId() const; 348cdf0e10cSrcweir virtual sal_uInt16 GetSubType() const; 349cdf0e10cSrcweir virtual void SetSubType(sal_uInt16); 350cdf0e10cSrcweir 351cdf0e10cSrcweir // Sprache an der Feldposition 352cdf0e10cSrcweir inline sal_uInt16 GetLanguage() const; 353cdf0e10cSrcweir virtual void SetLanguage(sal_uInt16 nLng); 354cdf0e10cSrcweir 355cdf0e10cSrcweir // Parameter fuer Dialog und BASIC erfragen 356cdf0e10cSrcweir inline sal_uInt32 GetFormat() const; 357cdf0e10cSrcweir virtual const String& GetPar1() const; 358cdf0e10cSrcweir virtual String GetPar2() const; 359cdf0e10cSrcweir 360cdf0e10cSrcweir virtual String GetFormula() const; 361cdf0e10cSrcweir 362cdf0e10cSrcweir virtual void ChangeFormat(sal_uInt32 n); 363cdf0e10cSrcweir virtual void SetPar1(const String& rStr); 364cdf0e10cSrcweir virtual void SetPar2(const String& rStr); 365cdf0e10cSrcweir 366cdf0e10cSrcweir virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const; 367cdf0e10cSrcweir virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ); 368cdf0e10cSrcweir // hat das Feld eine Action auf dem ClickHandler ? (z.B. INetFelder,..) 369cdf0e10cSrcweir sal_Bool HasClickHdl() const; 370cdf0e10cSrcweir // ist es ein Fix-Feld? 371cdf0e10cSrcweir sal_Bool IsFixed() const; 372cdf0e10cSrcweir 373cdf0e10cSrcweir sal_Bool IsAutomaticLanguage() const { return bIsAutomaticLanguage;} 374cdf0e10cSrcweir void SetAutomaticLanguage(sal_Bool bSet){bIsAutomaticLanguage = bSet;} 375cdf0e10cSrcweir 376cdf0e10cSrcweir virtual String GetDescription() const; 377cdf0e10cSrcweir }; 378cdf0e10cSrcweir 379cdf0e10cSrcweir inline SwFieldType* SwField::GetTyp() const 380cdf0e10cSrcweir { return pType; } 381cdf0e10cSrcweir 382cdf0e10cSrcweir inline sal_uInt32 SwField::GetFormat() const 383cdf0e10cSrcweir { return nFormat; } 384cdf0e10cSrcweir 385cdf0e10cSrcweir inline sal_uInt16 SwField::GetLanguage() const 386cdf0e10cSrcweir { return nLang; } 387cdf0e10cSrcweir 388cdf0e10cSrcweir /*-------------------------------------------------------------------- 389cdf0e10cSrcweir Beschreibung: Felder mit Values, die ueber der Numberformatter 390cdf0e10cSrcweir formatiert werden muessen 391cdf0e10cSrcweir --------------------------------------------------------------------*/ 392cdf0e10cSrcweir 393cdf0e10cSrcweir class SwValueFieldType : public SwFieldType 394cdf0e10cSrcweir { 395cdf0e10cSrcweir SwDoc* pDoc; 396cdf0e10cSrcweir sal_Bool bUseFormat; // Numberformatter verwenden 397cdf0e10cSrcweir 398cdf0e10cSrcweir protected: 399cdf0e10cSrcweir SwValueFieldType( SwDoc* pDocPtr, sal_uInt16 nWhichId ); 400cdf0e10cSrcweir SwValueFieldType( const SwValueFieldType& rTyp ); 401cdf0e10cSrcweir 402cdf0e10cSrcweir public: 403cdf0e10cSrcweir inline SwDoc* GetDoc() const { return pDoc; } 404cdf0e10cSrcweir inline void SetDoc(SwDoc* pNewDoc) { pDoc = pNewDoc; } 405cdf0e10cSrcweir 406cdf0e10cSrcweir inline sal_Bool UseFormat() const { return bUseFormat; } 407cdf0e10cSrcweir inline void EnableFormat(sal_Bool bFormat = sal_True) { bUseFormat = bFormat; } 408cdf0e10cSrcweir 409cdf0e10cSrcweir String ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const; 410cdf0e10cSrcweir void DoubleToString(String &rValue, const double &rVal, LanguageType eLng) const; 411cdf0e10cSrcweir void DoubleToString(String &rValue, const double &rVal, sal_uInt32 nFmt) const; 412cdf0e10cSrcweir }; 413cdf0e10cSrcweir 414cdf0e10cSrcweir class SW_DLLPUBLIC SwValueField : public SwField 415cdf0e10cSrcweir { 416cdf0e10cSrcweir double fValue; 417cdf0e10cSrcweir // String sExpand; 418cdf0e10cSrcweir 419cdf0e10cSrcweir protected: 420cdf0e10cSrcweir SwValueField( SwValueFieldType* pFldType, sal_uInt32 nFmt = 0, sal_uInt16 nLang = LANGUAGE_SYSTEM, const double fVal = 0.0 ); 421cdf0e10cSrcweir SwValueField( const SwValueField& rFld ); 422cdf0e10cSrcweir 423cdf0e10cSrcweir public: 424cdf0e10cSrcweir virtual ~SwValueField(); 425cdf0e10cSrcweir 426cdf0e10cSrcweir virtual SwFieldType* ChgTyp( SwFieldType* ); 427cdf0e10cSrcweir virtual void SetLanguage(sal_uInt16 nLng); 428cdf0e10cSrcweir // os: wozu war das denn da? 429cdf0e10cSrcweir // virtual void ChangeFormat(sal_uLong n); 430cdf0e10cSrcweir 431cdf0e10cSrcweir inline SwDoc* GetDoc() const { return ((SwValueFieldType*)GetTyp())->GetDoc(); } 432cdf0e10cSrcweir 433cdf0e10cSrcweir virtual double GetValue() const; 434cdf0e10cSrcweir virtual void SetValue( const double& rVal ); 435cdf0e10cSrcweir 436cdf0e10cSrcweir inline String ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const 437cdf0e10cSrcweir { return ((SwValueFieldType*)GetTyp())->ExpandValue(rVal, nFmt, nLng); } 438cdf0e10cSrcweir 439cdf0e10cSrcweir static sal_uInt32 GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFmt); 440cdf0e10cSrcweir }; 441cdf0e10cSrcweir 442cdf0e10cSrcweir class SW_DLLPUBLIC SwFormulaField : public SwValueField 443cdf0e10cSrcweir { 444cdf0e10cSrcweir String sFormula; 445cdf0e10cSrcweir 446cdf0e10cSrcweir protected: 447cdf0e10cSrcweir SwFormulaField( SwValueFieldType* pFldType, sal_uInt32 nFmt = 0, const double fVal = 0.0 ); 448cdf0e10cSrcweir SwFormulaField( const SwFormulaField& rFld ); 449cdf0e10cSrcweir 450cdf0e10cSrcweir public: 451cdf0e10cSrcweir virtual String GetFormula() const; 452cdf0e10cSrcweir void SetFormula(const String& rStr); 453cdf0e10cSrcweir 454cdf0e10cSrcweir void SetExpandedFormula(const String& rStr); 455cdf0e10cSrcweir String GetExpandedFormula() const; 456cdf0e10cSrcweir }; 457cdf0e10cSrcweir 458cdf0e10cSrcweir #endif // SW_FLDBAS_HXX 459