summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsw/inc/txtannotationfld.hxx3
-rw-r--r--sw/inc/txtfld.hxx13
-rw-r--r--sw/source/core/crsr/crstrvl.cxx2
-rw-r--r--sw/source/core/doc/docfld.cxx2
-rw-r--r--sw/source/core/txtnode/atrfld.cxx105
-rw-r--r--sw/source/core/txtnode/thints.cxx9
6 files changed, 72 insertions, 62 deletions
diff --git a/sw/inc/txtannotationfld.hxx b/sw/inc/txtannotationfld.hxx
index f7cd9b87c927..2a8d9db049a6 100755
--- a/sw/inc/txtannotationfld.hxx
+++ b/sw/inc/txtannotationfld.hxx
@@ -33,7 +33,8 @@ class SwTxtAnnotationFld : public SwTxtFld
public:
SwTxtAnnotationFld(
SwFmtFld & rAttr,
- xub_StrLen const nStart );
+ xub_StrLen const nStart,
+ const bool bIsClipboardDoc );
virtual ~SwTxtAnnotationFld();
diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx
index f31dd0705bc0..d86a44780dfe 100644
--- a/sw/inc/txtfld.hxx
+++ b/sw/inc/txtfld.hxx
@@ -39,18 +39,14 @@ class SwTxtFld : public SwTxtAttr
public:
SwTxtFld(
SwFmtFld & rAttr,
- xub_StrLen const nStart );
+ xub_StrLen const nStart,
+ const bool bIsClipboardDoc );
virtual ~SwTxtFld();
void CopyTxtFld( SwTxtFld *pDest ) const;
- void ExpandTxtFld() const;
- inline void ExpandAlways()
- {
- m_aExpand += ' '; // changing current value to assure that <ExpandTxtFld()> changes the value.
- ExpandTxtFld();
- }
+ void ExpandTxtFld( const bool bForceNotify = false ) const;
// get and set TxtNode pointer
inline SwTxtNode* GetpTxtNode() const
@@ -80,7 +76,8 @@ public:
SwTxtInputFld(
SwFmtFld & rAttr,
xub_StrLen const nStart,
- xub_StrLen const nEnd );
+ xub_StrLen const nEnd,
+ const bool bIsClipboardDoc );
virtual ~SwTxtInputFld();
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index fbbde306d4d1..479a75543d3a 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -722,7 +722,7 @@ sal_Bool SwCrsrShell::MoveFldType(
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/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 384bfa2227aa..bb93c8cb5ed3 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -2006,7 +2006,7 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames,
}
if (bExpand)
- pTxtFld->ExpandAlways();
+ pTxtFld->ExpandTxtFld( true );
}
SetModified();
}
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 90526b0a0558..d1119506bc2a 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -218,71 +218,76 @@ void SwFmtFld::SwClientNotify( const SwModify&, const SfxHint& rHint )
void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
- if( !mpTxtFld )
+ if ( mpTxtFld == NULL )
return;
- // don't do anything, especially not expand!
- if( pNew && pNew->Which() == RES_OBJECTDYING )
+ if( pNew != NULL
+ && pNew->Which() == RES_OBJECTDYING )
+ {
+ // don't do anything, especially not expand!
return;
+ }
- SwTxtNode* pTxtNd = (SwTxtNode*)&mpTxtFld->GetTxtNode();
+ SwTxtNode* pTxtNd = (SwTxtNode*) &mpTxtFld->GetTxtNode();
ASSERT( pTxtNd, "wo ist denn mein Node?" );
- if( pNew )
+ if ( pNew )
{
- switch( pNew->Which() )
+ switch (pNew->Which())
{
case RES_TXTATR_FLDCHG:
- // "Farbe hat sich geaendert !"
- // this, this fuer "nur Painten"
- pTxtNd->ModifyNotification( this, this );
- return;
+ // "Farbe hat sich geaendert !"
+ // this, this fuer "nur Painten"
+ pTxtNd->ModifyNotification( this, this );
+ return;
+
case RES_REFMARKFLD_UPDATE:
- // GetReferenz-Felder aktualisieren
- if( RES_GETREFFLD == GetField()->GetTyp()->Which() )
- {
- // --> OD 2007-09-06 #i81002#
-// ((SwGetRefField*)GetFld())->UpdateField();
- dynamic_cast<SwGetRefField*>(GetField())->UpdateField( mpTxtFld );
- // <--
- }
- break;
+ // GetReferenz-Felder aktualisieren
+ if ( RES_GETREFFLD == GetField()->GetTyp()->Which() )
+ {
+ dynamic_cast<SwGetRefField*>(GetField())->UpdateField( mpTxtFld );
+ }
+ break;
+
case RES_DOCPOS_UPDATE:
- // Je nach DocPos aktualisieren (SwTxtFrm::Modify())
- pTxtNd->ModifyNotification( pNew, this );
- return;
+ // Je nach DocPos aktualisieren (SwTxtFrm::Modify())
+ pTxtNd->ModifyNotification( pNew, this );
+ return;
case RES_ATTRSET_CHG:
- case RES_FMT_CHG:
- pTxtNd->ModifyNotification( pOld, pNew );
- return;
- default:
- break;
+ case RES_FMT_CHG:
+ pTxtNd->ModifyNotification( pOld, pNew );
+ return;
+
+ default:
+ break;
}
}
switch (GetField()->GetTyp()->Which())
{
- case RES_HIDDENPARAFLD:
- if( !pOld || RES_HIDDENPARA_PRINT != pOld->Which() )
- break;
- case RES_DBSETNUMBERFLD:
- case RES_DBNUMSETFLD:
- case RES_DBNEXTSETFLD:
- case RES_DBNAMEFLD:
- pTxtNd->ModifyNotification( 0, pNew);
- return;
+ case RES_HIDDENPARAFLD:
+ if ( !pOld || RES_HIDDENPARA_PRINT != pOld->Which() )
+ break;
+ case RES_DBSETNUMBERFLD:
+ case RES_DBNUMSETFLD:
+ case RES_DBNEXTSETFLD:
+ case RES_DBNAMEFLD:
+ pTxtNd->ModifyNotification( 0, pNew );
+ return;
}
- if( RES_USERFLD == GetField()->GetTyp()->Which() )
+ if ( RES_USERFLD == GetField()->GetTyp()->Which() )
{
- SwUserFieldType* pType = (SwUserFieldType*)GetField()->GetTyp();
- if(!pType->IsValid())
+ SwUserFieldType* pType = (SwUserFieldType*) GetField()->GetTyp();
+ if ( !pType->IsValid() )
{
SwCalc aCalc( *pTxtNd->GetDoc() );
pType->GetValue( aCalc );
}
}
- mpTxtFld->ExpandTxtFld();
+
+ const bool bForceNotify = (pOld == NULL) && (pNew == NULL);
+ mpTxtFld->ExpandTxtFld( bForceNotify );
}
sal_Bool SwFmtFld::GetInfo( SfxPoolItem& rInfo ) const
@@ -316,9 +321,10 @@ sal_Bool SwFmtFld::IsProtect() const
SwTxtFld::SwTxtFld(
SwFmtFld & rAttr,
- xub_StrLen const nStartPos )
+ xub_StrLen const nStartPos,
+ const bool bIsClipboardDoc )
: SwTxtAttr( rAttr, nStartPos )
- , m_aExpand( rAttr.GetField()->ExpandField(true) )
+ , m_aExpand( rAttr.GetField()->ExpandField( bIsClipboardDoc ) )
, m_pTxtNode( NULL )
{
rAttr.SetTxtFld( *this );
@@ -341,14 +347,15 @@ bool SwTxtFld::IsFldInDoc() const
&& GetpTxtNode()->GetNodes().IsDocNodes();
}
-void SwTxtFld::ExpandTxtFld() const
+void SwTxtFld::ExpandTxtFld( const bool bForceNotify ) const
{
ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" );
const SwField* pFld = GetFmtFld().GetField();
const XubString aNewExpand( pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) );
- if( aNewExpand == m_aExpand )
+ if ( !bForceNotify &&
+ aNewExpand == m_aExpand )
{
// Bei Seitennummernfeldern
const sal_uInt16 nWhich = pFld->GetTyp()->Which();
@@ -453,9 +460,10 @@ void SwTxtFld::NotifyContentChange(SwFmtFld& rFmtFld)
SwTxtInputFld::SwTxtInputFld(
SwFmtFld & rAttr,
xub_StrLen const nStart,
- xub_StrLen const nEnd )
+ xub_StrLen const nEnd,
+ const bool bIsClipboardDoc )
- : SwTxtFld( rAttr, nStart )
+ : SwTxtFld( rAttr, nStart, bIsClipboardDoc )
, m_nEnd( nEnd )
, m_bLockNotifyContentChange( false )
{
@@ -556,8 +564,9 @@ void SwTxtInputFld::UpdateTextNodeContent( const String& rNewContent )
// text annotation field
SwTxtAnnotationFld::SwTxtAnnotationFld(
SwFmtFld & rAttr,
- xub_StrLen const nStart )
- : SwTxtFld( rAttr, nStart )
+ xub_StrLen const nStart,
+ const bool bIsClipboardDoc )
+ : SwTxtFld( rAttr, nStart, bIsClipboardDoc )
{
}
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 6a7bdfcfde3a..66781e075112 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1049,12 +1049,14 @@ SwTxtAttr* MakeTxtAttr(
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_ANNOTATION:
{
- pNew = new SwTxtAnnotationFld( static_cast<SwFmtFld &>(rNew), nStt );
+ pNew =
+ new SwTxtAnnotationFld( static_cast<SwFmtFld &>(rNew), nStt, rDoc.IsClipBoard() );
if ( bIsCopy == COPY )
{
// On copy of the annotation field do not keep the annotated text range by removing
@@ -1067,7 +1069,8 @@ SwTxtAttr* MakeTxtAttr(
break;
case RES_TXTATR_INPUTFIELD:
- pNew = new SwTxtInputFld( static_cast<SwFmtFld &>(rNew), nStt, nEnd );
+ pNew =
+ new SwTxtInputFld( static_cast<SwFmtFld &>(rNew), nStt, nEnd, rDoc.IsClipBoard() );
break;
case RES_TXTATR_FLYCNT: