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