[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_3' - 52 commits - sw/inc sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 9 12:24:18 UTC 2018


Rebased ref, commits from common ancestor:
commit 3980f538916cb8b89f1d3a9f5f378743195f905e
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Nov 9 12:50:04 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 9 13:19:16 2018 +0100

    UnHideRedlines
    
    Change-Id: I85d99fc65a071279c2d4656a52ff82ed3b2db7d8

diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 7be6db566c8b..d257cff3f503 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4505,6 +4505,8 @@ void SwRootFrame::SetHideRedlines(bool const bHideRedlines)
             pFootnote->InvalidateNumberInLayout();
         }
     }
+    // TODO invalidate all chapter fields etc. to re-expand them
+    rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Chapter)->UpdateFields();
 
 //    InvalidateAllContent(SwInvalidateFlags::Size); // ??? TODO what to invalidate?  this is the big hammer
 }
commit d8e08defffd5f80ebfaa7e65fc01b87d69c28d23
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 8 18:51:20 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 9 13:18:50 2018 +0100

    sw_redlinehide_3: expand layout-dependent in SwChapterField/SwGetRefField
    
    Change-Id: I3b68a46f68fb4070d26b247a6701b510cc209d9b

diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx
index 957930f18af4..31dd91c4d50b 100644
--- a/sw/source/core/fields/chpfld.cxx
+++ b/sw/source/core/fields/chpfld.cxx
@@ -95,9 +95,9 @@ const OUString& SwChapterField::GetTitle(SwRootFrame const*const pLayout) const
     return rState.sTitle;
 }
 
-OUString SwChapterField::ExpandImpl(SwRootFrame const*const) const
+OUString SwChapterField::ExpandImpl(SwRootFrame const*const pLayout) const
 {
-    State const& rState(m_State);
+    State const& rState(pLayout && pLayout->IsHideRedlines() ? m_StateRLHidden : m_State);
     switch( GetFormat() )
     {
         case CF_TITLE:
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 4571765a9051..dfa2658b2226 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -416,9 +416,9 @@ void SwGetRefField::SetExpand( const OUString& rStr )
     m_sTextRLHidden = rStr;
 }
 
-OUString SwGetRefField::ExpandImpl(SwRootFrame const*const) const
+OUString SwGetRefField::ExpandImpl(SwRootFrame const*const pLayout) const
 {
-    return m_sText;
+    return pLayout && pLayout->IsHideRedlines() ? m_sTextRLHidden : m_sText;
 }
 
 OUString SwGetRefField::GetFieldName() const
commit 3c2667a1a55e054c47b9ef104ddb3c8c71691bdf
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 8 18:44:10 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 9 13:18:10 2018 +0100

    sw_redlinehide_3: transport layout from ExpandField() to Expand()
    
    While at it, rename that to ExpandImpl() so it's unique.
    
    Change-Id: I217deb72b4dfdca777e28e18ff56e49863e66640

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 60e7f1533100..c6bab5ccf91c 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -147,7 +147,7 @@ class SwAuthorityField : public SwField
     sal_IntPtr          m_nHandle;
     mutable sal_IntPtr  m_nTempSequencePos;
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
diff --git a/sw/inc/chpfld.hxx b/sw/inc/chpfld.hxx
index 85b896f0c042..db7f7d528c82 100644
--- a/sw/inc/chpfld.hxx
+++ b/sw/inc/chpfld.hxx
@@ -62,7 +62,7 @@ class SW_DLLPUBLIC SwChapterField : public SwField
     State m_State;
     State m_StateRLHidden;
 
-    virtual OUString Expand() const override;
+    virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx
index 5d2c51af7880..9d83bed743d8 100644
--- a/sw/inc/dbfld.hxx
+++ b/sw/inc/dbfld.hxx
@@ -62,7 +62,7 @@ class SW_DLLPUBLIC SwDBField : public SwValueField
     bool    bValidValue     : 1;
     bool    bInitialized    : 1;
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
@@ -164,7 +164,7 @@ public:
     SwDBNextSetField( SwDBNextSetFieldType*,
                       const OUString& rCond, const SwDBData& rDBData);
 
-    virtual OUString        Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     void                    Evaluate(SwDoc const *);
@@ -204,7 +204,7 @@ class SwDBNumSetField : public SwDBNameInfField
 public:
     SwDBNumSetField(SwDBNumSetFieldType*, const OUString& rCond, const OUString& rDBNum, const SwDBData& rDBData);
 
-    virtual OUString        Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     inline bool             IsCondValid() const;
@@ -247,7 +247,7 @@ class SW_DLLPUBLIC SwDBNameField : public SwDBNameInfField
 public:
     SwDBNameField(SwDBNameFieldType*, const SwDBData& rDBData);
 
-    virtual OUString Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
     virtual bool        QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
     virtual bool        PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
@@ -269,7 +269,7 @@ class SW_DLLPUBLIC SwDBSetNumberField : public SwDBNameInfField
 public:
     SwDBSetNumberField(SwDBSetNumberFieldType*, const SwDBData& rDBData, sal_uInt32 nFormat = 0);
 
-    virtual OUString Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
     void            Evaluate(SwDoc const *);
 
diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx
index 278e6a2963fa..64f904d87f61 100644
--- a/sw/inc/ddefld.hxx
+++ b/sw/inc/ddefld.hxx
@@ -105,7 +105,7 @@ public:
 class SwDDEField : public SwField
 {
 private:
-    virtual OUString Expand() const override;
+    virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index ead0f04620b4..03f2a1deebb9 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -156,7 +156,7 @@ public:
     void ChangeExpansion(sal_uInt16 const nPageNumber,
             sal_uInt16 const nMaxPage);
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     virtual OUString GetPar2() const override;
@@ -186,7 +186,7 @@ class SwAuthorField : public SwField
 public:
     SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFormat);
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     void         SetExpansion(const OUString& rStr) { m_aContent = rStr; }
@@ -212,7 +212,7 @@ class SW_DLLPUBLIC SwFileNameField : public SwField
 public:
     SwFileNameField(SwFileNameFieldType*, sal_uInt32 nFormat);
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     void         SetExpansion(const OUString& rStr) { m_aContent = rStr; }
@@ -236,7 +236,7 @@ class SW_DLLPUBLIC SwTemplNameField : public SwField
 public:
     SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFormat);
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
     virtual bool        QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
     virtual bool        PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
@@ -266,7 +266,7 @@ public:
 
     void ChangeExpansion( const SwFrame* pFrame );
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     virtual sal_uInt16      GetSubType() const override;
@@ -300,7 +300,7 @@ class SW_DLLPUBLIC SwHiddenTextField : public SwField
     bool m_bIsHidden : 1; ///< Is it not visible?
     bool m_bValid : 1; ///< Is DB-field evaluated?
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
@@ -361,7 +361,7 @@ public:
     /// Direct input, delete old value.
     SwHiddenParaField(SwHiddenParaFieldType*, const OUString& rCond);
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     void                SetHidden(bool bHidden)     { m_bIsHidden = bHidden; }
@@ -390,7 +390,7 @@ class SW_DLLPUBLIC SwMacroField : public SwField
     OUString m_aText;
     bool      m_bIsScriptURL;
 
-    virtual OUString Expand() const override;
+    virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
@@ -464,7 +464,7 @@ public:
 
     virtual ~SwPostItField() override;
 
-    virtual OUString        Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     const DateTime&         GetDateTime() const             { return m_aDateTime; }
@@ -510,7 +510,7 @@ class SW_DLLPUBLIC SwDocInfoField : public SwValueField
     OUString  m_aContent;
     OUString  m_aName;
 
-    virtual OUString        Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
@@ -546,7 +546,7 @@ class SwExtUserField : public SwField
 public:
     SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat);
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     virtual sal_uInt16      GetSubType() const override;
@@ -580,7 +580,7 @@ class SwRefPageSetField : public SwField
 public:
     SwRefPageSetField( SwRefPageSetFieldType*, short nOff, bool bOn );
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     virtual OUString  GetPar2() const override;
@@ -618,7 +618,7 @@ class SwRefPageGetField : public SwField
 public:
     SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFormat );
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     void SetText( const OUString& rText )      { m_sText = rText; }
@@ -649,7 +649,7 @@ public:
     SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat,
                      const OUString& sText, const OUString& sHelp );
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     /// Placeholder-Text
@@ -689,7 +689,7 @@ public:
 
     virtual OUString        GetDescription() const override;
 
-    virtual OUString        Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     /// Type
@@ -724,7 +724,7 @@ class SW_DLLPUBLIC SwCombinedCharField : public SwField
 public:
     SwCombinedCharField( SwCombinedCharFieldType*, const OUString& rChars );
 
-    virtual OUString        Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     /// Characters
diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index f289a91924f0..4c48d2e0e8a7 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -86,7 +86,7 @@ class SW_DLLPUBLIC SwGetExpField : public SwFormulaField
 
     bool            m_bLateInitialization; // #i82544#
 
-    virtual OUString            Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
@@ -208,7 +208,7 @@ class SW_DLLPUBLIC SwSetExpField : public SwFormulaField
     sal_uInt16          mnSubType;
     SwFormatField * mpFormatField; /// pool item to which the SwSetExpField belongs
 
-    virtual OUString            Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
@@ -293,7 +293,7 @@ class SW_DLLPUBLIC SwInputField : public SwField
 
     SwFormatField* mpFormatField; // attribute to which the <SwInputField> belongs to
 
