summaryrefslogtreecommitdiff
path: root/sw/source/core/table/swtable.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/table/swtable.cxx')
-rw-r--r--sw/source/core/table/swtable.cxx70
1 files changed, 27 insertions, 43 deletions
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index e4fc3278d4e1..dacefa85268c 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -68,15 +69,11 @@
#include <list>
#include <switerator.hxx>
-#ifndef DBG_UTIL
-#define CHECK_TABLE(t)
-#else
-#ifdef DEBUG
+#if OSL_DEBUG_LEVEL > 1
#define CHECK_TABLE(t) (t).CheckConsistency();
#else
#define CHECK_TABLE(t)
#endif
-#endif
using namespace com::sun::star;
@@ -181,7 +178,7 @@ void SwTableBox::setDummyFlag( bool bDummy )
pImpl->setDummyFlag( bDummy );
}
-//JP 15.09.98: Bug 55741 - Tabs beibehalten (vorne und hinten)
+//JP 15.09.98: Bug 55741 - Keep tabs (front and rear)
String& lcl_TabToBlankAtSttEnd( String& rTxt )
{
sal_Unicode c;
@@ -215,12 +212,12 @@ void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd,
SwTableBox* pBox,
sal_uInt16 nInsPos, sal_uInt16 nCnt )
{
- ASSERT( pBox->GetSttNd(), "Box ohne Start-Node" );
+ OSL_ENSURE( pBox->GetSttNd(), "Box ohne Start-Node" );
SwNodeIndex aIdx( *pBox->GetSttNd(), +1 );
SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
if( !pCNd )
pCNd = pDoc->GetNodes().GoNext( &aIdx );
- ASSERT( pCNd, "Box ohne ContentNode" );
+ OSL_ENSURE( pCNd, "Box ohne ContentNode" );
if( pCNd->IsTxtNode() )
{
@@ -272,7 +269,7 @@ SwTable::SwTable( SwTableFmt* pFmt )
bModifyLocked( sal_False ),
bNewModel( sal_True )
{
- // default Wert aus den Optionen setzen
+ // default value set in the options
eTblChgMode = (TblChgMode)GetTblChgDefaultMode();
}
@@ -299,7 +296,7 @@ SwTable::~SwTable()
if( refObj.Is() )
{
SwDoc* pDoc = GetFrmFmt()->GetDoc();
- if( !pDoc->IsInDtor() ) // dann aus der Liste entfernen
+ if( !pDoc->IsInDtor() ) // then remove from the list
pDoc->GetLinkManager().RemoveServer( &refObj );
refObj->Closed();
@@ -397,7 +394,7 @@ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld,
}
}
else {
- ASSERT( false, "Rounding error" );
+ OSL_FAIL( "Rounding error" );
}
nSum += nBox;
}
@@ -427,7 +424,7 @@ void SwTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
{
if ( !IsModifyLocked() )
{
- ASSERT( pOldSize && pOldSize->Which() == RES_FRM_SIZE &&
+ OSL_ENSURE( pOldSize && pOldSize->Which() == RES_FRM_SIZE &&
pNewSize && pNewSize->Which() == RES_FRM_SIZE,
"Kein Old oder New fuer FmtFrmSize-Modify der SwTable." );
AdjustWidths( pOldSize->GetWidth(), pNewSize->GetWidth() );
@@ -460,7 +457,7 @@ void lcl_RefreshHidden( SwTabCols &rToFill, sal_uInt16 nPos )
void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox,
const SwFrmFmt *pTabFmt, const sal_Bool bHidden,
- const FASTBOOL bRefreshHidden )
+ const bool bRefreshHidden )
{
const long nWish = pTabFmt->GetFrmSize().GetWidth();
const long nAct = rToFill.GetRight() - rToFill.GetLeft(); // +1 why?
@@ -563,7 +560,7 @@ void lcl_SortedTabColInsert( SwTabCols &rToFill, const SwTableBox *pBox,
}
void lcl_ProcessBoxGet( const SwTableBox *pBox, SwTabCols &rToFill,
- const SwFrmFmt *pTabFmt, FASTBOOL bRefreshHidden )
+ const SwFrmFmt *pTabFmt, bool bRefreshHidden )
{
if ( pBox->GetTabLines().Count() )
{
@@ -605,7 +602,7 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart,
//Array aktualisiert.
if ( bRefreshHidden )
{
- //Korrekturen entfernen
+ // remove corrections
sal_uInt16 i;
for ( i = 0; i < rToFill.Count(); ++i )
{
@@ -708,7 +705,7 @@ struct Parm
SwShareBoxFmts aShareFmts;
Parm( const SwTabCols &rN, const SwTabCols &rO ) :
- rNew( rN ), rOld( rO ), aBoxArr( 10, 1 ) {}
+ rNew( rN ), rOld( rO ), nNewWish(0), nOldWish(0), aBoxArr( 10, 1 ){}
};
inline sal_Bool BoxInArr( SvPtrarr& rArr, SwTableBox* pBox )
{
@@ -813,11 +810,6 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm )
nRightDiff = (long)rParm.rNew[nLeftPos] -
(long)rParm.rOld[nLeftPos];
}
-//MA 11. Feb. 99: #61577# 0 sollte doch gerade richtig sein, weil die
-//Kante doch schon in SetTabCols() korrigiert wurde.
-// else
-// nRightDiff = (long)rParm.rNew.GetRight() -
-// (long)rParm.rOld.GetRight();
}
if( pBox->getRowSpan() == 1 )
@@ -919,8 +911,6 @@ void lcl_AdjustBox( SwTableBox *pBox, const long nDiff, Parm &rParm )
//Groesse der Box anpassen.
SwFmtFrmSize aFmtFrmSize( pBox->GetFrmFmt()->GetFrmSize() );
aFmtFrmSize.SetWidth( aFmtFrmSize.GetWidth() + nDiff );
-//#30009# if ( aFmtFrmSize.GetWidth() < 0 )
-// aFmtFrmSize.SetWidth( -aFmtFrmSize.GetWidth() );
rParm.aShareFmts.SetSize( *pBox, aFmtFrmSize );
}
@@ -938,7 +928,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld,
Parm aParm( rNew, rOld );
- ASSERT( rOld.Count() == rNew.Count(), "Columnanzahl veraendert.");
+ OSL_ENSURE( rOld.Count() == rNew.Count(), "Columnanzahl veraendert.");
//Raender verarbeiten. Groesse der Tabelle und ein paar Boxen mussen
//angepasst werden. Bei der Groesseneinstellung darf allerdings das
@@ -976,7 +966,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld,
else if(!bLeftDist && rNew.GetRight() + nShRight < rNew.GetRightMax())
aOri.SetHoriOrient( text::HoriOrientation::LEFT );
else
- aOri.SetHoriOrient( text::HoriOrientation::NONE );
+ aOri.SetHoriOrient( text::HoriOrientation::LEFT_AND_WIDTH );
}
pFmt->SetFmtAttr( aOri );
}
@@ -1073,7 +1063,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld,
}
}
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
{
// steht im tblrwcl.cxx
extern void _CheckBoxWidth( const SwTableLine&, SwTwips );
@@ -1180,7 +1170,7 @@ static void lcl_CalcNewWidths( std::list<sal_uInt16> &rSpanPos, ChangeList& rCha
sal_uInt16 nPos = (sal_uInt16)nSum;
while( pCurr != rChanges.end() && pCurr->first < nPos )
{
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
sal_uInt16 nTemp = pCurr->first;
nTemp = pCurr->second;
#endif
@@ -1280,7 +1270,7 @@ static void lcl_CalcNewWidths( std::list<sal_uInt16> &rSpanPos, ChangeList& rCha
void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew,
const SwTabCols &rOld, const SwTableBox *pStart, sal_Bool bCurRowOnly )
{
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
static int nCallCount = 0;
++nCallCount;
#endif
@@ -1497,7 +1487,7 @@ const SwTableBox* SwTable::GetTblBox( const String& rName,
// Box ist ??
if( pBox && !pBox->GetSttNd() )
{
- ASSERT( sal_False, "Box ohne Inhalt, suche die naechste !!" );
+ OSL_FAIL( "Box ohne Inhalt, suche die naechste !!" );
// "herunterfallen lassen" bis zur ersten Box
while( pBox->GetTabLines().Count() )
pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0];
@@ -1742,7 +1732,7 @@ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwNodeIndex &rIdx,
// an der Table eintragen
const SwTableNode* pTblNd = pSttNd->FindTableNode();
- ASSERT( pTblNd, "in welcher Tabelle steht denn die Box?" );
+ OSL_ENSURE( pTblNd, "in welcher Tabelle steht denn die Box?" );
SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable().
GetTabSortBoxes();
SwTableBox* p = this; // error: &this
@@ -1760,7 +1750,7 @@ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwStartNode& rSttNd, SwTableL
// an der Table eintragen
const SwTableNode* pTblNd = pSttNd->FindTableNode();
- ASSERT( pTblNd, "in welcher Tabelle steht denn die Box?" );
+ OSL_ENSURE( pTblNd, "in welcher Tabelle steht denn die Box?" );
SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable().
GetTabSortBoxes();
SwTableBox* p = this; // error: &this
@@ -1774,7 +1764,7 @@ SwTableBox::~SwTableBox()
{
// an der Table austragen
const SwTableNode* pTblNd = pSttNd->FindTableNode();
- ASSERT( pTblNd, "in welcher Tabelle steht denn die Box?" );
+ OSL_ENSURE( pTblNd, "in welcher Tabelle steht denn die Box?" );
SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable().
GetTabSortBoxes();
SwTableBox *p = this; // error: &this
@@ -1972,7 +1962,7 @@ sal_Bool SwTableBox::IsInHeadline( const SwTable* pTbl ) const
return pTbl->GetTabLines()[ 0 ] == pLine;
}
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
sal_uLong SwTableBox::GetSttIdx() const
{
@@ -2316,7 +2306,7 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
SwTableBox* pBox = aIter.First();
if( pBox )
{
- ASSERT( !aIter.Next(), "keine Box oder mehrere am Format" );
+ OSL_ENSURE( !aIter.Next(), "keine Box oder mehrere am Format" );
sal_uLong nNewFmt;
if( pNewFmt )
@@ -2448,13 +2438,6 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
}
else if( bNewIsTxtFmt && nOldFmt != nNewFmt )
{
- // auf jedenfall muessen jetzt die Formeln/Values
- // geloescht werden!
- // LockModify();
- // ResetAttr( RES_BOXATR_FORMULA, RES_BOXATR_VALUE );
- // UnlockModify();
-
-
ChgNumToText( *pBox, nNewFmt );
}
}
@@ -2554,14 +2537,14 @@ sal_uLong SwTableBox::IsValidNumTxtNd( sal_Bool bCheckAttr ) const
{
const SwNode* pNode = pSttNd->GetNodes()[nIndex];
if( pNode->IsTableNode() )
- { /*return ULONG_MAX if the cell contains a table(in table)*/
+ {
pTextNode = 0;
break;
}
if( pNode->IsTxtNode() )
{
if( pTextNode )
- { /*return ULONG_MAX if the cell contains complex paragraphs*/
+ {
pTextNode = 0;
break;
}
@@ -2844,3 +2827,4 @@ void SwTableBox::ForgetFrmFmt()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file