Kaydet (Commit) 9519deda authored tarafından Michael Stahl's avatar Michael Stahl

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, 8485708f)
üst eb237af5
...@@ -42,7 +42,8 @@ class SwTxtFld : public SwTxtAttr ...@@ -42,7 +42,8 @@ class SwTxtFld : public SwTxtAttr
SwTxtNode * m_pTxtNode; SwTxtNode * m_pTxtNode;
public: public:
SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart); SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart,
bool const bInClipboard);
virtual ~SwTxtFld(); virtual ~SwTxtFld();
void CopyFld( SwTxtFld *pDest ) const; void CopyFld( SwTxtFld *pDest ) const;
......
...@@ -710,7 +710,8 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, ...@@ -710,7 +710,8 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField( SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
(SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) ); (SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) );
pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex() ); pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex(),
pDoc->IsClipBoard() );
pTxtFld->ChgTxtNode( pTNd ); pTxtFld->ChgTxtNode( pTNd );
} }
......
...@@ -283,9 +283,12 @@ sal_Bool SwFmtFld::IsProtect() const ...@@ -283,9 +283,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 ) : 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 ) , m_pTxtNode( 0 )
{ {
rAttr.pTxtAttr = this; rAttr.pTxtAttr = this;
......
...@@ -1035,7 +1035,8 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr, ...@@ -1035,7 +1035,8 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr,
pNew = new SwTxtINetFmt( (SwFmtINetFmt&)rNew, nStt, nEnd ); pNew = new SwTxtINetFmt( (SwFmtINetFmt&)rNew, nStt, nEnd );
break; break;
case RES_TXTATR_FIELD: case RES_TXTATR_FIELD:
pNew = new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt ); pNew = new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt,
rDoc.IsClipBoard() );
break; break;
case RES_TXTATR_FLYCNT: case RES_TXTATR_FLYCNT:
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment