summaryrefslogtreecommitdiff
path: root/sw/source/core/docnode/ndtbl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/docnode/ndtbl.cxx')
-rw-r--r--sw/source/core/docnode/ndtbl.cxx78
1 files changed, 20 insertions, 58 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 29ecd0ef79f4..5896792ee7c3 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -30,14 +30,11 @@
#include "precompiled_sw.hxx"
#include <com/sun/star/chart2/XChartDocument.hpp>
-
#include <hintids.hxx>
-
#include <editeng/lrspitem.hxx>
#include <editeng/brkitem.hxx>
#include <editeng/protitem.hxx>
#include <editeng/boxitem.hxx>
-// OD 06.08.2003 #i17174#
#include <editeng/shaditem.hxx>
#include <fmtfsize.hxx>
#include <fmtornt.hxx>
@@ -91,17 +88,13 @@
#include "docsh.hxx"
#include <tabcol.hxx>
#include <unochart.hxx>
-
#include <node.hxx>
#include <ndtxt.hxx>
-
#include <map>
#include <algorithm>
-// --> OD 2005-12-05 #i27138#
#include <rootfrm.hxx>
-// <--
#include <fldupde.hxx>
-
+#include <switerator.hxx>
#ifndef DBG_UTIL
#define CHECK_TABLE(t)
@@ -500,7 +493,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
}
SwTable * pNdTbl = &pTblNd->GetTable();
- pTableFmt->Add( pNdTbl ); // das Frame-Format setzen
+ pNdTbl->RegisterToFormat( *pTableFmt );
pNdTbl->SetRowsToRepeat( nRowsToRepeat );
pNdTbl->SetTableModel( bNewModel );
@@ -796,7 +789,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
//Orientation am Fmt der Table setzen
pTableFmt->SetFmtAttr( SwFmtHoriOrient( 0, eAdjust ) );
- pTableFmt->Add( pNdTbl ); // das Frame-Format setzen
+ pNdTbl->RegisterToFormat( *pTableFmt );
if( pTAFmt || ( rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) )
{
@@ -962,7 +955,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
// JP 28.10.96: vom 1. Node die Positionen des Trenners besorgen,
// damit die Boxen entsprechend eingestellt werden
- SwTxtFrmInfo aFInfo( (SwTxtFrm*)pTxtNd->GetFrm() );
+ SwTxtFrmInfo aFInfo( (SwTxtFrm*)pTxtNd->getLayoutFrm( pTxtNd->GetDoc()->GetCurrentLayout() ) );
if( aFInfo.IsOneLine() ) // nur dann sinnvoll!
{
const sal_Unicode* pTxt = pTxtNd->GetTxt().GetBuffer();
@@ -1154,10 +1147,6 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
if (bUndo)
{
-// GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE );
-// pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh, eAdjust, pTAFmt );
-// GetIDocumentUndoRedo().AppendUndo(pUndo);
-
// das Splitten vom TextNode nicht in die Undohistory aufnehmen
GetIDocumentUndoRedo().DoUndo(false);
}
@@ -1209,8 +1198,6 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
pLineFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ));
// die Tabelle bekommt USHRT_MAX als default SSize
pTableFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX ));
-// if( !(rInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT) )
-// pTableFmt->SetAttr( SwFmtLayoutSplit( sal_False ));
/* #106283# If the first node in the selection is a context node and if it
has an item FRAMEDIR set (no default) propagate the item to the
@@ -1233,13 +1220,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
SwTable * pNdTbl = &pTblNd->GetTable();
ASSERT( pNdTbl, "kein Tabellen-Node angelegt." )
- pTableFmt->Add( pNdTbl ); // das Frame-Format setzen
-
-// const sal_uInt16 nRowsToRepeat =
-// tabopts::HEADLINE == (rInsTblOpts.mnInsMode & tabopts::HEADLINE) ?
-// rInsTblOpts.mnRowsToRepeat :
-// 0;
-// pNdTbl->SetRowsToRepeat( nRowsToRepeat );
+ pNdTbl->RegisterToFormat( *pTableFmt );
sal_Bool bUseBoxFmt = sal_False;
if( !pBoxFmt->GetDepends() )
@@ -1249,28 +1230,11 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
bUseBoxFmt = sal_True;
pTableFmt->SetFmtAttr( pBoxFmt->GetFrmSize() );
delete pBoxFmt;
-// eAdjust = HORI_NONE;
}
- //Orientation am Fmt der Table setzen
-// pTableFmt->SetAttr( SwFmtHoriOrient( 0, eAdjust ) );
-// pTableFmt->Add( pNdTbl ); // das Frame-Format setzen
-
-
sal_uLong nIdx = pTblNd->GetIndex();
aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 );
- {
-// SwPaM& rTmp = (SwPaM&)rRange; // Point immer an den Anfang
-// rTmp.DeleteMark();
-// rTmp.GetPoint()->nNode = *pTblNd;
-// SwCntntNode* pCNd = GetNodes().GoNext( &rTmp.GetPoint()->nNode );
-// rTmp.GetPoint()->nContent.Assign( pCNd, 0 );
- }
-
-// if( pUndo )
-// GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE );
-
SetModified();
SetFieldsDirty( true, NULL, 0 );
return pNdTbl;
@@ -2472,14 +2436,14 @@ SwTableNode::~SwTableNode()
SwFrmFmt* pTblFmt = GetTable().GetFrmFmt();
SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
pTblFmt );
- pTblFmt->Modify( &aMsgHint, &aMsgHint );
+ pTblFmt->ModifyNotification( &aMsgHint, &aMsgHint );
DelFrms();
delete pTable;
}
-SwTabFrm *SwTableNode::MakeFrm()
+SwTabFrm *SwTableNode::MakeFrm( SwFrm* pSib )
{
- return new SwTabFrm( *pTable );
+ return new SwTabFrm( *pTable, pSib );
}
//Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
@@ -2501,7 +2465,7 @@ void SwTableNode::MakeFrms(const SwNodeIndex & rIdx )
while( 0 != (pFrm = aNode2Layout.NextFrm()) )
{
- pNew = pNode->MakeFrm();
+ pNew = pNode->MakeFrm( pFrm );
// wird ein Node vorher oder nachher mit Frames versehen
if ( bBefore )
// der neue liegt vor mir
@@ -2528,7 +2492,7 @@ void SwTableNode::MakeFrms( SwNodeIndex* pIdxBehind )
SwNode2Layout aNode2Layout( *pNd, GetIndex() );
while( 0 != (pUpper = aNode2Layout.UpperFrm( pFrm, *this )) )
{
- SwTabFrm* pNew = MakeFrm();
+ SwTabFrm* pNew = MakeFrm( pUpper );
pNew->Paste( pUpper, pFrm );
// --> OD 2005-12-01 #i27138#
// notify accessibility paragraphs objects about changed
@@ -2536,7 +2500,7 @@ void SwTableNode::MakeFrms( SwNodeIndex* pIdxBehind )
// Relation CONTENT_FLOWS_FROM for next paragraph will change
// and relation CONTENT_FLOWS_TO for previous paragraph will change.
{
- ViewShell* pViewShell( pNew->GetShell() );
+ ViewShell* pViewShell( pNew->getRootFrm()->GetCurrShell() );
if ( pViewShell && pViewShell->GetLayout() &&
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
@@ -2558,14 +2522,12 @@ void SwTableNode::DelFrms()
//Sie muessen etwas umstaendlich zerstort werden, damit die Master
//die Follows mit in's Grab nehmen.
- SwClientIter aIter( *(pTable->GetFrmFmt()) );
- SwClient *pLast = aIter.GoStart();
- while ( pLast )
+ SwIterator<SwTabFrm,SwFmt> aIter( *(pTable->GetFrmFmt()) );
+ SwTabFrm *pFrm = aIter.First();
+ while ( pFrm )
{
sal_Bool bAgain = sal_False;
- if ( pLast->IsA( TYPE(SwFrm) ) )
{
- SwTabFrm *pFrm = (SwTabFrm*)pLast;
if ( !pFrm->IsFollow() )
{
while ( pFrm->HasFollow() )
@@ -2576,7 +2538,7 @@ void SwTableNode::DelFrms()
// Relation CONTENT_FLOWS_FROM for current next paragraph will change
// and relation CONTENT_FLOWS_TO for current previous paragraph will change.
{
- ViewShell* pViewShell( pFrm->GetShell() );
+ ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() );
if ( pViewShell && pViewShell->GetLayout() &&
pViewShell->GetLayout()->IsAnyShellAccessible() )
{
@@ -2591,7 +2553,7 @@ void SwTableNode::DelFrms()
bAgain = sal_True;
}
}
- pLast = bAgain ? aIter.GoStart() : aIter++;
+ pFrm = bAgain ? aIter.First() : aIter.Next();
}
}
@@ -2631,7 +2593,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr,
if( pShCrsr )
aPt = pShCrsr->GetPtPos();
- const SwFrm* pTmpFrm = pCNd->GetFrm( &aPt, 0, sal_False );
+ const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
do {
pTmpFrm = pTmpFrm->GetUpper();
} while ( !pTmpFrm->IsCellFrm() );
@@ -2856,7 +2818,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly,
if( pShCrsr )
aPt = pShCrsr->GetPtPos();
- const SwFrm* pTmpFrm = pCNd->GetFrm( &aPt, 0, sal_False );
+ const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
do {
pTmpFrm = pTmpFrm->GetUpper();
} while ( !pTmpFrm->IsCellFrm() );
@@ -3065,7 +3027,7 @@ void SwDoc::SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet )
SwMsgPoolItem aChg( RES_TBLHEADLINECHG );
rTable.SetRowsToRepeat( nSet );
- rTable.GetFrmFmt()->Modify( &aChg, &aChg );
+ rTable.GetFrmFmt()->ModifyNotification( &aChg, &aChg );
SetModified();
}
@@ -3592,7 +3554,7 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter,
pOldTblFmt->GetDoc()->GetDfltFrmFmt() );
*pNewTblFmt = *pOldTblFmt;
- pNewTblFmt->Add( &pNewTblNd->GetTable() );
+ pNewTblNd->GetTable().RegisterToFormat( *pNewTblFmt );
// neue Size errechnen ? (lcl_ChgTblSize nur das 2. aufrufen, wenn es
// beim 1. schon geklappt hat; also absolute Groesse hat)