summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-03-16 11:28:29 +0100
committerMichael Stahl <mst@openoffice.org>2010-03-16 11:28:29 +0100
commitb0832f9ced2972f84f48d753554c1a5efc63d382 (patch)
tree088874bf269abc43664c996650cc7b49bee822b6 /sw/source/core
parent0c81e6d9550c35717e578cf8c622356400f3bed5 (diff)
odfmetadata4: #i109600#: refactor insertion of TOX:
SwDoc::InsertTableOf(): do not create a SwTOXBaseSection. SwNodes::InsertTextSection(): take SwTOXBase parameter. SwSectionNode ctor: if SwTOXBase is given, create SwTOXBaseSection. remove gross hack SwSectionNode::SetNewSection(). SwUnodo{Ins,Del}Section: adapt to store SwSection/SwTOXBase.
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/doc/docglbl.cxx24
-rw-r--r--sw/source/core/doc/doctxm.cxx61
-rw-r--r--sw/source/core/docnode/ndsect.cxx97
-rw-r--r--sw/source/core/edit/edsect.cxx4
-rw-r--r--sw/source/core/inc/doctxm.hxx2
-rw-r--r--sw/source/core/undo/unsect.cxx50
-rw-r--r--sw/source/core/unocore/unosect.cxx2
7 files changed, 106 insertions, 134 deletions
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index a67486c34ad8..e332675569b6 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -456,11 +456,15 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath,
SwNodeIndex aStartIdx(*pSttNd);
if (aEndIdx >= aStartIdx)
- pSectNd = GetNodes().InsertSection
- (aStartIdx, *pFmt, aSect, &aEndIdx, FALSE );
+ {
+ pSectNd = GetNodes().InsertTextSection(aStartIdx,
+ *pFmt, aSect, 0, &aEndIdx, false);
+ }
else
- pSectNd = GetNodes().InsertSection
- (aEndIdx, *pFmt, aSect, &aStartIdx, FALSE );
+ {
+ pSectNd = GetNodes().InsertTextSection(aEndIdx,
+ *pFmt, aSect, 0, &aStartIdx, false);
+ }
// <- #i26762#
pSectNd->GetSection().CreateLink( CREATE_CONNECT );
@@ -799,11 +803,15 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel )
SwNodeIndex aStartIdx(*pSttNd);
if (aEndIdx >= aStartIdx)
- pSectNd = GetNodes().InsertSection
- (aStartIdx, *pFmt, aSect, &aEndIdx, FALSE );
+ {
+ pSectNd = GetNodes().InsertTextSection(aStartIdx,
+ *pFmt, aSect, 0, &aEndIdx, false);
+ }
else
- pSectNd = GetNodes().InsertSection
- (aEndIdx, *pFmt, aSect, &aStartIdx, FALSE );
+ {
+ pSectNd = GetNodes().InsertTextSection(aEndIdx,
+ *pFmt, aSect, 0, &aStartIdx, false);
+ }
pSectNd->GetSection().CreateLink( CREATE_CONNECT );
}
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 0f095068a991..13aaf3c1c1a0 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -366,26 +366,23 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
{
StartUndo( UNDO_INSTOX, NULL );
- SwTOXBaseSection* pNew = new SwTOXBaseSection( rTOX );
String sSectNm( rTOX.GetTOXName() );
sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), &sSectNm );
- pNew->SetTOXName(sSectNm);
- pNew->SwSection::SetName(sSectNm);
SwPaM aPam( rPos );
- SwSection* pSect = InsertSwSection( aPam, *pNew, pSet, false );
- if( pSect )
+ SwSection aSection( TOX_CONTENT_SECTION, sSectNm );
+ SwTOXBaseSection *const pNewSection = dynamic_cast<SwTOXBaseSection *>(
+ InsertSwSection( aPam, aSection, & rTOX, pSet, false ));
+ if (pNewSection)
{
- SwSectionNode* pSectNd = pSect->GetFmt()->GetSectionNode();
- SwSection* pCl = pNew;
- pSect->GetFmt()->Add( pCl );
- pSectNd->SetNewSection( pNew );
+ SwSectionNode *const pSectNd = pNewSection->GetFmt()->GetSectionNode();
+ pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
if( bExpand )
{
// OD 19.03.2003 #106329# - add value for 2nd parameter = true to
// indicate, that a creation of a new table of content has to be performed.
// Value of 1st parameter = default value.
- pNew->Update( 0, true );
+ pNewSection->Update( 0, true );
}
else if( 1 == rTOX.GetTitle().Len() && IsInReading() )
// insert title of TOX
@@ -396,7 +393,7 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
SwTxtNode* pHeadNd = GetNodes().MakeTxtNode( aIdx,
GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
- String sNm( pNew->GetTOXName() );
+ String sNm( pNewSection->GetTOXName() );
// ??Resource
sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
@@ -404,16 +401,14 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
SwNodeIndex aStt( *pHeadNd ); aIdx--;
SwSectionFmt* pSectFmt = MakeSectionFmt( 0 );
- GetNodes().InsertSection( aStt, *pSectFmt, aSect, &aIdx,
- TRUE, FALSE );
+ GetNodes().InsertTextSection(
+ aStt, *pSectFmt, aSect, 0, &aIdx, true, false);
}
}
- else
- delete pNew, pNew = 0;
EndUndo( UNDO_INSTOX, NULL );
- return pNew;
+ return pNewSection;
}
@@ -433,13 +428,10 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( ULONG nSttNd, ULONG nEndNd,
pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
}
- // create SectionNode around the Nodes
- SwTOXBaseSection* pNew = new SwTOXBaseSection( rTOX );
-
String sSectNm( rTOX.GetTOXName() );
sSectNm = GetUniqueTOXBaseName(*rTOX.GetTOXType(), &sSectNm);
- pNew->SetTOXName(sSectNm);
- pNew->SwSection::SetName(sSectNm);
+
+ SwSection aSection(TOX_CONTENT_SECTION, sSectNm);
SwNodeIndex aStt( GetNodes(), nSttNd ), aEnd( GetNodes(), nEndNd );
SwSectionFmt* pFmt = MakeSectionFmt( 0 );
@@ -448,20 +440,18 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( ULONG nSttNd, ULONG nEndNd,
// --aEnd; // im InsertSection ist Ende inclusive
- pSectNd = GetNodes().InsertSection( aStt, *pFmt, *pNew, &aEnd );
- if( pSectNd )
+ SwSectionNode *const pNewSectionNode =
+ GetNodes().InsertTextSection(aStt, *pFmt, aSection, &rTOX, &aEnd);
+ if (!pNewSectionNode)
{
- SwSection* pCl = pNew;
- pFmt->Add( pCl );
- pSectNd->SetNewSection( pNew );
- }
- else
- {
- delete pNew, pNew = 0;
DelSectionFmt( pFmt );
+ return 0;
}
- return pNew;
+ SwTOXBaseSection *const pNewSection(
+ dynamic_cast<SwTOXBaseSection*>(& pNewSectionNode->GetSection()));
+ pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
+ return pNewSection;
}
/*--------------------------------------------------------------------
@@ -776,8 +766,9 @@ const SwTxtNode* lcl_FindChapterNode( const SwNode& rNd, BYTE nLvl = 0 )
Beschreibung: Verzeichnis-Klasse
--------------------------------------------------------------------*/
-SwTOXBaseSection::SwTOXBaseSection( const SwTOXBase& rBase )
- : SwTOXBase( rBase ), SwSection( TOX_CONTENT_SECTION, aEmptyStr )
+SwTOXBaseSection::SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFmt & rFmt)
+ : SwTOXBase( rBase )
+ , SwSection( TOX_CONTENT_SECTION, aEmptyStr, & rFmt )
{
SetProtect( rBase.IsProtected() );
SwSection::SetName( GetTOXName() );
@@ -966,8 +957,8 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
SwNodeIndex aStt( *pHeadNd ); aIdx--;
SwSectionFmt* pSectFmt = pDoc->MakeSectionFmt( 0 );
- pDoc->GetNodes().InsertSection( aStt, *pSectFmt, aSect, &aIdx,
- TRUE, FALSE );
+ pDoc->GetNodes().InsertTextSection(
+ aStt, *pSectFmt, aSect, 0, &aIdx, true, false);
}
// jetzt waere ein prima Zeitpunkt, um die Numerierung zu updaten
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index acb0d6acd274..88203d87f10f 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -155,8 +155,10 @@ void lcl_CheckEmptyLayFrm( SwNodes& rNds, SwSection& rSect,
}
}
-SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
- const SfxItemSet* pAttr, bool bUpdate )
+SwSection *
+SwDoc::InsertSwSection(SwPaM const& rRange, SwSection const& rNew,
+ SwTOXBase const*const pTOXBase,
+ SfxItemSet const*const pAttr, bool const bUpdate)
{
const SwNode* pPrvNd = 0;
USHORT nRegionRet = 0;
@@ -186,7 +188,7 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
if( DoesUndo() )
{
ClearRedo();
- pUndoInsSect = new SwUndoInsSection( rRange, rNew, pAttr );
+ pUndoInsSect = new SwUndoInsSection(rRange, rNew, pAttr, pTOXBase);
AppendUndo( pUndoInsSect );
DoUndo( FALSE );
}
@@ -216,7 +218,8 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
aEnd++;
--aEnd; // im InsertSection ist Ende inclusive
- pNewSectNode = GetNodes().InsertSection( aStt, *pFmt, rNew, &aEnd );
+ pNewSectNode = GetNodes().InsertTextSection(
+ aStt, *pFmt, rNew, pTOXBase, & aEnd);
}
else
{
@@ -287,8 +290,8 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
pEndPos->nContent.Assign( pTNd, nCntnt );
}
}
- pNewSectNode = GetNodes().InsertSection( pSttPos->nNode, *pFmt, rNew,
- &pEndPos->nNode );
+ pNewSectNode = GetNodes().InsertTextSection(
+ pSttPos->nNode, *pFmt, rNew, pTOXBase, &pEndPos->nNode);
}
}
else
@@ -297,11 +300,13 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
const SwCntntNode* pCNd = pPos->nNode.GetNode().GetCntntNode();
if( !pPos->nContent.GetIndex() )
{
- pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, TRUE );
+ pNewSectNode = GetNodes().InsertTextSection(
+ pPos->nNode, *pFmt, rNew, pTOXBase, 0, true);
}
else if( pPos->nContent.GetIndex() == pCNd->Len() )
{
- pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, FALSE );
+ pNewSectNode = GetNodes().InsertTextSection(
+ pPos->nNode, *pFmt, rNew, pTOXBase, 0, false);
}
else
{
@@ -310,7 +315,8 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
pUndoInsSect->SaveSplitNode( (SwTxtNode*)pCNd, TRUE );
}
SplitNode( *pPos, false );
- pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, TRUE );
+ pNewSectNode = GetNodes().InsertTextSection(
+ pPos->nNode, *pFmt, rNew, pTOXBase, 0, true);
}
}
@@ -806,11 +812,12 @@ inline BOOL lcl_IsTOXSection( const SwSection& rSection )
TOX_HEADER_SECTION == rSection.GetType();
}
-SwSectionNode* SwNodes::InsertSection( const SwNodeIndex& rNdIdx,
+SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx,
SwSectionFmt& rSectionFmt,
const SwSection& rSection,
- const SwNodeIndex* pEnde,
- BOOL bInsAtStart, BOOL bCreateFrms )
+ SwTOXBase const*const pTOXBase,
+ SwNodeIndex const*const pEnde,
+ bool const bInsAtStart, bool const bCreateFrms)
{
SwNodeIndex aInsPos( rNdIdx );
if( !pEnde ) // kein Bereich also neue Section davor/hinter anlegen
@@ -841,7 +848,8 @@ SwSectionNode* SwNodes::InsertSection( const SwNodeIndex& rNdIdx,
}
}
- SwSectionNode* pSectNd = new SwSectionNode( aInsPos, rSectionFmt );
+ SwSectionNode *const pSectNd =
+ new SwSectionNode(aInsPos, rSectionFmt, pTOXBase);
if( pEnde )
{
// Sonderfall fuer die Reader/Writer
@@ -998,7 +1006,8 @@ SwSectionNode* SwNode::FindSectionNode()
// SwSectionNode
//---------
-SwSectionNode::SwSectionNode( const SwNodeIndex& rIdx, SwSectionFmt& rFmt )
+SwSectionNode::SwSectionNode(SwNodeIndex const& rIdx,
+ SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase)
: SwStartNode( rIdx, ND_SECTIONNODE )
{
SwSectionNode* pParent = StartOfSectionNode()->FindSectionNode();
@@ -1007,7 +1016,9 @@ SwSectionNode::SwSectionNode( const SwNodeIndex& rIdx, SwSectionFmt& rFmt )
// das Format beim richtigen Parent anmelden.
rFmt.SetDerivedFrom( pParent->GetSection().GetFmt() );
}
- pSection = new SwSection( CONTENT_SECTION, rFmt.GetName(), &rFmt );
+ pSection = (pTOXBase)
+ ? new SwTOXBaseSection(*pTOXBase, rFmt)
+ : new SwSection( CONTENT_SECTION, rFmt.GetName(), & rFmt );
// jetzt noch die Verbindung von Format zum Node setzen
// Modify unterdruecken, interresiert keinen
@@ -1083,32 +1094,6 @@ SwSectionNode::~SwSectionNode()
pDoc->DoUndo( bUndo );
}
-// setze ein neues SectionObject. Erstmal nur gedacht fuer die
-// neuen VerzeichnisSections. Der geht ueber in den Besitz des Nodes!
-void SwSectionNode::SetNewSection( SwSection* pNewSection )
-{
- ASSERT( pNewSection, "ohne Pointer geht hier nichts" );
- if( pNewSection )
- {
- SwNode2Layout aN2L( *this );
-
- // einige Flags sollten ueber nommen werden!
- pNewSection->bProtectFlag = pSection->bProtectFlag;
- pNewSection->bHiddenFlag = pSection->bHiddenFlag;
- pNewSection->bHidden = pSection->bHidden;
- pNewSection->bCondHiddenFlag = pSection->bCondHiddenFlag;
-
- // The section frame contains a pointer to the section. That for,
- // the frame must be destroyed before deleting the section.
- DelFrms();
-
- delete pSection;
- pSection = pNewSection;
-
- ULONG nIdx = GetIndex();
- aN2L.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 );
- }
-}
SwFrm *SwSectionNode::MakeFrm()
{
@@ -1299,37 +1284,31 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c
SwSectionFmt* pSectFmt = pDoc->MakeSectionFmt( 0 );
pSectFmt->CopyAttrs( *GetSection().GetFmt() );
- SwSectionNode* pSectNd = new SwSectionNode( rIdx, *pSectFmt );
+ ::std::auto_ptr<SwTOXBase> pTOXBase;
+ if (TOX_CONTENT_SECTION == GetSection().GetType())
+ {
+ ASSERT( GetSection().ISA( SwTOXBaseSection ), "no TOXBaseSection!" );
+ SwTOXBaseSection const& rTBS(
+ dynamic_cast<SwTOXBaseSection const&>(GetSection()));
+ pTOXBase.reset( new SwTOXBase(rTBS, pDoc) );
+ }
+
+ SwSectionNode *const pSectNd =
+ new SwSectionNode(rIdx, *pSectFmt, pTOXBase.get());
SwEndNode* pEndNd = new SwEndNode( rIdx, *pSectNd );
SwNodeIndex aInsPos( *pEndNd );
// Werte uebertragen
SwSection* pNewSect = pSectNd->pSection;
- switch( GetSection().GetType() )
+ if (TOX_CONTENT_SECTION != GetSection().GetType())
{
- case TOX_CONTENT_SECTION:
- {
- ASSERT( GetSection().ISA( SwTOXBaseSection ), "keine TOXBaseSection!" );
- SwTOXBaseSection& rTOXSect = (SwTOXBaseSection&)GetSection();
- SwTOXBase aTmp( rTOXSect, pDoc );
-
- SwTOXBaseSection* pNew = new SwTOXBaseSection( aTmp );
-
- pNewSect = pNew;
- pSectFmt->Add( pNewSect );
- pSectNd->SetNewSection( pNew );
- }
- break;
-
- default:
// beim Move den Namen beibehalten
if( rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() )
pNewSect->SetName( GetSection().GetName() );
else
pNewSect->SetName( pDoc->GetUniqueSectionName(
&GetSection().GetName() ) );
- break;
}
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 6ad8337e063a..0b0533b3e745 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -53,8 +53,8 @@ const SwSection* SwEditShell::InsertSection( const SwSection& rNew,
GetDoc()->StartUndo( UNDO_INSSECTION, NULL );
FOREACHPAM_START(this)
- const SwSection* const pNew =
- GetDoc()->InsertSwSection( *PCURCRSR, rNew, pAttr );
+ SwSection const*const pNew =
+ GetDoc()->InsertSwSection( *PCURCRSR, rNew, 0, pAttr );
if( !pRet )
pRet = pNew;
FOREACHPAM_END()
diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx
index 1372a82dbb6e..cb03e0531000 100644
--- a/sw/source/core/inc/doctxm.hxx
+++ b/sw/source/core/inc/doctxm.hxx
@@ -96,7 +96,7 @@ class SwTOXBaseSection : public SwTOXBase, public SwSection
SwTxtFmtColl* GetTxtFmtColl( USHORT nLevel );
public:
- SwTOXBaseSection( const SwTOXBase& rBase );
+ SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFmt & rFmt);
virtual ~SwTOXBaseSection();
// OD 19.03.2003 #106329# - add parameter <_bNewTOX> in order to distinguish
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index 9f5687a8edce..2651251d4cf4 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -74,18 +74,15 @@ SfxItemSet* lcl_GetAttrSet( const SwSection& rSect )
return pAttr;
}
-SwUndoInsSection::SwUndoInsSection( const SwPaM& rPam, const SwSection& rNew,
- const SfxItemSet* pSet )
- : SwUndo( UNDO_INSSECTION ), SwUndRng( rPam ),
- pHistory( 0 ), pRedlData( 0 ), pAttr( 0 ), nSectNodePos( 0 )
+SwUndoInsSection::SwUndoInsSection(
+ SwPaM const& rPam, SwSection const& rNew,
+ SfxItemSet const*const pSet, SwTOXBase const*const pTOXBase)
+ : SwUndo( UNDO_INSSECTION ), SwUndRng( rPam )
+ , pHistory( 0 )
+ , pSection(new SwSection(rNew.GetType(), rNew.GetName()))
+ , m_pTOXBase(pTOXBase ? new SwTOXBase(*pTOXBase) : 0)
+ , pRedlData( 0 ), pAttr( 0 ), nSectNodePos( 0 )
{
- if( rNew.ISA( SwTOXBaseSection ))
- {
- const SwTOXBase& rBase = (SwTOXBaseSection&)rNew;
- pSection = new SwTOXBaseSection( rBase );
- }
- else
- pSection = new SwSection( rNew.GetType(), rNew.GetName() );
*pSection = rNew;
SwDoc& rDoc = *(SwDoc*)rPam.GetDoc();
@@ -182,15 +179,15 @@ void SwUndoInsSection::Redo( SwUndoIter& rUndoIter )
SetPaM( rUndoIter );
const SwTOXBaseSection* pUpdateTOX = 0;
- if( pSection->ISA( SwTOXBaseSection ))
+ if (m_pTOXBase.get())
{
- const SwTOXBase& rBase = *(SwTOXBaseSection*)pSection;
pUpdateTOX = rDoc.InsertTableOf( *rUndoIter.pAktPam->GetPoint(),
- rBase, pAttr, TRUE );
+ *m_pTOXBase, pAttr, TRUE );
}
else
{
- rDoc.InsertSwSection( *rUndoIter.pAktPam, *pSection, pAttr, true );
+ rDoc.InsertSwSection(*rUndoIter.pAktPam,
+ *pSection, 0, pAttr, true);
}
if( pHistory )
@@ -228,16 +225,15 @@ void SwUndoInsSection::Redo( SwUndoIter& rUndoIter )
void SwUndoInsSection::Repeat( SwUndoIter& rUndoIter )
{
- if( pSection->ISA( SwTOXBaseSection ))
+ if (m_pTOXBase.get())
{
- const SwTOXBase& rBase = *(SwTOXBaseSection*)pSection;
rUndoIter.GetDoc().InsertTableOf( *rUndoIter.pAktPam->GetPoint(),
- rBase, pAttr, TRUE );
+ *m_pTOXBase, pAttr, TRUE );
}
else
{
rUndoIter.GetDoc().InsertSwSection( *rUndoIter.pAktPam,
- *pSection, pAttr );
+ *pSection, 0, pAttr);
}
}
@@ -287,11 +283,10 @@ SwUndoDelSection::SwUndoDelSection( const SwSectionFmt& rFmt )
const SwSection& rSect = *rFmt.GetSection();
if( rSect.ISA( SwTOXBaseSection ))
{
- const SwTOXBase& rBase = (SwTOXBaseSection&)rSect;
- pSection = new SwTOXBaseSection( rBase );
+ m_pTOXBase.reset(
+ new SwTOXBase(static_cast<SwTOXBaseSection const&>(rSect)) );
}
- else
- pSection = new SwSection( rSect.GetType(), rSect.GetName() );
+ pSection = new SwSection( rSect.GetType(), rSect.GetName() );
*pSection = rSect;
pAttr = ::lcl_GetAttrSet( rSect );
@@ -313,10 +308,9 @@ void SwUndoDelSection::Undo( SwUndoIter& rUndoIter )
{
SwDoc& rDoc = rUndoIter.GetDoc();
- if( pSection->ISA( SwTOXBaseSection ))
+ if (m_pTOXBase.get())
{
- const SwTOXBase& rBase = *(SwTOXBaseSection*)pSection;
- rDoc.InsertTableOf( nSttNd, nEndNd-2, rBase, pAttr );
+ rDoc.InsertTableOf( nSttNd, nEndNd-2, *m_pTOXBase, pAttr );
}
else
{
@@ -328,8 +322,8 @@ void SwUndoDelSection::Undo( SwUndoIter& rUndoIter )
/// OD 04.10.2002 #102894#
/// remember inserted section node for further calculations
- SwSectionNode* pInsertedSectNd =
- rDoc.GetNodes().InsertSection( aStt, *pFmt, *pSection, &aEnd );
+ SwSectionNode* pInsertedSectNd = rDoc.GetNodes().InsertTextSection(
+ aStt, *pFmt, *pSection, 0, & aEnd);
if( SFX_ITEM_SET == pFmt->GetItemState( RES_FTN_AT_TXTEND ) ||
SFX_ITEM_SET == pFmt->GetItemState( RES_END_AT_TXTEND ))
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 3dda0cebec28..fe8fe6d43431 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -431,7 +431,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
SwSection *const pRet =
- pDoc->InsertSwSection( aPam, aSect, aSet.Count() ? &aSet : 0 );
+ pDoc->InsertSwSection( aPam, aSect, 0, aSet.Count() ? &aSet : 0 );
pRet->GetFmt()->Add(m_pImpl.get());
pRet->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));