summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/fldbas.hxx8
-rw-r--r--sw/inc/txtfld.hxx3
-rw-r--r--sw/source/core/crsr/crstrvl.cxx3
-rw-r--r--sw/source/core/crsr/findtxt.cxx3
-rw-r--r--sw/source/core/doc/doc.cxx2
-rw-r--r--sw/source/core/edit/edattr.cxx2
-rw-r--r--sw/source/core/edit/edfld.cxx3
-rw-r--r--sw/source/core/fields/cellfml.cxx2
-rw-r--r--sw/source/core/fields/fldbas.cxx7
-rw-r--r--sw/source/core/text/itratr.cxx7
-rw-r--r--sw/source/core/tox/txmsrt.cxx4
-rw-r--r--sw/source/core/txtnode/atrfld.cxx5
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx7
-rw-r--r--sw/source/core/txtnode/thints.cxx3
-rw-r--r--sw/source/core/unocore/unofield.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/rtf/rtfatr.cxx6
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx2
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx10
-rw-r--r--sw/source/ui/docvw/edtwin2.cxx3
-rw-r--r--sw/source/ui/fldui/inpdlg.cxx2
22 files changed, 40 insertions, 48 deletions
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index d46ca308c3ba..fd570f623eaf 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -326,10 +326,14 @@ public:
virtual SwFieldType* ChgTyp( SwFieldType* );
/** expand the field.
- @param bInClipboard field is in clipboard document?
+ @param bCached return cached field value.
+ @remark most callers should use the cached field value.
+ this is because various fields need special handing
+ (ChangeExpansion()) to return correct values, and only
+ SwTxtFormatter::NewFldPortion() sets things up properly.
@return the generated text (suitable for display)
*/
- String ExpandField(bool const bInClipboard) const;
+ String ExpandField(bool const bCached) const;
virtual String GetFieldName() const;
diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx
index d0be4a008cab..6dd556a84436 100644
--- a/sw/inc/txtfld.hxx
+++ b/sw/inc/txtfld.hxx
@@ -41,8 +41,7 @@ class SwTxtFld : public SwTxtAttr
SwTxtNode * m_pTxtNode;
public:
- SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart,
- bool const bInClipboard);
+ SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart);
virtual ~SwTxtFld();
void CopyFld( SwTxtFld *pDest ) const;
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index c11092c5fd9d..c7835289e7d3 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -717,8 +717,7 @@ BOOL SwCrsrShell::MoveFldType( const SwFieldType* pFldType, BOOL bNext,
SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
(SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) );
- pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex(),
- pDoc->IsClipBoard() );
+ pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex() );
pTxtFld->ChgTxtNode( pTNd );
}
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 4a0697692975..ed4bcc089957 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -143,8 +143,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
// hinterher alle am Stringende (koenten ja 'normale' 0x7f drinstehen
BOOL bEmpty = RES_TXTATR_FIELD != pHt->Which() ||
!(static_cast<SwTxtFld const*>(pHt)
- ->GetFld().GetFld()->ExpandField(
- rNd.GetDoc()->IsClipBoard()).Len());
+ ->GetFld().GetFld()->ExpandField(true).Len());
if ( bEmpty && nStart == nAkt )
{
rArr.Insert( nAkt, rArr.Count() );
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index cd580581cfb4..a8f926522b71 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -2451,7 +2451,7 @@ BOOL SwDoc::ConvertFieldsToText()
nWhich != RES_REFPAGEGETFLD&&
nWhich != RES_REFPAGESETFLD))
{
- String sText = pField->ExpandField( this->IsClipBoard() );
+ String sText = pField->ExpandField(true);
//database fields should not convert their command into text
if( RES_DBFLD == pCurType->Which() && !static_cast<const SwDBField*>(pField)->IsInitialized())
sText.Erase();
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 31c4a7dfea3e..f1f288f99d06 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -457,7 +457,7 @@ BOOL lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos,
const SwField* const pFld = pAttr->GetFld().GetFld();
if (pFld)
{
- sExp += pFld->ExpandField(rTNd.GetDoc()->IsClipBoard());
+ sExp += pFld->ExpandField(true);
}
}
}
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 1e4f699fa203..eab4c2bd1ae8 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -224,8 +224,7 @@ void SwEditShell::FieldToText( SwFieldType* pType )
*pFmtFld->GetTxtFld()->GetStart() );
// Feldinhalt durch Text ersetzen
- String const aEntry(
- pFmtFld->GetFld()->ExpandField(GetDoc()->IsClipBoard()) );
+ String const aEntry( pFmtFld->GetFld()->ExpandField(true) );
pPaM->SetMark();
pPaM->Move( fnMoveForward );
GetDoc()->DeleteRange( *pPaM );
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 182ed12d6ddd..36b981b90752 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -203,7 +203,7 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const
break;
default:
- String const value(pFld->ExpandField(pDoc->IsClipBoard()));
+ String const value(pFld->ExpandField(true));
nRet = rCalcPara.rCalc.Calculate(value).GetDouble();
}
}
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index f7fec69cf5eb..6ffe675c760a 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -427,9 +427,9 @@ BOOL SwField::IsFixed() const
return bRet;
}
-String SwField::ExpandField(bool const bInClipboard) const
+String SwField::ExpandField(bool const bCached) const
{
- if (!bInClipboard) // #i85766# do not expand fields in clipboard documents
+ if (!bCached) // #i85766# do not expand fields in clipboard documents
{
m_Cache = Expand();
}
@@ -440,7 +440,8 @@ SwField * SwField::CopyField() const
{
SwField *const pNew = Copy();
// #i85766# cache expansion of source (for clipboard)
- pNew->m_Cache = Expand();
+ // use this->cache, not this->Expand(): only text formatting calls Expand()
+ pNew->m_Cache = m_Cache;
return pNew;
}
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 2fde18643f16..c4ec51b5ecb4 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -779,9 +779,7 @@ void SwTxtNode::GetMinMaxSize( ULONG nIndex, ULONG& rMin, ULONG &rMax,
case RES_TXTATR_FIELD :
{
SwField *pFld = (SwField*)pHint->GetFld().GetFld();
- SwDoc const*const pDoc(GetDoc());
- const String aTxt =
- pFld->ExpandField(pDoc->IsClipBoard());
+ const String aTxt = pFld->ExpandField(true);
if( lcl_MinMaxString( aArg, aIter.GetFnt(), aTxt, 0,
aTxt.Len() ) )
nAdd = 20;
@@ -984,8 +982,7 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd )
case RES_TXTATR_FIELD :
{
SwField *pFld = (SwField*)pHint->GetFld().GetFld();
- SwDoc const*const pDoc( GetDoc() );
- String const aTxt = pFld->ExpandField(pDoc->IsClipBoard());
+ String const aTxt = pFld->ExpandField(true);
SwDrawTextInfo aDrawInf( pSh, *pOut, 0, aTxt, 0, aTxt.Len() );
nProWidth += aIter.GetFnt()->_GetTxtSize( aDrawInf ).Width();
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index fa6149de051e..ba3145c1139b 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -868,9 +868,7 @@ USHORT SwTOXAuthority::GetLevel() const
-----------------------------------------------------------------------*/
static String lcl_GetText(SwFmtFld const& rField)
{
- bool const isClipBoard(
- rField.GetTxtFld()->GetTxtNode().GetDoc()->IsClipBoard());
- return rField.GetFld()->ExpandField(isClipBoard);
+ return rField.GetFld()->ExpandField(true);
}
void SwTOXAuthority::GetText_Impl( String& rTxt, String& ) const
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 6b1adc76fbec..be01f06cd472 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -259,10 +259,9 @@ BOOL SwFmtFld::IsProtect() const
|*
*************************************************************************/
-SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos,
- bool const bInClipboard)
+SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos)
: SwTxtAttr( rAttr, nStartPos )
- , m_aExpand( rAttr.GetFld()->ExpandField(bInClipboard) )
+ , m_aExpand( rAttr.GetFld()->ExpandField(true) )
, m_pTxtNode( 0 )
{
rAttr.pTxtAttr = this;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 686cfac9dd88..a708b2d60312 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3067,8 +3067,7 @@ void SwTxtNode::Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt,
{
const XubString aExpand(
static_cast<SwTxtFld const*>(pAttr)->GetFld()
- .GetFld()->ExpandField(
- GetDoc()->IsClipBoard()));
+ .GetFld()->ExpandField(true));
rTxt.Insert( aExpand, nPos );
nPos = nPos + aExpand.Len();
nEndPos = nEndPos + aExpand.Len();
@@ -3217,7 +3216,7 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
{
XubString const aExpand(
static_cast<SwTxtFld const*>(pHt)->GetFld().GetFld()
- ->ExpandField(GetDoc()->IsClipBoard()));
+ ->ExpandField(true));
if( aExpand.Len() )
{
aDestIdx++; // dahinter einfuegen;
@@ -3315,7 +3314,7 @@ const ModelToViewHelper::ConversionMap*
{
const XubString aExpand(
static_cast<SwTxtFld const*>(pAttr)->GetFld().GetFld()
- ->ExpandField(GetDoc()->IsClipBoard()));
+ ->ExpandField(true));
if ( aExpand.Len() > 0 )
{
const xub_StrLen nFieldPos = *pAttr->GetStart();
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index ac2f281b0d90..4d56942ecef4 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1043,8 +1043,7 @@ 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,
- rDoc.IsClipBoard() );
+ pNew = new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt );
break;
case RES_TXTATR_FLYCNT:
{
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index d5a84de322d5..f63fee217e29 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1275,7 +1275,7 @@ OUString SwXTextField::getPresentation(sal_Bool bShowCommand) throw( uno::Runtim
}
::rtl::OUString const ret( (bShowCommand)
? pField->GetFieldName()
- : pField->ExpandField( GetDoc()->IsClipBoard() ) );
+ : pField->ExpandField(true) );
return ret;
}
/* -----------------18.02.99 13:39-------------------
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index c1ba4908a339..f2a8229c3092 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -125,7 +125,7 @@ BOOL SwASC_AttrIter::OutAttr( xub_StrLen nSwPos )
{
case RES_TXTATR_FIELD:
sOut = static_cast<SwTxtFld const*>(pHt)->GetFld().GetFld()
- ->ExpandField(rWrt.pDoc->IsClipBoard());
+ ->ExpandField(true);
break;
case RES_TXTATR_FTN:
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index 50b7bdc7ddc8..6b905e450dee 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -305,7 +305,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld,
}
// Inhalt des Feldes ausgeben
- String const sExpand( pFld->ExpandField(rWrt.pDoc->IsClipBoard()) );
+ String const sExpand( pFld->ExpandField(true) );
sal_Bool bNeedsCJKProcessing = sal_False;
if( sExpand.Len() )
{
diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx
index 8303b5abf4ce..db91ec79d2e7 100644
--- a/sw/source/filter/rtf/rtfatr.cxx
+++ b/sw/source/filter/rtf/rtfatr.cxx
@@ -2903,7 +2903,7 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt )
case RES_HIDDENTXTFLD:
if( TYP_CONDTXTFLD == ((SwHiddenTxtField*)pFld)->GetSubType() )
RTFOutFuncs::Out_String( rWrt.Strm(),
- pFld->ExpandField(rWrt.pDoc->IsClipBoard()),
+ pFld->ExpandField(true),
rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt );
else
{
@@ -2960,7 +2960,7 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt )
if( ' ' != cCh ) // vorweg immer einen Trenner
rWrt.Strm() << ' ';
RTFOutFuncs::Out_String( rWrt.Strm(),
- pFld->ExpandField(rWrt.pDoc->IsClipBoard()),
+ pFld->ExpandField(true),
rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt );
}
break;
@@ -2970,7 +2970,7 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt )
{
rWrt.Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << ' ';
RTFOutFuncs::Out_String( rWrt.Strm(),
- pFld->ExpandField(rWrt.pDoc->IsClipBoard()),
+ pFld->ExpandField(true),
rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt );
rWrt.Strm() << "}}";
rRTFWrt.bOutFmtAttr = FALSE;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 73c2410e7bda..c7f5c06cb81c 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -343,7 +343,7 @@ void WW8Export::DoFormText(const SwInputField * pFld)
OutputField(0, ww::eFORMTEXT, aEmptyStr, WRITEFIELD_CMD_END);
- String const fieldStr( pFld->ExpandField(pDoc->IsClipBoard()) );
+ String const fieldStr( pFld->ExpandField(true) );
SwWW8Writer::WriteString16(Strm(), fieldStr, false);
static BYTE aArr2[] = {
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index df438a0eed51..6e00687ffafa 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1743,9 +1743,9 @@ static void InsertSpecialChar( WW8Export& rWrt, BYTE c,
aItems.GetData());
}
-String lcl_GetExpandedField(const SwField &rFld, SwDoc const& rDoc)
+String lcl_GetExpandedField(const SwField &rFld)
{
- String sRet(rFld.ExpandField(rDoc.IsClipBoard()));
+ String sRet(rFld.ExpandField(true));
//replace LF 0x0A with VT 0x0B
sRet.SearchAndReplaceAll(0x0A, 0x0B);
@@ -1871,7 +1871,7 @@ void WW8Export::OutputField( const SwField* pFld, ww::eField eFldType,
{
String sOut;
if( pFld )
- sOut = lcl_GetExpandedField(*pFld, *pDoc);
+ sOut = lcl_GetExpandedField(*pFld);
else
sOut = rFldCmd;
if( sOut.Len() )
@@ -2598,7 +2598,7 @@ void WW8AttributeOutput::RefField( const SwField &rFld, const String &rRef)
sStr.APPEND_CONST_ASC( "\" " );
m_rWW8Export.OutputField( &rFld, ww::eREF, sStr, WRITEFIELD_START |
WRITEFIELD_CMD_START | WRITEFIELD_CMD_END );
- String sVar = lcl_GetExpandedField( rFld, *GetExport().pDoc );
+ String sVar = lcl_GetExpandedField( rFld );
if ( sVar.Len() )
{
if ( m_rWW8Export.IsUnicode() )
@@ -2614,7 +2614,7 @@ void WW8AttributeOutput::RefField( const SwField &rFld, const String &rRef)
void WW8AttributeOutput::WriteExpand( const SwField* pFld )
{
- String sExpand( lcl_GetExpandedField( *pFld, *GetExport().pDoc ) );
+ String sExpand( lcl_GetExpandedField( *pFld ) );
if ( m_rWW8Export.IsUnicode() )
SwWW8Writer::WriteString16( m_rWW8Export.Strm(), sExpand, false );
else
diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx
index 820b55cac53e..1ecf32144ee5 100644
--- a/sw/source/ui/docvw/edtwin2.cxx
+++ b/sw/source/ui/docvw/edtwin2.cxx
@@ -304,8 +304,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
{
USHORT nOldSubType = pFld->GetSubType();
((SwField*)pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD);
- sTxt =
- pFld->ExpandField(rSh.GetDoc()->IsClipBoard());
+ sTxt = pFld->ExpandField(true);
((SwField*)pFld)->SetSubType(nOldSubType);
}
break;
diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx
index 670b59d26610..6676b72a1f84 100644
--- a/sw/source/ui/fldui/inpdlg.cxx
+++ b/sw/source/ui/fldui/inpdlg.cxx
@@ -119,7 +119,7 @@ SwFldInputDlg::SwFldInputDlg( Window *pParent, SwWrtShell &rS,
CharClass aCC( SvxCreateLocale( pSetFld->GetLanguage() ));
if( aCC.isNumeric( sFormula ))
{
- aStr = pSetFld->ExpandField(false/*no dialogs for clipboard*/);
+ aStr = pSetFld->ExpandField(true);
}
else
aStr = sFormula;