summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-10-04 17:14:34 +0200
committerMichael Stahl <mst@openoffice.org>2010-10-04 17:14:34 +0200
commitf7c044dd301bfdfa165714b88b1d0af067d5b193 (patch)
tree5aaf3b473e3a2106451df9ebdc4731d9c6fec2a9 /sw/inc
parentc4443211969706af9ddf418164d9e10bbda60dc3 (diff)
sw34bf01: #i85766# #i112425#: prevent expansion of fields in temp documents:
SwField subclasses: make Expand()/Copy() methods private, like in SwField. SwField+subclasses: replace method GetCntnt(BOOL) with GetFieldName(). SwTblField: refactor Expand() and GetCntnt(BOOL): create new private method.
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/authfld.hxx10
-rw-r--r--sw/inc/chpfld.hxx13
-rw-r--r--sw/inc/dbfld.hxx18
-rw-r--r--sw/inc/ddefld.hxx13
-rw-r--r--sw/inc/docufld.hxx27
-rw-r--r--sw/inc/expfld.hxx41
-rw-r--r--sw/inc/fldbas.hxx15
-rw-r--r--sw/inc/flddat.hxx12
-rw-r--r--sw/inc/flddropdown.hxx43
-rw-r--r--sw/inc/inetfld.hxx13
-rw-r--r--sw/inc/reffld.hxx13
-rw-r--r--sw/inc/usrfld.hxx13
12 files changed, 118 insertions, 113 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