[Libreoffice-commits] core.git: sw/inc sw/source

Matteo Casalin matteo.casalin at yahoo.com
Tue Jul 16 06:56:09 PDT 2013


 sw/inc/authfld.hxx                    |   34 +--
 sw/inc/chpfld.hxx                     |   15 -
 sw/inc/dbfld.hxx                      |   44 ++--
 sw/inc/ddefld.hxx                     |   18 -
 sw/inc/docufld.hxx                    |  170 +++++++--------
 sw/inc/expfld.hxx                     |  106 ++++-----
 sw/inc/fldbas.hxx                     |   47 ++--
 sw/inc/flddat.hxx                     |    4 
 sw/inc/flddropdown.hxx                |   12 -
 sw/inc/reffld.hxx                     |   22 +-
 sw/inc/usrfld.hxx                     |   18 -
 sw/source/core/crsr/findtxt.cxx       |    4 
 sw/source/core/doc/docfld.cxx         |   58 ++---
 sw/source/core/edit/edattr.cxx        |    8 
 sw/source/core/fields/authfld.cxx     |   43 ++-
 sw/source/core/fields/chpfld.cxx      |   67 +++---
 sw/source/core/fields/dbfld.cxx       |  145 +++++--------
 sw/source/core/fields/ddefld.cxx      |   95 ++++----
 sw/source/core/fields/docufld.cxx     |  370 ++++++++++++++++------------------
 sw/source/core/fields/expfld.cxx      |  272 ++++++++++++------------
 sw/source/core/fields/fldbas.cxx      |   50 ++--
 sw/source/core/fields/flddat.cxx      |    2 
 sw/source/core/fields/flddropdown.cxx |   55 +----
 sw/source/core/fields/macrofld.cxx    |   45 +---
 sw/source/core/fields/reffld.cxx      |   72 +++---
 sw/source/core/fields/scrptfld.cxx    |   12 -
 sw/source/core/fields/tblcalc.cxx     |   53 ++--
 sw/source/core/fields/usrfld.cxx      |   46 +---
 sw/source/core/inc/docfld.hxx         |    4 
 sw/source/filter/ww8/ww8atr.cxx       |   11 -
 sw/source/ui/fldui/fldfunc.cxx        |    4 
 sw/source/ui/fldui/fldmgr.cxx         |  173 ++++++++-------
 sw/source/ui/fldui/xfldui.cxx         |    4 
 sw/source/ui/inc/fldmgr.hxx           |   53 ++--
 sw/source/ui/inc/initui.hxx           |    3 
 sw/source/ui/index/swuiidxmrk.cxx     |    6 
 sw/source/ui/utlui/initui.cxx         |   21 +
 37 files changed, 1078 insertions(+), 1088 deletions(-)

New commits:
commit 263153842741d7ce21cc0bf1c5296a55a1138024
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jul 14 15:21:18 2013 +0200

    String to OUString
    
    Change-Id: I64f31d8a0bb02a2ecd8fcc993c90ca76923b35fb
    Reviewed-on: https://gerrit.libreoffice.org/4924
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 7df89db..516120b 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -27,16 +27,16 @@
 
 class SwAuthEntry
 {
-    String      aAuthFields[AUTH_FIELD_END];
+    OUString        aAuthFields[AUTH_FIELD_END];
     sal_uInt16      nRefCount;
 public:
     SwAuthEntry() : nRefCount(0){}
     SwAuthEntry( const SwAuthEntry& rCopy );
     sal_Bool            operator==(const SwAuthEntry& rComp);
 
-    inline const String&    GetAuthorField(ToxAuthorityField ePos)const;
+    inline OUString         GetAuthorField(ToxAuthorityField ePos) const;
     inline void             SetAuthorField(ToxAuthorityField ePos,
-                                            const String& rField);
+                                            const OUString& rField);
 
     void            AddRef()                { ++nRefCount; }
     void            RemoveRef()             { --nRefCount; }
@@ -67,7 +67,7 @@ class SW_DLLPUBLIC SwAuthorityFieldType : public SwFieldType
     sal_Bool                m_bIsSequence :1;
     sal_Bool                m_bSortByDocument :1;
     LanguageType            m_eLanguage;
-    String                  m_sSortAlgorithm;
+    OUString                m_sSortAlgorithm;
 
 protected:
 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
@@ -84,7 +84,7 @@ public:
     inline void         SetDoc(SwDoc* pNewDoc)              { m_pDoc = pNewDoc; }
     SwDoc*              GetDoc(){ return m_pDoc; }
     void                RemoveField(sal_IntPtr nHandle);
-    sal_IntPtr          AddField(const String& rFieldContents);
+    sal_IntPtr          AddField(const OUString& rFieldContents);
     sal_Bool            AddField(sal_IntPtr nHandle);
     void                DelSequenceArray()
                         {
@@ -93,8 +93,8 @@ public:
 
     const SwAuthEntry*  GetEntryByHandle(sal_IntPtr nHandle) const;
 
-    void                GetAllEntryIdentifiers( std::vector<String>& rToFill )const;
-    const SwAuthEntry*  GetEntryByIdentifier(const String& rIdentifier)const;
+    void                GetAllEntryIdentifiers( std::vector<OUString>& rToFill ) const;
+    const SwAuthEntry*  GetEntryByIdentifier(const OUString& rIdentifier) const;
 
     bool                ChangeEntryContent(const SwAuthEntry* pNewEntry);
     // import interface
@@ -130,14 +130,14 @@ public:
     void                SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey nKeys[]);
 
     //initui.cxx
-    static const String&    GetAuthFieldName(ToxAuthorityField eType);
-    static const String&    GetAuthTypeName(ToxAuthorityType eType);
+    static OUString     GetAuthFieldName(ToxAuthorityField eType);
+    static OUString     GetAuthTypeName(ToxAuthorityType eType);
 
     LanguageType    GetLanguage() const {return m_eLanguage;}
     void            SetLanguage(LanguageType nLang)  {m_eLanguage = nLang;}
 
-    const String&   GetSortAlgorithm()const {return m_sSortAlgorithm;}
-    void            SetSortAlgorithm(const String& rSet) {m_sSortAlgorithm = rSet;}
+    OUString        GetSortAlgorithm() const {return m_sSortAlgorithm;}
+    void            SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;}
 
 };
 
@@ -146,15 +146,15 @@ class SwAuthorityField : public SwField
     sal_IntPtr          m_nHandle;
     mutable sal_IntPtr  m_nTempSequencePos;
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
 public:
-    SwAuthorityField(SwAuthorityFieldType* pType, const String& rFieldContents);
+    SwAuthorityField(SwAuthorityFieldType* pType, const OUString& rFieldContents);
     SwAuthorityField(SwAuthorityFieldType* pType, sal_IntPtr nHandle);
     ~SwAuthorityField();
 
-    const String&       GetFieldText(ToxAuthorityField eField) const;
+    OUString            GetFieldText(ToxAuthorityField eField) const;
 
     virtual void        SetPar1(const OUString& rStr);
     virtual SwFieldType* ChgTyp( SwFieldType* );
@@ -164,16 +164,16 @@ public:
 
     sal_IntPtr          GetHandle() const       { return m_nHandle; }
 
-    virtual String GetDescription() const;
+    virtual OUString GetDescription() const;
 };
 
 // --- inlines -----------------------------------------------------------
-inline const String&    SwAuthEntry::GetAuthorField(ToxAuthorityField ePos)const
+inline OUString SwAuthEntry::GetAuthorField(ToxAuthorityField ePos) const
 {
     OSL_ENSURE(AUTH_FIELD_END > ePos, "wrong index");
     return aAuthFields[ePos];
 }
-inline void SwAuthEntry::SetAuthorField(ToxAuthorityField ePos, const String& rField)
+inline void SwAuthEntry::SetAuthorField(ToxAuthorityField ePos, const OUString& rField)
 {
     OSL_ENSURE(AUTH_FIELD_END > ePos, "wrong index");
     if(AUTH_FIELD_END > ePos)
diff --git a/sw/inc/chpfld.hxx b/sw/inc/chpfld.hxx
index 2593578..1a87f43 100644
--- a/sw/inc/chpfld.hxx
+++ b/sw/inc/chpfld.hxx
@@ -51,9 +51,12 @@ class SW_DLLPUBLIC SwChapterField : public SwField
 {
     friend class SwChapterFieldType;
     sal_uInt8 nLevel;
-    String sTitle, sNumber, sPre, sPost;
+    OUString sTitle;
+    OUString sNumber;
+    OUString sPre;
+    OUString sPost;
 
-    virtual String   Expand() const;
+    virtual OUString Expand() const;
     virtual SwField* Copy() const;
 
 public:
@@ -68,16 +71,16 @@ public:
     inline sal_uInt8 GetLevel() const;
     inline void SetLevel(sal_uInt8);
 
-    inline const String& GetNumber() const;
-    inline const String& GetTitle() const;
+    inline OUString      GetNumber() const;
+    inline OUString      GetTitle() const;
     virtual bool         QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool         PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
 };
 
 inline sal_uInt8 SwChapterField::GetLevel() const   { return nLevel; }
 inline void SwChapterField::SetLevel(sal_uInt8 nLev) { nLevel = nLev; }
-inline const String& SwChapterField::GetNumber() const { return sNumber; }
-inline const String& SwChapterField::GetTitle() const { return sTitle; }
+inline OUString SwChapterField::GetNumber() const { return sNumber; }
+inline OUString SwChapterField::GetTitle() const { return sTitle; }
 
 #endif // SW_CHPFLD_HXX
 
diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx
index b4f55a9..20d6289 100644
--- a/sw/inc/dbfld.hxx
+++ b/sw/inc/dbfld.hxx
@@ -35,21 +35,21 @@ class SW_DLLPUBLIC SwDBFieldType : public SwValueFieldType
 {
     SwDBData    aDBData;        //
     OUString sName;          ///< only used in ::GetName() !
-    String      sColumn;
+    OUString sColumn;
     long        nRefCnt;
 
 public:
 
-    SwDBFieldType(SwDoc* pDocPtr, const String& rColumnName, const SwDBData& rDBData);
+    SwDBFieldType(SwDoc* pDocPtr, const OUString& rColumnName, const SwDBData& rDBData);
     ~SwDBFieldType();
 
-    virtual const OUString& GetName() const;
+    virtual OUString GetName() const;
     virtual SwFieldType*  Copy() const;
 
     inline void     AddRef() { nRefCnt++; }
     void            ReleaseRef();
 
-    const String&   GetColumnName() const {return sColumn;}
+    OUString        GetColumnName() const {return sColumn;}
     const SwDBData& GetDBData() const {return aDBData;}
 
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
@@ -70,7 +70,7 @@ class SW_DLLPUBLIC SwDBField : public SwValueField
     bool    bValidValue     : 1;
     bool    bInitialized    : 1;
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
 public:
@@ -80,12 +80,12 @@ public:
     virtual SwFieldType*    ChgTyp( SwFieldType* );
 
     /// Current text.
-    inline  void        SetExpansion(const String& rStr);
+    inline  void        SetExpansion(const OUString& rStr);
 
     virtual sal_uInt16      GetSubType() const;
     virtual void        SetSubType(sal_uInt16 nType);
 
-    virtual String      GetFieldName() const;
+    virtual OUString    GetFieldName() const;
 
     /// For calculations in expressions.
     void                ChgValue( double d, bool bVal );
@@ -96,7 +96,7 @@ public:
     /// Evaluation for header and footer.
     void                ChangeExpansion( const SwFrm*, const SwTxtFld* );
     void                InitContent();
-    void                InitContent(const String& rExpansion);
+    void                InitContent(const OUString& rExpansion);
 
     inline void         ChgBodyTxtFlag( bool bIsInBody );
 
@@ -105,10 +105,10 @@ public:
     inline void         SetInitialized()        { bInitialized = true; }
 
     /// Get name.
-    virtual const OUString& GetPar1() const;
+    virtual OUString    GetPar1() const;
 
     /// access to the command string
-    const OUString& GetFieldCode() const { return sFieldCode;}
+    OUString            GetFieldCode() const { return sFieldCode;}
     void                SetFieldCode(const OUString& rStr) { sFieldCode = rStr; }
 
     /// DBName
@@ -117,7 +117,7 @@ public:
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
 };
 
-inline  void SwDBField::SetExpansion(const String& rStr)
+inline  void SwDBField::SetExpansion(const OUString& rStr)
     { aContent = rStr; }
 
 /// set from UpdateExpFlds (the Node-Position is known there)
@@ -146,7 +146,7 @@ public:
     SwDBData                GetDBData(SwDoc* pDoc);
     void                    SetDBData(const SwDBData& rDBData);
 
-    virtual String          GetFieldName() const;
+    virtual OUString        GetFieldName() const;
 
     virtual bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
@@ -177,9 +177,9 @@ class SW_DLLPUBLIC SwDBNextSetField : public SwDBNameInfField
 
 public:
     SwDBNextSetField( SwDBNextSetFieldType*,
-                      const String& rCond, const String& rDummy, const SwDBData& rDBData);
+                      const OUString& rCond, const OUString& rDummy, const SwDBData& rDBData);
 
