diff options
31 files changed, 364 insertions, 372 deletions
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx index 7d3ff5514b72..71f8a201243f 100644 --- a/sw/inc/authfld.hxx +++ b/sw/inc/authfld.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _AUTHFLD_HXX -#define _AUTHFLD_HXX +#ifndef SW_AUTHFLD_HXX +#define SW_AUTHFLD_HXX #include "swdllapi.h" #include <fldbas.hxx> @@ -166,6 +166,10 @@ class SwAuthorityField : public SwField { long m_nHandle; mutable long m_nTempSequencePos; + + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwAuthorityField(SwAuthorityFieldType* pType, const String& rFieldContents); SwAuthorityField(SwAuthorityFieldType* pType, long nHandle); @@ -173,8 +177,6 @@ public: const String& GetFieldText(ToxAuthorityField eField) const; - virtual String Expand() const; - virtual SwField* Copy() const; virtual void SetPar1(const String& rStr); virtual SwFieldType* ChgTyp( SwFieldType* ); diff --git a/sw/inc/chpfld.hxx b/sw/inc/chpfld.hxx index 40f2f9ecf1d3..5d63c866c68d 100644 --- a/sw/inc/chpfld.hxx +++ b/sw/inc/chpfld.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _CHPFLD_HXX -#define _CHPFLD_HXX +#ifndef SW_CHPFLD_HXX +#define SW_CHPFLD_HXX #include "fldbas.hxx" @@ -69,6 +69,10 @@ class SW_DLLPUBLIC SwChapterField : public SwField friend class SwChapterFieldType; BYTE nLevel; String sTitle, sNumber, sPre, sPost; + + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwChapterField(SwChapterFieldType*, sal_uInt32 nFmt = 0); @@ -82,9 +86,6 @@ public: // <-- void ChangeExpansion(const SwTxtNode &rNd, BOOL bSrchNum); - virtual String Expand() const; - virtual SwField* Copy() const; - inline BYTE GetLevel() const; inline void SetLevel(BYTE); @@ -99,4 +100,4 @@ inline void SwChapterField::SetLevel(BYTE nLev) { nLevel = nLev; } inline const String& SwChapterField::GetNumber() const { return sNumber; } inline const String& SwChapterField::GetTitle() const { return sTitle; } -#endif // _CHPFLD_HXX +#endif // SW_CHPFLD_HXX diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx index 4114c0cfe0d3..c13c766e1147 100644 --- a/sw/inc/dbfld.hxx +++ b/sw/inc/dbfld.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _DBFLD_HXX -#define _DBFLD_HXX +#ifndef SW_DBFLD_HXX +#define SW_DBFLD_HXX #include "swdllapi.h" #include "fldbas.hxx" @@ -79,6 +79,9 @@ class SW_DLLPUBLIC SwDBField : public SwValueField BOOL bValidValue : 1; BOOL bInitialized : 1; + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwDBField(SwDBFieldType*, ULONG nFmt = 0); virtual ~SwDBField(); @@ -87,14 +90,11 @@ public: // Der aktuelle Text inline void SetExpansion(const String& rStr); - virtual String Expand() const; - virtual SwField* Copy() const; virtual USHORT GetSubType() const; virtual void SetSubType(USHORT nType); - // Name oder Inhalt - virtual String GetCntnt(BOOL bName = FALSE) const; + virtual String GetFieldName() const; // fuer Berechnungen in Ausdruecken void ChgValue( double d, BOOL bVal ); @@ -157,8 +157,8 @@ public: SwDBData GetDBData(SwDoc* pDoc); void SetDBData(const SwDBData& rDBData); // #111840# - // Name oder Inhalt - virtual String GetCntnt(BOOL bName = FALSE) const; + virtual String GetFieldName() const; + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nWhich ) const; virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nWhich ); virtual USHORT GetSubType() const; @@ -335,4 +335,4 @@ inline void SwDBSetNumberField::SetSetNumber(long nNum) { nNumber = nNum; } -#endif // _DBFLD_HXX +#endif // SW_DBFLD_HXX diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx index d9a011461eba..87b8a9f53dea 100644 --- a/sw/inc/ddefld.hxx +++ b/sw/inc/ddefld.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _DDEFLD_HXX -#define _DDEFLD_HXX +#ifndef SW_DDEFLD_HXX +#define SW_DDEFLD_HXX #include <sfx2/lnkbase.hxx> #include "swdllapi.h" @@ -97,13 +97,14 @@ public: class SwDDEField : public SwField { +private: + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwDDEField(SwDDEFieldType*); ~SwDDEField(); - virtual String Expand() const; - virtual SwField* Copy() const; - // ueber Typen Parameter ermitteln // Name kann nicht geaendert werden virtual const String& GetPar1() const; @@ -114,4 +115,4 @@ public: }; -#endif // _DDEFLD_HXX +#endif // SW_DDEFLD_HXX diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 8483cf7b2d39..3607ad0cd970 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _DOCUFLD_HXX -#define _DOCUFLD_HXX +#ifndef SW_DOCUFLD_HXX +#define SW_DOCUFLD_HXX #include <tools/date.hxx> @@ -363,6 +363,9 @@ class SwHiddenTxtField : public SwField BOOL bIsHidden : 1; // ist es nicht sichtbar? BOOL bValid : 1; // DB-Feld evaluiert? + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwHiddenTxtField( SwHiddenTxtFieldType*, BOOL bConditional, @@ -377,9 +380,7 @@ public: const String& rFalse, USHORT nSubType = TYP_HIDDENTXTFLD); - virtual String GetCntnt(BOOL bName = FALSE) const; - virtual String Expand() const; - virtual SwField* Copy() const; + virtual String GetFieldName() const; void Evaluate(SwDoc*); @@ -463,6 +464,9 @@ class SW_DLLPUBLIC SwMacroField : public SwField String aText; BOOL bIsScriptURL; + virtual String Expand() const; + virtual SwField* Copy() const; + public: // Direkte Eingabe alten Wert loeschen SwMacroField( SwMacroFieldType*, const String& rLibAndName, @@ -473,9 +477,7 @@ public: String GetMacroName() const; SvxMacro GetSvxMacro() const; - virtual String GetCntnt(BOOL bName = FALSE) const; - virtual String Expand() const; - virtual SwField* Copy() const; + virtual String GetFieldName() const; // Library und FileName virtual const String& GetPar1() const; @@ -571,6 +573,9 @@ class SW_DLLPUBLIC SwDocInfoField : public SwValueField String aContent; String aName; + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwDocInfoField(SwDocInfoFieldType*, USHORT nSub, const String& rName, sal_uInt32 nFmt=0); SwDocInfoField(SwDocInfoFieldType*, USHORT nSub, const String& rName, const String& rValue, sal_uInt32 nFmt=0); @@ -578,9 +583,7 @@ public: virtual void SetSubType(USHORT); virtual USHORT GetSubType() const; virtual void SetLanguage(USHORT nLng); - virtual String Expand() const; - virtual String GetCntnt(BOOL bName = FALSE) const; - virtual SwField* Copy() const; + virtual String GetFieldName() const; String GetName() const { return aName; } void SetName( const String& rName ) { aName = rName; } inline void SetExpansion(const String& rStr) { aContent = rStr; } @@ -833,4 +836,4 @@ public: }; -#endif // _DOCUFLD_HXX +#endif // SW_DOCUFLD_HXX diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx index 00598528e891..32fdbe202462 100644 --- a/sw/inc/expfld.hxx +++ b/sw/inc/expfld.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _EXPFLD_HXX -#define _EXPFLD_HXX +#ifndef SW_EXPFLD_HXX +#define SW_EXPFLD_HXX #include <svl/svarray.hxx> #include "swdllapi.h" @@ -98,6 +98,9 @@ class SW_DLLPUBLIC SwGetExpField : public SwFormulaField bool bLateInitialization; // #i82544# + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwGetExpField( SwGetExpFieldType*, const String& rFormel, USHORT nSubType = nsSwGetSetExpType::GSE_EXPR, ULONG nFmt = 0); @@ -105,9 +108,6 @@ public: virtual void SetValue( const double& rVal ); virtual void SetLanguage(USHORT nLng); - virtual String Expand() const; - virtual SwField* Copy() const; - inline const String& GetExpStr() const; inline void ChgExpStr(const String& rExpand); @@ -119,7 +119,7 @@ public: // (wird nur von der Formatierung aufgerufen!!) void ChangeExpansion( const SwFrm&, const SwTxtFld& ); - virtual String GetCntnt(BOOL bName = FALSE) const; + virtual String GetFieldName() const; // Die Formel aendern virtual String GetPar2() const; @@ -234,14 +234,14 @@ class SW_DLLPUBLIC SwSetExpField : public SwFormulaField USHORT nSeqNo; USHORT nSubType; + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwSetExpField(SwSetExpFieldType*, const String& rFormel, ULONG nFmt = 0); virtual void SetValue( const double& rVal ); - virtual String Expand() const; - virtual SwField* Copy() const; - inline const String& GetExpStr() const; inline void ChgExpStr( const String& rExpand ); @@ -252,7 +252,8 @@ public: inline void SetInputFlag(BOOL bInp); inline BOOL GetInputFlag() const; - virtual String GetCntnt(BOOL bName = FALSE) const; + virtual String GetFieldName() const; + virtual USHORT GetSubType() const; virtual void SetSubType(USHORT nType); @@ -319,15 +320,17 @@ class SW_DLLPUBLIC SwInputField : public SwField String aHelp; String aToolTip; USHORT nSubType; + + virtual String Expand() const; + virtual SwField* Copy() const; + public: // Direkte Eingabe ueber Dialog alten Wert loeschen SwInputField(SwInputFieldType*, const String& rContent , const String& rPrompt, USHORT nSubType = 0, ULONG nFmt = 0); - virtual String GetCntnt(BOOL bName = FALSE) const; - virtual String Expand() const; - virtual SwField* Copy() const; + virtual String GetFieldName() const; // Content virtual const String& GetPar1() const; @@ -405,9 +408,14 @@ class SwTblField : public SwValueField, public SwTableFormula String sExpand; USHORT nSubType; + virtual String Expand() const; + virtual SwField* Copy() const; + // suche den TextNode, in dem das Feld steht virtual const SwNode* GetNodeOfFormula() const; + String GetCommand(); + public: SwTblField( SwTblFieldType*, const String& rFormel, USHORT nSubType = 0, ULONG nFmt = 0); @@ -415,8 +423,6 @@ public: virtual void SetValue( const double& rVal ); virtual USHORT GetSubType() const; virtual void SetSubType(USHORT nType); - virtual String Expand() const; - virtual SwField* Copy() const; const String& GetExpStr() const { return sExpand; } void ChgExpStr(const String& rStr) { sExpand = rStr; } @@ -424,7 +430,8 @@ public: // berechne sich selbst void CalcField( SwTblCalcPara& rCalcPara ); - virtual String GetCntnt(BOOL bName = FALSE) const; + virtual String GetFieldName() const; + // Die Formel virtual String GetPar2() const; virtual void SetPar2(const String& rStr); @@ -433,4 +440,4 @@ public: }; -#endif // _EXPFLD_HXX +#endif // SW_EXPFLD_HXX diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index a2e08366ba24..d46ca308c3ba 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -24,10 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _FLDBAS_HXX -#define _FLDBAS_HXX - -#ifndef FIELDIDS_ONLY // SWG-Testreader!! +#ifndef SW_FLDBAS_HXX +#define SW_FLDBAS_HXX #include <i18npool/lang.h> #include <tools/debug.hxx> @@ -40,7 +38,6 @@ class SwDoc; class SvStringsDtor; class SvNumberFormatter; -#endif // FIELDIDS_ONLY /*-------------------------------------------------------------------- Beschreibung: die ID's fuer die Feldtypen @@ -236,8 +233,6 @@ enum SwDateTimeSubType TIMEFLD = 4 }; -#ifndef FIELDIDS_ONLY // SWG-Testreader!! - extern USHORT __FAR_DATA aTypeTab[]; @@ -336,8 +331,7 @@ public: */ String ExpandField(bool const bInClipboard) const; - // liefert den Namen oder den Inhalt - virtual String GetCntnt(BOOL bName = FALSE) const; + virtual String GetFieldName() const; SwField * CopyField() const; @@ -461,5 +455,4 @@ public: String GetExpandedFormula() const; }; -#endif // FIELDIDS_ONLY -#endif // _FLDBAS_HXX +#endif // SW_FLDBAS_HXX diff --git a/sw/inc/flddat.hxx b/sw/inc/flddat.hxx index d302f45a96bc..1196f0f1264d 100644 --- a/sw/inc/flddat.hxx +++ b/sw/inc/flddat.hxx @@ -25,8 +25,8 @@ * ************************************************************************/ -#ifndef _FLDDAT_HXX -#define _FLDDAT_HXX +#ifndef SW_FLDDAT_HXX +#define SW_FLDDAT_HXX #include <tools/string.hxx> @@ -115,6 +115,9 @@ class SW_DLLPUBLIC SwDateTimeField : public SwValueField USHORT nSubType; long nOffset; // Offset in Minuten + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwDateTimeField(SwDateTimeFieldType* pType, USHORT nSubType = DATEFLD, ULONG nFmt = 0, USHORT nLng = 0); @@ -138,11 +141,8 @@ public: void SetDateTime(const DateTime& rDT); static double GetDateTime(SwDoc* pDoc, const DateTime& rDT); - virtual String Expand() const; - virtual SwField* Copy() const; - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nMId ) const; virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nMId ); }; -#endif // _FLDDAT_HXX +#endif // SW_FLDDAT_HXX diff --git a/sw/inc/flddropdown.hxx b/sw/inc/flddropdown.hxx index 77963bf1510a..e3e40a82b940 100644 --- a/sw/inc/flddropdown.hxx +++ b/sw/inc/flddropdown.hxx @@ -24,19 +24,14 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _FLDDROPDOWN_HXX -#define _FLDDROPDOWN_HXX +#ifndef SW_FLDDROPDOWN_HXX +#define SW_FLDDROPDOWN_HXX -#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX #include "com/sun/star/uno/Sequence.hxx" -#endif #include "swdllapi.h" #include "fldbas.hxx" -#ifndef INCLUDED_VECTOR #include <vector> -#define INCLUDED_VECTOR -#endif /** Field type for dropdown boxes. @@ -95,6 +90,23 @@ class SW_DLLPUBLIC SwDropDownField : public SwField */ String aToolTip; + /** + Expands the field. + + The expanded value of the field is the value of the selected + item. If no item is selected, an empty string is returned. + + @return the expanded value of the field + */ + virtual String Expand() const; + + /** + Creates a copy of this field. + + @return the copy of this field + */ + virtual SwField * Copy() const; + public: /** Constructor @@ -116,23 +128,6 @@ public: virtual ~SwDropDownField(); /** - Expands the field. - - The expanded value of the field is the value of the selected - item. If no item is selected, an empty string is returned. - - @return the expanded value of the field - */ - virtual String Expand() const; - - /** - Creates a copy of this field. - - @return the copy of this field - */ - virtual SwField * Copy() const; - - /** Returns the selected value. @see Expand diff --git a/sw/inc/inetfld.hxx b/sw/inc/inetfld.hxx index 2bb3c6f9c880..de3f81c49e31 100644 --- a/sw/inc/inetfld.hxx +++ b/sw/inc/inetfld.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _INETFLD_HXX -#define _INETFLD_HXX +#ifndef SW_INETFLD_HXX +#define SW_INETFLD_HXX #include "fldbas.hxx" @@ -69,15 +69,16 @@ class SwINetField : public SwField String sText; SvxMacroTableDtor* pMacroTbl; + virtual String Expand() const; + virtual SwField* Copy() const; + public: // Direkte Eingabe alten Wert loeschen SwINetField( SwINetFieldType* pTyp, USHORT nFmt, const String& rURL, const String& rText ); virtual ~SwINetField(); - virtual String GetCntnt(BOOL bName = FALSE) const; - virtual String Expand() const; - virtual SwField* Copy() const; + virtual String GetFieldName() const; // URL virtual const String& GetPar1() const; @@ -105,5 +106,5 @@ public: }; -#endif // _INETFLD_HXX +#endif // SW_INETFLD_HXX diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx index b2b61dff6434..44d17eb38ca8 100644 --- a/sw/inc/reffld.hxx +++ b/sw/inc/reffld.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _REFFLD_HXX -#define _REFFLD_HXX +#ifndef SW_REFFLD_HXX +#define SW_REFFLD_HXX #include <fldbas.hxx> @@ -99,6 +99,9 @@ private: USHORT nSubType; USHORT nSeqNo; + virtual String Expand() const; + virtual SwField* Copy() const; + // --> OD 2007-08-24 #i81002# String MakeRefNumStr( const SwTxtNode& rTxtNodeOfField, const SwTxtNode& rTxtNodeOfReferencedItem, @@ -110,9 +113,7 @@ public: virtual ~SwGetRefField(); - virtual String GetCntnt(BOOL bName = FALSE) const; - virtual String Expand() const; - virtual SwField* Copy() const; + virtual String GetFieldName() const; const String& GetSetRefName() const { return sSetRefName; } @@ -158,5 +159,5 @@ public: }; -#endif // _REFFLD_HXX +#endif // SW_REFFLD_HXX diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx index b755cbc1631b..dea534074179 100644 --- a/sw/inc/usrfld.hxx +++ b/sw/inc/usrfld.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _USRFLD_HXX -#define _USRFLD_HXX +#ifndef SW_USRFLD_HXX +#define SW_USRFLD_HXX #include "swdllapi.h" #include "fldbas.hxx" @@ -106,6 +106,9 @@ class SW_DLLPUBLIC SwUserField : public SwValueField { USHORT nSubType; + virtual String Expand() const; + virtual SwField* Copy() const; + public: SwUserField(SwUserFieldType*, USHORT nSub = 0, sal_uInt32 nFmt = 0); @@ -115,9 +118,7 @@ public: virtual double GetValue() const; virtual void SetValue( const double& rVal ); - virtual String Expand() const; - virtual SwField* Copy() const; - virtual String GetCntnt(BOOL bName = FALSE) const; + virtual String GetFieldName() const; // Name kann nicht geaendert werden virtual const String& GetPar1() const; @@ -129,4 +130,4 @@ public: virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nWhichId ); }; -#endif // _USRFLD_HXX +#endif // SW_USRFLD_HXX diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index f1ae3e241b1b..63bc08acb611 100755 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -2442,7 +2442,7 @@ BOOL SwDoc::ConvertFieldsToText() nWhich != RES_REFPAGEGETFLD&& nWhich != RES_REFPAGESETFLD)) { - String sText = pField->GetCntnt(); + String sText = pField->ExpandField( this->IsClipBoard() ); //database fields should not convert their command into text if( RES_DBFLD == pCurType->Which() && !static_cast<const SwDBField*>(pField)->IsInitialized()) sText.Erase(); diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index 15c44286921c..ec3f5200ba67 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -28,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <float.h> #include <sfx2/app.hxx> #include <svl/zforlist.hxx> @@ -44,15 +43,11 @@ #include <pam.hxx> #include <ndtxt.hxx> #include <dbfld.hxx> -#ifndef _DBMGR_HXX #include <dbmgr.hxx> -#endif #include <docfld.hxx> #include <expfld.hxx> #include <txtatr.hxx> -#ifndef _UNOFLDMID_H #include <unofldmid.h> -#endif using namespace ::com::sun::star::sdbc; @@ -281,27 +276,23 @@ SwField* SwDBField::Copy() const return pTmp; } -String SwDBField::GetCntnt(BOOL bName) const +String SwDBField::GetFieldName() const { - if(bName) - { - const String& rDBName = ((SwDBFieldType*)GetTyp())->GetName(); + const String& rDBName = static_cast<SwDBFieldType*>(GetTyp())->GetName(); //TODO/CLEANUP //Funktion tut nichts! //String sContent( SFX_APP()->LocalizeDBName(INI2NATIONAL, // rDBName.GetToken(0, DB_DELIM))); - String sContent( rDBName.GetToken(0, DB_DELIM) ); + String sContent( rDBName.GetToken(0, DB_DELIM) ); - if (sContent.Len() > 1) - { - sContent += DB_DELIM; - sContent += rDBName.GetToken(1, DB_DELIM); - sContent += DB_DELIM; - sContent += rDBName.GetToken(2, DB_DELIM); - } - return lcl_DBTrennConv(sContent); + if (sContent.Len() > 1) + { + sContent += DB_DELIM; + sContent += rDBName.GetToken(1, DB_DELIM); + sContent += DB_DELIM; + sContent += rDBName.GetToken(2, DB_DELIM); } - return Expand(); + return lcl_DBTrennConv(sContent); } //------------------------------------------------------------------------------ @@ -547,19 +538,15 @@ void SwDBNameInfField::SetDBData(const SwDBData & rDBData) //------------------------------------------------------------------------------ -String SwDBNameInfField::GetCntnt(BOOL bName) const +String SwDBNameInfField::GetFieldName() const { - String sStr(SwField::GetCntnt(bName)); - - if(bName) + String sStr( SwField::GetFieldName() ); + if (aDBData.sDataSource.getLength()) { - if (aDBData.sDataSource.getLength()) - { - sStr += ':'; - sStr += String(aDBData.sDataSource); - sStr += DB_DELIM; - sStr += String(aDBData.sCommand); - } + sStr += ':'; + sStr += String(aDBData.sDataSource); + sStr += DB_DELIM; + sStr += String(aDBData.sCommand); } return lcl_DBTrennConv(sStr); } diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index fba7115075e8..7f91567aad5c 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1198,30 +1198,30 @@ String SwDocInfoField::Expand() const /* --------------------------------------------------------------------------- ---------------------------------------------------------------------------*/ -String SwDocInfoField::GetCntnt(sal_Bool bName) const +String SwDocInfoField::GetFieldName() const { - if ( bName ) - { - String aStr(SwFieldType::GetTypeStr(GetTypeId())); - aStr += ':'; + String aStr(SwFieldType::GetTypeStr(GetTypeId())); + aStr += ':'; - sal_uInt16 nSub = nSubType & 0xff; + sal_uInt16 const nSub = nSubType & 0xff; - switch(nSub) - { - case DI_CUSTOM: - aStr += aName; - break; + switch (nSub) + { + case DI_CUSTOM: + aStr += aName; + break; - default: - aStr += *ViewShell::GetShellRes()->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ]; - break; - } - if( IsFixed() ) - ( aStr += ' ' ) += ViewShell::GetShellRes()->aFixedStr; - return aStr; + default: + aStr += *ViewShell::GetShellRes() + ->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ]; + break; } - return Expand(); + if (IsFixed()) + { + aStr += ' '; + aStr += ViewShell::GetShellRes()->aFixedStr; + } + return aStr; } /* --------------------------------------------------------------------------- @@ -1517,25 +1517,20 @@ void SwHiddenTxtField::Evaluate(SwDoc* pDoc) /* --------------------------------------------------------------------------- ---------------------------------------------------------------------------*/ -String SwHiddenTxtField::GetCntnt(sal_Bool bName) const +String SwHiddenTxtField::GetFieldName() const { - if ( bName ) - { - String aStr(SwFieldType::GetTypeStr(nSubType)); - aStr += ' '; - aStr += aCond; - aStr += ' '; - aStr += aTRUETxt; + String aStr(SwFieldType::GetTypeStr(nSubType)); + aStr += ' '; + aStr += aCond; + aStr += ' '; + aStr += aTRUETxt; - if(nSubType == TYP_CONDTXTFLD) - { -static char __READONLY_DATA cTmp[] = " : "; - aStr.AppendAscii(cTmp); - aStr += aFALSETxt; - } - return aStr; + if (nSubType == TYP_CONDTXTFLD) + { + aStr.AppendAscii(" : "); + aStr += aFALSETxt; } - return Expand(); + return aStr; } /* --------------------------------------------------------------------------- diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 25b0cf932e83..3440e37f91ba 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -305,18 +305,15 @@ String SwGetExpField::Expand() const return sExpand; } -String SwGetExpField::GetCntnt(BOOL bName) const -{ - if ( bName ) - { - String aStr( SwFieldType::GetTypeStr( static_cast<USHORT>(nsSwGetSetExpType::GSE_FORMULA & nSubType - ? TYP_FORMELFLD - : TYP_GETFLD ) )); - aStr += ' '; - aStr += GetFormula(); - return aStr; - } - return Expand(); +String SwGetExpField::GetFieldName() const +{ + String aStr( SwFieldType::GetTypeStr( + static_cast<USHORT>(((nsSwGetSetExpType::GSE_FORMULA & nSubType) != 0) + ? TYP_FORMELFLD + : TYP_GETFLD ) )); + aStr += ' '; + aStr += GetFormula(); + return aStr; } SwField* SwGetExpField::Copy() const @@ -834,35 +831,28 @@ String SwSetExpField::Expand() const } /*-------------------------------------------------------------------- - Beschreibung: liefert den Namen oder den Inhalt + @return the field name --------------------------------------------------------------------*/ -String SwSetExpField::GetCntnt(BOOL bName) const +String SwSetExpField::GetFieldName() const { - if( bName ) - { - USHORT nStrType; - - if( IsSequenceFld() ) - nStrType = TYP_SEQFLD; - else if( bInput ) - nStrType = TYP_SETINPFLD; - else - nStrType = TYP_SETFLD; + USHORT const nStrType( (IsSequenceFld()) + ? TYP_SEQFLD + : (bInput) + ? TYP_SETINPFLD + : TYP_SETFLD ); - String aStr( SwFieldType::GetTypeStr( nStrType ) ); - aStr += ' '; - aStr += GetTyp()->GetName(); + String aStr( SwFieldType::GetTypeStr( nStrType ) ); + aStr += ' '; + aStr += GetTyp()->GetName(); - if( TYP_SEQFLD != nStrType ) - { - // Sequence nicht die Formel ausgeben - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " = " )); - aStr += GetFormula(); - } - return aStr; + // Sequence: without formula + if (TYP_SEQFLD != nStrType) + { + aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " = " ) ); + aStr += GetFormula(); } - return Expand(); + return aStr; } SwField* SwSetExpField::Copy() const @@ -1021,20 +1011,16 @@ SwInputField::SwInputField(SwInputFieldType* pTyp, const String& rContent, { } -String SwInputField::GetCntnt(BOOL bName) const +String SwInputField::GetFieldName() const { - if ( bName ) + String aStr(SwField::GetFieldName()); + if ((nSubType & 0x00ff) == INP_USR) { - String aStr(SwField::GetCntnt(bName)); - if ((nSubType & 0x00ff) == INP_USR) - { - aStr += GetTyp()->GetName(); - aStr += ' '; - aStr += aContent; - } - return aStr; + aStr += GetTyp()->GetName(); + aStr += ' '; + aStr += aContent; } - return Expand(); + return aStr; } SwField* SwInputField::Copy() const diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index c47bd63e70ad..5bd97cba75ff 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -28,16 +28,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - -// #include <math.h> #include <float.h> #include <rtl/math.hxx> #include <svl/zforlist.hxx> #include <svl/zformat.hxx> #include <editeng/unolingu.hxx> -#ifndef _UNOFLDMID_H #include <unofldmid.h> -#endif #include <doc.hxx> #include <editsh.hxx> #include <frame.hxx> @@ -53,9 +49,7 @@ #include <expfld.hxx> #include <shellres.hxx> #include <calc.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <math.h> #ifdef MAC @@ -272,21 +266,20 @@ USHORT SwField::GetTypeId() const Beschreibung: liefert den Namen oder den Inhalt --------------------------------------------------------------------*/ -String SwField::GetCntnt( BOOL bName ) const +String SwField::GetFieldName() const { - String sRet; - if( bName ) + USHORT nTypeId = GetTypeId(); + if (RES_DATETIMEFLD == GetTyp()->Which()) { - USHORT nTypeId = GetTypeId(); - if( RES_DATETIMEFLD == GetTyp()->Which() ) - nTypeId = static_cast<USHORT>(GetSubType() & DATEFLD ? TYP_DATEFLD : TYP_TIMEFLD); - - sRet = SwFieldType::GetTypeStr( nTypeId ); - if( IsFixed() ) - ( sRet += ' ' ) += ViewShell::GetShellRes()->aFixedStr; + nTypeId = static_cast<USHORT>( + ((GetSubType() & DATEFLD) != 0) ? TYP_DATEFLD : TYP_TIMEFLD); + } + String sRet = SwFieldType::GetTypeStr( nTypeId ); + if (IsFixed()) + { + sRet += ' '; + sRet += ViewShell::GetShellRes()->aFixedStr; } - else - sRet = Expand(); return sRet; } diff --git a/sw/source/core/fields/macrofld.cxx b/sw/source/core/fields/macrofld.cxx index 70a0d2dcf689..f77bcf1fd457 100644 --- a/sw/source/core/fields/macrofld.cxx +++ b/sw/source/core/fields/macrofld.cxx @@ -28,20 +28,19 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <hintids.hxx> #include <doc.hxx> #include <docufld.hxx> -#ifndef _UNOFLDMID_H #include <unofldmid.h> -#endif #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uri/XUriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <comphelper/processfactory.hxx> + using namespace ::com::sun::star; using ::rtl::OUString; + /*-------------------------------------------------------------------- Beschreibung: MacroFeldtypen --------------------------------------------------------------------*/ @@ -79,16 +78,12 @@ SwField* SwMacroField::Copy() const return new SwMacroField((SwMacroFieldType*)GetTyp(), aMacro, aText); } -String SwMacroField::GetCntnt(BOOL bName) const +String SwMacroField::GetFieldName() const { - if(bName) - { - String aStr(GetTyp()->GetName()); - aStr += ' '; - aStr += aMacro; - return aStr; - } - return Expand(); + String aStr(GetTyp()->GetName()); + aStr += ' '; + aStr += aMacro; + return aStr; } String SwMacroField::GetLibName() const diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 8b03b7e54664..1af598eb4e46 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -62,18 +62,12 @@ // <-- #include <ftnidx.hxx> #include <viewsh.hxx> -#ifndef _UNOFLDMID_H #include <unofldmid.h> -#endif #include <SwStyleNameMapper.hxx> #include <shellres.hxx> #include <poolfmt.hxx> -#ifndef _POOLFMT_HRC #include <poolfmt.hrc> -#endif -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <numrule.hxx> #include <SwNodeNum.hxx> @@ -280,11 +274,8 @@ String SwGetRefField::Expand() const } -String SwGetRefField::GetCntnt(BOOL bName) const +String SwGetRefField::GetFieldName() const { - if( !bName ) - return Expand(); - String aStr(GetTyp()->GetName()); aStr += ' '; aStr += sSetRefName; diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index ae340b9a7ba5..abaacf8abc9e 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -37,9 +37,8 @@ #include <txtfld.hxx> #include <expfld.hxx> #include <docfld.hxx> // fuer _SetGetExpFld -#ifndef _UNOFLDMID_H #include <unofldmid.h> -#endif + using namespace ::com::sun::star; using ::rtl::OUString; @@ -91,22 +90,12 @@ SwField* SwTblField::Copy() const } -String SwTblField::GetCntnt(BOOL bName) const +String SwTblField::GetFieldName() const { - if( bName ) - { - String aStr(GetTyp()->GetName()); - aStr += ' '; - - USHORT nOldSubType = nSubType; - SwTblField* pThis = (SwTblField*)this; - pThis->nSubType |= nsSwExtendedSubType::SUB_CMD; - aStr += Expand(); - pThis->nSubType = nOldSubType; - - return aStr; - } - return Expand(); + String aStr(GetTyp()->GetName()); + aStr += ' '; + aStr += const_cast<SwTblField *>(this)->GetCommand(); + return aStr; } // suche den TextNode, in dem das Feld steht @@ -127,21 +116,28 @@ const SwNode* SwTblField::GetNodeOfFormula() const return 0; } +String SwTblField::GetCommand() +{ + if (EXTRNL_NAME != GetNameType()) + { + SwNode const*const pNd = GetNodeOfFormula(); + SwTableNode const*const pTblNd = (pNd) ? pNd->FindTableNode() : 0; + if (pTblNd) + { + PtrToBoxNm( &pTblNd->GetTable() ); + } + } + return (EXTRNL_NAME == GetNameType()) + ? SwTableFormula::GetFormula() + : String(); +} String SwTblField::Expand() const { String aStr; if (nSubType & nsSwExtendedSubType::SUB_CMD) { - if( EXTRNL_NAME != GetNameType() ) - { - const SwNode* pNd = GetNodeOfFormula(); - const SwTableNode* pTblNd = pNd ? pNd->FindTableNode() : 0; - if( pTblNd ) - ((SwTblField*)this)->PtrToBoxNm( &pTblNd->GetTable() ); - } - if( EXTRNL_NAME == GetNameType() ) - aStr = SwTableFormula::GetFormula(); + aStr = const_cast<SwTblField *>(this)->GetCommand(); } else { diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index f9437cd0fbd5..ccb10ca03ee1 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -40,12 +40,12 @@ #include <doc.hxx> #include <editsh.hxx> #include <dpage.hxx> -#ifndef _UNOFLDMID_H #include <unofldmid.h> -#endif + using namespace ::com::sun::star; using ::rtl::OUString; + /*-------------------------------------------------------------------- Beschreibung: Benutzerfelder --------------------------------------------------------------------*/ @@ -72,17 +72,14 @@ SwField* SwUserField::Copy() const return pTmp; } -String SwUserField::GetCntnt(sal_Bool bName) const +String SwUserField::GetFieldName() const { - if ( bName ) - { String aStr(SwFieldType::GetTypeStr(TYP_USERFLD)); - aStr += ' '; - aStr += GetTyp()->GetName(); - aStr.AppendAscii(" = "); - aStr += ((SwUserFieldType*)GetTyp())->GetContent(); - return aStr; - } - return Expand(); + String aStr(SwFieldType::GetTypeStr(TYP_USERFLD)); + aStr += ' '; + aStr += GetTyp()->GetName(); + aStr.AppendAscii(" = "); + aStr += static_cast<SwUserFieldType*>(GetTyp())->GetContent(); + return aStr; } double SwUserField::GetValue() const diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx index d88aae514904..e82f5dc71253 100644 --- a/sw/source/core/inc/txmsrt.hxx +++ b/sw/source/core/inc/txmsrt.hxx @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _TXMSRT_HXX -#define _TXMSRT_HXX +#ifndef SW_TXMSRT_HXX +#define SW_TXMSRT_HXX #include <i18npool/lang.h> #include <tox.hxx> @@ -154,7 +154,7 @@ private: String sSortTxt; String sSortTxtReading; - virtual void _GetText( String&, String& ) = 0; + virtual void GetText_Impl( String&, String& ) const = 0; }; inline void SwTOXSortTabBase::GetTxt( String& rSortTxt, @@ -163,7 +163,7 @@ inline void SwTOXSortTabBase::GetTxt( String& rSortTxt, if( !bValidTxt ) { SwTOXSortTabBase* pThis = (SwTOXSortTabBase*)this; - pThis->_GetText( pThis->sSortTxt, pThis->sSortTxtReading ); + pThis->GetText_Impl( pThis->sSortTxt, pThis->sSortTxtReading ); pThis->bValidTxt = TRUE; } @@ -194,7 +194,7 @@ struct SwTOXIndex : public SwTOXSortTabBase virtual BOOL operator<( const SwTOXSortTabBase& ); private: - virtual void _GetText( String&, String& ); + virtual void GetText_Impl( String&, String& ) const; BYTE nKeyLevel; }; @@ -211,7 +211,7 @@ struct SwTOXCustom : public SwTOXSortTabBase virtual BOOL operator<( const SwTOXSortTabBase& ); private: - virtual void _GetText( String&, String& ); + virtual void GetText_Impl( String&, String& ) const; String aKey; String sReading; @@ -231,7 +231,7 @@ struct SwTOXContent : public SwTOXSortTabBase virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0 ) const; virtual USHORT GetLevel() const; private: - virtual void _GetText( String&, String& ); + virtual void GetText_Impl( String&, String& ) const; }; @@ -248,7 +248,7 @@ struct SwTOXPara : public SwTOXSortTabBase virtual String GetURL() const; private: - virtual void _GetText( String&, String& ); + virtual void GetText_Impl( String&, String& ) const; SwTOXElement eType; USHORT m_nLevel; @@ -267,7 +267,7 @@ struct SwTOXTable : public SwTOXSortTabBase virtual String GetURL() const; private: - virtual void _GetText( String&, String& ); + virtual void GetText_Impl( String&, String& ) const; USHORT nLevel; }; @@ -277,7 +277,7 @@ struct SwTOXAuthority : public SwTOXSortTabBase private: SwFmtFld& m_rField; virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0 ) const; - virtual void _GetText( String&, String& ); + virtual void GetText_Impl( String&, String& ) const; public: SwTOXAuthority( const SwCntntNode& rNd, SwFmtFld& rField, const SwTOXInternational& rIntl ); @@ -291,4 +291,4 @@ public: }; -#endif // _TXMSRT_HXX +#endif // SW_TXMSRT_HXX diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 60b476839705..8a80a8d22e01 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -779,7 +779,9 @@ void SwTxtNode::GetMinMaxSize( ULONG nIndex, ULONG& rMin, ULONG &rMax, case RES_TXTATR_FIELD : { SwField *pFld = (SwField*)pHint->GetFld().GetFld(); - const String aTxt = pFld->GetCntnt( FALSE ); + SwDoc const*const pDoc(GetDoc()); + const String aTxt = + pFld->ExpandField(pDoc->IsClipBoard()); if( lcl_MinMaxString( aArg, aIter.GetFnt(), aTxt, 0, aTxt.Len() ) ) nAdd = 20; @@ -974,7 +976,8 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) case RES_TXTATR_FIELD : { SwField *pFld = (SwField*)pHint->GetFld().GetFld(); - const String aTxt = pFld->GetCntnt( FALSE ); + SwDoc const*const pDoc( GetDoc() ); + String const aTxt = pFld->ExpandField(pDoc->IsClipBoard()); SwDrawTextInfo aDrawInf( pSh, *pOut, 0, aTxt, 0, aTxt.Len() ); nProWidth += aIter.GetFnt()->_GetTxtSize( aDrawInf ).Width(); diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 526dbe74c4d9..50094f04fb3f 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -106,6 +106,8 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, } ViewShell *pSh = rInf.GetVsh(); + SwDoc *const pDoc( (pSh) ? pSh->GetDoc() : 0 ); + bool const bInClipboard( (pDoc) ? pDoc->IsClipBoard() : true ); sal_Bool bPlaceHolder = sal_False; switch( pFld->GetTyp()->Which() ) @@ -117,16 +119,26 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, case RES_COMBINED_CHARS: { - String sStr( pFld->GetCntnt( bName )); if( bName ) - pRet = new SwFldPortion( sStr ); + { + String const sName( pFld->GetFieldName() ); + pRet = new SwFldPortion(sName); + } else - pRet = new SwCombinedPortion( sStr ); + { + String const sContent( pFld->ExpandField(bInClipboard) ); + pRet = new SwCombinedPortion(sContent); + } } break; case RES_HIDDENTXTFLD: - pRet = new SwHiddenPortion(pFld->GetCntnt( bName )); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwHiddenPortion(str); + } break; case RES_CHAPTERFLD: @@ -135,13 +147,25 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, ((SwChapterField*)pFld)->ChangeExpansion( pFrame, &((SwTxtFld*)pHint)->GetTxtNode() ); } - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion( str ); + } break; case RES_DOCSTATFLD: if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() ) + { ((SwDocStatField*)pFld)->ChangeExpansion( pFrame ); - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + } + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion( str ); + } break; case RES_PAGENUMBERFLD: @@ -153,7 +177,6 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, const SwRootFrm* pTmpRootFrm = pSh->GetLayout(); const sal_Bool bVirt = pTmpRootFrm->IsVirtPageNum(); - SwDoc* pDoc = pSh->GetDoc(); MSHORT nVirtNum = pFrame->GetVirtPageNum(); MSHORT nNumPages = pTmpRootFrm->GetPageNum(); sal_Int16 nNumFmt = -1; @@ -163,7 +186,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, pPageNr->ChangeExpansion( pDoc, nVirtNum, nNumPages, bVirt, nNumFmt > -1 ? &nNumFmt : 0); } - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion( str ); + } break; } case RES_GETEXPFLD: @@ -183,7 +211,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, pExpFld->ChgBodyTxtFlag( sal_True ); } } - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion( str ); + } break; } case RES_DBFLD: @@ -207,13 +240,25 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, } */ } - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion(str); + } break; } case RES_REFPAGEGETFLD: if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() ) + { ((SwRefPageGetField*)pFld)->ChangeExpansion( pFrame, (SwTxtFld*)pHint ); - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + } + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion(str); + } break; case RES_JUMPEDITFLD: @@ -224,9 +269,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, break; default: - { - pRet = new SwFldPortion(pFld->GetCntnt( bName ) ); - } + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion(str); + } } if( bNewFlyPor ) @@ -249,7 +297,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, else pTmpFnt->SetDiffFnt( &pChFmt->GetAttrSet(), pFrm->GetTxtNode()->getIDocumentSettingAccess() ); } - pRet = new SwFldPortion( pFld->GetCntnt( bName ), pTmpFnt, bPlaceHolder ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion(str, pTmpFnt, bPlaceHolder); + } } return pRet; diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 61f873b010b7..fa6149de051e 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -51,9 +51,7 @@ #include <authfld.hxx> #include <toxwrap.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <numrule.hxx> extern BOOL IsFrameBehind( const SwTxtNode& rMyNd, xub_StrLen nMySttPos, @@ -403,7 +401,7 @@ BOOL SwTOXIndex::operator<( const SwTOXSortTabBase& rCmpBase ) // -void SwTOXIndex::_GetText( String& rTxt, String& rTxtReading ) +void SwTOXIndex::GetText_Impl( String& rTxt, String& rTxtReading ) const { ASSERT(pTxtMark, "pTxtMark == 0, Kein Stichwort"); const SwTOXMark& rTOXMark = pTxtMark->GetTOXMark(); @@ -530,7 +528,7 @@ USHORT SwTOXCustom::GetLevel() const } -void SwTOXCustom::_GetText( String& rTxt, String &rTxtReading ) +void SwTOXCustom::GetText_Impl( String& rTxt, String &rTxtReading ) const { rTxt = aKey; rTxtReading = sReading; @@ -553,7 +551,7 @@ SwTOXContent::SwTOXContent( const SwTxtNode& rNd, const SwTxtTOXMark* pMark, // Der Text des Inhalts // -void SwTOXContent::_GetText( String& rTxt, String& rTxtReading ) +void SwTOXContent::GetText_Impl( String& rTxt, String& rTxtReading ) const { const xub_StrLen* pEnd = pTxtMark->GetEnd(); if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() ) @@ -612,7 +610,7 @@ SwTOXPara::SwTOXPara( const SwCntntNode& rNd, SwTOXElement eT, USHORT nLevel ) } -void SwTOXPara::_GetText( String& rTxt, String& ) +void SwTOXPara::GetText_Impl( String& rTxt, String& ) const { const SwCntntNode* pNd = aTOXSources[0].pNd; switch( eType ) @@ -801,7 +799,7 @@ SwTOXTable::SwTOXTable( const SwCntntNode& rNd ) } -void SwTOXTable::_GetText( String& rTxt, String& ) +void SwTOXTable::GetText_Impl( String& rTxt, String& ) const { const SwNode* pNd = aTOXSources[0].pNd; if( pNd && 0 != ( pNd = pNd->FindTableNode() ) ) @@ -868,11 +866,16 @@ USHORT SwTOXAuthority::GetLevel() const /*-- 15.09.99 14:28:08--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwTOXAuthority::_GetText( String& rTxt, String& ) +static String lcl_GetText(SwFmtFld const& rField) { bool const isClipBoard( - m_rField.GetTxtFld()->GetTxtNode().GetDoc()->IsClipBoard()); - rTxt = m_rField.GetFld()->ExpandField(isClipBoard); + rField.GetTxtFld()->GetTxtNode().GetDoc()->IsClipBoard()); + return rField.GetFld()->ExpandField(isClipBoard); +} + +void SwTOXAuthority::GetText_Impl( String& rTxt, String& ) const +{ + rTxt = lcl_GetText(m_rField); } /* -----------------21.09.99 12:50------------------- @@ -885,7 +888,7 @@ void SwTOXAuthority::FillText( SwTxtNode& rNd, String sText; if(AUTH_FIELD_IDENTIFIER == nAuthField) { - sText = pField->Expand(); + sText = lcl_GetText(m_rField); const SwAuthorityFieldType* pType = (const SwAuthorityFieldType*)pField->GetTyp(); sal_Unicode cChar = pType->GetPrefix(); if(cChar && cChar != ' ') diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index bd4a4ce5ef98..d5a84de322d5 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1267,13 +1267,16 @@ uno::Reference< beans::XPropertySet > SwXTextField::getTextFieldMaster(void) th OUString SwXTextField::getPresentation(sal_Bool bShowCommand) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - OUString sRet; - const SwField* pField = GetField(); - if(pField) - sRet = pField->GetCntnt(bShowCommand); - else + + SwField const*const pField = GetField(); + if (!pField) + { throw uno::RuntimeException(); - return sRet; + } + ::rtl::OUString const ret( (bShowCommand) + ? pField->GetFieldName() + : pField->ExpandField( GetDoc()->IsClipBoard() ) ); + return ret; } /* -----------------18.02.99 13:39------------------- * diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 7f1b6658800e..73c2410e7bda 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -343,7 +343,8 @@ void WW8Export::DoFormText(const SwInputField * pFld) OutputField(0, ww::eFORMTEXT, aEmptyStr, WRITEFIELD_CMD_END); - SwWW8Writer::WriteString16(Strm(), pFld->Expand(), false); + String const fieldStr( pFld->ExpandField(pDoc->IsClipBoard()) ); + SwWW8Writer::WriteString16(Strm(), fieldStr, false); static BYTE aArr2[] = { 0x03, 0x6a, 0x00, 0x00, 0x00, 0x00, // sprmCPicLocation diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 89aef162ec01..df438a0eed51 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2776,7 +2776,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) if (pDocInfoField != NULL) { - String sFieldname = pDocInfoField->GetCntnt(TRUE); + String sFieldname = pDocInfoField->GetFieldName(); xub_StrLen nIndex = sFieldname.Search(':'); if (nIndex != sFieldname.Len()) diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx index be201c32c24e..820b55cac53e 100644 --- a/sw/source/ui/docvw/edtwin2.cxx +++ b/sw/source/ui/docvw/edtwin2.cxx @@ -340,7 +340,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) break; case RES_DBFLD: - sTxt = ((SwDBField*)pFld)->GetCntnt(TRUE); + sTxt = pFld->GetFieldName(); break; case RES_USERFLD: diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx index 68ce692f6a32..1d3fafa880a1 100644 --- a/sw/source/ui/fldui/DropDownFieldDialog.cxx +++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx @@ -32,21 +32,14 @@ #undef SW_DLLIMPLEMENTATION #endif - #include <wrtsh.hxx> #include <fldbas.hxx> #include <fldmgr.hxx> -#ifndef _MSGBOX_HXX #include <vcl/msgbox.hxx> -#endif #include <DropDownFieldDialog.hxx> #include <flddropdown.hxx> -#ifndef _FLDUI_HRC #include <fldui.hrc> -#endif -#ifndef _SW_DROPDOWNFIELDDIALOG_HRC #include <DropDownFieldDialog.hrc> -#endif using namespace ::com::sun::star; @@ -124,13 +117,12 @@ void sw::DropDownFieldDialog::Apply() { rSh.StartAllAction(); - SwDropDownField * pCopy = (SwDropDownField *) pDropField->Copy(); + ::std::auto_ptr<SwDropDownField> const pCopy( + static_cast<SwDropDownField *>( pDropField->CopyField() ) ); pCopy->SetPar1(sSelect); rSh.SwEditShell::UpdateFlds(*pCopy); - delete pCopy; - rSh.SetUndoNoResetModified(); rSh.EndAllAction(); } diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx index 46c05c4ac63b..670b59d26610 100644 --- a/sw/source/ui/fldui/inpdlg.cxx +++ b/sw/source/ui/fldui/inpdlg.cxx @@ -32,13 +32,7 @@ #undef SW_DLLIMPLEMENTATION #endif - - -#define _INPDLG_CXX - -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <unotools/charclass.hxx> #include <editeng/unolingu.hxx> #include <wrtsh.hxx> @@ -48,12 +42,8 @@ #include <inpdlg.hxx> #include <fldmgr.hxx> -#ifndef _FLDUI_HRC #include <fldui.hrc> -#endif -#ifndef _INPDLG_HRC #include <inpdlg.hrc> -#endif /*-------------------------------------------------------------------- @@ -128,7 +118,9 @@ SwFldInputDlg::SwFldInputDlg( Window *pParent, SwWrtShell &rS, //values are formatted - formulas are not CharClass aCC( SvxCreateLocale( pSetFld->GetLanguage() )); if( aCC.isNumeric( sFormula )) - aStr = pSetFld->Expand(); + { + aStr = pSetFld->ExpandField(false/*no dialogs for clipboard*/); + } else aStr = sFormula; aLabelED.SetText( pSetFld->GetPromptText() ); |