summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-11-08 17:43:16 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-14 18:42:15 +0100
commitc0c9c93c7cf5473745cae05df1dc16ac9ad50b14 (patch)
treed7ffaabfbfd271e110260aa163fabede536367c0
parent6806a1cae7703fb3dd1f36578cee6c5eaa797269 (diff)
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
-rw-r--r--sw/inc/doc.hxx2
-rw-r--r--sw/inc/fldbas.hxx5
-rw-r--r--sw/source/core/crsr/findtxt.cxx2
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx6
-rw-r--r--sw/source/core/doc/doc.cxx6
-rw-r--r--sw/source/core/edit/edattr.cxx2
-rw-r--r--sw/source/core/edit/edfld.cxx2
-rw-r--r--sw/source/core/edit/editsh.cxx2
-rw-r--r--sw/source/core/fields/cellfml.cxx2
-rw-r--r--sw/source/core/fields/fldbas.cxx3
-rw-r--r--sw/source/core/inc/fieldhint.hxx14
-rw-r--r--sw/source/core/text/itratr.cxx5
-rw-r--r--sw/source/core/text/txtfld.cxx46
-rw-r--r--sw/source/core/tox/txmsrt.cxx2
-rw-r--r--sw/source/core/txtnode/atrfld.cxx13
-rw-r--r--sw/source/core/txtnode/modeltoviewhelper.cxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx2
-rw-r--r--sw/source/core/unocore/unofield.cxx2
-rw-r--r--sw/source/core/unocore/unoportenum.cxx2
-rw-r--r--sw/source/filter/ascii/ascatr.cxx2
-rw-r--r--sw/source/filter/html/htmlfldw.cxx2
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx2
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx2
-rw-r--r--sw/source/ui/fldui/inpdlg.cxx2
-rw-r--r--sw/source/uibase/docvw/edtwin2.cxx2
28 files changed, 75 insertions, 63 deletions
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 d85cb168b02f..aeca6373f718 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -301,7 +301,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;