-    virtual String          Expand() const;
+    virtual OUString        Expand() const;
     virtual SwField*        Copy() const;
 
     void                    Evaluate(SwDoc*);
@@ -187,7 +187,7 @@ public:
     inline bool             IsCondValid() const;
 
     // Condition
-    virtual const OUString&   GetPar1() const;
+    virtual OUString    GetPar1() const;
     virtual void        SetPar1(const OUString& rStr);
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
@@ -219,13 +219,13 @@ public:
 class SwDBNumSetField : public SwDBNameInfField
 {
     OUString  aCond;
-    String  aPar2;
+    OUString  aPar2;
     bool    bCondValid;
 
 public:
-    SwDBNumSetField(SwDBNumSetFieldType*, const String& rCond, const String& rDBNum, const SwDBData& rDBData);
+    SwDBNumSetField(SwDBNumSetFieldType*, const OUString& rCond, const OUString& rDBNum, const SwDBData& rDBData);
 
-    virtual String          Expand() const;
+    virtual OUString        Expand() const;
     virtual SwField*        Copy() const;
 
     inline bool             IsCondValid() const;
@@ -233,7 +233,7 @@ public:
     void                    Evaluate(SwDoc*);
 
     // Condition
-    virtual const OUString&   GetPar1() const;
+    virtual OUString        GetPar1() const;
     virtual void            SetPar1(const OUString& rStr);
 
     // Number of data record.
@@ -261,7 +261,7 @@ class SwDBNameFieldType : public SwFieldType
 public:
     SwDBNameFieldType(SwDoc*);
 
-    String                  Expand(sal_uLong) const;
+    OUString                Expand(sal_uLong) const;
     virtual SwFieldType*    Copy() const;
 };
 
@@ -274,7 +274,7 @@ class SW_DLLPUBLIC SwDBNameField : public SwDBNameInfField
 public:
     SwDBNameField(SwDBNameFieldType*, const SwDBData& rDBData, sal_uLong nFmt = 0);
 
-    virtual String   Expand() const;
+    virtual OUString Expand() const;
     virtual SwField* Copy() const;
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
@@ -303,7 +303,7 @@ class SW_DLLPUBLIC SwDBSetNumberField : public SwDBNameInfField
 public:
     SwDBSetNumberField(SwDBSetNumberFieldType*, const SwDBData& rDBData, sal_uLong nFmt = 0);
 
-    virtual String  Expand() const;
+    virtual OUString Expand() const;
     virtual         SwField* Copy() const;
     void            Evaluate(SwDoc*);
 
diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx
index 3277660..917d90f 100644
--- a/sw/inc/ddefld.hxx
+++ b/sw/inc/ddefld.hxx
@@ -32,7 +32,7 @@ class SwDoc;
 class SW_DLLPUBLIC SwDDEFieldType : public SwFieldType
 {
     OUString aName;
-    String aExpansion;
+    OUString aExpansion;
 
     ::sfx2::SvBaseLinkRef refLink;
     SwDoc* pDoc;
@@ -44,22 +44,22 @@ class SW_DLLPUBLIC SwDDEFieldType : public SwFieldType
     SW_DLLPRIVATE void _RefCntChgd();
 
 public:
-    SwDDEFieldType( const String& rName, const String& rCmd,
+    SwDDEFieldType( const OUString& rName, const OUString& rCmd,
                     sal_uInt16 = sfx2::LINKUPDATE_ONCALL );
     ~SwDDEFieldType();
 
-    const String& GetExpansion() const          { return aExpansion; }
-    void SetExpansion( const String& rStr )     { aExpansion = rStr,
+    OUString GetExpansion() const               { return aExpansion; }
+    void SetExpansion( const OUString& rStr )   { aExpansion = rStr;
                                                   bCRLFFlag = sal_False; }
 
     virtual SwFieldType* Copy() const;
-    virtual const OUString& GetName() const;
+    virtual OUString GetName() const;
 
     virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
 
-    String GetCmd() const;
-    void SetCmd( const String& rStr );
+    OUString GetCmd() const;
+    void SetCmd( OUString aStr );
 
     sal_uInt16 GetType() const          { return refLink->GetUpdateMode();  }
     void SetType( sal_uInt16 nType )    { refLink->SetUpdateMode( nType );  }
@@ -90,7 +90,7 @@ public:
 class SwDDEField : public SwField
 {
 private:
-    virtual String   Expand() const;
+    virtual OUString Expand() const;
     virtual SwField* Copy() const;
 
 public:
@@ -99,7 +99,7 @@ public:
 
     /** Get parameter via types.
      Name cannot be changed. */
-    virtual const OUString& GetPar1() const;
+    virtual OUString  GetPar1() const;
 
     // Command
     virtual OUString  GetPar2() const;
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 272a6d3..529bf14 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -148,8 +148,8 @@ class SwPageNumberFieldType : public SwFieldType
 public:
     SwPageNumberFieldType();
 
-    String& Expand( sal_uInt32 nFmt, short nOff, sal_uInt16 const nPageNumber,
-            sal_uInt16 const nMaxPage, const String&, String& rRet ) const;
+    OUString Expand( sal_uInt32 nFmt, short nOff, sal_uInt16 const nPageNumber,
+                     sal_uInt16 const nMaxPage, const OUString& ) const;
     void ChangeExpansion( SwDoc* pDoc,
                             sal_Bool bVirtPageNum, const sal_Int16* pNumFmt = 0 );
     virtual SwFieldType* Copy() const;
@@ -161,7 +161,7 @@ public:
 
 class SW_DLLPUBLIC SwPageNumberField : public SwField
 {
-    String  sUserStr;
+    OUString sUserStr;
     sal_uInt16  nSubType;
     short   nOffset;
     // fdo#58074 store page number in SwField, not SwFieldType
@@ -177,7 +177,7 @@ public:
     void ChangeExpansion(sal_uInt16 const nPageNumber,
             sal_uInt16 const nMaxPage);
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
     virtual OUString GetPar2() const;
@@ -187,8 +187,8 @@ public:
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
 
-    const String& GetUserString() const         { return sUserStr; }
-    void SetUserString( const String& rS )      { sUserStr = rS; }
+    OUString GetUserString() const            { return sUserStr; }
+    void SetUserString( const OUString& rS )  { sUserStr = rS; }
 };
 
 /*--------------------------------------------------------------------
@@ -200,7 +200,7 @@ class SwAuthorFieldType : public SwFieldType
 public:
     SwAuthorFieldType();
 
-    String                  Expand(sal_uLong) const;
+    OUString                Expand(sal_uLong) const;
     virtual SwFieldType*    Copy() const;
 };
 
@@ -210,16 +210,16 @@ public:
 
 class SwAuthorField : public SwField
 {
-    String  aContent;
+    OUString aContent;
 
 public:
     SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFmt = 0);
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
-    inline void         SetExpansion(const String& rStr) { aContent = rStr; }
-    inline const String& GetContent() const { return aContent; }
+    inline void         SetExpansion(const OUString& rStr) { aContent = rStr; }
+    inline OUString     GetContent() const { return aContent; }
 
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
@@ -235,7 +235,7 @@ class SwFileNameFieldType : public SwFieldType
 public:
     SwFileNameFieldType(SwDoc*);
 
-    String                  Expand(sal_uLong) const;
+    OUString                Expand(sal_uLong) const;
     virtual SwFieldType*    Copy() const;
 };
 
@@ -245,16 +245,16 @@ public:
 
 class SW_DLLPUBLIC SwFileNameField : public SwField
 {
-    String aContent;
+    OUString aContent;
 
 public:
     SwFileNameField(SwFileNameFieldType*, sal_uInt32 nFmt = 0);
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
-    inline void         SetExpansion(const String& rStr) { aContent = rStr; }
-    inline const String& GetContent() const { return aContent; }
+    inline void         SetExpansion(const OUString& rStr) { aContent = rStr; }
+    inline OUString     GetContent() const { return aContent; }
 
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
@@ -270,7 +270,7 @@ class SwTemplNameFieldType : public SwFieldType
 public:
     SwTemplNameFieldType(SwDoc*);
 
-    String                  Expand(sal_uLong) const;
+    OUString                Expand(sal_uLong) const;
     virtual SwFieldType*    Copy() const;
 };
 
@@ -283,7 +283,7 @@ class SW_DLLPUBLIC SwTemplNameField : public SwField
 public:
     SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFmt = 0);
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
@@ -301,7 +301,7 @@ class SwDocStatFieldType : public SwFieldType
 
 public:
     SwDocStatFieldType(SwDoc*);
-    String                  Expand(sal_uInt16 nSubType, sal_uInt32 nFmt) const;
+    OUString                Expand(sal_uInt16 nSubType, sal_uInt32 nFmt) const;
     virtual SwFieldType*    Copy() const;
 
     inline void             SetNumFormat( sal_Int16 eFmt )  { nNumberingType = eFmt; }
@@ -321,7 +321,7 @@ public:
 
     void ChangeExpansion( const SwFrm* pFrm );
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
     virtual sal_uInt16      GetSubType() const;
@@ -363,34 +363,34 @@ class SwHiddenTxtField : public SwField
     sal_Bool    bIsHidden  : 1;     ///< Is it not visible?
     sal_Bool    bValid     : 1;     ///< Is DB-field evaluated?
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
 public:
     SwHiddenTxtField( SwHiddenTxtFieldType*,
                      sal_Bool   bConditional,
-                     const  String& rCond,
-                     const  String& rTxt,
+                     const OUString& rCond,
+                     const OUString& rTxt,
                      sal_Bool   bHidden  = sal_False,
                      sal_uInt16 nSubType = TYP_HIDDENTXTFLD);
 
     SwHiddenTxtField( SwHiddenTxtFieldType*,
-                      const String& rCond,
-                      const String& rTrue,
-                      const String& rFalse,
+                      const OUString& rCond,
+                      const OUString& rTrue,
+                      const OUString& rFalse,
                       sal_uInt16 nSubType = TYP_HIDDENTXTFLD);
 
-    virtual String      GetFieldName() const;
+    virtual OUString    GetFieldName() const;
 
     void                Evaluate(SwDoc*);
 
     inline void         SetValue(sal_Bool bHidden)  { bIsHidden = bHidden; }
-    String              GetColumnName(const String& rName);
-    String              GetDBName(const String& rName, SwDoc *pDoc);
+    OUString            GetColumnName(const OUString& rName);
+    OUString            GetDBName(const OUString& rName, SwDoc *pDoc);
 
     /// Condition
     virtual void        SetPar1(const OUString& rStr);
-    virtual const OUString& GetPar1() const;
+    virtual OUString    GetPar1() const;
 
     /// True/False - String
     virtual void        SetPar2(const OUString& rStr);
@@ -425,16 +425,16 @@ class SwHiddenParaField : public SwField
     sal_Bool                bIsHidden:1;
 public:
     /// Direct input, delete old value.
-    SwHiddenParaField(SwHiddenParaFieldType*, const String& rCond);
+    SwHiddenParaField(SwHiddenParaFieldType*, const OUString& rCond);
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
     void                SetHidden(sal_Bool bHidden)     { bIsHidden = bHidden; }
     sal_Bool                IsHidden() const            { return bIsHidden;    }
 
     /// Query, set condition.
-    virtual const OUString& GetPar1() const;
+    virtual OUString    GetPar1() const;
     virtual void        SetPar1(const OUString& rStr);
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
@@ -464,24 +464,24 @@ class SW_DLLPUBLIC SwMacroField : public SwField
     OUString aText;
     sal_Bool      bIsScriptURL;
 
-    virtual String   Expand() const;
+    virtual OUString Expand() const;
     virtual SwField* Copy() const;
 
 public:
     /// Direct input, delete old value.
-    SwMacroField( SwMacroFieldType*, const String& rLibAndName,
-                  const String& rTxt);
+    SwMacroField( SwMacroFieldType*, const OUString& rLibAndName,
+                  const OUString& rTxt);
 
-    inline const OUString& GetMacro() const { return aMacro; }
-    String           GetLibName() const;
-    String           GetMacroName() const;
+    inline OUString  GetMacro() const { return aMacro; }
+    OUString         GetLibName() const;
+    OUString         GetMacroName() const;
     SvxMacro         GetSvxMacro() const;
 
-    virtual String   GetFieldName() const;
+    virtual OUString GetFieldName() const;
 
     /// Library and FileName
-    virtual const OUString& GetPar1() const;
-    virtual void    SetPar1(const OUString& rStr);
+    virtual OUString GetPar1() const;
+    virtual void     SetPar1(const OUString& rStr);
 
     /// Macrotext
     virtual OUString  GetPar2() const;
@@ -490,10 +490,10 @@ public:
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
 
     static void CreateMacroString( OUString& rMacro,
-                                   const String& rMacroName,
-                                   const String& rLibraryName );
+                                   const OUString& rMacroName,
+                                   const OUString& rLibraryName );
 
-    static sal_Bool isScriptURL( const String& str );
+    static sal_Bool isScriptURL( const OUString& str );
 };
 
 
@@ -528,13 +528,17 @@ class SW_DLLPUBLIC SwPostItField : public SwField
 
 public:
     SwPostItField( SwPostItFieldType*,
-                   const String& rAuthor, const String& rTxt, const String& rInitials, const String& rName, const DateTime& rDate);
+                   const OUString& rAuthor,
+                   const OUString& rTxt,
+                   const OUString& rInitials,
+                   const OUString& rName,
+                   const DateTime& rDate);
     ~SwPostItField();
 
     /// Looks up a field identified by its unique name (used to get the postit field of a comment fieldmark)
     static const SwFmtFld* GetByName(SwDoc* pDoc, const OUString& rName);
 
-    virtual String          Expand() const;
+    virtual OUString        Expand() const;
     virtual SwField*        Copy() const;
 
     inline const DateTime   GetDateTime() const             { return aDateTime; }
@@ -542,16 +546,16 @@ public:
     inline const Time       GetTime() const                 { return aDateTime.GetTime(); }
 
     /// Author
-    virtual const OUString& GetPar1() const;
+    virtual OUString        GetPar1() const;
     virtual void            SetPar1(const OUString& rStr);
 
     /// Text
     virtual OUString   GetPar2() const;
     virtual void            SetPar2(const OUString& rStr);
-    const OUString&    GetTxt() const { return sTxt; }
-    const OUString&    GetInitials() const;
+    OUString                GetTxt() const { return sTxt; }
+    OUString                GetInitials() const;
     void                    SetName(const OUString& rStr);
-    const OUString&         GetName() const;
+    OUString                GetName() const;
 
     const OutlinerParaObject*   GetTextObject() const;
     void SetTextObject( OutlinerParaObject* pText );
@@ -560,7 +564,7 @@ public:
 
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
-    virtual String      GetDescription() const;
+    virtual OUString    GetDescription() const;
 };
 
 /*--------------------------------------------------------------------
@@ -572,30 +576,30 @@ class SwDocInfoFieldType : public SwValueFieldType
 public:
     SwDocInfoFieldType(SwDoc* pDc);
 
-    String                  Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, sal_uInt16 nLang, const String& rName) const;
+    OUString                Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, sal_uInt16 nLang, const OUString& rName) const;
     virtual SwFieldType*    Copy() const;
 };
 
 class SW_DLLPUBLIC SwDocInfoField : public SwValueField
 {
     sal_uInt16  nSubType;
-    String  aContent;
-    String  aName;
+    OUString  aContent;
+    OUString  aName;
 
-    virtual String          Expand() const;
+    virtual OUString        Expand() const;
     virtual SwField*        Copy() const;
 
 public:
-    SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const String& rName, sal_uInt32 nFmt=0);
-    SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const String& rName, const String& rValue, sal_uInt32 nFmt=0);
+    SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, sal_uInt32 nFmt=0);
+    SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, const OUString& rValue, sal_uInt32 nFmt=0);
 
     virtual void            SetSubType(sal_uInt16);
     virtual sal_uInt16          GetSubType() const;
     virtual void            SetLanguage(sal_uInt16 nLng);
-    virtual String          GetFieldName() const;
-    String                  GetName() const { return aName; }
-    void                    SetName( const String& rName ) { aName = rName; }
-    inline void             SetExpansion(const String& rStr) { aContent = rStr; }
+    virtual OUString        GetFieldName() const;
+    OUString                GetName() const { return aName; }
+    void                    SetName( const OUString& rName ) { aName = rName; }
+    inline void             SetExpansion(const OUString& rStr) { aContent = rStr; }
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
 };
@@ -607,31 +611,31 @@ public:
 
 class SwExtUserFieldType : public SwFieldType
 {
-    String aData;
+    OUString aData;
 public:
     SwExtUserFieldType();
 
-    inline void             SetData(const String& rStr)     { aData = rStr; }
+    inline void             SetData(const OUString& rStr)     { aData = rStr; }
 
-    String                  Expand(sal_uInt16 nSubType, sal_uInt32 nFormat) const;
+    OUString                Expand(sal_uInt16 nSubType, sal_uInt32 nFormat) const;
     virtual SwFieldType*    Copy() const;
 };
 
 class SwExtUserField : public SwField
 {
-    String  aContent;
+    OUString aContent;
     sal_uInt16  nType;
 
 public:
     SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFmt=0);
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
     virtual sal_uInt16      GetSubType() const;
     virtual void        SetSubType(sal_uInt16 nSub);
 
-    inline void         SetExpansion(const String& rStr) { aContent = rStr; }
+    inline void         SetExpansion(const OUString& rStr) { aContent = rStr; }
 
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
@@ -667,7 +671,7 @@ public:
     SwRefPageSetField( SwRefPageSetFieldType*, short nOff = 0,
                         sal_Bool bOn = sal_True );
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
     virtual OUString  GetPar2() const;
@@ -707,14 +711,14 @@ public:
 
 class SwRefPageGetField : public SwField
 {
-    String sTxt;
+    OUString sTxt;
 public:
     SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFmt );
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
-    void SetText( const String& rTxt )      { sTxt = rTxt; }
+    void SetText( const OUString& rTxt )      { sTxt = rTxt; }
 
     void ChangeExpansion( const SwFrm* pFrm, const SwTxtFld* pFld );
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
@@ -742,13 +746,13 @@ class SwJumpEditField : public SwField
     OUString sTxt, sHelp;
 public:
     SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat,
-                    const String& sText, const String& sHelp );
+                     const OUString& sText, const OUString& sHelp );
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
     /// Placeholder-Text
-    virtual const OUString& GetPar1() const;
+    virtual OUString GetPar1() const;
     virtual void    SetPar1(const OUString& rStr);
 
     /// Hint-Text
@@ -787,16 +791,16 @@ class SwScriptField : public SwField
     sal_Bool    bCodeURL; ///< Code contains URL of a script.
 
 public:
-    SwScriptField( SwScriptFieldType*, const String& rType,
-                   const String& rCode, sal_Bool bURL=sal_False );
+    SwScriptField( SwScriptFieldType*, const OUString& rType,
+                   const OUString& rCode, sal_Bool bURL=sal_False );
 
-    virtual String          GetDescription() const;
+    virtual OUString        GetDescription() const;
 
-    virtual String          Expand() const;
+    virtual OUString        Expand() const;
     virtual SwField*        Copy() const;
 
     /// Type
-    virtual const OUString&   GetPar1() const;
+    virtual OUString        GetPar1() const;
     virtual void            SetPar1(const OUString& rStr);
     /// Text
     virtual OUString   GetPar2() const;
@@ -831,13 +835,13 @@ class SW_DLLPUBLIC SwCombinedCharField : public SwField
     OUString sCharacters;    ///< combine these characters
 
 public:
-    SwCombinedCharField( SwCombinedCharFieldType*, const String& rChars );
+    SwCombinedCharField( SwCombinedCharFieldType*, const OUString& rChars );
 
-    virtual String          Expand() const;
+    virtual OUString        Expand() const;
     virtual SwField*        Copy() const;
 
     /// Characters
-    virtual const OUString&   GetPar1() const;
+    virtual OUString    GetPar1() const;
     virtual void        SetPar1(const OUString& rStr);
 
     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index 8ac6e48..bca2b0b 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -39,14 +39,14 @@ class SwEditShell;
 const SwTxtNode* GetBodyTxtNode( const SwDoc& pDoc, SwPosition& rPos,
                                  const SwFrm& rFrm );
 
-void ReplacePoint(String& sTmpName, bool bWithCommandType = false);
+OUString ReplacePoint(OUString sTmpName, bool bWithCommandType = false);
 
 struct _SeqFldLstElem
 {
-    String sDlgEntry;
+    OUString sDlgEntry;
     sal_uInt16 nSeqNo;
 
-    _SeqFldLstElem( const String& rStr, sal_uInt16 nNo )
+    _SeqFldLstElem( const OUString& rStr, sal_uInt16 nNo )
         : sDlgEntry( rStr ), nSeqNo( nNo )
     {}
 };
@@ -84,24 +84,24 @@ protected:
 
 class SW_DLLPUBLIC SwGetExpField : public SwFormulaField
 {
-    String          sExpand;
+    OUString        sExpand;
     bool            bIsInBodyTxt;
     sal_uInt16          nSubType;
 
     bool            bLateInitialization; // #i82544#
 
-    virtual String              Expand() const;
+    virtual OUString            Expand() const;
     virtual SwField*            Copy() const;
 
 public:
-    SwGetExpField( SwGetExpFieldType*, const String& rFormel,
+    SwGetExpField( SwGetExpFieldType*, const OUString& rFormel,
                    sal_uInt16 nSubType = nsSwGetSetExpType::GSE_EXPR, sal_uLong nFmt = 0);
 
     virtual void                SetValue( const double& rVal );
     virtual void                SetLanguage(sal_uInt16 nLng);
 
-    inline const String&        GetExpStr() const;
-    inline void                 ChgExpStr(const String& rExpand);
+    inline OUString             GetExpStr() const;
+    inline void                 ChgExpStr(const OUString& rExpand);
 
     /// Called by formating.
     inline bool                 IsInBodyTxt() const;
@@ -113,7 +113,7 @@ public:
      Only called by formating!! */
     void                        ChangeExpansion( const SwFrm&, const SwTxtFld& );
 
-    virtual String      GetFieldName() const;
+    virtual OUString    GetFieldName() const;
 
     /// Change formula.
     virtual OUString GetPar2() const;
@@ -129,10 +129,10 @@ public:
     void                SetLateInitialization() { bLateInitialization = true;}
 };
 
-inline void SwGetExpField::ChgExpStr(const String& rExpand)
+inline void SwGetExpField::ChgExpStr(const OUString& rExpand)
     { sExpand = rExpand;}
 
-inline const String& SwGetExpField::GetExpStr() const
+inline OUString SwGetExpField::GetExpStr() const
     { return sExpand;   }
 
  /// Called by formating.
@@ -149,7 +149,7 @@ class SW_DLLPUBLIC SwSetExpFieldType : public SwValueFieldType
 {
     OUString sName;
     const SwNode* pOutlChgNd;
-    String      sDelim;
+    OUString      sDelim;
     sal_uInt16      nType;
     sal_uInt8       nLevel;
     sal_Bool        bDeleted;
@@ -158,10 +158,10 @@ protected:
    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
 
 public:
-    SwSetExpFieldType( SwDoc* pDoc, const String& rName,
+    SwSetExpFieldType( SwDoc* pDoc, const OUString& rName,
                         sal_uInt16 nType = nsSwGetSetExpType::GSE_EXPR );
     virtual SwFieldType*    Copy() const;
-    virtual const OUString&   GetName() const;
+    virtual OUString        GetName() const;
 
     inline void             SetType(sal_uInt16 nTyp);
     inline sal_uInt16       GetType() const;
@@ -173,16 +173,16 @@ public:
     void                    SetDeleted( sal_Bool b )    { bDeleted = b; }
 
     /// Overlay, because set-field takes care for its being updated by itself.
-    inline const OUString& GetSetRefName() const;
+    inline OUString         GetSetRefName() const;
 
     sal_uInt16 SetSeqRefNo( SwSetExpField& rFld );
 
     sal_uInt16 GetSeqFldList( SwSeqFldList& rList );
-    String MakeSeqName( sal_uInt16 nSeqNo );
+    OUString MakeSeqName( sal_uInt16 nSeqNo );
 
     /// Number sequence fields chapterwise if required.
-    const String& GetDelimiter() const      { return sDelim; }
-    void SetDelimiter( const String& s )    { sDelim = s; }
+    OUString GetDelimiter() const             { return sDelim; }
+    void SetDelimiter( const OUString& s )    { sDelim = s; }
     sal_uInt8 GetOutlineLvl() const                 { return nLevel; }
     void SetOutlineLvl( sal_uInt8 n )           { nLevel = n; }
     void SetChapter( SwSetExpField& rFld, const SwNode& rNd );
@@ -205,38 +205,38 @@ inline void SwSetExpFieldType::SetType( sal_uInt16 nTyp )
 inline sal_uInt16 SwSetExpFieldType::GetType() const
     { return nType;   }
 
-inline const OUString& SwSetExpFieldType::GetSetRefName() const
+inline OUString SwSetExpFieldType::GetSetRefName() const
     { return sName; }
 
 
 class SW_DLLPUBLIC SwSetExpField : public SwFormulaField
 {
-    String          sExpand;
-    String          aPText;
-    String          aSeqText;
+    OUString        sExpand;
+    OUString        aPText;
+    OUString        aSeqText;
     sal_Bool            bInput;
     sal_uInt16          nSeqNo;
     sal_uInt16          nSubType;
 
-    virtual String              Expand() const;
+    virtual OUString            Expand() const;
     virtual SwField*            Copy() const;
 
 public:
-    SwSetExpField(SwSetExpFieldType*, const String& rFormel, sal_uLong nFmt = 0);
+    SwSetExpField(SwSetExpFieldType*, const OUString& rFormel, sal_uLong nFmt = 0);
 
     virtual void                SetValue( const double& rVal );
 
-    inline const String&        GetExpStr() const;
+    inline OUString             GetExpStr() const;
 
-    inline void                 ChgExpStr( const String& rExpand );
+    inline void                 ChgExpStr( const OUString& rExpand );
 
-    inline void                 SetPromptText(const String& rStr);
-    inline const                String& GetPromptText() const;
+    inline void                 SetPromptText(const OUString& rStr);
+    inline OUString             GetPromptText() const;
 
     inline void                 SetInputFlag(sal_Bool bInp);
     inline sal_Bool                 GetInputFlag() const;
 
-    virtual String              GetFieldName() const;
+    virtual OUString            GetFieldName() const;
 
     virtual sal_uInt16              GetSubType() const;
     virtual void                SetSubType(sal_uInt16 nType);
@@ -248,7 +248,7 @@ public:
     inline sal_uInt16           GetSeqNumber() const        { return nSeqNo; }
 
     /// Query name only.
-    virtual const OUString& GetPar1()   const;
+    virtual OUString       GetPar1()   const;
 
     /// Query formula.
     virtual OUString       GetPar2()   const;
@@ -257,16 +257,16 @@ public:
     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
 };
 
-inline const String& SwSetExpField::GetExpStr() const
+inline OUString SwSetExpField::GetExpStr() const
     { return sExpand;       }
 
-inline void SwSetExpField::ChgExpStr( const String& rExpand )
+inline void SwSetExpField::ChgExpStr( const OUString& rExpand )
     { sExpand = rExpand;    }
 
-inline void  SwSetExpField::SetPromptText(const String& rStr)
+inline void  SwSetExpField::SetPromptText(const OUString& rStr)
     { aPText = rStr;        }
 
-inline const String& SwSetExpField::GetPromptText() const
+inline OUString SwSetExpField::GetPromptText() const
     { return aPText;        }
 
 inline void SwSetExpField::SetInputFlag(sal_Bool bInp)
@@ -294,35 +294,35 @@ public:
 class SW_DLLPUBLIC SwInputField : public SwField
 {
     OUString aContent;
-    String  aPText;
-    String  aHelp;
-    String  aToolTip;
+    OUString aPText;
+    OUString aHelp;
+    OUString aToolTip;
     sal_uInt16  nSubType;
 
-    virtual String          Expand() const;
+    virtual OUString        Expand() const;
     virtual SwField*        Copy() const;
 
 public:
     /// Direct input via dialog; delete old value.
-    SwInputField(SwInputFieldType*, const String& rContent ,
-                 const String& rPrompt, sal_uInt16 nSubType = 0,
+    SwInputField(SwInputFieldType*, const OUString& rContent,
+                 const OUString& rPrompt, sal_uInt16 nSubType = 0,
                  sal_uLong nFmt = 0);
 
-    virtual String          GetFieldName() const;
+    virtual OUString        GetFieldName() const;
 
     /// Content
-    virtual const OUString&   GetPar1() const;
+    virtual OUString        GetPar1() const;
     virtual void            SetPar1(const OUString& rStr);
 
     /// aPromptText
     virtual OUString   GetPar2() const;
     virtual void            SetPar2(const OUString& rStr);
 
-    virtual String          GetHelp() const;
-    virtual void            SetHelp(const String & rStr);
+    virtual OUString        GetHelp() const;
+    virtual void            SetHelp(const OUString & rStr);
 
-    virtual String          GetToolTip() const;
-    virtual void            SetToolTip(const String & rStr);
+    virtual OUString        GetToolTip() const;
+    virtual void            SetToolTip(const OUString & rStr);
 
     virtual sal_Bool            isFormField() const;
 
@@ -373,31 +373,31 @@ public:
 
 class SwTblField : public SwValueField, public SwTableFormula
 {
-    String      sExpand;
+    OUString      sExpand;
     sal_uInt16      nSubType;
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
     /// Search TextNode containing the field.
     virtual const SwNode* GetNodeOfFormula() const;
 
-    String GetCommand();
+    OUString GetCommand();
 
 public:
-    SwTblField( SwTblFieldType*, const String& rFormel,
+    SwTblField( SwTblFieldType*, const OUString& rFormel,
                 sal_uInt16 nSubType = 0, sal_uLong nFmt = 0);
 
     virtual void        SetValue( const double& rVal );
     virtual sal_uInt16      GetSubType() const;
     virtual void        SetSubType(sal_uInt16 nType);
 
-    const String&       GetExpStr() const               { return sExpand; }
-    void                ChgExpStr(const String& rStr)   { sExpand = rStr; }
+    OUString            GetExpStr() const               { return sExpand; }
+    void                ChgExpStr(const OUString& rStr) { sExpand = rStr; }
 
     void                CalcField( SwTblCalcPara& rCalcPara );
 
-    virtual String      GetFieldName() const;
+    virtual OUString    GetFieldName() const;
 
     /// The formula.
     virtual OUString GetPar2()   const;
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 057f917..e90d813 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -20,7 +20,6 @@
 #define SW_FLDBAS_HXX
 
 #include <i18nlangtag/lang.h>
-#include <tools/string.hxx>
 #include "swdllapi.h"
 #include <calbck.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -219,9 +218,9 @@ enum SwDateTimeSubType
 
 
 /// General tools.
-String  GetResult(double nVal, sal_uInt32 nNumFmt, sal_uInt16 nLang = LANGUAGE_SYSTEM);
-void    SetErrorStr(const String& rStr);
-String  FormatNumber(sal_uInt32 nNum, sal_uInt32 nFormat);
+OUString  GetResult(double nVal, sal_uInt32 nNumFmt, sal_uInt16 nLang = LANGUAGE_SYSTEM);
+void      SetErrorStr(const OUString& rStr);
+OUString  FormatNumber(sal_uInt32 nNum, sal_uInt32 nFormat);
 
 /** Instances of SwFields and those derived from it occur 0 to n times.
  For each class there is one instance of the associated type class.
@@ -235,7 +234,7 @@ class SW_DLLPUBLIC SwFieldType : public SwModify
     sal_uInt16 nWhich;
 
     friend void _FinitUI();     ///< In order to delete pointer!
-    static  std::vector<String>* pFldNames;
+    static  std::vector<OUString>* pFldNames;
 
     static void _GetFldName();  ///< Sets up FldNames; fldmgr.cxx!
 
@@ -252,10 +251,10 @@ public:
                     ::com::sun::star::beans::XPropertySet> const& xFieldMaster)
             { m_wXFieldMaster = xFieldMaster; }
 
-    static  const String&   GetTypeStr( sal_uInt16 nTypeId );
+    static OUString    GetTypeStr( sal_uInt16 nTypeId );
 
     /// Only in derived classes.
-    virtual const OUString&   GetName() const;
+    virtual OUString        GetName() const;
     virtual SwFieldType*    Copy()    const = 0;
     virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
     virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
@@ -276,14 +275,14 @@ inline void SwFieldType::UpdateFlds() const
 class SW_DLLPUBLIC SwField
 {
 private:
-    mutable String      m_Cache;     ///< Cached expansion (for clipboard).
+    mutable OUString    m_Cache;     ///< Cached expansion (for clipboard).
     sal_uInt16              nLang;   ///< Always change via SetLanguage!
     sal_Bool                bIsAutomaticLanguage;
     sal_uInt32          nFormat;
 
     SwFieldType*        pType;
 
-    virtual String      Expand() const = 0;
+    virtual OUString    Expand() const = 0;
     virtual SwField*    Copy() const = 0;
 
 protected:
@@ -307,10 +306,10 @@ public:
                     SwTxtFormatter::NewFldPortion() sets things up properly.
         @return     the generated text (suitable for display)
       */
-    String              ExpandField(bool const bCached) const;
+    OUString            ExpandField(bool const bCached) const;
 
     /// @return name or content.
-    virtual String      GetFieldName() const;
+    virtual OUString    GetFieldName() const;
 
     SwField *           CopyField() const;
 
@@ -333,10 +332,10 @@ public:
 
     /// Query parameters for dialog and for BASIC.
     inline sal_uInt32   GetFormat() const;
-    virtual const OUString& GetPar1() const;
-    virtual OUString GetPar2()   const;
+    virtual OUString GetPar1() const;
+    virtual OUString GetPar2() const;
 
-    virtual String      GetFormula() const;
+    virtual OUString    GetFormula() const;
 
     virtual void        ChangeFormat(sal_uInt32 n);
     virtual void        SetPar1(const OUString& rStr);
@@ -352,7 +351,7 @@ public:
     sal_Bool                IsAutomaticLanguage() const { return bIsAutomaticLanguage;}
     void                SetAutomaticLanguage(sal_Bool bSet){bIsAutomaticLanguage = bSet;}
 
-    virtual String      GetDescription() const;
+    virtual OUString    GetDescription() const;
     /// Is this field clickable?
     bool IsClickable() const;
 };
@@ -384,9 +383,9 @@ public:
     inline sal_Bool     UseFormat() const                   { return bUseFormat; }
     inline void     EnableFormat(sal_Bool bFormat = sal_True)   { bUseFormat = bFormat; }
 
-    String          ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const;
-    String          DoubleToString(const double &rVal, LanguageType eLng) const;
-    String          DoubleToString(const double &rVal, sal_uInt32 nFmt) const;
+    OUString        ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const;
+    OUString        DoubleToString(const double &rVal, LanguageType eLng) const;
+    OUString        DoubleToString(const double &rVal, sal_uInt32 nFmt) const;
 };
 
 class SW_DLLPUBLIC SwValueField : public SwField
@@ -408,7 +407,7 @@ public:
     virtual double          GetValue() const;
     virtual void            SetValue( const double& rVal );
 
-    inline String   ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const
+    inline OUString ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const
         { return ((SwValueFieldType*)GetTyp())->ExpandValue(rVal, nFmt, nLng); }
 
     static sal_uInt32       GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFmt);
@@ -416,18 +415,18 @@ public:
 
 class SW_DLLPUBLIC SwFormulaField : public SwValueField
 {
-    String sFormula;
+    OUString sFormula;
 
 protected:
     SwFormulaField( SwValueFieldType* pFldType, sal_uInt32 nFmt = 0, const double fVal = 0.0 );
     SwFormulaField( const SwFormulaField& rFld );
 
 public:
-    virtual String          GetFormula() const;
-    void                    SetFormula(const String& rStr);
+    virtual OUString        GetFormula() const;
+    void                    SetFormula(const OUString& rStr);
 
-    void                    SetExpandedFormula(const String& rStr);
-    String                  GetExpandedFormula() const;
+    void                    SetExpandedFormula(const OUString& rStr);
+    OUString                GetExpandedFormula() const;
 };
 
 #endif // SW_FLDBAS_HXX
diff --git a/sw/inc/flddat.hxx b/sw/inc/flddat.hxx
index ccf8885..ea2c2cf 100644
--- a/sw/inc/flddat.hxx
+++ b/sw/inc/flddat.hxx
@@ -20,8 +20,6 @@
 #ifndef SW_FLDDAT_HXX
 #define SW_FLDDAT_HXX
 
-#include <tools/string.hxx>
-
 #include "fldbas.hxx"
 
 class DateTime;
@@ -98,7 +96,7 @@ class SW_DLLPUBLIC SwDateTimeField : public SwValueField
         sal_uInt16              nSubType;
         long                nOffset;    // Offset in minutes.
 
-        virtual String      Expand() const;
+        virtual OUString    Expand() const;
         virtual SwField*    Copy() const;
 
 public:
diff --git a/sw/inc/flddropdown.hxx b/sw/inc/flddropdown.hxx
index 57d4ee2..bf943a1 100644
--- a/sw/inc/flddropdown.hxx
+++ b/sw/inc/flddropdown.hxx
@@ -90,7 +90,7 @@ class SW_DLLPUBLIC SwDropDownField : public SwField
 
        @return the expanded value of the field
     */
-    virtual String Expand() const;
+    virtual OUString Expand() const;
 
     /**
        Creates a copy of this field.
@@ -126,7 +126,7 @@ public:
 
        @return the selected value
     */
-    virtual const OUString & GetPar1() const;
+    virtual OUString GetPar1() const;
 
     /**
        Returns the name of the field.
@@ -181,28 +181,28 @@ public:
 
        @return the selected item
     */
-    const OUString & GetSelectedItem() const;
+    OUString GetSelectedItem() const;
 
     /**
        Returns the name of the field.
 
        @return the name of the field
     */
-    const OUString & GetName() const;
+    OUString GetName() const;
 
     /**
        Returns the help text of the field.
 
        @return the help text of the field
     */
-    const OUString & GetHelp() const;
+    OUString GetHelp() const;
 
     /**
        Returns the tool tip of the field.
 
        @return the tool tip of the field
      */
-    const OUString & GetToolTip() const;
+    OUString GetToolTip() const;
 
     /**
        Sets the selected item.
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 9550de4..6201907 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -72,7 +72,7 @@ public:
 
     void MergeWithOtherDoc( SwDoc& rDestDoc );
 
-    static SwTxtNode* FindAnchor( SwDoc* pDoc, const String& rRefMark,
+    static SwTxtNode* FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
                                         sal_uInt16 nSubType, sal_uInt16 nSeqNo,
                                         sal_uInt16* pStt, sal_uInt16* pEnd = 0 );
 };
@@ -82,27 +82,27 @@ class SW_DLLPUBLIC SwGetRefField : public SwField
 {
 private:
     OUString sSetRefName;
-    String sTxt;
+    OUString sTxt;
     sal_uInt16 nSubType;
     sal_uInt16 nSeqNo;
 
-    virtual String      Expand() const;
+    virtual OUString    Expand() const;
     virtual SwField*    Copy() const;
 
     // #i81002#
-    String MakeRefNumStr( const SwTxtNode& rTxtNodeOfField,
+    OUString MakeRefNumStr( const SwTxtNode& rTxtNodeOfField,
                           const SwTxtNode& rTxtNodeOfReferencedItem,
                           const sal_uInt32 nRefNumFormat ) const;
 
 public:
-    SwGetRefField( SwGetRefFieldType*, const String& rSetRef,
+    SwGetRefField( SwGetRefFieldType*, const OUString& rSetRef,
                     sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFmt );
 
     virtual ~SwGetRefField();
 
-    virtual String      GetFieldName() const;
+    virtual OUString GetFieldName() const;
 
-    const OUString& GetSetRefName() const { return sSetRefName; }
+    OUString GetSetRefName() const { return sSetRefName; }
 
     // #i81002#
     /** The <SwTxtFld> instance, which represents the text attribute for the
@@ -113,7 +113,7 @@ public:
        no update for these reference format types. */
     void                UpdateField( const SwTxtFld* pFldTxtAttr );
 
-    void                SetExpand( const String& rStr ) { sTxt = rStr; }
+    void                SetExpand( const OUString& rStr ) { sTxt = rStr; }
 
     /// Get/set sub type.
     virtual sal_uInt16      GetSubType() const;
@@ -124,7 +124,7 @@ public:
     bool IsRefToNumItemCrossRefBookmark() const;
     const SwTxtNode* GetReferencedTxtNode() const;
     // #i85090#
-    String GetExpandedTxtOfReferencedTxtNode() const;
+    OUString GetExpandedTxtOfReferencedTxtNode() const;
 
 
     /// Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
@@ -132,7 +132,7 @@ public:
     void                SetSeqNo( sal_uInt16 n )    { nSeqNo = n; }
 
     // Name of reference.
-    virtual const OUString& GetPar1() const;
+    virtual OUString    GetPar1() const;
     virtual void        SetPar1(const OUString& rStr);
 
     virtual OUString GetPar2() const;
@@ -141,7 +141,7 @@ public:
 
     void                ConvertProgrammaticToUIName();
 
-    virtual String GetDescription() const;
+    virtual OUString GetDescription() const;
 };
 
 
diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx
index 85fe469..f529c32 100644
--- a/sw/inc/usrfld.hxx
+++ b/sw/inc/usrfld.hxx
@@ -33,19 +33,19 @@ class SW_DLLPUBLIC SwUserFieldType : public SwValueFieldType
     bool    bDeleted : 1;
     double  nValue;
     OUString  aName;
-    String  aContent;
+    OUString  aContent;
     sal_uInt16  nType;
 
 public:
-    SwUserFieldType( SwDoc* pDocPtr, const String& );
+    SwUserFieldType( SwDoc* pDocPtr, const OUString& );
 
-    virtual const OUString&   GetName() const;
+    virtual OUString        GetName() const;
     virtual SwFieldType*    Copy() const;
 
-    String                  Expand(sal_uInt32 nFmt, sal_uInt16 nSubType, sal_uInt16 nLng);
+    OUString                Expand(sal_uInt32 nFmt, sal_uInt16 nSubType, sal_uInt16 nLng);
 
-    String                  GetContent( sal_uInt32 nFmt = 0 );
-           void             SetContent( const String& rStr, sal_uInt32 nFmt = 0 );
+    OUString                GetContent( sal_uInt32 nFmt = 0 );
+           void             SetContent( const OUString& rStr, sal_uInt32 nFmt = 0 );
 
     inline bool             IsValid() const;
     inline void             ChgValid( bool bNew );
@@ -93,7 +93,7 @@ class SW_DLLPUBLIC SwUserField : public SwValueField
 {
     sal_uInt16  nSubType;
 
-    virtual String          Expand() const;
+    virtual OUString        Expand() const;
     virtual SwField*        Copy() const;
 
 public:
@@ -105,10 +105,10 @@ public:
     virtual double          GetValue() const;
     virtual void            SetValue( const double& rVal );
 
-    virtual String          GetFieldName() const;
+    virtual OUString        GetFieldName() const;
 
     // Name cannot be changed.
-    virtual const OUString& GetPar1() const;
+    virtual OUString   GetPar1() const;
 
     // Content.
     virtual OUString   GetPar2() const;
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 6f56e12..8439cff 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -134,8 +134,8 @@ static String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, xub_StrLen
                         // replacement and remove afterwards all at a string's
                         // end (might be normal 0x7f).
                         bool bEmpty = RES_TXTATR_FIELD != pHt->Which() ||
-                            !(static_cast<SwTxtFld const*>(pHt)
-                                ->GetFld().GetFld()->ExpandField(true).Len());
+                            (static_cast<SwTxtFld const*>(pHt)
+                                ->GetFld().GetFld()->ExpandField(true).isEmpty());
                         if ( bEmpty && nStart == nAkt )
                            {
                             rArr.push_back( nAkt );
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index a78a592..bb7db00 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -984,15 +984,14 @@ _HashStr::_HashStr( const String& rName, const String& rText,
 }
 
 /// Look up the Name, if it is present, return it's String, otherwise return an empty String
-void LookString( SwHash** ppTbl, sal_uInt16 nSize, const String& rName,
-                    String& rRet, sal_uInt16* pPos )
+OUString LookString( SwHash** ppTbl, sal_uInt16 nSize, const OUString& rName,
+                     sal_uInt16* pPos )
 {
-    rRet = comphelper::string::strip(rName, ' ');
-    SwHash* pFnd = Find( rRet, ppTbl, nSize, pPos );
+    SwHash* pFnd = Find( comphelper::string::strip(rName, ' '), ppTbl, nSize, pPos );
     if( pFnd )
-        rRet = ((_HashStr*)pFnd)->aSetStr;
-    else
-        rRet.Erase();
+        return ((_HashStr*)pFnd)->aSetStr;
+
+    return OUString();
 }
 
 static String lcl_GetDBVarName( SwDoc& rDoc, SwDBNameInfField& rDBFld )
@@ -1145,8 +1144,7 @@ void SwDoc::FldsToExpand( SwHash**& ppHashTbl, sal_uInt16& rTblSize,
                 // set the new value in the hash table
                 // is the formula a field?
                 SwSetExpField* pSFld = (SwSetExpField*)pFld;
-                String aNew;
-                LookString( ppHashTbl, rTblSize, pSFld->GetFormula(), aNew );
+                String aNew = LookString( ppHashTbl, rTblSize, pSFld->GetFormula() );
 
                 if( !aNew.Len() )               // nothing found, then the formula is
                     aNew = pSFld->GetFormula(); // the new value
@@ -1392,8 +1390,8 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds )
                     if( (!pUpdtFld || pUpdtFld == pTxtFld )
                         && pGFld->IsInBodyTxt() )
                     {
-                        LookString( pHashStrTbl, nStrFmtCnt,
-                                    pGFld->GetFormula(), aNew );
+                        aNew = LookString( pHashStrTbl, nStrFmtCnt,
+                                    pGFld->GetFormula() );
                         pGFld->ChgExpStr( aNew );
                     }
                 }
@@ -1401,8 +1399,8 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds )
                 {
                     SwSetExpField* pSFld = (SwSetExpField*)pFld;
                     // is the "formula" a field?
-                    LookString( pHashStrTbl, nStrFmtCnt,
-                                pSFld->GetFormula(), aNew );
+                    aNew = LookString( pHashStrTbl, nStrFmtCnt,
+                                pSFld->GetFormula() );
 
                     if( !aNew.Len() )               // nothing found then the formula is the new value
                         aNew = pSFld->GetFormula();
@@ -2261,11 +2259,11 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
         }
     }
 
-    OUString sTrue("TRUE"), sFalse("FALSE");
+    const OUString sTrue("TRUE");
+    const OUString sFalse("FALSE");
 
     bool bIsDBMgr = 0 != rDoc.GetNewDBMgr();
     sal_uInt16 nWhich, n;
-    const OUString* pFormel = 0;
     const SfxPoolItem* pItem;
     sal_uInt32 nMaxItems = rDoc.GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
     for( n = 0; n < nMaxItems; ++n )
@@ -2278,40 +2276,41 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
         if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
             continue;
 
+        OUString sFormel;
         const SwField* pFld = pFmtFld->GetFld();
         switch( nWhich = pFld->GetTyp()->Which() )
         {
             case RES_DBSETNUMBERFLD:
             case RES_GETEXPFLD:
                 if( GETFLD_ALL == eGetMode )
-                    pFormel = &sTrue;
+                    sFormel = sTrue;
                 break;
 
             case RES_DBFLD:
                 if( GETFLD_EXPAND & eGetMode )
-                    pFormel = &sTrue;
+                    sFormel = sTrue;
                 break;
 
             case RES_SETEXPFLD:
                 if ( !(eGetMode == GETFLD_EXPAND) ||
                      (nsSwGetSetExpType::GSE_STRING & pFld->GetSubType()) )
                 {
-                    pFormel = &sTrue;
+                    sFormel = sTrue;
                 }
                 break;
 
             case RES_HIDDENPARAFLD:
                 if( GETFLD_ALL == eGetMode )
                 {
-                    pFormel = &pFld->GetPar1();
-                    if (pFormel->isEmpty() || pFormel->equals(sFalse))
+                    sFormel = pFld->GetPar1();
+                    if (sFormel.isEmpty() || sFormel==sFalse)
                         ((SwHiddenParaField*)pFld)->SetHidden( sal_False );
-                    else if (pFormel->equals(sTrue))
+                    else if (sFormel==sTrue)
                         ((SwHiddenParaField*)pFld)->SetHidden( sal_True );
                     else
                         break;
 
-                    pFormel = 0;
+                    sFormel = OUString();
                     // trigger formatting
                     ((SwFmtFld*)pFmtFld)->ModifyNotification( 0, 0 );
                 }
@@ -2320,15 +2319,15 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
             case RES_HIDDENTXTFLD:
                 if( GETFLD_ALL == eGetMode )
                 {
-                    pFormel = &pFld->GetPar1();
-                    if (pFormel->isEmpty() || pFormel->equals(sFalse))
+                    sFormel = pFld->GetPar1();
+                    if (sFormel.isEmpty() || sFormel==sFalse)
                         ((SwHiddenTxtField*)pFld)->SetValue( sal_True );
-                    else if (pFormel->equals(sTrue))
+                    else if (sFormel==sTrue)
                         ((SwHiddenTxtField*)pFld)->SetValue( sal_False );
                     else
                         break;
 
-                    pFormel = 0;
+                    sFormel = OUString();
 
                     // evaluate field
                     ((SwHiddenTxtField*)pFld)->Evaluate(&rDoc);
@@ -2346,7 +2345,7 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
                      (GETFLD_ALL == eGetMode || (GETFLD_CALC & eGetMode && ((SwDBNumSetField*)pFld)->IsCondValid()))
                    )
                 {
-                    pFormel = &pFld->GetPar1();
+                    sFormel = pFld->GetPar1();
                 }
             }
             break;
@@ -2359,16 +2358,15 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
                      (GETFLD_ALL == eGetMode || (GETFLD_CALC & eGetMode && ((SwDBNextSetField*)pFld)->IsCondValid()))
                    )
                 {
-                    pFormel = &pFld->GetPar1();
+                    sFormel = pFld->GetPar1();
                 }
             }
             break;
         }
 
-        if (pFormel && !pFormel->isEmpty())
+        if (!sFormel.isEmpty())
         {
             GetBodyNode( *pTxtFld, nWhich );
-            pFormel = 0;
         }
     }
     nFldLstGetMode = static_cast<sal_uInt8>( eGetMode );
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 74b58a5..1133863 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -346,15 +346,15 @@ sal_uInt16 SwEditShell::GetSeqFtnList( SwSeqFldList& rList, bool bEndNotes )
 
             if( pTxtNd )
             {
-                String sTxt( rFtn.GetViewNumStr( *mpDoc ));
-                if( sTxt.Len() )
-                    sTxt += ' ';
+                OUString sTxt( rFtn.GetViewNumStr( *mpDoc ));
+                if( !sTxt.isEmpty() )
+                    sTxt += " ";
                 sTxt += pTxtNd->GetExpandTxt( 0, USHRT_MAX );
 
                 _SeqFldLstElem* pNew = new _SeqFldLstElem( sTxt,
                                             pTxtFtn->GetSeqRefNo() );
                 while( rList.InsertSort( pNew ) )
-                    pNew->sDlgEntry += ' ';
+                    pNew->sDlgEntry += " ";
             }
         }
     }
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index d1fbe79..3d13d60 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -110,13 +110,13 @@ void    SwAuthorityFieldType::RemoveField(sal_IntPtr nHandle)
 #endif
 }
 
-sal_IntPtr SwAuthorityFieldType::AddField(const String& rFieldContents)
+sal_IntPtr SwAuthorityFieldType::AddField(const OUString& rFieldContents)
 {
     sal_IntPtr nRet = 0;
     SwAuthEntry* pEntry = new SwAuthEntry;
     for( sal_uInt16 i = 0; i < AUTH_FIELD_END; ++i )
         pEntry->SetAuthorField( (ToxAuthorityField)i,
-                        rFieldContents.GetToken( i, TOX_STYLE_DELIMITER ));
+                        rFieldContents.getToken( i, TOX_STYLE_DELIMITER ));
 
     for(sal_uInt16 j = 0; j < m_DataArr.size() && pEntry; j++)
     {
@@ -178,7 +178,7 @@ const SwAuthEntry*  SwAuthorityFieldType::GetEntryByHandle(sal_IntPtr nHandle) c
 }
 
 void SwAuthorityFieldType::GetAllEntryIdentifiers(
-    std::vector<String>& rToFill )const
+    std::vector<OUString>& rToFill )const
 {
     for(sal_uInt16 j = 0; j < m_DataArr.size(); j++)
     {
@@ -188,7 +188,7 @@ void SwAuthorityFieldType::GetAllEntryIdentifiers(
 }
 
 const SwAuthEntry*  SwAuthorityFieldType::GetEntryByIdentifier(
-                                const String& rIdentifier)const
+                                const OUString& rIdentifier)const
 {
     const SwAuthEntry* pRet = 0;
     for( sal_uInt16 j = 0; j < m_DataArr.size(); ++j )
@@ -373,7 +373,7 @@ bool SwAuthorityFieldType::QueryValue( Any& rVal, sal_uInt16 nWhichId ) const
         }
         break;
     case FIELD_PROP_PAR3:
-        rVal <<= OUString(GetSortAlgorithm());
+        rVal <<= GetSortAlgorithm();
         break;
 
     case FIELD_PROP_BOOL1:
@@ -416,14 +416,14 @@ bool SwAuthorityFieldType::QueryValue( Any& rVal, sal_uInt16 nWhichId ) const
 bool    SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
 {
     bool bRet = true;
-    String sTmp;
     switch( nWhichId )
     {
     case FIELD_PROP_PAR1:
     case FIELD_PROP_PAR2:
     {
-        ::GetString( rAny, sTmp );
-        sal_Unicode uSet = sTmp.GetChar(0);
+        OUString sTmp;
+        rAny >>= sTmp;
+        const sal_Unicode uSet = !sTmp.isEmpty() ? sTmp[0] : 0;
         if( FIELD_PROP_PAR1 == nWhichId )
             m_cPrefix = uSet;
         else
@@ -431,9 +431,12 @@ bool    SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
     }
     break;
     case FIELD_PROP_PAR3:
-        SetSortAlgorithm( ::GetString( rAny, sTmp ));
+    {
+        OUString sTmp;
+        rAny >>= sTmp;
+        SetSortAlgorithm(sTmp);
         break;
-
+    }
     case FIELD_PROP_BOOL1:
         m_bIsSequence = *(sal_Bool*)rAny.getValue();
         break;
@@ -516,7 +519,7 @@ void SwAuthorityFieldType::SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey aKeys[
 }
 
 SwAuthorityField::SwAuthorityField( SwAuthorityFieldType* pInitType,
-                                    const String& rFieldContents )
+                                    const OUString& rFieldContents )
     : SwField(pInitType),
     m_nTempSequencePos( -1 )
 {
@@ -537,12 +540,12 @@ SwAuthorityField::~SwAuthorityField()
     ((SwAuthorityFieldType* )GetTyp())->RemoveField(m_nHandle);
 }
 
-String  SwAuthorityField::Expand() const
+OUString SwAuthorityField::Expand() const
 {
     SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp();
-    String sRet;
+    OUString sRet;
     if(pAuthType->GetPrefix())
-        sRet.Assign(pAuthType->GetPrefix());
+        sRet = OUString(pAuthType->GetPrefix());
 
     if( pAuthType->IsSequence() )
     {
@@ -559,7 +562,7 @@ String  SwAuthorityField::Expand() const
             sRet += pEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER);
     }
     if(pAuthType->GetSuffix())
-        sRet += pAuthType->GetSuffix();
+        sRet += OUString(pAuthType->GetSuffix());
     return sRet;
 }
 
@@ -569,7 +572,7 @@ SwField* SwAuthorityField::Copy() const
     return new SwAuthorityField(pAuthType, m_nHandle);
 }
 
