if( rNewHead.IsActive() )
{
SwFrameFormat* pFormat = new SwFrameFormat( *rNewHead.GetHeaderFormat() ); // The Ctor of this object will remove the duplicate!
SwFormatHeader aFormatHeader(pFormat);
(void)aFormatHeader; if (!rNewDesc.IsHeaderShared())
{
pFormat = new SwFrameFormat( *rNewDesc.GetLeft().GetHeader().GetHeaderFormat() ); // The Ctor of this object will remove the duplicate!
SwFormatHeader aLeftHeader(pFormat);
(void)aLeftHeader;
} if (!rNewDesc.IsFirstShared())
{
pFormat = new SwFrameFormat( *rNewDesc.GetFirstMaster().GetHeader().GetHeaderFormat() ); // The Ctor of this object will remove the duplicate!
SwFormatHeader aFirstHeader(pFormat);
(void)aFirstHeader;
}
} // Same procedure for footers... if( rNewFoot.IsActive() )
{
SwFrameFormat* pFormat = new SwFrameFormat( *rNewFoot.GetFooterFormat() ); // The Ctor of this object will remove the duplicate!
SwFormatFooter aFormatFooter(pFormat);
(void)aFormatFooter; if (!rNewDesc.IsFooterShared())
{
pFormat = new SwFrameFormat( *rNewDesc.GetLeft().GetFooter().GetFooterFormat() ); // The Ctor of this object will remove the duplicate!
SwFormatFooter aLeftFooter(pFormat);
(void)aLeftFooter;
} if (!rNewDesc.IsFirstShared())
{
pFormat = new SwFrameFormat( *rNewDesc.GetFirstMaster().GetFooter().GetFooterFormat() ); // The Ctor of this object will remove the duplicate!
SwFormatFooter aFirstFooter(pFormat);
(void)aFirstFooter;
}
}
// After this exchange method the old page description will point to zero, // the new one will point to the node position of the original content nodes.
ExchangeContentNodes( m_aOld.m_PageDesc, m_aNew.m_PageDesc );
}
SwUndoPageDesc::~SwUndoPageDesc()
{
}
void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDest )
{
OSL_ENSURE( m_bExchange, "You shouldn't do that." ); const SwFormatHeader& rDestHead = rDest.GetMaster().GetHeader(); const SwFormatHeader& rSourceHead = rSource.GetMaster().GetHeader(); if( rDestHead.IsActive() )
{ // Let the destination page description point to the source node position, // from now on this descriptor is responsible for the content nodes! const SwFormatHeader* pItem = rDest.GetMaster().GetAttrSet().GetItemIfSet( RES_HEADER, false );
std::unique_ptr<SwFormatHeader> pNewItem(pItem->Clone());
SwFrameFormat* pNewFormat = pNewItem->GetHeaderFormat();
pNewFormat->SetFormatAttr( rSourceHead.GetHeaderFormat()->GetContent() );
// Let the source page description point to zero node position, // it loses the responsible and can be destroyed without removing the content nodes.
pItem = rSource.GetMaster().GetAttrSet().GetItemIfSet( RES_HEADER, false );
pNewItem.reset(pItem->Clone());
pNewFormat = pNewItem->GetHeaderFormat();
pNewFormat->SetFormatAttr( SwFormatContent() );
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.