summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode/atrfld.cxx
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2010-12-21 19:33:34 +0100
committerMathias Bauer <mba@openoffice.org>2010-12-21 19:33:34 +0100
commit09d6c9a395b8849e3e09c694282a1446b786bf80 (patch)
tree2679219635044f2ce5fba49309555db74432b002 /sw/source/core/txtnode/atrfld.cxx
parent3144cdca91c66439f241ba972904632900f86022 (diff)
CWS swlayoutrefactoring: #i115510#: use boost::noncopyable for SwClient; move some code from client iterations into SwClientNotify calls
Diffstat (limited to 'sw/source/core/txtnode/atrfld.cxx')
-rw-r--r--sw/source/core/txtnode/atrfld.cxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 8d4721ff23ff..79bf770b4e16 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -43,7 +43,7 @@
#include "calc.hxx" // Update fuer UserFields
#include "hints.hxx"
#include <IDocumentFieldsAccess.hxx>
-
+#include <fieldhint.hxx>
#include <svl/smplhint.hxx>
TYPEINIT3( SwFmtFld, SfxPoolItem, SwClient,SfxBroadcaster)
@@ -159,6 +159,29 @@ SfxPoolItem* SwFmtFld::Clone( SfxItemPool* ) const
return new SwFmtFld( *this );
}
+void SwFmtFld::SwClientNotify( const SwModify&, const SfxHint& rHint )
+{
+ if( !pTxtAttr )
+ return;
+
+ const SwFieldHint* pHint = dynamic_cast<const SwFieldHint*>( &rHint );
+ if ( pHint )
+ {
+ // replace field content by text
+ SwPaM* pPaM = pHint->GetPaM();
+ SwDoc* pDoc = pPaM->GetDoc();
+ const SwTxtNode& rTxtNode = pTxtAttr->GetTxtNode();
+ pPaM->GetPoint()->nNode = rTxtNode;
+ pPaM->GetPoint()->nContent.Assign( (SwTxtNode*)&rTxtNode, *pTxtAttr->GetStart() );
+
+ String const aEntry( GetFld()->ExpandField( pDoc->IsClipBoard() ) );
+ pPaM->SetMark();
+ pPaM->Move( fnMoveForward );
+ pDoc->DeleteRange( *pPaM );
+ pDoc->InsertString( *pPaM, aEntry );
+ }
+}
+
void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
if( !pTxtAttr )