-const String&   SwAuthorityField::GetFieldText(ToxAuthorityField eField) const
+OUString SwAuthorityField::GetFieldText(ToxAuthorityField eField) const
 {
     SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp();
     const SwAuthEntry* pEntry = pAuthType->GetEntryByHandle( m_nHandle );
@@ -583,7 +586,7 @@ void    SwAuthorityField::SetPar1(const OUString& rStr)
     m_nHandle = pInitType->AddField(rStr);
 }
 
-String SwAuthorityField::GetDescription() const
+OUString SwAuthorityField::GetDescription() const
 {
     return SW_RES(STR_AUTHORITY_ENTRY);
 }
@@ -635,11 +638,11 @@ bool    SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const
     for(sal_Int16 i = 0; i < AUTH_FIELD_END; i++)
     {
         pValues[i].Name = OUString::createFromAscii(aFieldNames[i]);
-        const String& rField = pAuthEntry->GetAuthorField((ToxAuthorityField) i);
+        const OUString sField = pAuthEntry->GetAuthorField((ToxAuthorityField) i);
         if(i == AUTH_FIELD_AUTHORITY_TYPE)
-            pValues[i].Value <<= sal_Int16(rField.ToInt32());
+            pValues[i].Value <<= sal_Int16(sField.toInt32());
         else
-            pValues[i].Value <<= OUString(rField);
+            pValues[i].Value <<= sField;
     }
     rAny <<= aRet;
     /* FIXME: it is weird that we always return false here */
diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx
index e469c57..ddda6c4 100644
--- a/sw/source/core/fields/chpfld.cxx
+++ b/sw/source/core/fields/chpfld.cxx
@@ -29,6 +29,28 @@
 
 using namespace ::com::sun::star;
 
+namespace
+{
+
+OUString removeControlChars(OUString sIn)
+{
+    OUStringBuffer aBuf(sIn);
+    sal_Int32 nLen = aBuf.getLength();
+    for (sal_Int32 i = 0; i < nLen; ++i)
+    {
+        if (aBuf[i] < ' ')
+        {
+            sal_Int32 j = i+1;
+            while (j<nLen && aBuf[j]<' ') ++j;
+            aBuf.remove(i, j-i);
+            nLen = aBuf.getLength();
+        }
+    }
+    return aBuf.makeStringAndClear();
+}
+
+}
+
 // SwChapterFieldType
 
 SwChapterFieldType::SwChapterFieldType()
@@ -47,23 +69,21 @@ SwChapterField::SwChapterField(SwChapterFieldType* pTyp, sal_uInt32 nFmt)
     : SwField(pTyp, nFmt), nLevel( 0 )
 {}
 
-String SwChapterField::Expand() const
+OUString SwChapterField::Expand() const
 {
-    String sStr( sNumber );
     switch( GetFormat() )
     {
-        case CF_TITLE:      sStr = sTitle;  break;
-
+        case CF_TITLE:
+            return sTitle;
         case CF_NUMBER:
-        case CF_NUM_TITLE:  sStr.Insert( sPre, 0 );
-                            sStr += sPost;
-                            if( CF_NUM_TITLE == GetFormat() )
-                                sStr += sTitle;
-                            break;
-
-        case CF_NUM_NOPREPST_TITLE: sStr += sTitle; break;
+            return sPre + sNumber + sPost;
+        case CF_NUM_TITLE:
+            return sPre + sNumber + sPost + sTitle;
+        case CF_NUM_NOPREPST_TITLE:
+            return sNumber + sTitle;
     }
-    return sStr;
+    // CF_NUMBER_NOPREPST
+    return sNumber;
 }
 
 SwField* SwChapterField::Copy() const
@@ -104,10 +124,10 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum)
 {
     //i120759,this function is for both the reference chapter field and normal chapter field
     //bSrchNum can distinguish the two types,to the latter type,the outline num rule is must...
-    sNumber = aEmptyStr;
-    sTitle = aEmptyStr;
-    sPost = aEmptyStr;
-    sPre = aEmptyStr;
+    sNumber = OUString();
+    sTitle = OUString();
+    sPost = OUString();
+    sPre = OUString();
     //The reference chapter field of normal num rule will be handled in this code segment
     if (bSrchNum && !rTxtNd.IsOutline())
     {
@@ -121,13 +141,9 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum)
         }
         else
         {
-            sNumber = String("??", RTL_TEXTENCODING_ASCII_US);
+            sNumber = "??";
         }
-        sTitle = rTxtNd.GetExpandTxt();
-
-        for( xub_StrLen i = 0; i < sTitle.Len(); ++i )
-            if( ' ' > sTitle.GetChar( i ) )
-                sTitle.Erase( i--, 1 );
+        sTitle = removeControlChars(rTxtNd.GetExpandTxt());
     }
     else
     {
@@ -185,14 +201,11 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum)
         }
         else
         {
-            sNumber = String("??", RTL_TEXTENCODING_ASCII_US);
+            sNumber = "??";
         }
 
-        sTitle = pTxtNd->GetExpandTxt();
+        sTitle = removeControlChars(pTxtNd->GetExpandTxt());
 
-        for( xub_StrLen i = 0; i < sTitle.Len(); ++i )
-            if( ' ' > sTitle.GetChar( i ) )
-                sTitle.Erase( i--, 1 );
     }
     }
 }
diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx
index f3e8111..8b7d7e0 100644
--- a/sw/source/core/fields/dbfld.cxx
+++ b/sw/source/core/fields/dbfld.cxx
@@ -43,30 +43,28 @@ using namespace ::com::sun::star::sdbc;
 using namespace ::com::sun::star;
 
 /// replace database separator by dots for display
-static String lcl_DBTrennConv(const String& aContent)
+static OUString lcl_DBTrennConv(const OUString& aContent)
 {
-    String sTmp(aContent);
-    sal_Unicode* pStr = sTmp.GetBufferAccess();
-    for( sal_uInt16 i = sTmp.Len(); i; --i, ++pStr )
-        if( DB_DELIM == *pStr )
-            *pStr = '.';
-    return sTmp;
+    return aContent.replaceAll(OUString(DB_DELIM), OUString('.'));
 }
 
 // database field type
 
-SwDBFieldType::SwDBFieldType(SwDoc* pDocPtr, const String& rNam, const SwDBData& rDBData ) :
+SwDBFieldType::SwDBFieldType(SwDoc* pDocPtr, const OUString& rNam, const SwDBData& rDBData ) :
     SwValueFieldType( pDocPtr, RES_DBFLD ),
     aDBData(rDBData),
+    sName(rNam),
     sColumn(rNam),
     nRefCnt(0)
 {
     if(!aDBData.sDataSource.isEmpty() || !aDBData.sCommand.isEmpty())
     {
-        sName = OUStringBuffer(aDBData.sDataSource).append(DB_DELIM).
-            append(aDBData.sCommand).append(DB_DELIM).makeStringAndClear();
+        sName = aDBData.sDataSource
+            + OUString(DB_DELIM)
+            + aDBData.sCommand
+            + OUString(DB_DELIM)
+            + sName;
     }
-    sName += GetColumnName();
 }
 
 SwDBFieldType::~SwDBFieldType()
@@ -79,7 +77,7 @@ SwFieldType* SwDBFieldType::Copy() const
     return pTmp;
 }
 
-const OUString& SwDBFieldType::GetName() const
+OUString SwDBFieldType::GetName() const
 {
     return sName;
 }
@@ -111,7 +109,7 @@ bool SwDBFieldType::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
         rAny <<= aDBData.sCommand;
         break;
     case FIELD_PROP_PAR3:
-        rAny <<= OUString(sColumn);
+        rAny <<= sColumn;
         break;
     case FIELD_PROP_SHORT1:
         rAny <<= aDBData.nCommandType;
@@ -134,8 +132,8 @@ bool SwDBFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
         break;
     case FIELD_PROP_PAR3:
         {
-            String sTmp;
-            ::GetString( rAny, sTmp );
+            OUString sTmp;
+            rAny >>= sTmp;
             if( sTmp != sColumn )
             {
                 sColumn = sTmp;
@@ -150,7 +148,7 @@ bool SwDBFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
                         SwDBField* pDBField = (SwDBField*)pFld->GetFld();
                         pDBField->ClearInitialized();
                         pDBField->InitContent();
-                     }
+                    }
                     pFld = aIter.Next();
                 }
             }
