diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-03-02 19:02:03 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@frugalware.org> | 2012-03-05 15:00:44 +0100 |
commit | bad17b39d1567c5f58c439093c8f8b692e106cdc (patch) | |
tree | 016046e301728d20792fa13d8b51bf57514c7c65 | |
parent | 011a970de6f65fe6543337c7da643d998a450750 (diff) |
fdo#39694: SwTxtFld: do expand the field in the ctor
While only the text formatting is able to expand all fields correctly,
this is still good enough for many field types and fixes a race
condition when the field value is requested before layout is finished.
(regression from CWS sw34bf01, 8485708f3001fca132c3353c464fe7187ef62bed)
(cherry picked from commit 9519deda120b73b72e75d89c3b2ae3d66220ec2d)
Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
-rw-r--r-- | sw/inc/txtfld.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrfld.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 3 |
4 files changed, 11 insertions, 5 deletions
diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx index 4b06c3ff05..246de80f5e 100644 --- a/sw/inc/txtfld.hxx +++ b/sw/inc/txtfld.hxx @@ -42,7 +42,8 @@ class SwTxtFld : public SwTxtAttr SwTxtNode * m_pTxtNode; public: - SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart); + SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart, + bool const bInClipboard); virtual ~SwTxtFld(); void CopyFld( SwTxtFld *pDest ) const; diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index ca4b282676..0bf0aae540 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -711,7 +711,8 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField( (SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) ); - pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex() ); + pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex(), + pDoc->IsClipBoard() ); pTxtFld->ChgTxtNode( pTNd ); } diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 30eb065bb2..a2e746244d 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -287,9 +287,12 @@ sal_Bool SwFmtFld::IsProtect() const |* *************************************************************************/ -SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos) +SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos, + bool const bInClipboard) : SwTxtAttr( rAttr, nStartPos ) - , m_aExpand( rAttr.GetFld()->ExpandField(true) ) +// fdo#39694 the ExpandField here may not give the correct result in all cases, +// but is better than nothing + , m_aExpand( rAttr.GetFld()->ExpandField(bInClipboard) ) , m_pTxtNode( 0 ) { rAttr.pTxtAttr = this; diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index b67be35b8b..4f0de8e67a 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1041,7 +1041,8 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr, pNew = new SwTxtINetFmt( (SwFmtINetFmt&)rNew, nStt, nEnd ); break; case RES_TXTATR_FIELD: - pNew = new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt ); + pNew = new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt, + rDoc.IsClipBoard() ); break; case RES_TXTATR_FLYCNT: { |