Rebased ref, commits from common ancestor: commit 85de89ac8ab63c39a7e049087901c6869d3bc50a Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Fri Nov 9 16:04:17 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 2018 +0100
sw_redlinehide_3: update fields on redline ops Can't tell which chapter/reference fields will be affected by a redline, so we have to either update all of them, or rely on the IDocumentSettingAccess::getFieldUpdateFlags() which lets the SwIdle update the fields, at some later time... Change-Id: I3b9cfd17bd227a18f64dac193f0cc912768810c1 diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 0d4448a79079..a8e04dc8af42 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -22,6 +22,7 @@ #include <txtfrm.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> #include <redline.hxx> #include <UndoRedline.hxx> @@ -119,6 +120,12 @@ using namespace com::sun::star; namespace sw { +void UpdateFieldsForRedline(IDocumentFieldsAccess & rIDFA) +{ + rIDFA.GetSysFieldType(SwFieldIds::Chapter)->UpdateFields(); + rIDFA.UpdateRefFields(); +} + void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) { // no need to call UpdateFootnoteNums for FTNNUM_PAGE: @@ -148,6 +155,8 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) // node of the merged frame, there could be another redline nearby sw::AddRemoveFlysAnchoredToFrameStartingAtNode(*pFrame, *pStartNode, nullptr); } + // fields last - SwGetRefField::UpdateField requires up-to-date frames + UpdateFieldsForRedline(rDoc.getIDocumentFieldsAccess()); // after footnotes } void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) @@ -205,6 +214,8 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) AppendAllObjs(rDoc.GetSpzFrameFormats(), pLayout); } } + // fields last - SwGetRefField::UpdateField requires up-to-date frames + UpdateFieldsForRedline(rDoc.getIDocumentFieldsAccess()); // after footnotes } } // namespace sw commit 264be80951a9a635906f076ce505f0b971f7b923 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Fri Nov 9 12:50:04 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 2018 +0100 sw_redlinehide_3: update fields in UnHideRedlines Repainting is not enough, values require up-to-date outline visibility etc. Change-Id: I85d99fc65a071279c2d4656a52ff82ed3b2db7d8 diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index eb8a0fa12368..9706f12682c8 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -4504,6 +4504,9 @@ void SwRootFrame::SetHideRedlines(bool const bHideRedlines) pFootnote->InvalidateNumberInLayout(); } } + // TODO invalidate all chapter fields etc. to re-expand them + rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Chapter)->UpdateFields(); + rDoc.getIDocumentFieldsAccess().UpdateRefFields(); // InvalidateAllContent(SwInvalidateFlags::Size); // ??? TODO what to invalidate? this is the big hammer } commit 2740584d501afac37618dadf84a5cb559e14a0c9 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Fri Nov 9 16:40:12 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 2018 +0100 sw: remove the SwSetExpFieldType::m_pOutlChgNd member It's only used in one function, just use a local map. Change-Id: I3a79876acf8b31c1a8a14e9f65ada2153e7c773a diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx index 4c48d2e0e8a7..7ec48a69af5d 100644 --- a/sw/inc/expfld.hxx +++ b/sw/inc/expfld.hxx @@ -140,7 +140,6 @@ class SwSetExpField; class SW_DLLPUBLIC SwSetExpFieldType : public SwValueFieldType { OUString const m_sName; - const SwNode* m_pOutlChgNd; OUString m_sDelim; sal_uInt16 m_nType; sal_uInt8 m_nLevel; @@ -178,11 +177,6 @@ public: void SetOutlineLvl( sal_uInt8 n ) { m_nLevel = n; } void SetChapter( SwSetExpField& rField, const SwNode& rNd ); - /** Member only for SwDoc::UpdateExpField. - It is needed only at runtime of sequence field types! */ - const SwNode* GetOutlineChgNd() const { return m_pOutlChgNd; } - void SetOutlineChgNd( const SwNode* p ) { m_pOutlChgNd = p; } - virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; }; diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index 0ce2a53fd7b4..efb42e357632 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -890,9 +890,6 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp aHashStrTable[nPos].release() ) ); } break; - case SwFieldIds::SetExp: - const_cast<SwSetExpFieldType*>(static_cast<const SwSetExpFieldType*>(pFieldType))->SetOutlineChgNd( nullptr ); - break; default: break; } } @@ -928,6 +925,8 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp } } + std::unordered_map<SwSetExpFieldType const*, SwTextNode const*> SetExpOutlineNodeMap; + for( SetGetExpFields::const_iterator it = mpUpdateFields->GetSortLst()->begin(); it != mpUpdateFields->GetSortLst()->end(); ++it ) { SwSection* pSect = const_cast<SwSection*>((*it)->GetSection()); @@ -1131,9 +1130,11 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp const SwTextNode* pOutlNd = pSeqNd-> FindOutlineNodeOfLevel( nLvl ); - if( pSFieldTyp->GetOutlineChgNd() != pOutlNd ) + auto const iter(SetExpOutlineNodeMap.find(pSFieldTyp)); + if (iter == SetExpOutlineNodeMap.end() + || iter->second != pOutlNd) { - pSFieldTyp->SetOutlineChgNd( pOutlNd ); + SetExpOutlineNodeMap[pSFieldTyp] = pOutlNd; aCalc.VarChange( aNew, 0 ); } } diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index a9f70bed75fe..9884be99aee3 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -490,7 +490,6 @@ bool SwGetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) SwSetExpFieldType::SwSetExpFieldType( SwDoc* pDc, const OUString& rName, sal_uInt16 nTyp ) : SwValueFieldType( pDc, SwFieldIds::SetExp ), m_sName( rName ), - m_pOutlChgNd( nullptr ), m_sDelim( "." ), m_nType(nTyp), m_nLevel( UCHAR_MAX ), m_bDeleted( false ) commit 404e50dafb30d5f79217ea97f066e044a3f19f18 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Nov 8 18:51:20 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 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 ebc38c49f4ab..0d8def9f662c 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 6b04b3fd03e994be19570750c3b121a16e516186 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Nov 8 18:44:10 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 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 8deb794bcc68..65f06bac106a 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -274,7 +274,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: @@ -285,7 +285,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 bd08703640ce..39a2a5c28e11 100644 --- a/sw/inc/reffld.hxx +++ b/sw/inc/reffld.hxx @@ -90,7 +90,7 @@ private: /// reference to either a SwTextFootnote::m_nSeqNo or a SwSetExpField::mnSeqNo 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 20ddd1ed7011..034a221e72e5 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 bfcf86f8b7bf..ebc38c49f4ab 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); } @@ -870,7 +870,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 @@ -934,7 +934,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 4ffd7622f835..6eddc41656c2 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -62,7 +62,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 0843a265d2ac4bb6fd107ae9f9fe074962b86a7c Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Nov 8 17:43:16 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 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 ab388b68023c..1230304fae5e 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 0aa7619eaa4f..8deb794bcc68 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -28,6 +28,7 @@ #include <climits> 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; } } } } @@ -316,9 +317,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 2804371cd724..a238e571b370 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -140,7 +140,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 0367d2a8f0f4..34610c2b57e1 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 d1c0141cca5b..1ae7e8e23469 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -1161,7 +1161,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; @@ -1358,7 +1359,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 d1ff01703e29..808cdb6db9e7 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 ); @@ -345,7 +346,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 ); @@ -372,7 +373,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 @@ -563,7 +566,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 8302e34604ce..3bc3dbb59f21 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 e8718a213237..d4e30e17c05c 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3499,7 +3499,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 857b577e621e..b8ada47916cd 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 333b5731f249..4c5911e72090 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -307,7 +307,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 b691312b5794..796c6e621f8e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1944,7 +1944,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 05bcce08dfcf..62adfc62fc8e 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 e3910364b03e..849ede23b070 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 317a4efc9bcf..cbe0fa6ac810 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 19881f34d752..b94bf6e586f9 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -300,7 +300,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 ae561904b6b46834fb8addf46583ebb67f912138 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Nov 8 15:26:58 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 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 a2b3f35b5e70..e1a849b35d2c 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -179,8 +179,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 ); @@ -189,16 +190,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 33ee152c9846..19881f34d752 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -245,8 +245,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 6571e3a1d23e4248fe7b88a6fb066d764052026e Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Nov 8 15:15:43 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 2018 +0100 sw_redlinehide_3: SwGetRefField::GetExpandedTextOfReferencedTextNode Change-Id: I98530004f2d75b10fc4cd3241b06d513ed57675b diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx index 7e02260d5ba6..bd08703640ce 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 ); @@ -122,7 +123,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 0ed25e890088..bfcf86f8b7bf 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 e4258ed60f50..33ee152c9846 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -345,7 +345,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 760fb51c599fa0b9bb401e6b78cd261864beb465 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Nov 8 14:59:17 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 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 ba94bc890781..47f5cc9b1692 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -667,7 +667,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); @@ -1085,7 +1085,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 a6c6758c5d2da525d11273efad6ad1cf2e970f42 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Nov 8 14:42:11 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 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 6889862e26d2..b5c08d53d015 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)); @@ -2451,7 +2452,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 a7edee8146b9..7b14d3156938 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 3766facb5cc1..fead8dd1ec45 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1068,7 +1068,7 @@ namespace { sRet.append( '\n' ); } - sRet.append( aIdx.GetNode().GetTextNode()->GetExpandText() ); + sRet.append( aIdx.GetNode().GetTextNode()->GetExpandText(nullptr) ); } ++aIdx; } @@ -1177,7 +1177,7 @@ OUString SwCompareLine::GetText() const switch( rNode.GetNodeType() ) { case SwNodeType::Text: - sRet = rNode.GetTextNode()->GetExpandText(); + sRet = rNode.GetTextNode()->GetExpandText(nullptr); break; case SwNodeType::Table: @@ -1231,7 +1231,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 0ca27af58c4f..37147b624bdd 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 98366e1b8f0f..0367d2a8f0f4 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 f6a64aeb3a26..0ed25e890088 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 4fb9dbc606c0..d1ff01703e29 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -577,7 +577,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 697019c9d128..a2b3f35b5e70 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -189,12 +189,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 7dbacee6596d..e8718a213237 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3380,7 +3380,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, @@ -3390,7 +3391,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; @@ -3403,14 +3404,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 2b59e5ec84e2..3cc3e62c8e16 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1228,7 +1228,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 9324c70999af..036bcea4c706 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 7da20fbd088ae9628055bd7e7a618e29d38b5f4b Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Nov 8 13:46:03 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 9 18:00:24 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 593428d3956a..ab388b68023c 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, ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits