From 114b920b0856f4b4acd79f8c288b93a6464161ea Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 16 Mar 2010 11:28:35 +0100 Subject: odfmetadata4: #i109599#,#i109600#: copy and undo for section xml:id. SwSectionNode::MakeCopy(): copy xml:id. SwUndoDelSection: store xml:id. --- sw/source/core/docnode/ndsect.cxx | 3 +++ sw/source/core/undo/unsect.cxx | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'sw/source/core') diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 004b2b20be60..306560272c6f 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -1371,6 +1371,9 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c pDoc->GetLinkManager().InsertServer( pNewSect->GetObject() ); } + // METADATA: copy xml:id; must be done after insertion of node + pSectFmt->RegisterAsCopyOf(*GetSection().GetFmt()); + return pSectNd; } diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 3a0fd3ca13f0..98d0e41d4616 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -293,11 +293,13 @@ private: ::std::auto_ptr const m_pSectionData; /// section not TOX ::std::auto_ptr const m_pTOXBase; /// set iff section is TOX ::std::auto_ptr const m_pAttrSet; + ::boost::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo; ULONG const m_nStartNode; ULONG const m_nEndNode; public: - SwUndoDelSection(SwSection const&, SwNodeIndex const*const); + SwUndoDelSection( + SwSectionFmt const&, SwSection const&, SwNodeIndex const*const); virtual ~SwUndoDelSection(); virtual void Undo( SwUndoIter& ); virtual void Redo( SwUndoIter& ); @@ -305,18 +307,20 @@ public: SW_DLLPRIVATE SwUndo * MakeUndoDelSection(SwSectionFmt const& rFormat) { - return new SwUndoDelSection(*rFormat.GetSection(), + return new SwUndoDelSection(rFormat, *rFormat.GetSection(), rFormat.GetCntnt().GetCntntIdx()); } SwUndoDelSection::SwUndoDelSection( - SwSection const& rSection, SwNodeIndex const*const pIndex) + SwSectionFmt const& rSectionFmt, SwSection const& rSection, + SwNodeIndex const*const pIndex) : SwUndo( UNDO_DELSECTION ) , m_pSectionData( new SwSectionData(rSection) ) , m_pTOXBase( rSection.ISA( SwTOXBaseSection ) ? new SwTOXBase(static_cast(rSection)) : 0 ) , m_pAttrSet( ::lcl_GetAttrSet(rSection) ) + , m_pMetadataUndo( rSectionFmt.CreateUndo() ) , m_nStartNode( pIndex->GetIndex() ) , m_nEndNode( pIndex->GetNode().EndOfSectionIndex() ) { @@ -375,6 +379,7 @@ void SwUndoDelSection::Undo( SwUndoIter& rUndoIter ) aInsertedSect.SetCondHidden( bRecalcCondHidden ); } + pFmt->RestoreMetadata(m_pMetadataUndo); } } -- cgit v1.2.3