@@ -189,38 +187,30 @@ void SwDBField::InitContent()
 {
     if (!IsInitialized())
     {
-        aContent = OUStringBuffer().append('<')
-            .append(((const SwDBFieldType*)GetTyp())->GetColumnName())
-            .append('>').makeStringAndClear();
+        aContent = "<" + ((const SwDBFieldType*)GetTyp())->GetColumnName() + ">";
     }
 }
 
-void SwDBField::InitContent(const String& rExpansion)
+void SwDBField::InitContent(const OUString& rExpansion)
 {
-    if (rExpansion.Len() > 2)
+    if (rExpansion.startsWith("<") && rExpansion.endsWith(">"))
     {
-        if (rExpansion.GetChar(0) == '<' &&
-            rExpansion.GetChar(rExpansion.Len() - 1) == '>')
+        const OUString sColumn( rExpansion.copy( 1, rExpansion.getLength() - 2 ) );
+        if( ::GetAppCmpStrIgnore().isEqual( sColumn,
+                        ((SwDBFieldType *)GetTyp())->GetColumnName() ))
         {
-            String sColumn( rExpansion.Copy( 1, rExpansion.Len() - 2 ) );
-            if( ::GetAppCmpStrIgnore().isEqual( sColumn,
-                            ((SwDBFieldType *)GetTyp())->GetColumnName() ))
-            {
-                InitContent();
-                return;
-            }
+            InitContent();
+            return;
         }
     }
     SetExpansion( rExpansion );
 }
 
-String SwDBField::Expand() const
+OUString SwDBField::Expand() const
 {
-    String sRet;
-
     if(0 ==(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE))
-        sRet = lcl_DBTrennConv(aContent);
-    return sRet;
+        return lcl_DBTrennConv(aContent);
+    return OUString();
 }
 
 SwField* SwDBField::Copy() const
@@ -237,18 +227,18 @@ SwField* SwDBField::Copy() const
     return pTmp;
 }
 
-String SwDBField::GetFieldName() const
+OUString SwDBField::GetFieldName() const
 {
-    const String& rDBName = static_cast<SwDBFieldType*>(GetTyp())->GetName();
+    const OUString rDBName = static_cast<SwDBFieldType*>(GetTyp())->GetName();
 
-    String sContent( rDBName.GetToken(0, DB_DELIM) );
+    OUString sContent( rDBName.getToken(0, DB_DELIM) );
 
-    if (sContent.Len() > 1)
+    if (sContent.getLength() > 1)
     {
-        sContent += DB_DELIM;
-        sContent += rDBName.GetToken(1, DB_DELIM);
-        sContent += DB_DELIM;
-        sContent += rDBName.GetToken(2, DB_DELIM);
+        sContent += OUString(DB_DELIM)
+            + rDBName.getToken(1, DB_DELIM)
+            + OUString(DB_DELIM)
+            + rDBName.getToken(2, DB_DELIM);
     }
     return lcl_DBTrennConv(sContent);
 }
@@ -334,7 +324,7 @@ void SwDBField::Evaluate()
 }
 
 /// get name
-const OUString& SwDBField::GetPar1() const
+OUString SwDBField::GetPar1() const
 {
     return ((const SwDBFieldType*)GetTyp())->GetName();
 }
@@ -369,10 +359,10 @@ bool SwDBField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
         rAny <<= (sal_Int32)GetFormat();
         break;
     case FIELD_PROP_PAR1:
-        rAny <<= OUString(aContent);
+        rAny <<= aContent;
         break;
     case FIELD_PROP_PAR2:
-        rAny <<= OUString(sFieldCode);
+        rAny <<= sFieldCode;
         break;
     default:
         OSL_FAIL("illegal property");
@@ -463,15 +453,15 @@ void SwDBNameInfField::SetDBData(const SwDBData & rDBData)
     aDBData = rDBData;
 }
 
-String SwDBNameInfField::GetFieldName() const
+OUString SwDBNameInfField::GetFieldName() const
 {
-    String sStr( SwField::GetFieldName() );
+    OUString sStr( SwField::GetFieldName() );
     if (!aDBData.sDataSource.isEmpty())
     {
-        sStr += ':';
-        sStr += String(aDBData.sDataSource);
-        sStr += DB_DELIM;
-        sStr += String(aDBData.sCommand);
+        sStr += OUString(':')
+            + aDBData.sDataSource
+            + OUString(DB_DELIM)
+            + aDBData.sCommand;
     }
     return lcl_DBTrennConv(sStr);
 }
@@ -559,21 +549,21 @@ SwFieldType* SwDBNextSetFieldType::Copy() const
 // SwDBSetField
 
 SwDBNextSetField::SwDBNextSetField(SwDBNextSetFieldType* pTyp,
-                                   const String& rCond,
-                                   const String& ,
+                                   const OUString& rCond,
+                                   const OUString& ,
                                    const SwDBData& rDBData) :
     SwDBNameInfField(pTyp, rDBData), aCond(rCond), bCondValid(true)
 {}
 
-String SwDBNextSetField::Expand() const
+OUString SwDBNextSetField::Expand() const
 {
-    return aEmptyStr;
+    return OUString();
 }
 
 SwField* SwDBNextSetField::Copy() const
 {
     SwDBNextSetField *pTmp = new SwDBNextSetField((SwDBNextSetFieldType*)GetTyp(),
-                                         aCond, aEmptyStr, GetDBData());
+                                         aCond, OUString(), GetDBData());
     pTmp->SetSubType(GetSubType());
     pTmp->bCondValid = bCondValid;
     return pTmp;
@@ -590,7 +580,7 @@ void SwDBNextSetField::Evaluate(SwDoc* pDoc)
 }
 
 /// get condition
-const OUString& SwDBNextSetField::GetPar1() const
+OUString SwDBNextSetField::GetPar1() const
 {
     return aCond;
 }
@@ -607,7 +597,7 @@ bool SwDBNextSetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
     switch( nWhichId )
     {
     case FIELD_PROP_PAR3:
-        rAny <<= OUString(aCond);
+        rAny <<= aCond;
         break;
     default:
         bRet = SwDBNameInfField::QueryValue( rAny, nWhichId );
@@ -645,8 +635,8 @@ SwFieldType* SwDBNumSetFieldType::Copy() const
 // SwDBNumSetField
 
 SwDBNumSetField::SwDBNumSetField(SwDBNumSetFieldType* pTyp,
-                                 const String& rCond,
-                                 const String& rDBNum,
+                                 const OUString& rCond,
+                                 const OUString& rDBNum,
                                  const SwDBData& rDBData) :
     SwDBNameInfField(pTyp, rDBData),
     aCond(rCond),
@@ -654,9 +644,9 @@ SwDBNumSetField::SwDBNumSetField(SwDBNumSetFieldType* pTyp,
     bCondValid(true)
 {}
 
-String SwDBNumSetField::Expand() const
+OUString SwDBNumSetField::Expand() const
 {
-    return aEmptyStr;
+    return OUString();
 }
 
 SwField* SwDBNumSetField::Copy() const
@@ -676,12 +666,12 @@ void SwDBNumSetField::Evaluate(SwDoc* pDoc)
     if( bCondValid && pMgr && pMgr->IsInMerge() &&
                         pMgr->IsDataSourceOpen(aTmpData.sDataSource, aTmpData.sCommand, sal_True))
     {   // Bedingug OK -> aktuellen Set einstellen
-        pMgr->ToRecordId(std::max((sal_uInt16)aPar2.ToInt32(), sal_uInt16(1))-1);
+        pMgr->ToRecordId(std::max((sal_uInt16)aPar2.toInt32(), sal_uInt16(1))-1);
     }
 }
 
 /// get LogDBName
-const OUString& SwDBNumSetField::GetPar1() const
+OUString SwDBNumSetField::GetPar1() const
 {
     return aCond;
 }
@@ -710,10 +700,10 @@ bool SwDBNumSetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
     switch( nWhichId )
     {
     case FIELD_PROP_PAR3:
-        rAny <<= OUString(aCond);
+        rAny <<= aCond;
         break;
     case FIELD_PROP_FORMAT:
-        rAny <<= (sal_Int32)aPar2.ToInt32();
+        rAny <<= aPar2.toInt32();
         break;
     default:
         bRet = SwDBNameInfField::QueryValue(rAny, nWhichId );
@@ -750,13 +740,10 @@ SwDBNameFieldType::SwDBNameFieldType(SwDoc* pDocument)
     pDoc = pDocument;
 }
 
-String SwDBNameFieldType::Expand(sal_uLong ) const
+OUString SwDBNameFieldType::Expand(sal_uLong ) const
 {
     const SwDBData aData = pDoc->GetDBData();
-    String sRet(aData.sDataSource);
-    sRet += '.';
-    sRet += (String)aData.sCommand;
-    return sRet;
+    return aData.sDataSource + "." + aData.sCommand;
 }
 
 SwFieldType* SwDBNameFieldType::Copy() const
@@ -771,12 +758,11 @@ SwDBNameField::SwDBNameField(SwDBNameFieldType* pTyp, const SwDBData& rDBData, s
     : SwDBNameInfField(pTyp, rDBData, nFmt)
 {}
 
-String SwDBNameField::Expand() const
+OUString SwDBNameField::Expand() const
 {
-    String sRet;
     if(0 ==(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE))
-        sRet = ((SwDBNameFieldType*)GetTyp())->Expand(GetFormat());
-    return sRet;
+        return ((SwDBNameFieldType*)GetTyp())->Expand(GetFormat());
+    return OUString();
 }
 
 SwField* SwDBNameField::Copy() const
@@ -819,12 +805,11 @@ SwDBSetNumberField::SwDBSetNumberField(SwDBSetNumberFieldType* pTyp,
     : SwDBNameInfField(pTyp, rDBData, nFmt), nNumber(0)
 {}
 
-String SwDBSetNumberField::Expand() const
+OUString SwDBSetNumberField::Expand() const
 {
     if(0 !=(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE) || nNumber == 0)
-        return aEmptyStr;
-    else
-        return FormatNumber((sal_uInt16)nNumber, GetFormat());
+        return OUString();
+    return FormatNumber((sal_uInt16)nNumber, GetFormat());
 }
 
 void SwDBSetNumberField::Evaluate(SwDoc* pDoc)
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 1ec6035..6fd3c08 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <comphelper/string.hxx>
 #include <sfx2/linkmgr.hxx>
 #include <doc.hxx>
 #include <editsh.hxx>
@@ -228,8 +227,8 @@ sal_Bool SwIntrnlRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd,
     return sal_False;
 }
 
-SwDDEFieldType::SwDDEFieldType(const String& rName,
-                                const String& rCmd, sal_uInt16 nUpdateType )
+SwDDEFieldType::SwDDEFieldType(const OUString& rName,
+                               const OUString& rCmd, sal_uInt16 nUpdateType )
     : SwFieldType( RES_DDEFLD ),
     aName( rName ), pDoc( 0 ), nRefCnt( 0 )
 {
@@ -255,21 +254,22 @@ SwFieldType* SwDDEFieldType::Copy() const
     return pType;
 }
 
-const OUString& SwDDEFieldType::GetName() const
+OUString SwDDEFieldType::GetName() const
 {
     return aName;
 }
 
-void SwDDEFieldType::SetCmd( const String& rStr )
+void SwDDEFieldType::SetCmd( OUString aStr )
 {
-    String sCmd( rStr );
-    xub_StrLen nPos;
-    while( STRING_NOTFOUND != (nPos = sCmd.SearchAscii( "  " )) )
-        sCmd.Erase( nPos, 1 );
-    refLink->SetLinkSourceName( sCmd );
+    sal_Int32 nIndex = 0;
+    do
+    {
+        aStr = aStr.replaceFirst("  ", " ", &nIndex);
+    } while (nIndex>=0);
+    refLink->SetLinkSourceName( aStr );
 }
 
-String SwDDEFieldType::GetCmd() const
+OUString SwDDEFieldType::GetCmd() const
 {
     return refLink->GetLinkSourceName();
 }
@@ -312,12 +312,12 @@ void SwDDEFieldType::_RefCntChgd()
 
 bool SwDDEFieldType::QueryValue( uno::Any& rVal, sal_uInt16 nWhichId ) const
 {
-    sal_uInt8 nPart = 0;
+    sal_Int32 nPart = -1;
     switch( nWhichId )
     {
-    case FIELD_PROP_PAR2:      nPart = 3; break;
-    case FIELD_PROP_PAR4:      nPart = 2; break;
-    case FIELD_PROP_SUBTYPE:   nPart = 1; break;
+    case FIELD_PROP_PAR2:      nPart = 2; break;
+    case FIELD_PROP_PAR4:      nPart = 1; break;
+    case FIELD_PROP_SUBTYPE:   nPart = 0; break;
     case FIELD_PROP_BOOL1:
         {
             sal_Bool bSet = GetType() == sfx2::LINKUPDATE_ALWAYS ? sal_True : sal_False;
@@ -325,46 +325,50 @@ bool SwDDEFieldType::QueryValue( uno::Any& rVal, sal_uInt16 nWhichId ) const
         }
         break;
     case FIELD_PROP_PAR5:
-        rVal <<= OUString(aExpansion);
-    break;
+        rVal <<= aExpansion;
+        break;
     default:
         OSL_FAIL("illegal property");
     }
-    if( nPart )
-        rVal <<= OUString(GetCmd().GetToken(nPart-1, sfx2::cTokenSeparator));
+    if ( nPart>=0 )
+        rVal <<= GetCmd().getToken(nPart, sfx2::cTokenSeparator);
     return true;
 }
 
 bool SwDDEFieldType::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
 {
-    sal_uInt8 nPart = 0;
+    sal_Int32 nPart = -1;
     switch( nWhichId )
     {
-    case FIELD_PROP_PAR2:      nPart = 3; break;
-    case FIELD_PROP_PAR4:      nPart = 2; break;
-    case FIELD_PROP_SUBTYPE:   nPart = 1; break;
+    case FIELD_PROP_PAR2:      nPart = 2; break;
+    case FIELD_PROP_PAR4:      nPart = 1; break;
+    case FIELD_PROP_SUBTYPE:   nPart = 0; break;
     case FIELD_PROP_BOOL1:
         SetType( static_cast<sal_uInt16>(*(sal_Bool*)rVal.getValue() ?
                                      sfx2::LINKUPDATE_ALWAYS :
                                      sfx2::LINKUPDATE_ONCALL ) );
         break;
     case FIELD_PROP_PAR5:
-    {
-        OUString sTemp;
-        rVal >>= sTemp;
-        aExpansion = sTemp;
-    }
-    break;
+        rVal >>= aExpansion;
+        break;
     default:
         OSL_FAIL("illegal property");
     }
-    if( nPart )
+    if( nPart>=0 )
     {
-        String sTmp, sCmd( GetCmd() );
-        while(3 > comphelper::string::getTokenCount(sCmd, sfx2::cTokenSeparator))
-            sCmd += sfx2::cTokenSeparator;
-        sCmd.SetToken( nPart-1, sfx2::cTokenSeparator, ::GetString( rVal, sTmp ) );
-        SetCmd( sCmd );
+        const OUString sOldCmd( GetCmd() );
+        OUString sNewCmd;
+        sal_Int32 nIndex = 0;
+        for (sal_Int32 i=0; i<3; ++i)
+        {
+            OUString sToken = sOldCmd.getToken(0, sfx2::cTokenSeparator, nIndex);
+            if (i==nPart)
+            {
+                rVal >>= sToken;
+            }
+            sNewCmd += sToken + OUString(sfx2::cTokenSeparator);
+        }
+        SetCmd( sNewCmd );
     }
     return true;
 }
@@ -380,17 +384,16 @@ SwDDEField::~SwDDEField()
         ((SwDDEFieldType*)GetTyp())->Disconnect();
 }
 
-String SwDDEField::Expand() const
+OUString SwDDEField::Expand() const
 {
-    xub_StrLen nPos;
-    String aStr(comphelper::string::remove(((SwDDEFieldType*)GetTyp())->GetExpansion(), '\r'));
-
-    while( (nPos = aStr.Search( '\t' )) != STRING_NOTFOUND )
-        aStr.SetChar( nPos, ' ' );
-    while( (nPos = aStr.Search( '\n' )) != STRING_NOTFOUND )
-        aStr.SetChar( nPos, '|' );
-    if( aStr.Len() && ( aStr.GetChar( aStr.Len()-1 ) == '|') )
-        aStr.Erase( aStr.Len()-1, 1 );
+    OUString aStr = ((SwDDEFieldType*)GetTyp())->GetExpansion();
+    aStr = aStr.replaceAll("\r", OUString());
+    aStr = aStr.replaceAll("\t", " ");
+    aStr = aStr.replaceAll("\n", "|");
+    if (aStr.endsWith("|"))
+    {
+        return aStr.copy(0, aStr.getLength()-1);
+    }
     return aStr;
 }
 
@@ -400,7 +403,7 @@ SwField* SwDDEField::Copy() const
 }
 
 /// get field type name
