diff options
author | Michael Stahl <mst@openoffice.org> | 2010-03-16 11:28:35 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2010-03-16 11:28:35 +0100 |
commit | 114b920b0856f4b4acd79f8c288b93a6464161ea (patch) | |
tree | 6fb4dc6ce08d5a695930130bd0f3e100230c1211 /sw | |
parent | a396d6e9a01b9c1428118728c980fc75c1815b9e (diff) |
odfmetadata4: #i109599#,#i109600#: copy and undo for section xml:id.
SwSectionNode::MakeCopy(): copy xml:id.
SwUndoDelSection: store xml:id.
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/docnode/ndsect.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/undo/unsect.cxx | 11 |
2 files changed, 11 insertions, 3 deletions
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<SwSectionData> const m_pSectionData; /// section not TOX ::std::auto_ptr<SwTOXBase> const m_pTOXBase; /// set iff section is TOX ::std::auto_ptr<SfxItemSet> 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<SwTOXBaseSection const&>(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); } } |