-    virtual OUString        Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     // Accessing Input Field's content
@@ -379,7 +379,7 @@ class SwTableField : public SwValueField, public SwTableFormula
     OUString      sExpand;
     sal_uInt16      nSubType;
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
     /// Search TextNode containing the field.
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 923a3d79837e..ae4a713af9b5 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -273,7 +273,7 @@ inline void SwFieldType::UpdateFields() const
 
 /** Base class of all fields.
  Type of field is queried via Which.
- Expanded content of field is queried via Expand(). */
+ Expanded content of field is queried via ExpandField(). */
 class SW_DLLPUBLIC SwField
 {
 private:
@@ -284,7 +284,7 @@ private:
     sal_uInt32          m_nFormat;              /// this can be either SvxNumType or SwChapterFormat depending on the subtype
     SwFieldType*        m_pType;
 
-    virtual OUString    Expand() const = 0;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const = 0;
     virtual std::unique_ptr<SwField> Copy() const = 0;
 
 protected:
diff --git a/sw/inc/flddat.hxx b/sw/inc/flddat.hxx
index f2c0ca3435f5..b2896729b8bd 100644
--- a/sw/inc/flddat.hxx
+++ b/sw/inc/flddat.hxx
@@ -45,7 +45,7 @@ class SW_DLLPUBLIC SwDateTimeField : public SwValueField
         sal_uInt16              m_nSubType;
         long                m_nOffset;    // Offset in minutes.
 
-        virtual OUString    Expand() const override;
+        virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
         virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
diff --git a/sw/inc/flddropdown.hxx b/sw/inc/flddropdown.hxx
index f53e727cfe24..b42445afa2ed 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 OUString Expand() const override;
+    virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
 
     /**
        Creates a copy of this field.
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 9499f769f1f9..c94409acf379 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -89,7 +89,7 @@ private:
     sal_uInt16 m_nSubType;
     sal_uInt16 m_nSeqNo;
 
-    virtual OUString    Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx
index ee565278fe6d..01e38b360685 100644
--- a/sw/inc/usrfld.hxx
+++ b/sw/inc/usrfld.hxx
@@ -102,7 +102,7 @@ class SW_DLLPUBLIC SwUserField : public SwValueField
 {
     sal_uInt16  nSubType;
 
-    virtual OUString        Expand() const override;
+    virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
 
 public:
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 9f5983b03fca..9e9616017ca9 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -511,7 +511,7 @@ SwAuthorityField::~SwAuthorityField()
     static_cast<SwAuthorityFieldType* >(GetTyp())->RemoveField(m_nHandle);
 }
 
-OUString SwAuthorityField::Expand() const
+OUString SwAuthorityField::ExpandImpl(SwRootFrame const*const) const
 {
     return ConditionalExpandAuthIdentifier();
 }
diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx
index 4502f783d179..957930f18af4 100644
--- a/sw/source/core/fields/chpfld.cxx
+++ b/sw/source/core/fields/chpfld.cxx
@@ -95,7 +95,7 @@ const OUString& SwChapterField::GetTitle(SwRootFrame const*const pLayout) const
     return rState.sTitle;
 }
 
-OUString SwChapterField::Expand() const
+OUString SwChapterField::ExpandImpl(SwRootFrame const*const) const
 {
     State const& rState(m_State);
     switch( GetFormat() )
diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx
index 9b2f5940ee1b..f85e61eafd5d 100644
--- a/sw/source/core/fields/dbfld.cxx
+++ b/sw/source/core/fields/dbfld.cxx
@@ -206,7 +206,7 @@ void SwDBField::InitContent(const OUString& rExpansion)
     SetExpansion( rExpansion );
 }
 
-OUString SwDBField::Expand() const
+OUString SwDBField::ExpandImpl(SwRootFrame const*const) const
 {
     if(0 ==(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE))
         return lcl_DBTrennConv(aContent);
@@ -566,7 +566,7 @@ SwDBNextSetField::SwDBNextSetField(SwDBNextSetFieldType* pTyp,
     SwDBNameInfField(pTyp, rDBData), aCond(rCond), bCondValid(true)
 {}
 
-OUString SwDBNextSetField::Expand() const
+OUString SwDBNextSetField::ExpandImpl(SwRootFrame const*const) const
 {
     return OUString();
 }
@@ -653,7 +653,7 @@ SwDBNumSetField::SwDBNumSetField(SwDBNumSetFieldType* pTyp,
     bCondValid(true)
 {}
 
-OUString SwDBNumSetField::Expand() const
+OUString SwDBNumSetField::ExpandImpl(SwRootFrame const*const) const
 {
     return OUString();
 }
@@ -765,7 +765,7 @@ SwDBNameField::SwDBNameField(SwDBNameFieldType* pTyp, const SwDBData& rDBData)
     : SwDBNameInfField(pTyp, rDBData, 0)
 {}
 
-OUString SwDBNameField::Expand() const
+OUString SwDBNameField::ExpandImpl(SwRootFrame const*const) const
 {
     if(0 ==(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE))
         return static_cast<SwDBNameFieldType*>(GetTyp())->Expand();
@@ -810,7 +810,7 @@ SwDBSetNumberField::SwDBSetNumberField(SwDBSetNumberFieldType* pTyp,
     : SwDBNameInfField(pTyp, rDBData, nFormat), nNumber(0)
 {}
 
-OUString SwDBSetNumberField::Expand() const
+OUString SwDBSetNumberField::ExpandImpl(SwRootFrame const*const) const
 {
     if(0 !=(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE) || nNumber == 0)
         return OUString();
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index f5aacede9507..4b4544f0ee5a 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -342,7 +342,7 @@ SwDDEField::~SwDDEField()
         static_cast<SwDDEFieldType*>(GetTyp())->Disconnect();
 }
 
-OUString SwDDEField::Expand() const
+OUString SwDDEField::ExpandImpl(SwRootFrame const*const) const
 {
     OUString aStr = static_cast<SwDDEFieldType*>(GetTyp())->GetExpansion();
     aStr = aStr.replaceAll("\r", "");
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index da1c5b3b1cbc..2f997bed40fe 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -185,7 +185,7 @@ void SwPageNumberField::ChangeExpansion(sal_uInt16 const nPageNumber,
     m_nMaxPage = nMaxPage;
 }
 
-OUString SwPageNumberField::Expand() const
+OUString SwPageNumberField::ExpandImpl(SwRootFrame const*const) const
 {
     OUString sRet;
     SwPageNumberFieldType* pFieldType = static_cast<SwPageNumberFieldType*>(GetTyp());
@@ -335,7 +335,7 @@ SwAuthorField::SwAuthorField(SwAuthorFieldType* pTyp, sal_uInt32 nFormat)
     m_aContent = SwAuthorFieldType::Expand(GetFormat());
 }
 
-OUString SwAuthorField::Expand() const
+OUString SwAuthorField::ExpandImpl(SwRootFrame const*const) const
 {
     if (!IsFixed())
         const_cast<SwAuthorField*>(this)->m_aContent =
@@ -469,7 +469,7 @@ SwFileNameField::SwFileNameField(SwFileNameFieldType* pTyp, sal_uInt32 nFormat)
     m_aContent = static_cast<SwFileNameFieldType*>(GetTyp())->Expand(GetFormat());
 }
 
-OUString SwFileNameField::Expand() const
+OUString SwFileNameField::ExpandImpl(SwRootFrame const*const) const
 {
     if (!IsFixed())
         const_cast<SwFileNameField*>(this)->m_aContent = static_cast<SwFileNameFieldType*>(GetTyp())->Expand(GetFormat());
@@ -638,7 +638,7 @@ SwTemplNameField::SwTemplNameField(SwTemplNameFieldType* pTyp, sal_uInt32 nForma
     : SwField(pTyp, nFormat)
 {}
 
-OUString SwTemplNameField::Expand() const
+OUString SwTemplNameField::ExpandImpl(SwRootFrame const*const) const
 {
     return static_cast<SwTemplNameFieldType*>(GetTyp())->Expand(GetFormat());
 }
@@ -765,7 +765,7 @@ SwDocStatField::SwDocStatField(SwDocStatFieldType* pTyp, sal_uInt16 nSub, sal_uI
     m_nSubType(nSub)
 {}
 
-OUString SwDocStatField::Expand() const
+OUString SwDocStatField::ExpandImpl(SwRootFrame const*const) const
 {
     return static_cast<SwDocStatFieldType*>(GetTyp())->Expand(m_nSubType, static_cast<SvxNumType>(GetFormat()));
 }
@@ -1031,7 +1031,7 @@ static double lcl_DateToDouble( const D& rDate, const Date& rNullDate )
     return double( nDate - nNullDate );
 }
 
-OUString SwDocInfoField::Expand() const
+OUString SwDocInfoField::ExpandImpl(SwRootFrame const*const) const
 {
     if ( ( m_nSubType & 0xFF ) == DI_CUSTOM )
     {
@@ -1190,7 +1190,7 @@ bool SwDocInfoField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
         }
         break;
     case FIELD_PROP_PAR3:
-        rAny <<= Expand();
+        rAny <<= ExpandImpl(nullptr);
         break;
     case FIELD_PROP_BOOL2:
         {
@@ -1310,7 +1310,7 @@ SwHiddenTextField::SwHiddenTextField( SwHiddenTextFieldType* pFieldType,
     m_bCanToggle = !m_aCond.isEmpty();
 }
 
-OUString SwHiddenTextField::Expand() const
+OUString SwHiddenTextField::ExpandImpl(SwRootFrame const*const) const
 {
     // Type: !Hidden  -> show always
     //        Hide    -> evaluate condition
@@ -1661,7 +1661,7 @@ SwHiddenParaField::SwHiddenParaField(SwHiddenParaFieldType* pTyp, const OUString
     m_bIsHidden = false;
 }
 
-OUString SwHiddenParaField::Expand() const
+OUString SwHiddenParaField::ExpandImpl(SwRootFrame const*const) const
 {
     return OUString();
 }
@@ -1761,7 +1761,7 @@ SwPostItField::~SwPostItField()
     mpText.reset();
 }
 
-OUString SwPostItField::Expand() const
+OUString SwPostItField::ExpandImpl(SwRootFrame const*const) const
 {
     return OUString();
 }
@@ -1988,7 +1988,7 @@ SwExtUserField::SwExtUserField(SwExtUserFieldType* pTyp, sal_uInt16 nSubTyp, sal
     m_aContent = SwExtUserFieldType::Expand(m_nType);
 }
 
-OUString SwExtUserField::Expand() const
+OUString SwExtUserField::ExpandImpl(SwRootFrame const*const) const
 {
     if (!IsFixed())
         const_cast<SwExtUserField*>(this)->m_aContent = SwExtUserFieldType::Expand(m_nType);
@@ -2089,7 +2089,7 @@ SwRefPageSetField::SwRefPageSetField( SwRefPageSetFieldType* pTyp,
 {
 }
 
-OUString SwRefPageSetField::Expand() const
+OUString SwRefPageSetField::ExpandImpl(SwRootFrame const*const) const
 {
     return OUString();
 }
@@ -2283,7 +2283,7 @@ SwRefPageGetField::SwRefPageGetField( SwRefPageGetFieldType* pTyp,
 {
 }
 
-OUString SwRefPageGetField::Expand() const
+OUString SwRefPageGetField::ExpandImpl(SwRootFrame const*const) const
 {
     return m_sText;
 }
@@ -2417,7 +2417,7 @@ SwJumpEditField::SwJumpEditField( SwJumpEditFieldType* pTyp, sal_uInt32 nForm,
 {
 }
 
-OUString SwJumpEditField::Expand() const
+OUString SwJumpEditField::ExpandImpl(SwRootFrame const*const) const
 {
     return "<" + m_sText + ">";
 }
@@ -2537,7 +2537,7 @@ SwCombinedCharField::SwCombinedCharField( SwCombinedCharFieldType* pFTyp,
 {
 }
 
-OUString SwCombinedCharField::Expand() const
+OUString SwCombinedCharField::ExpandImpl(SwRootFrame const*const) const
 {
     return m_sCharacters;
 }
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index c62f7d79d880..a9f70bed75fe 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -291,7 +291,7 @@ SwGetExpField::SwGetExpField(SwGetExpFieldType* pTyp, const OUString& rFormel,
     SetFormula( rFormel );
 }
 
-OUString SwGetExpField::Expand() const
+OUString SwGetExpField::ExpandImpl(SwRootFrame const*const) const
 {
     if(m_nSubType & nsSwExtendedSubType::SUB_CMD)
         return GetFormula();
@@ -797,7 +797,7 @@ void SwSetExpField::SetFormatField(SwFormatField & rFormatField)
     mpFormatField = &rFormatField;
 }
 
-OUString SwSetExpField::Expand() const
+OUString SwSetExpField::ExpandImpl(SwRootFrame const*const) const
 {
     if (mnSubType & nsSwExtendedSubType::SUB_CMD)
     {   // we need the CommandString
@@ -1211,7 +1211,7 @@ std::unique_ptr<SwField> SwInputField::Copy() const
     return std::unique_ptr<SwField>(pField.release());
 }
 
-OUString SwInputField::Expand() const
+OUString SwInputField::ExpandImpl(SwRootFrame const*const) const
 {
     if((mnSubType & 0x00ff) == INP_TXT)
     {
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 315bba814aa8..7be1be2d0f11 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -409,7 +409,7 @@ bool SwField::IsFixed() const
 }
 
 OUString
-SwField::ExpandField(bool const bCached, SwRootFrame const*const ) const
+SwField::ExpandField(bool const bCached, SwRootFrame const*const pLayout) const
 {
     if ( m_bUseFieldValueCache )
     {
@@ -421,12 +421,12 @@ SwField::ExpandField(bool const bCached, SwRootFrame const*const ) const
                 m_Cache = pAuthorityField->ConditionalExpandAuthIdentifier();
             }
             else
-                m_Cache = Expand();
+                m_Cache = ExpandImpl(pLayout);
         }
         return m_Cache;
     }
 
-    return Expand();
+    return ExpandImpl(pLayout);
 }
 
 std::unique_ptr<SwField> SwField::CopyField() const
diff --git a/sw/source/core/fields/flddat.cxx b/sw/source/core/fields/flddat.cxx
index 55b319f0421b..18ca8ddaed11 100644
--- a/sw/source/core/fields/flddat.cxx
+++ b/sw/source/core/fields/flddat.cxx
@@ -61,7 +61,7 @@ SwDateTimeField::SwDateTimeField(SwDateTimeFieldType* pInitType, sal_uInt16 nSub
     }
 }
 
-OUString SwDateTimeField::Expand() const
+OUString SwDateTimeField::ExpandImpl(SwRootFrame const*const) const
 {
     double fVal;
 
diff --git a/sw/source/core/fields/flddropdown.cxx b/sw/source/core/fields/flddropdown.cxx
index 97b5cb5a338c..b79e81f2220e 100644
--- a/sw/source/core/fields/flddropdown.cxx
+++ b/sw/source/core/fields/flddropdown.cxx
@@ -62,7 +62,7 @@ SwDropDownField::~SwDropDownField()
 {
 }
 
-OUString SwDropDownField::Expand() const
+OUString SwDropDownField::ExpandImpl(SwRootFrame const*const) const
 {
     OUString sSelect = GetSelectedItem();
     if (sSelect.isEmpty())
diff --git a/sw/source/core/fields/macrofld.cxx b/sw/source/core/fields/macrofld.cxx
index d51816cde458..705165115ffa 100644
--- a/sw/source/core/fields/macrofld.cxx
+++ b/sw/source/core/fields/macrofld.cxx
@@ -47,7 +47,7 @@ SwMacroField::SwMacroField(SwMacroFieldType* pInitType,
     m_bIsScriptURL = isScriptURL(m_aMacro);
 }
 
-OUString SwMacroField::Expand() const
+OUString SwMacroField::ExpandImpl(SwRootFrame const*const) const
 {
     return m_aText ;
 }
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 608148e70635..4571765a9051 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -416,7 +416,7 @@ void SwGetRefField::SetExpand( const OUString& rStr )
     m_sTextRLHidden = rStr;
 }
 
-OUString SwGetRefField::Expand() const
+OUString SwGetRefField::ExpandImpl(SwRootFrame const*const) const
 {
     return m_sText;
 }
@@ -428,7 +428,7 @@ OUString SwGetRefField::GetFieldName() const
     {
         return aName + " " + m_sSetRefName;
     }
-    return Expand();
+    return ExpandImpl(nullptr);
 }
 
 
@@ -869,7 +869,7 @@ void SwGetRefField::SetPar1( const OUString& rName )
 
 OUString SwGetRefField::GetPar2() const
 {
-    return Expand();
+    return ExpandImpl(nullptr);
 }
 
 bool SwGetRefField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
@@ -933,7 +933,7 @@ bool SwGetRefField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
     }
     break;
     case FIELD_PROP_PAR3:
-        rAny <<= Expand();
+        rAny <<= ExpandImpl(nullptr);
         break;
     case FIELD_PROP_PAR4:
         rAny <<= m_sSetReferenceLanguage;
diff --git a/sw/source/core/fields/scrptfld.cxx b/sw/source/core/fields/scrptfld.cxx
index 84b115b4e7c9..53e8aec6a44b 100644
--- a/sw/source/core/fields/scrptfld.cxx
+++ b/sw/source/core/fields/scrptfld.cxx
@@ -47,7 +47,7 @@ OUString SwScriptField::GetDescription() const
     return SwResId(STR_SCRIPT);
 }
 
-OUString SwScriptField::Expand() const
+OUString SwScriptField::ExpandImpl(SwRootFrame const*const) const
 {
     return OUString();
 }
diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx
index 8ca2334aecb6..9f4ab0913748 100644
--- a/sw/source/core/fields/tblcalc.cxx
+++ b/sw/source/core/fields/tblcalc.cxx
@@ -108,7 +108,7 @@ OUString SwTableField::GetCommand()
         : OUString();
 }
 
-OUString SwTableField::Expand() const
+OUString SwTableField::ExpandImpl(SwRootFrame const*const) const
 {
     if (nSubType & nsSwExtendedSubType::SUB_CMD)
     {
@@ -160,7 +160,7 @@ bool SwTableField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
             sal_uInt16 nOldSubType = nSubType;
             SwTableField* pThis = const_cast<SwTableField*>(this);
             pThis->nSubType |= nsSwExtendedSubType::SUB_CMD;
-            rAny <<= Expand();
+            rAny <<= ExpandImpl(nullptr);
             pThis->nSubType = nOldSubType;
         }
         break;
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 5537fc36ea92..3b28be9fda24 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -61,7 +61,7 @@ SwUserField::SwUserField(SwUserFieldType* pTyp, sal_uInt16 nSub, sal_uInt32 nFor
 {
 }
 
-OUString SwUserField::Expand() const
+OUString SwUserField::ExpandImpl(SwRootFrame const*const) const
 {
     if(!(nSubType & nsSwExtendedSubType::SUB_INVISIBLE))
         return static_cast<SwUserFieldType*>(GetTyp())->Expand(GetFormat(), nSubType, GetLanguage());
commit 90d570a00b70fa7d5e0f73aeb160144d5b2ec982
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 8 17:43:16 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 9 13:15:22 2018 +0100

    sw_redlinehide_3: add layout parameter to SwField::ExpandField()
    
    If the bCached=true, it shouldn't matter what the layout is, because the
    field won't be expanded properly anyway.
    
    Except for the SwInputField which disables caching, but that one often
    has a different code path anyway.
    
    For most fields it doesn't matter anyway, e.g. database fields.
    
    Change-Id: I628195f43c5d26feba94af0a832386791c072ba1

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 1e35ecd0ea1d..7b73c8cff0a9 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1387,7 +1387,7 @@ public:
     // restore the invisible content if it's available on the undo stack
     bool RestoreInvisibleContent();
 
-    bool ConvertFieldsToText();
+    bool ConvertFieldsToText(SwRootFrame const& rLayout);
 
     // Create sub-documents according to given collection.
     // If no collection is given, use chapter styles for 1st level.
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index e6b977b5c295..923a3d79837e 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -27,6 +27,7 @@
 #include <vector>
 
 class SwDoc;
+class SwRootFrame;
 class SvNumberFormatter;
 namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
 namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
@@ -315,9 +316,11 @@ public:
                     this is because various fields need special handing
                     (ChangeExpansion()) to return correct values, and only
                     SwTextFormatter::NewFieldPortion() sets things up properly.
+        @param  pLayout     the layout to use for expansion; there are a few
+                            fields that expand differently via layout mode.
         @return     the generated text (suitable for display)
       */
-    OUString            ExpandField(bool const bCached) const;
+    OUString            ExpandField(bool bCached, SwRootFrame const* pLayout) const;
 
     /// @return name or content.
     virtual OUString    GetFieldName() const;
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 60654d3aace7..a4979c998b7f 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -139,7 +139,7 @@ lcl_CleanStr(const SwTextNode& rNd, sal_Int32 const nStart, sal_Int32& rEnd,
                         // replacement and remove afterwards all at a string's
                         // end (might be normal 0x7f).
                         const bool bEmpty = pHt->Which() != RES_TXTATR_FIELD
-                            || (static_txtattr_cast<SwTextField const*>(pHt)->GetFormatField().GetField()->ExpandField(true).isEmpty());
+                            || (static_txtattr_cast<SwTextField const*>(pHt)->GetFormatField().GetField()->ExpandField(true, nullptr).isEmpty());
                         if ( bEmpty && nStart == nCurrent )
                         {
                             rArr.push_back( nCurrent );
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index d024ea9117fc..0ce2a53fd7b4 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1000,7 +1000,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp
         {
             const_cast<SwDBSetNumberField*>(static_cast<const SwDBSetNumberField*>(pField))->Evaluate(&m_rDoc);
             aCalc.VarChange( sDBNumNm, static_cast<const SwDBSetNumberField*>(pField)->GetSetNumber());
-            pField->ExpandField(m_rDoc.IsClipBoard());
+            pField->ExpandField(m_rDoc.IsClipBoard(), nullptr);
         }
 #endif
         break;
@@ -1031,7 +1031,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp
             // Entry present?
             sal_uInt16 nPos;
             HashStr* pFnd = aHashStrTable.Find( rName, &nPos );
-            OUString const value(pField->ExpandField(m_rDoc.IsClipBoard()));
+            OUString const value(pField->ExpandField(m_rDoc.IsClipBoard(), nullptr));
             if( pFnd )
             {
                 // Modify entry in the hash table
@@ -1544,7 +1544,7 @@ void DocumentFieldsManager::FieldsToExpand( SwHashTable<HashStr> & rHashTable,
                 // Entry present?
                 sal_uInt16 nPos;
                 HashStr* pFnd = rHashTable.Find( rName, &nPos );
-                OUString const value(pField->ExpandField(m_rDoc.IsClipBoard()));
+                OUString const value(pField->ExpandField(m_rDoc.IsClipBoard(), nullptr));
                 if( pFnd )
                 {
                     // modify entry in the hash table
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 66286f9bc971..8056e3fe5fdf 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1383,7 +1383,7 @@ bool SwDoc::FieldHidesPara(const SwField& rField) const
             return static_cast<const SwHiddenParaField&>(rField).IsHidden();
         case SwFieldIds::Database:
             return FieldCanHideParaWeight(SwFieldIds::Database)
-                   && rField.ExpandField(true).isEmpty();
+                   && rField.ExpandField(true, nullptr).isEmpty();
         default:
             return false;
     }
@@ -1584,7 +1584,7 @@ bool SwDoc::RestoreInvisibleContent()
     return false;
 }
 
-bool SwDoc::ConvertFieldsToText()
+bool SwDoc::ConvertFieldsToText(SwRootFrame const& rLayout)
 {
     bool bRet = false;
     getIDocumentFieldsAccess().LockExpFields();
@@ -1633,7 +1633,7 @@ bool SwDoc::ConvertFieldsToText()
                         nWhich != SwFieldIds::RefPageGet&&
                         nWhich != SwFieldIds::RefPageSet))
                 {
-                    OUString sText = pField->ExpandField(true);
+                    OUString sText = pField->ExpandField(true, &rLayout);
 
                     // database fields should not convert their command into text
                     if( SwFieldIds::Database == pCurType->Which() && !static_cast<const SwDBField*>(pField)->IsInitialized())
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index c4465cbd17d5..6bb70261d9f2 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -617,7 +617,7 @@ static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const& rLayout,
                 const SwField* const pField = pAttr->GetFormatField().GetField();
                 if (pField)
                 {
-                    sExp += pField->ExpandField(true);
+                    sExp += pField->ExpandField(true, &rLayout);
                 }
             }
         }
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index d57da627a3cc..57a4f77e43c1 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -133,7 +133,7 @@ void SwEditShell::FieldToText( SwFieldType const * pType )
     Push();
     SwPaM* pPaM = GetCursor();
     // TODO: this is really hackish
-    SwFieldHint aHint( pPaM );
+    SwFieldHint aHint(pPaM, GetLayout());
     SwIterator<SwClient,SwFieldType> aIter(*pType);
     for( SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next() )
     {
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 114699707eda..111fec2ae91f 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -736,7 +736,7 @@ SvNumberFormatter* SwEditShell::GetNumberFormatter()
 bool SwEditShell::ConvertFieldsToText()
 {
     StartAllAction();
-    bool bRet = GetDoc()->ConvertFieldsToText();
+    bool bRet = GetDoc()->ConvertFieldsToText(*GetLayout());
     EndAllAction();
     return bRet;
 }
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 72ac817d2341..836ae5c24ef6 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -193,7 +193,7 @@ double SwTableBox::GetValue( SwTableCalcPara& rCalcPara ) const
                 break;
 
             default:
-                nRet = rCalcPara.m_rCalc.Calculate( pField->ExpandField(true) ).GetDouble();
+                nRet = rCalcPara.m_rCalc.Calculate( pField->ExpandField(true, nullptr) ).GetDouble();
             }
         }
         else if ( nSttPos < sText.getLength()
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 2c51bbab11c4..315bba814aa8 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -408,7 +408,8 @@ bool SwField::IsFixed() const
     return bRet;
 }
 
-OUString SwField::ExpandField(bool const bCached) const
+OUString
+SwField::ExpandField(bool const bCached, SwRootFrame const*const ) const
 {
     if ( m_bUseFieldValueCache )
     {
diff --git a/sw/source/core/inc/fieldhint.hxx b/sw/source/core/inc/fieldhint.hxx
index a835f15714f6..2aca032e728a 100644
--- a/sw/source/core/inc/fieldhint.hxx
+++ b/sw/source/core/inc/fieldhint.hxx
@@ -22,16 +22,20 @@
 
 #include <svl/hint.hxx>
 
+class SwPaM;
+class SwRootFrame;
+
 class SwFieldHint : public SfxHint
 {
-    SwPaM* const pPaM;
-
 public:
-    SwFieldHint( SwPaM* p )
-        : pPaM(p)
+    SwPaM* const m_pPaM;
+    SwRootFrame const*const m_pLayout;
+
+    SwFieldHint(SwPaM *const pPaM, SwRootFrame const*const pLayout)
+        : m_pPaM(pPaM)
+        , m_pLayout(pLayout)
     {}
 
-    SwPaM* GetPaM() const { return pPaM; }
 };
 
 #endif
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 18145cb38523..db72c0471fae 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -1169,7 +1169,8 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
                     case RES_TXTATR_ANNOTATION :
                         {
                             SwField *pField = const_cast<SwField*>(pHint->GetFormatField().GetField());
-                            const OUString aText = pField->ExpandField(true);
+                            const OUString aText = pField->ExpandField(true,
+                                    pSh ? pSh->GetLayout() : nullptr);
                             if( lcl_MinMaxString( aArg, aIter.GetFnt(), aText, 0,
                                 aText.getLength() ) )
                                 nAdd = 20;
@@ -1366,7 +1367,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
             case RES_TXTATR_ANNOTATION :
                 {
                     SwField *pField = const_cast<SwField*>(pHint->GetFormatField().GetField());
-                    OUString const aText = pField->ExpandField(true);
+                    OUString const aText = pField->ExpandField(true, pSh->GetLayout());
                     SwDrawTextInfo aDrawInf(pSh, *pOut, aText, 0, aText.getLength());
 
                     nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index ce9ede4c13f6..c4db3035c775 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -107,15 +107,15 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
                 if( bName )
                     pRet = new SwFieldPortion( pField->GetFieldName() );
                 else
-                    pRet = new SwCombinedPortion( pField->ExpandField(bInClipboard) );
+                    pRet = new SwCombinedPortion( pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
             }
             break;
 
         case SwFieldIds::HiddenText:
             {
                 OUString const aStr( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwHiddenPortion(aStr);
             }
             break;
@@ -128,8 +128,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             }
             {
                 OUString const aStr( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwFieldPortion( aStr );
             }
             break;
@@ -141,8 +141,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             }
             {
                 OUString const aStr( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwFieldPortion( aStr );
             }
             static_cast<SwFieldPortion*>(pRet)->m_nAttrFieldType= ATTR_PAGECOOUNTFLD;
@@ -169,8 +169,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             }
             {
                 OUString const aStr( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwFieldPortion( aStr );
             }
             static_cast<SwFieldPortion*>(pRet)->m_nAttrFieldType= ATTR_PAGENUMBERFLD;
@@ -197,8 +197,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             }
             {
                 OUString const aStr( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwFieldPortion( aStr );
             }
             break;
@@ -212,8 +212,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             }
             {
                 OUString const aStr( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwFieldPortion(aStr);
             }
             break;
@@ -226,8 +226,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             }
             {
                 OUString const aStr( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwFieldPortion(aStr);
             }
             break;
@@ -242,8 +242,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             subType = static_cast<SwGetRefField*>(pField)->GetSubType();
             {
                 OUString const str( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwFieldPortion(str);
             }
             if( subType == REF_BOOKMARK  )
@@ -255,8 +255,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             subType = static_cast<SwDateTimeField*>(pField)->GetSubType();
             {
                 OUString const str( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwFieldPortion(str);
             }
             if( subType & DATEFLD  )
@@ -267,8 +267,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
         default:
             {
                 OUString const aStr( bName
-                        ? pField->GetFieldName()
-                        : pField->ExpandField(bInClipboard) );
+                    ? pField->GetFieldName()
+                    : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
                 pRet = new SwFieldPortion(aStr);
             }
     }
@@ -282,8 +282,8 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             pTmpFnt->SetDiffFnt(&pChFormat->GetAttrSet(), &m_pFrame->GetDoc().getIDocumentSettingAccess());
         }
         OUString const aStr( bName
-                ? pField->GetFieldName()
-                : pField->ExpandField(bInClipboard) );
+            ? pField->GetFieldName()
+            : pField->ExpandField(bInClipboard, pFrame->getRootFrame()) );
         pRet = new SwFieldPortion(aStr, std::move(pTmpFnt), bPlaceHolder);
     }
 
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 9be42b24ee79..b33d31c9d60e 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -690,7 +690,7 @@ sal_uInt16 SwTOXAuthority::GetLevel() const
 
 static OUString lcl_GetText(SwFormatField const& rField)
 {
-    return rField.GetField()->ExpandField(true);
+    return rField.GetField()->ExpandField(true, nullptr);
 }
 
 TextAndReading SwTOXAuthority::GetText_Impl() const
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index e7144b9fd6df..e9cbe8e974b6 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -39,6 +39,7 @@
 #include <hints.hxx>
 #include <IDocumentFieldsAccess.hxx>
 #include <IDocumentMarkAccess.hxx>
+#include <IDocumentLayoutAccess.hxx>
 #include <fieldhint.hxx>
 #include <sal/log.hxx>
 
@@ -215,13 +216,13 @@ void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHin
     if ( pHint )
     {
         // replace field content by text
-        SwPaM* pPaM = pHint->GetPaM();
+        SwPaM* pPaM = pHint->m_pPaM;
         SwDoc* pDoc = pPaM->GetDoc();
         const SwTextNode& rTextNode = mpTextField->GetTextNode();
         pPaM->GetPoint()->nNode = rTextNode;
         pPaM->GetPoint()->nContent.Assign( const_cast<SwTextNode*>(&rTextNode), mpTextField->GetStart() );
 
-        OUString const aEntry( mpField->ExpandField( pDoc->IsClipBoard() ) );
+        OUString const aEntry(mpField->ExpandField(pDoc->IsClipBoard(), pHint->m_pLayout));
         pPaM->SetMark();
         pPaM->Move( fnMoveForward );
         pDoc->getIDocumentContentOperations().DeleteRange( *pPaM );
@@ -348,7 +349,7 @@ SwTextField::SwTextField(
     : SwTextAttr( rAttr, nStartPos )
 // fdo#39694 the ExpandField here may not give the correct result in all cases,
 // but is better than nothing
-    , m_aExpand( rAttr.GetField()->ExpandField(bInClipboard) )
+    , m_aExpand( rAttr.GetField()->ExpandField(bInClipboard, nullptr) )
     , m_pTextNode( nullptr )
 {
     rAttr.SetTextField( *this );
@@ -375,7 +376,9 @@ void SwTextField::ExpandTextField(const bool bForceNotify) const
     OSL_ENSURE( m_pTextNode, "SwTextField: where is my TextNode?" );
 
     const SwField* pField = GetFormatField().GetField();
-    const OUString aNewExpand( pField->ExpandField(m_pTextNode->GetDoc()->IsClipBoard()) );
+    const OUString aNewExpand( pField->ExpandField(m_pTextNode->GetDoc()->IsClipBoard(),
+        // can't do any better than this here...
+        m_pTextNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()) );
 
     const SwFieldIds nWhich = pField->GetTyp()->Which();
     const bool bSameExpandSimpleNotification
@@ -566,7 +569,7 @@ void SwTextInputField::NotifyContentChange( SwFormatField& rFormatField )
 
 const OUString SwTextInputField::GetFieldContent() const
 {
-    return GetFormatField().GetField()->ExpandField(false);
+    return GetFormatField().GetField()->ExpandField(false, nullptr/*ignored anyway*/);
 }
 
 void SwTextInputField::UpdateFieldContent()
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index af37bbb9cf50..e2fcf1ebb5fb 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -152,7 +152,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode,
                                 aFieldResult.m_sExpand = ((eMode & ExpandMode::ReplaceMode)
                                     ? OUString(CHAR_ZWSP) : OUString("")) +
                                       static_txtattr_cast<SwTextField const*>(pAttr)->
-                                      GetFormatField().GetField()->ExpandField(true);
+                                      GetFormatField().GetField()->ExpandField(true, pLayout);
                                 aFieldResult.m_eType = FieldResult::FIELD;
                             }
                             break;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 51894cb3144d..1dccd146283d 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3506,7 +3506,7 @@ bool SwTextNode::CopyExpandText(SwTextNode& rDestNd, const SwIndex* pDestIdx,
                 case RES_TXTATR_ANNOTATION:
                     {
                         OUString const aExpand(
-                            static_txtattr_cast<SwTextField const*>(pHt)->GetFormatField().GetField()->ExpandField(true));
+                            static_txtattr_cast<SwTextField const*>(pHt)->GetFormatField().GetField()->ExpandField(true, pLayout));
                         if (!aExpand.isEmpty())
                         {
                             ++aDestIdx;     // insert behind
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 81a3b1453eee..0c269ff60391 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1305,7 +1305,7 @@ OUString SAL_CALL SwXTextField::getPresentation(sal_Bool bShowCommand)
     {
         throw uno::RuntimeException();
     }
-    return bShowCommand ? pField->GetFieldName() : pField->ExpandField(true);
+    return bShowCommand ? pField->GetFieldName() : pField->ExpandField(true, nullptr);
 }
 
 void SAL_CALL SwXTextField::attach(
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index ef5b27135594..0776b3325261 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -887,7 +887,7 @@ lcl_ExportHints(
                     {
 
                         pUnoCursor->Right(
-                            pAttr->GetFormatField().GetField()->ExpandField( true ).getLength() + 2 );
+                            pAttr->GetFormatField().GetField()->ExpandField(true, nullptr).getLength() + 2 );
                         if( *pUnoCursor->GetMark() == *pUnoCursor->GetPoint() )
                             break;
                         SwXTextPortion* pPortion =
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index ae581f0eeb3e..ddcc22637923 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -141,7 +141,7 @@ bool SwASC_AttrIter::OutAttr( sal_Int32 nSwPos )
                 case RES_TXTATR_ANNOTATION:
                 case RES_TXTATR_INPUTFIELD:
                     sOut = static_txtattr_cast<SwTextField const*>(pHt)
-                            ->GetFormatField().GetField()->ExpandField(true);
+                            ->GetFormatField().GetField()->ExpandField(true, nullptr);
                     break;
 
                 case RES_TXTATR_FTN:
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index e9ee2209e15d..b083159a785f 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -306,7 +306,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField,
     }
 
     // output content of the field
-    OUString const sExpand( pField->ExpandField(true) );
+    OUString const sExpand( pField->ExpandField(true, nullptr) );
     bool bNeedsCJKProcessing = false;
     if( !sExpand.isEmpty() )
     {
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6e2987cc67fe..acd86cfb9980 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1951,7 +1951,7 @@ void DocxAttributeOutput::EndField_Impl( const SwTextNode* pNode, sal_Int32 nPos
         }
         else
         {
-            sExpand = rInfos.pField->ExpandField( true );
+            sExpand = rInfos.pField->ExpandField(true, nullptr);
         }
         // newlines embedded in fields are 0x0B in MSO and 0x0A for us
         RunText(sExpand.replace(0x0A, 0x0B));
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index efbec3e6cf0a..79cb9bfc969c 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1548,7 +1548,7 @@ void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType
             m_aRunText->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
         }
         if (pField)
-            m_aRunText->append(msfilter::rtfutil::OutString(pField->ExpandField(true),
+            m_aRunText->append(msfilter::rtfutil::OutString(pField->ExpandField(true, nullptr),
                                                             m_rExport.m_eDefaultEncoding));
         if (bHasInstructions)
             m_aRunText->append("}}");
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 89354bafc1dc..c8ef6be2e265 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -333,7 +333,7 @@ void RtfExport::DoComboBox(const OUString& /*rName*/, const OUString& /*rHelp*/,
 
 void RtfExport::DoFormText(const SwInputField* pField)
 {
-    OUString sResult = pField->ExpandField(true);
+    OUString sResult = pField->ExpandField(true, nullptr);
     const OUString& rHelp = pField->GetHelp();
     OUString sName = pField->GetPar2();
     const OUString& rStatus = pField->GetToolTip();
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index ac7815c13a6a..368c4d8bdf00 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -513,7 +513,7 @@ void WW8Export::DoFormText(const SwInputField * pField)
 
     OutputField(nullptr, ww::eFORMTEXT, OUString(), FieldFlags::CmdEnd);
 
-    const OUString fieldStr( pField->ExpandField(true) );
+    const OUString fieldStr( pField->ExpandField(true, nullptr) );
     SwWW8Writer::WriteString16(Strm(), fieldStr, false);
 
     static sal_uInt8 aArr2[] = {
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 7a92a825ceaf..87e620c97176 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1699,7 +1699,7 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c,
 
 static OUString lcl_GetExpandedField(const SwField &rField)
 {
-    OUString sRet(rField.ExpandField(true));
+    OUString sRet(rField.ExpandField(true, nullptr));
 
     //replace LF 0x0A with VT 0x0B
     return sRet.replace(0x0A, 0x0B);
diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx
index a9cad5d770d2..361d14a184a8 100644
--- a/sw/source/ui/fldui/inpdlg.cxx
+++ b/sw/source/ui/fldui/inpdlg.cxx
@@ -86,7 +86,7 @@ SwFieldInputDlg::SwFieldInputDlg(weld::Window *pParent, SwWrtShell &rS,
         CharClass aCC( LanguageTag( pSetField->GetLanguage() ));
         if( aCC.isNumeric( sFormula ))
         {
-            aStr = pSetField->ExpandField(true);
+            aStr = pSetField->ExpandField(true, rS.GetLayout());
         }
         else
             aStr = sFormula;
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index f7054b542995..fc666e5e3e5a 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -303,7 +303,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
                         {
                             sal_uInt16 nOldSubType = pField->GetSubType();
                             const_cast<SwField*>(pField)->SetSubType(nsSwExtendedSubType::SUB_CMD);
-                            sText = pField->ExpandField(true);
+                            sText = pField->ExpandField(true, rSh.GetLayout());
                             const_cast<SwField*>(pField)->SetSubType(nOldSubType);
                         }
                         break;
commit d88769345c9e887140818dc7ea01807e1e438c64
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 8 15:26:58 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 9 13:15:04 2018 +0100

    sw_redlinehide_3: adapt SwFormatFootnote::GetFootnoteText()
    
    Change-Id: I206d7345525a4de0f9ece6bac575f82ff1f96df8

diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx
index 5c22c157fb49..44ccc9556c46 100644
--- a/sw/inc/fmtftn.hxx
+++ b/sw/inc/fmtftn.hxx
@@ -85,7 +85,7 @@ public:
     const SwTextFootnote *GetTextFootnote() const   { return m_pTextAttr; }
           SwTextFootnote *GetTextFootnote()         { return m_pTextAttr; }
 
-    void GetFootnoteText( OUString& rStr ) const;
+    OUString GetFootnoteText(SwRootFrame const& rLayout) const;
 
     /// Returns string to be displayed of footnote / endnote.
     OUString GetViewNumStr(const SwDoc& rDoc, SwRootFrame const* pLayout,
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index fdbd642a680b..336804507dcc 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -180,8 +180,9 @@ SwFormatFootnote::~SwFormatFootnote()
 {
 }
 
-void SwFormatFootnote::GetFootnoteText( OUString& rStr ) const
+OUString SwFormatFootnote::GetFootnoteText(SwRootFrame const& rLayout) const
 {
+    OUStringBuffer buf;
     if( m_pTextAttr->GetStartNode() )
     {
         SwNodeIndex aIdx( *m_pTextAttr->GetStartNode(), 1 );
@@ -190,16 +191,20 @@ void SwFormatFootnote::GetFootnoteText( OUString& rStr ) const
             pCNd = aIdx.GetNodes().GoNext( &aIdx );
 
         if( pCNd->IsTextNode() ) {
-            rStr = static_cast<SwTextNode*>(pCNd)->GetExpandText(nullptr/*TODO*/);
+            buf.append(static_cast<SwTextNode*>(pCNd)->GetExpandText(&rLayout));
 
             ++aIdx;
             while ( !aIdx.GetNode().IsEndNode() ) {
                 if ( aIdx.GetNode().IsTextNode() )
-                    rStr += "  " + aIdx.GetNode().GetTextNode()->GetExpandText(nullptr/*TODO*/);
+                {
+                    buf.append("  ");
+                    buf.append(aIdx.GetNode().GetTextNode()->GetExpandText(&rLayout));
+                }
                 ++aIdx;
             }
         }
     }
+    return buf.makeStringAndClear();
 }
 
 /// return the view string of the foot/endnote
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index 51b095f92e64..f7054b542995 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -248,8 +248,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
                 if( aContentAtPos.pFndTextAttr && aContentAtPos.aFnd.pAttr )
                 {
                     const SwFormatFootnote* pFootnote = static_cast<const SwFormatFootnote*>(aContentAtPos.aFnd.pAttr);
-                    OUString sTmp;
-                    pFootnote->GetFootnoteText( sTmp );
+                    OUString sTmp(pFootnote->GetFootnoteText(*rSh.GetLayout()));
                     sText = SwResId( pFootnote->IsEndNote()
                                     ? STR_ENDNOTE : STR_FTNNOTE ) + sTmp;
                     bBalloon = true;
commit 782cee33275d9874e5618c94ad59d92d957e1dc1
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 8 15:15:43 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 9 13:14:26 2018 +0100

    sw_redlinehide_3: SwGetRefField::GetExpandedTextOfReferencedTextNode
    
    Change-Id: I98530004f2d75b10fc4cd3241b06d513ed57675b

diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index acd9fe852571..9499f769f1f9 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -25,6 +25,7 @@ class SfxPoolItem;
 class SwDoc;
 class SwTextNode;
 class SwTextField;
+class SwRootFrame;
 
 bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos,
                     const SwTextNode& rBehindNd, sal_Int32 nSttPos );
@@ -121,7 +122,7 @@ public:
     bool IsRefToNumItemCrossRefBookmark() const;
     const SwTextNode* GetReferencedTextNode() const;
     // #i85090#
-    OUString GetExpandedTextOfReferencedTextNode() const;
+    OUString GetExpandedTextOfReferencedTextNode(SwRootFrame const& rLayout) const;
 
     /// Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
     sal_uInt16              GetSeqNo() const        { return m_nSeqNo; }
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 7d62b8985d75..608148e70635 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -401,11 +401,12 @@ const SwTextNode* SwGetRefField::GetReferencedTextNode() const
 }
 
 // #i85090#
-OUString SwGetRefField::GetExpandedTextOfReferencedTextNode() const
+OUString SwGetRefField::GetExpandedTextOfReferencedTextNode(
+        SwRootFrame const& rLayout) const
 {
     const SwTextNode* pReferencedTextNode( GetReferencedTextNode() );
     return pReferencedTextNode
-           ? pReferencedTextNode->GetExpandText(nullptr/*TODO*/, 0, -1, true, true, false)
+           ? sw::GetExpandTextMerged(&rLayout, *pReferencedTextNode, true, false, ExpandMode(0))
            : OUString();
 }
 
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index e2049a33be52..51b095f92e64 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -348,7 +348,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
                                 if ( pRefField->IsRefToHeadingCrossRefBookmark() ||
                                      pRefField->IsRefToNumItemCrossRefBookmark() )
                                 {
-                                    sText = pRefField->GetExpandedTextOfReferencedTextNode();
+                                    sText = pRefField->GetExpandedTextOfReferencedTextNode(*rSh.GetLayout());
                                     if ( sText.getLength() > 80  )
                                     {
                                         sText = sText.copy(0, 80) + "...";
commit 98dd8e5a4f1b07ecb5faf03c262d790506a28a6e
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 8 14:59:17 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 9 13:14:26 2018 +0100

    sw_redlinehide_3: adapt SwSetExpFieldType::GetSeqFieldList()
    
    Change-Id: Iea24b3823b648066e331dc5e9789c79662727a12

diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index 7389a6d40ec9..f289a91924f0 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -29,6 +29,7 @@
 class SfxPoolItem;
 class SwTextNode;
 class SwFrame;
+class SwRootFrame;
 struct SwPosition;
 class SwTextField;
 class SwDoc;
@@ -168,7 +169,7 @@ public:
 
     void   SetSeqRefNo( SwSetExpField& rField );
 
-    size_t GetSeqFieldList( SwSeqFieldList& rList );
+    size_t GetSeqFieldList(SwSeqFieldList& rList, SwRootFrame const* pLayout);
 
     /// Number sequence fields chapterwise if required.
     const OUString& GetDelimiter() const      { return m_sDelim; }
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 3505ed94774d..c62f7d79d880 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -583,7 +583,8 @@ void SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rField )
     rField.SetSeqNumber( n );
 }
 
-size_t SwSetExpFieldType::GetSeqFieldList( SwSeqFieldList& rList )
+size_t SwSetExpFieldType::GetSeqFieldList(SwSeqFieldList& rList,
+        SwRootFrame const*const pLayout)
 {
     rList.Clear();
 
@@ -596,7 +597,7 @@ size_t SwSetExpFieldType::GetSeqFieldList( SwSeqFieldList& rList )
             pNd->GetNodes().IsDocNodes() )
         {
             SeqFieldLstElem aNew(
-                    pNd->GetExpandText(nullptr/*TODO*/),
+                    pNd->GetExpandText(pLayout),
                     static_cast<SwSetExpField*>(pF->GetField())->GetSeqNumber() );
             rList.InsertSort( aNew );
         }
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index dfdb141f2d47..76c9b2bdb0a2 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -666,7 +666,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
                 if(IsFieldEdit())
                     sOldSel.clear();
 
-                const size_t nCnt = pType->GetSeqFieldList( aArr );
+                const size_t nCnt = pType->GetSeqFieldList(aArr, pSh->GetLayout());
                 for( size_t n = 0; n < nCnt; ++n )
                 {
                     bool isSubstring = MatchSubstring(aArr[ n ].sDlgEntry, filterString);
@@ -1084,7 +1084,8 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
                 nSubType = REF_SEQUENCEFLD;
                 aName = pType->GetName();
 
-                if (pType->GetSeqFieldList(aArr) && aArr.SeekEntry(aElem, &nPos))
+                if (pType->GetSeqFieldList(aArr, pSh->GetLayout())
+                    && aArr.SeekEntry(aElem, &nPos))
                 {
                     aVal = OUString::number( aArr[nPos].nSeqNo );
 
commit d3a54b19d46459c40026c6237ff528a29d8a083d
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 8 14:42:11 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 9 13:09:21 2018 +0100

    sw_redlinehide_3: pass layout into SwTextNode::GetExpandText()
    
    Change-Id: I3cf6697b37616570fd56fd32da27752983a66f4a

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index d204527165e0..8fd2c5449f7b 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -673,7 +673,8 @@ public:
        add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
        spaces are inserted in front of the expanded text string depending on
        the list level. */
-    OUString GetExpandText(  const sal_Int32 nIdx = 0,
+    OUString GetExpandText( SwRootFrame const* pLayout,
+                            const sal_Int32 nIdx = 0,
                             const sal_Int32 nLen = -1,
                             const bool bWithNum = false,
                             const bool bAddSpaceAfterListLabelStr = false,
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 73da4699b643..27223f74105c 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2436,6 +2436,7 @@ OUString SwCursorShell::GetSelText() const
                             ? pEnd->nContent.GetIndex()
                             : rNode.GetTextNode()->Len());
                     buf.append(rNode.GetTextNode()->GetExpandText(
+                                GetLayout(),
                                 nStart, nEnd - nStart, false, false, false,
                                 ExpandMode::HideDeletions));
 
@@ -2452,7 +2453,7 @@ OUString SwCursorShell::GetSelText() const
         if( pTextNd )
         {
             const sal_Int32 nStt = m_pCurrentCursor->Start()->nContent.GetIndex();
-            aText = pTextNd->GetExpandText( nStt,
+            aText = pTextNd->GetExpandText(GetLayout(), nStt,
                     m_pCurrentCursor->End()->nContent.GetIndex() - nStt );
         }
     }
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 5220dd4f8071..8f8acfe9bdd2 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1536,7 +1536,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
                             const sal_Int32* pEnd = pTextAttr->GetEnd();
                             if( pEnd )
                                 rContentAtPos.sStr =
-                                    pTextNd->GetExpandText( pTextAttr->GetStart(), *pEnd - pTextAttr->GetStart() );
+                                    pTextNd->GetExpandText(GetLayout(), pTextAttr->GetStart(), *pEnd - pTextAttr->GetStart());
                             else if( RES_TXTATR_TOXMARK == pTextAttr->Which())
                                 rContentAtPos.sStr =
                                     pTextAttr->GetTOXMark().GetAlternativeText();
@@ -1582,7 +1582,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
                             const sal_Int32 nSt = pTextAttr->GetStart();
                             const sal_Int32 nEnd = *pTextAttr->End();
 
-                            rContentAtPos.sStr = pTextNd->GetExpandText(nSt, nEnd-nSt);
+                            rContentAtPos.sStr = pTextNd->GetExpandText(GetLayout(), nSt, nEnd-nSt);
 
                             rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
                             rContentAtPos.eContentAtPos = IsAttrAtPos::InetAttr;
@@ -2438,7 +2438,8 @@ bool SwCursorShell::SelectNxtPrvHyperlink( bool bNext )
                         ? ( aPos < aCmpPos && aCurPos < aPos )
                         : ( aCmpPos < aPos && aPos < aCurPos ))
                     {
-                        OUString sText( pTextNd->GetExpandText( rAttr.GetStart(),
+                        OUString sText(pTextNd->GetExpandText(GetLayout(),
+                                        rAttr.GetStart(),
                                         *rAttr.GetEnd() - rAttr.GetStart() ) );
 
                         sText = sText.replaceAll(OUStringLiteral1(0x0a), "");
diff --git a/sw/source/core/doc/DocumentOutlineNodesManager.cxx b/sw/source/core/doc/DocumentOutlineNodesManager.cxx
index 12945c76ae6e..4f66fd4a3d0e 100644
--- a/sw/source/core/doc/DocumentOutlineNodesManager.cxx
+++ b/sw/source/core/doc/DocumentOutlineNodesManager.cxx
@@ -60,8 +60,8 @@ OUString GetExpandTextMerged(SwRootFrame const*const pLayout,
                 else
                 {
                     ExpandMode const mode(ExpandMode::HideDeletions | i_mode);
-                    OUStringBuffer ret(rNode.GetExpandText(0, -1, bWithNumber,
-                        bWithNumber, bWithSpacesForLevel, mode));
+                    OUStringBuffer ret(rNode.GetExpandText(pLayout, 0, -1,
+                        bWithNumber, bWithNumber, bWithSpacesForLevel, mode));
                     for (sal_uLong i = rNode.GetIndex() + 1;
                          i <= pMerged->pLastNode->GetIndex(); ++i)
                     {
@@ -69,7 +69,7 @@ OUString GetExpandTextMerged(SwRootFrame const*const pLayout,
                         if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst)
                         {
                             ret.append(pTmp->GetTextNode()->GetExpandText(
-                                        0, -1, false, false, false, mode));
+                                pLayout, 0, -1, false, false, false, mode));
                         }
                     }
                     return ret.makeStringAndClear();
@@ -77,7 +77,7 @@ OUString GetExpandTextMerged(SwRootFrame const*const pLayout,
             }
         }
     }
-    return rNode.GetExpandText( 0, -1, bWithNumber,
+    return rNode.GetExpandText(pLayout, 0, -1, bWithNumber,
                     bWithNumber, bWithSpacesForLevel, i_mode);
 }
 
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index b322e36d7cba..7a50117921e5 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1067,7 +1067,7 @@ namespace
                 {
                     sRet.append( '\n' );
                 }
-                sRet.append( aIdx.GetNode().GetTextNode()->GetExpandText() );
+                sRet.append( aIdx.GetNode().GetTextNode()->GetExpandText(nullptr) );
             }
             ++aIdx;
         }
@@ -1176,7 +1176,7 @@ OUString SwCompareLine::GetText() const
     switch( rNode.GetNodeType() )
     {
     case SwNodeType::Text:
-        sRet = rNode.GetTextNode()->GetExpandText();
+        sRet = rNode.GetTextNode()->GetExpandText(nullptr);
         break;
 
     case SwNodeType::Table:
@@ -1230,7 +1230,7 @@ OUString SwCompareLine::GetText() const
 
 sal_uLong SwCompareLine::GetTextNodeHashValue( const SwTextNode& rNd, sal_uLong nVal )
 {
-    OUString sStr( rNd.GetExpandText() );
+    OUString sStr( rNd.GetExpandText(nullptr) );
     for( sal_Int32 n = 0; n < sStr.getLength(); ++n )
         ( nVal <<= 1 ) += sStr[ n ];
     return nVal;
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 3ddbf4bc96ad..4845ed486497 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -291,7 +291,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
                     OUString sTitle( xDocProps->getTitle() );
                     if (!sTitle.isEmpty())
                         sTitle += ": ";
-                    sTitle += pStartNd->GetTextNode()->GetExpandText();
+                    sTitle += pStartNd->GetTextNode()->GetExpandText(nullptr);
                     xDocProps->setTitle( sTitle );
 
                     // Replace template
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 693e6fc27497..b63a65524531 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -591,14 +591,14 @@ bool SwDoc::MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type
     return MoveParagraph( aPam, nOffs, true );
 }
 
-static SwTextNode* lcl_FindOutlineName( const SwOutlineNodes& rOutlNds, const OUString& rName,
-                            bool bExact )
+static SwTextNode* lcl_FindOutlineName(const SwOutlineNodes& rOutlNds,
+    SwRootFrame const*const pLayout, const OUString& rName, bool const bExact)
 {
     SwTextNode* pSavedNode = nullptr;
     for( auto pOutlNd : rOutlNds )
     {
         SwTextNode* pTextNd = pOutlNd->GetTextNode();
-        const OUString sText( pTextNd->GetExpandText() );
+        const OUString sText( pTextNd->GetExpandText(pLayout) );
         if (sText.startsWith(rName))
         {
             if (sText.getLength() == rName.getLength())
@@ -730,7 +730,7 @@ bool SwDoc::GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame con
         SwTextNode* pNd = ::lcl_FindOutlineNum(rOutlNds, sName, pLayout);
         if ( pNd )
         {
-            OUString sExpandedText = pNd->GetExpandText();
+            OUString sExpandedText = pNd->GetExpandText(pLayout);
             //#i4533# leading numbers followed by a dot have been remove while
             //searching for the outline position
             //to compensate this they must be removed from the paragraphs text content, too
@@ -746,7 +746,7 @@ bool SwDoc::GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame con
 
             if( sExpandedText != sName )
             {
-                SwTextNode *pTmpNd = ::lcl_FindOutlineName( rOutlNds, sName, true );
+                SwTextNode *pTmpNd = ::lcl_FindOutlineName(rOutlNds, pLayout, sName, true);
                 if ( pTmpNd )             // found via the Name
                 {
                     pNd = pTmpNd;
@@ -757,7 +757,7 @@ bool SwDoc::GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame con
             return true;
         }
 
-        pNd = ::lcl_FindOutlineName( rOutlNds, rName, false );
+        pNd = ::lcl_FindOutlineName(rOutlNds, pLayout, rName, false);
         if ( pNd )
         {
             rPos.nNode = *pNd;
@@ -768,7 +768,7 @@ bool SwDoc::GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame con
         // #i68289# additional search on hyperlink URL without its outline numbering part
         if ( sName != rName )
         {
-            pNd = ::lcl_FindOutlineName( rOutlNds, sName, false );
+            pNd = ::lcl_FindOutlineName(rOutlNds, pLayout, sName, false);
             if ( pNd )
             {
                 rPos.nNode = *pNd;
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 0584a4d73471..c4465cbd17d5 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -468,7 +468,7 @@ size_t SwEditShell::GetSeqFootnoteList( SwSeqFieldList& rList, bool bEndNotes )
                 OUString sText(rFootnote.GetViewNumStr(*mxDoc, GetLayout()));
                 if( !sText.isEmpty() )
                     sText += " ";
-                sText += pTextNd->GetExpandText();
+                sText += pTextNd->GetExpandText(GetLayout());
 
                 SeqFieldLstElem aNew( sText, pTextFootnote->GetSeqRefNo() );
                 while( rList.InsertSort( aNew ) )
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index f548e2baf064..114699707eda 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -533,8 +533,8 @@ OUString SwEditShell::Calculate()
         {
             const SwPosition *pStart = rCurrentPaM.Start(), *pEnd = rCurrentPaM.End();
             const sal_Int32 nStt = pStart->nContent.GetIndex();
-            OUString aStr = pTextNd->GetExpandText( nStt, pEnd->nContent.
-                                                GetIndex() - nStt );
+            OUString aStr = pTextNd->GetExpandText(GetLayout(),
+                                nStt, pEnd->nContent.GetIndex() - nStt);
 
             aStr = rCC.lowercase( aStr );
 
@@ -692,8 +692,8 @@ void SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr )
                 pTextNd->GetNodes().IsDocNodes() )
             {
                 SwTextINetFormat& rAttr = *pFnd;
-                OUString sText( pTextNd->GetExpandText( rAttr.GetStart(),
-                                    *rAttr.GetEnd() - rAttr.GetStart() ) );
+                OUString sText( pTextNd->GetExpandText(GetLayout(),
+                        rAttr.GetStart(), *rAttr.GetEnd() - rAttr.GetStart()) );
 
                 sText = sText.replaceAll(OUStringLiteral1(0x0a), "");
                 sText = comphelper::string::strip(sText, ' ');
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 97c415050724..3505ed94774d 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -596,7 +596,7 @@ size_t SwSetExpFieldType::GetSeqFieldList( SwSeqFieldList& rList )
             pNd->GetNodes().IsDocNodes() )
         {
             SeqFieldLstElem aNew(
-                    pNd->GetExpandText(),
+                    pNd->GetExpandText(nullptr/*TODO*/),
                     static_cast<SwSetExpField*>(pF->GetField())->GetSeqNumber() );
             rList.InsertSort( aNew );
         }
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index efd5b0b88ebf..7d62b8985d75 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -405,7 +405,7 @@ OUString SwGetRefField::GetExpandedTextOfReferencedTextNode() const
 {
     const SwTextNode* pReferencedTextNode( GetReferencedTextNode() );
     return pReferencedTextNode
-           ? pReferencedTextNode->GetExpandText(0, -1, true, true, false)
+           ? pReferencedTextNode->GetExpandText(nullptr/*TODO*/, 0, -1, true, true, false)
            : OUString();
 }
 
@@ -609,7 +609,7 @@ void SwGetRefField::UpdateField( const SwTextField* pFieldTextAttr )
 
             if( nStart != nEnd ) // a section?
             {
-                m_sText = pTextNd->GetExpandText(nStart, nEnd - nStart, false, false, false);
+                m_sText = pTextNd->GetExpandText(pLayout, nStart, nEnd - nStart, false, false, false);
                 if (m_nSubType == REF_OUTLINE
                     || (m_nSubType == REF_SEQUENCEFLD && REF_CONTENT == GetFormat()))
                 {
@@ -618,7 +618,7 @@ void SwGetRefField::UpdateField( const SwTextField* pFieldTextAttr )
                 }
                 else
                 {
-                    m_sTextRLHidden = pTextNd->GetExpandText(
+                    m_sTextRLHidden = pTextNd->GetExpandText(pLayoutRLHidden,
                         nStart, nEnd - nStart, false, false, false, ExpandMode::HideDeletions);
                 }
                 FilterText(m_sText, GetLanguage(), m_sSetReferenceLanguage);
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index f7dca91d90d9..0a653db9d137 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -177,7 +177,7 @@ OUString SwTOXMark::GetText() const
         if( pEndIdx )
         {
             const sal_Int32 nStt = m_pTextAttr->GetStart();
-            return m_pTextAttr->GetpTextNd()->GetExpandText( nStt, *pEndIdx-nStt );
+            return m_pTextAttr->GetpTextNd()->GetExpandText(nullptr, nStt, *pEndIdx-nStt);
         }
     }
 
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 9b0da776fc5d..9be42b24ee79 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -373,6 +373,7 @@ void SwTOXIndex::FillText( SwTextNode& rNd, const SwIndex& rInsPos, sal_uInt16 )
             !(GetOptions() & SwTOIOptions::KeyAsEntry))
     {
         aRet.sText = static_cast<const SwTextNode*>(aTOXSources[0].pNd)->GetExpandText(
+                            nullptr,
                             pTextMark->GetStart(),
                             *pEnd - pTextMark->GetStart());
         if(SwTOIOptions::InitialCaps & nOpt && pTOXIntl && !aRet.sText.isEmpty())
@@ -452,6 +453,7 @@ TextAndReading SwTOXContent::GetText_Impl() const
     {
         return TextAndReading(
             static_cast<const SwTextNode*>(aTOXSources[0].pNd)->GetExpandText(
+                                     nullptr,
                                      pTextMark->GetStart(),
                                      *pEnd - pTextMark->GetStart() ),
             pTextMark->GetTOXMark().GetTextReading());
@@ -503,6 +505,7 @@ TextAndReading SwTOXPara::GetText_Impl() const
     case SwTOXElement::OutlineLevel:
         {
             return TextAndReading(static_cast<const SwTextNode*>(pNd)->GetExpandText(
+                    nullptr,
                     nStartIndex,
                     nEndIndex == -1 ? -1 : nEndIndex - nStartIndex,
                     false, false, false),
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 060ae4cf3995..e7144b9fd6df 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -580,7 +580,7 @@ void SwTextInputField::UpdateFieldContent()
         const sal_Int32 nIdx = GetStart() + 1;
         // skip CH_TXT_ATR_INPUTFIELDEND character
         const sal_Int32 nLen = static_cast<sal_Int32>(std::max<sal_Int32>( 0, ( (*End()) - 1 - nIdx ) ));
-        const OUString aNewFieldContent = GetTextNode().GetExpandText( nIdx, nLen );
+        const OUString aNewFieldContent = GetTextNode().GetExpandText(nullptr, nIdx, nLen);
 
         const SwInputField* pInputField = dynamic_cast<const SwInputField*>(GetFormatField().GetField());
         assert(pInputField != nullptr);
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index de299bcc0cc8..fdbd642a680b 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -190,12 +190,12 @@ void SwFormatFootnote::GetFootnoteText( OUString& rStr ) const
             pCNd = aIdx.GetNodes().GoNext( &aIdx );
 
         if( pCNd->IsTextNode() ) {
-            rStr = static_cast<SwTextNode*>(pCNd)->GetExpandText();
+            rStr = static_cast<SwTextNode*>(pCNd)->GetExpandText(nullptr/*TODO*/);
 
             ++aIdx;
             while ( !aIdx.GetNode().IsEndNode() ) {
                 if ( aIdx.GetNode().IsTextNode() )
-                    rStr += "  " + aIdx.GetNode().GetTextNode()->GetExpandText();
+                    rStr += "  " + aIdx.GetNode().GetTextNode()->GetExpandText(nullptr/*TODO*/);
                 ++aIdx;
             }
         }
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index ce3f39eb4f8b..51894cb3144d 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3387,7 +3387,8 @@ static void Replace0xFF(
 
 // Expand fields
 // #i83479# - handling of new parameters
-OUString SwTextNode::GetExpandText(  const sal_Int32 nIdx,
+OUString SwTextNode::GetExpandText(SwRootFrame const*const pLayout,
+                                   const sal_Int32 nIdx,
                                    const sal_Int32 nLen,
                                    const bool bWithNum,
                                    const bool bAddSpaceAfterListLabelStr,
@@ -3397,7 +3398,7 @@ OUString SwTextNode::GetExpandText(  const sal_Int32 nIdx,
 {
     ExpandMode eMode = ExpandMode::ExpandFields | eAdditionalMode;
 
-    ModelToViewHelper aConversionMap(*this, nullptr/*TODO*/, eMode);
+    ModelToViewHelper aConversionMap(*this, pLayout, eMode);
     const OUString aExpandText = aConversionMap.getViewText();
     const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nIdx );
     sal_Int32 nEnd = nLen == -1 ? GetText().getLength() : nIdx + nLen;
@@ -3410,14 +3411,14 @@ OUString SwTextNode::GetExpandText(  const sal_Int32 nIdx,
 
     if( bWithNum )
     {
-        if ( !GetNumString().isEmpty() )
+        if (!GetNumString(true, MAXLEVEL, pLayout).isEmpty())
         {
             if ( bAddSpaceAfterListLabelStr )
             {
                 const sal_Unicode aSpace = ' ';
                 aText.insert(0, aSpace);
             }
-            aText.insert(0, GetNumString());
+            aText.insert(0, GetNumString(true, MAXLEVEL, pLayout));
         }
     }
 
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 6275e317caf9..e7bb8572fd4a 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -173,7 +173,7 @@ OUString SwXTextPortion::getString()
     if ( pTextNd )
     {
         const sal_Int32 nStt = rUnoCursor.Start()->nContent.GetIndex();
-        aText = pTextNd->GetExpandText( nStt,
+        aText = pTextNd->GetExpandText(nullptr, nStt,
                 rUnoCursor.End()->nContent.GetIndex() - nStt );
     }
     return aText;
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 32353635a075..235df891264a 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1240,7 +1240,7 @@ void AttributeOutputBase::TOXMark( const SwTextNode& rNode, const SwTOXMark& rAt
     const sal_Int32* pTextEnd = rTextTOXMark.End();
     if ( pTextEnd ) // has range?
     {
-        sText = rNode.GetExpandText( rTextTOXMark.GetStart(),
+        sText = rNode.GetExpandText(nullptr, rTextTOXMark.GetStart(),
                                    *pTextEnd - rTextTOXMark.GetStart() );
     }
     else
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 0446bf4bac7c..86b622bacb64 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1081,7 +1081,7 @@ static OUString lcl_CreateOutlineString( size_t nIndex,
             sEntry.append(".");
         }
     sEntry.append( rOutlineNodes[ nIndex ]->
-                    GetTextNode()->GetExpandText() );
+                    GetTextNode()->GetExpandText(nullptr) );
     return sEntry.makeStringAndClear();
 }
 
commit c3ee8816822e7473ebf151c431f52986c617128f
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 8 13:46:03 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 9 13:09:21 2018 +0100

    sw_redlinehide_3: pass current layout through ModelToViewHelper
    
    The expansion of footnotes (and soon text fields) depends on the
    layout's mode.
    
    In SwXFlatParagraphIterator, just use whatever is SwDoc's "current"
    layout, should be good enough...
    
    Change-Id: Ica3b9eae56b14910c435c0f9c3f8ab6dbcda105f

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index d76a5a61ba36..1e35ecd0ea1d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -632,6 +632,7 @@ public:
     css::uno::Any
             Spell( SwPaM&, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &,
                    sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
+                   SwRootFrame const* pLayout, // for grammar-check
                    SwConversionArgs *pConvArgs = nullptr ) const;
 
     css::uno::Reference< css::linguistic2::XHyphenatedWord >
diff --git a/sw/inc/modeltoviewhelper.hxx b/sw/inc/modeltoviewhelper.hxx
index 03707596662d..7ca5397e3e81 100644
--- a/sw/inc/modeltoviewhelper.hxx
+++ b/sw/inc/modeltoviewhelper.hxx
@@ -26,6 +26,7 @@
 #include <vector>
 
 class SwTextNode;
+class SwRootFrame;
 
 /** Some helpers for converting model strings to view strings.
 
@@ -124,7 +125,7 @@ public:
         ModelPosition() : mnPos(0), mnSubPos(0), mbIsField(false) {}
     };
 
-    ModelToViewHelper(const SwTextNode &rNode,
+    ModelToViewHelper(const SwTextNode &rNode, SwRootFrame const* pLayout,
             // defaults are appropriate for spell/grammar checking
             ExpandMode eMode = ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | ExpandMode::ReplaceMode);
     ModelToViewHelper() //pass through filter, view == model
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 2eb25ddd1687..ac06585c0efe 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -363,7 +363,7 @@ void SwDocTest::testModelToViewHelperPassthrough()
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode, ExpandMode::PassThrough);
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr, ExpandMode::PassThrough);
     OUString sViewText = aModelToViewHelper.getViewText();
     OUString sModelText = pTextNode->GetText();
     CPPUNIT_ASSERT_EQUAL(sModelText, sViewText);
@@ -373,7 +373,8 @@ void SwDocTest::testModelToViewHelperExpandFieldsExpandFootnote()
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode, ExpandMode::ExpandFields | ExpandMode::ExpandFootnote);
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr,
+            ExpandMode::ExpandFields | ExpandMode::ExpandFootnote);
     OUString sViewText = aModelToViewHelper.getViewText();
     CPPUNIT_ASSERT_EQUAL(
         OUString("AAAAA BBBBB foo CCCCC foo DDDDD"), sViewText);
@@ -383,7 +384,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsExpandFootnoteReplaceMode()
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode,
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr,
             ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | ExpandMode::ReplaceMode);
     OUString sViewText = aModelToViewHelper.getViewText();
     CPPUNIT_ASSERT_EQUAL(
@@ -403,7 +404,7 @@ void SwDocTest::testModelToViewHelperExpandFields()
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode, ExpandMode::ExpandFields);
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr, ExpandMode::ExpandFields);
     OUString sViewText = aModelToViewHelper.getViewText();
     CPPUNIT_ASSERT_EQUAL(
         OUString("AAAAA BBBBB  CCCCC  DDDDD"), sViewText);
@@ -413,7 +414,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsReplaceMode()
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode,
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr,
         ExpandMode::ExpandFields | ExpandMode::ReplaceMode);
     OUString sViewText = aModelToViewHelper.getViewText();
     CPPUNIT_ASSERT_EQUAL(OUString("AAAAA BBBBB  CCCCC  DDDDD"),
@@ -428,7 +429,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisible()
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode, ExpandMode::HideInvisible);
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr, ExpandMode::HideInvisible);
     OUString sViewText = aModelToViewHelper.getViewText();
     CPPUNIT_ASSERT_EQUAL(
         OUString("AAAAA CCCCC " + OUStringLiteral1(CH_TXTATR_BREAKWORD) + " DDDDD"),
@@ -439,7 +440,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideRedlined()
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode, ExpandMode::HideDeletions);
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr, ExpandMode::HideDeletions);
     OUString sViewText = aModelToViewHelper.getViewText();
     CPPUNIT_ASSERT_EQUAL(
         OUString("AAAABB " + OUStringLiteral1(CH_TXTATR_BREAKWORD) + " CCCCC " + OUStringLiteral1(CH_TXTATR_BREAKWORD) + " DDDDD"),
@@ -450,7 +451,8 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisibleExpandFootnote()
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode, ExpandMode::ExpandFields | ExpandMode::HideInvisible | ExpandMode::ExpandFootnote);
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr,
+        ExpandMode::ExpandFields | ExpandMode::HideInvisible | ExpandMode::ExpandFootnote);
     OUString sViewText = aModelToViewHelper.getViewText();
     CPPUNIT_ASSERT_EQUAL(OUString("AAAAA CCCCC foo DDDDD"), sViewText);
 }
@@ -459,7 +461,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisibleExpandFootnoteRepl
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode,
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr,
         ExpandMode::ExpandFields | ExpandMode::HideInvisible | ExpandMode::ExpandFootnote | ExpandMode::ReplaceMode);
     OUString sViewText = aModelToViewHelper.getViewText();
     CPPUNIT_ASSERT_EQUAL(
@@ -477,7 +479,8 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnote(
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode, ExpandMode::ExpandFields | ExpandMode::HideDeletions | ExpandMode::ExpandFootnote);
+    ModelToViewHelper aModelToViewHelper(*pTextNode, nullptr,
+        ExpandMode::ExpandFields | ExpandMode::HideDeletions | ExpandMode::ExpandFootnote);
     OUString sViewText = aModelToViewHelper.getViewText();
     CPPUNIT_ASSERT_EQUAL(
         OUString("AAAABB foo CCCCC foo DDDDD"), sViewText);
@@ -487,7 +490,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnoteR
 {
     SwTextNode* pTextNode = getModelToViewTestDocument(m_pDoc);
 
-    ModelToViewHelper aModelToViewHelper(*pTextNode,

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list