-const OUString& SwDDEField::GetPar1() const
+OUString SwDDEField::GetPar1() const
 {
     return ((const SwDDEFieldType*)GetTyp())->GetName();
 }
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 891e72c..c8eb6f4 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -108,20 +108,20 @@ SwPageNumberFieldType::SwPageNumberFieldType()
 {
 }
 
-String& SwPageNumberFieldType::Expand( sal_uInt32 nFmt, short nOff,
+OUString SwPageNumberFieldType::Expand( sal_uInt32 nFmt, short nOff,
          sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage,
-                                const String& rUserStr, String& rRet ) const
+         const OUString& rUserStr ) const
 {
     sal_uInt32 nTmpFmt = (SVX_NUM_PAGEDESC == nFmt) ? (sal_uInt32)nNumberingType : nFmt;
     int const nTmp = nPageNumber + nOff;
 
     if (0 >= nTmp || SVX_NUM_NUMBER_NONE == nTmpFmt || (!bVirtuell && nTmp > nMaxPage))
-        rRet = aEmptyStr;
-    else if( SVX_NUM_CHAR_SPECIAL == nTmpFmt )
-        rRet = rUserStr;
-    else
-        rRet = FormatNumber( (sal_uInt16)nTmp, nTmpFmt );
-    return rRet;
+        return OUString();
+
+    if( SVX_NUM_CHAR_SPECIAL == nTmpFmt )
+        return rUserStr;
+
+    return FormatNumber( (sal_uInt16)nTmp, nTmpFmt );
 }
 
 SwFieldType* SwPageNumberFieldType::Copy() const
@@ -186,32 +186,29 @@ void SwPageNumberField::ChangeExpansion(sal_uInt16 const nPageNumber,
     m_nMaxPage = nMaxPage;
 }
 
-String SwPageNumberField::Expand() const
+OUString SwPageNumberField::Expand() const
 {
-    String sRet;
+    OUString sRet;
     SwPageNumberFieldType* pFldType = (SwPageNumberFieldType*)GetTyp();
 
     if( PG_NEXT == nSubType && 1 != nOffset )
     {
-        if (pFldType->Expand(GetFormat(), 1, m_nPageNumber, m_nMaxPage,
-                    sUserStr, sRet).Len())
+        sRet = pFldType->Expand(GetFormat(), 1, m_nPageNumber, m_nMaxPage, sUserStr);
+        if (!sRet.isEmpty())
         {
-            pFldType->Expand(GetFormat(), nOffset, m_nPageNumber, m_nMaxPage,
-                    sUserStr, sRet);
+            sRet = pFldType->Expand(GetFormat(), nOffset, m_nPageNumber, m_nMaxPage, sUserStr);
         }
     }
     else if( PG_PREV == nSubType && -1 != nOffset )
     {
-        if (pFldType->Expand(GetFormat(), -1, m_nPageNumber, m_nMaxPage,
-                    sUserStr, sRet).Len())
+        sRet = pFldType->Expand(GetFormat(), -1, m_nPageNumber, m_nMaxPage, sUserStr);
+        if (!sRet.isEmpty())
         {
-            pFldType->Expand(GetFormat(), nOffset, m_nPageNumber, m_nMaxPage,
-                    sUserStr, sRet);
+            sRet = pFldType->Expand(GetFormat(), nOffset, m_nPageNumber, m_nMaxPage, sUserStr);
         }
     }
     else
-        pFldType->Expand(GetFormat(), nOffset, m_nPageNumber, m_nMaxPage,
-                sUserStr, sRet);
+        sRet = pFldType->Expand(GetFormat(), nOffset, m_nPageNumber, m_nMaxPage, sUserStr);
     return sRet;
 }
 
@@ -262,7 +259,7 @@ bool SwPageNumberField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
         }
         break;
     case FIELD_PROP_PAR1:
-        rAny <<= OUString(sUserStr);
+        rAny <<= sUserStr;
         break;
 
     default:
@@ -307,7 +304,7 @@ bool SwPageNumberField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
         }
         break;
     case FIELD_PROP_PAR1:
-        ::GetString( rAny, sUserStr );
+        rAny >>= sUserStr;
         break;
 
     default:
@@ -322,15 +319,13 @@ SwAuthorFieldType::SwAuthorFieldType()
 {
 }
 
-String SwAuthorFieldType::Expand(sal_uLong nFmt) const
+OUString SwAuthorFieldType::Expand(sal_uLong nFmt) const
 {
-    String sRet;
     SvtUserOptions&  rOpt = SW_MOD()->GetUserOptions();
     if((nFmt & 0xff) == AF_NAME)
-        sRet = rOpt.GetFullName();
-    else
-        sRet = rOpt.GetID();
-    return sRet;
+        return rOpt.GetFullName();
+
+    return rOpt.GetID();
 }
 
 SwFieldType* SwAuthorFieldType::Copy() const
@@ -346,7 +341,7 @@ SwAuthorField::SwAuthorField(SwAuthorFieldType* pTyp, sal_uInt32 nFmt)
     aContent = ((SwAuthorFieldType*)GetTyp())->Expand(GetFormat());
 }
 
-String SwAuthorField::Expand() const
+OUString SwAuthorField::Expand() const
 {
     if (!IsFixed())
         ((SwAuthorField*)this)->aContent =
@@ -379,7 +374,7 @@ bool SwAuthorField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
         break;
 
     case FIELD_PROP_PAR1:
-        rAny <<= OUString(GetContent());
+        rAny <<= GetContent();
         break;
 
     default:
@@ -404,7 +399,7 @@ bool SwAuthorField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
         break;
 
     case FIELD_PROP_PAR1:
-        ::GetString( rAny, aContent );
+        rAny >>= aContent;
         break;
 
     default:
@@ -421,9 +416,9 @@ SwFileNameFieldType::SwFileNameFieldType(SwDoc *pDocument)
     pDoc = pDocument;
 }
 
-String SwFileNameFieldType::Expand(sal_uLong nFmt) const
+OUString SwFileNameFieldType::Expand(sal_uLong nFmt) const
 {
-    String aRet;
+    OUString aRet;
     const SwDocShell* pDShell = pDoc->GetDocShell();
     if( pDShell && pDShell->HasName() )
     {
@@ -444,8 +439,11 @@ String SwFileNameFieldType::Expand(sal_uLong nFmt) const
                         aRet = URIHelper::removePassword(
                                     rURLObj.GetMainURL( INetURLObject::NO_DECODE ),
                                     INetURLObject::WAS_ENCODED, URL_DECODE );
-                        aRet.Erase( aRet.Search( String(rURLObj.GetLastName(
-                                                    URL_DECODE )) ) );
+                        const sal_Int32 nPos = aRet.indexOf(rURLObj.GetLastName( URL_DECODE ));
+                        if (nPos>=0)
+                        {
+                            aRet = aRet.copy(0, nPos);
+                        }
                     }
                 }
                 break;
@@ -484,7 +482,7 @@ SwFileNameField::SwFileNameField(SwFileNameFieldType* pTyp, sal_uInt32 nFmt)
     aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat());
 }
 
-String SwFileNameField::Expand() const
+OUString SwFileNameField::Expand() const
 {
     if (!IsFixed())
         ((SwFileNameField*)this)->aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat());
@@ -533,7 +531,7 @@ bool SwFileNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
         break;
 
     case FIELD_PROP_PAR3:
-        rAny <<= OUString(GetContent());
+        rAny <<= GetContent();
         break;
     default:
         OSL_FAIL("illegal property");
@@ -580,7 +578,7 @@ bool SwFileNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
         break;
 
     case FIELD_PROP_PAR3:
-        ::GetString( rAny, aContent );
+        rAny >>= aContent;
         break;
 
     default:
@@ -597,11 +595,11 @@ SwTemplNameFieldType::SwTemplNameFieldType(SwDoc *pDocument)
     pDoc = pDocument;
 }
 
-String SwTemplNameFieldType::Expand(sal_uLong nFmt) const
+OUString SwTemplNameFieldType::Expand(sal_uLong nFmt) const
 {
     OSL_ENSURE( nFmt < FF_END, "Expand: kein guelt. Fmt!" );
 
-    String aRet;
+    OUString aRet;
     SwDocShell *pDocShell(pDoc->GetDocShell());
     OSL_ENSURE(pDocShell, "no SwDocShell");
     if (pDocShell) {
@@ -621,7 +619,9 @@ String SwTemplNameFieldType::Expand(sal_uLong nFmt) const
                 SfxDocumentTemplates aFac;
                 aFac.Construct();
                 String sTmp;
-                aFac.GetLogicNames( xDocProps->getTemplateURL(), aRet, sTmp );
+                String sRegion;
+                aFac.GetLogicNames( xDocProps->getTemplateURL(), sRegion, sTmp );
+                aRet = sRegion;
             }
             else
             {
@@ -657,7 +657,7 @@ SwTemplNameField::SwTemplNameField(SwTemplNameFieldType* pTyp, sal_uInt32 nFmt)
     : SwField(pTyp, nFmt)
 {}
 
-String SwTemplNameField::Expand() const
+OUString SwTemplNameField::Expand() const
 {
     return((SwTemplNameFieldType*)GetTyp())->Expand(GetFormat());

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list