[Libreoffice-commits] .: 11 commits - sw/inc sw/source
Michael Stahl
mst at kemper.freedesktop.org
Wed Nov 23 15:57:33 PST 2011
sw/inc/SwNumberTree.hxx | 17
sw/inc/crsrsh.hxx | 4
sw/inc/dbgoutsw.hxx | 4
sw/inc/doc.hxx | 6
sw/inc/fldbas.hxx | 2
sw/inc/hints.hxx | 2
sw/inc/index.hxx | 134 ++-
sw/inc/ndarr.hxx | 2
sw/inc/ndhints.hxx | 2
sw/inc/ndindex.hxx | 5
sw/inc/ndtxt.hxx | 2
sw/inc/node.hxx | 17
sw/inc/numrule.hxx | 5
sw/inc/pam.hxx | 2
sw/inc/swrect.hxx | 2
sw/inc/swtable.hxx | 23
sw/inc/viewopt.hxx | 64 -
sw/inc/viscrs.hxx | 19
sw/source/core/SwNumberTree/SwNumberTree.cxx | 24
sw/source/core/access/accmap.cxx | 20
sw/source/core/attr/calbck.cxx | 2
sw/source/core/attr/hints.cxx | 4
sw/source/core/attr/swatrset.cxx | 4
sw/source/core/bastyp/index.cxx | 403 +++++-------
sw/source/core/bastyp/init.cxx | 4
sw/source/core/bastyp/swcache.cxx | 108 +--
sw/source/core/bastyp/swrect.cxx | 8
sw/source/core/bastyp/tabcol.cxx | 2
sw/source/core/crsr/crsrsh.cxx | 29
sw/source/core/crsr/crstrvl.cxx | 8
sw/source/core/crsr/pam.cxx | 2
sw/source/core/crsr/trvltbl.cxx | 2
sw/source/core/crsr/viscrs.cxx | 23
sw/source/core/doc/acmplwrd.cxx | 22
sw/source/core/doc/dbgoutsw.cxx | 4
sw/source/core/doc/docbm.cxx | 4
sw/source/core/doc/docdraw.cxx | 2
sw/source/core/doc/docfld.cxx | 48 -
sw/source/core/doc/docfly.cxx | 2
sw/source/core/doc/doclay.cxx | 4
sw/source/core/doc/docnew.cxx | 2
sw/source/core/doc/docredln.cxx | 12
sw/source/core/doc/doctxm.cxx | 2
sw/source/core/doc/fmtcol.cxx | 2
sw/source/core/doc/htmltbl.cxx | 6
sw/source/core/doc/number.cxx | 11
sw/source/core/doc/tblrwcl.cxx | 10
sw/source/core/doc/visiturl.cxx | 5
sw/source/core/docnode/ndcopy.cxx | 4
sw/source/core/docnode/ndindex.cxx | 14
sw/source/core/docnode/ndnum.cxx | 2
sw/source/core/docnode/ndsect.cxx | 4
sw/source/core/docnode/ndtbl.cxx | 2
sw/source/core/docnode/node.cxx | 16
sw/source/core/docnode/nodedump.cxx | 4
sw/source/core/docnode/nodes.cxx | 6
sw/source/core/draw/dcontact.cxx | 4
sw/source/core/edit/autofmt.cxx | 2
sw/source/core/edit/eddel.cxx | 2
sw/source/core/edit/editsh.cxx | 29
sw/source/core/edit/ednumber.cxx | 4
sw/source/core/fields/authfld.cxx | 12
sw/source/core/fields/docufld.cxx | 9
sw/source/core/fields/fldbas.cxx | 6
sw/source/core/frmedt/fedesc.cxx | 2
sw/source/core/frmedt/fefly1.cxx | 6
sw/source/core/inc/MarkManager.hxx | 2
sw/source/core/inc/dbg_lay.hxx | 2
sw/source/core/inc/drawfont.hxx | 168 ++---
sw/source/core/inc/flyfrm.hxx | 2
sw/source/core/inc/fntcache.hxx | 5
sw/source/core/inc/frame.hxx | 9
sw/source/core/inc/ftnfrm.hxx | 4
sw/source/core/inc/layact.hxx | 6
sw/source/core/inc/laycache.hxx | 2
sw/source/core/inc/layfrm.hxx | 4
sw/source/core/inc/rootfrm.hxx | 7
sw/source/core/inc/scriptinfo.hxx | 2
sw/source/core/inc/swcache.hxx | 50 -
sw/source/core/inc/swfntcch.hxx | 4
sw/source/core/inc/swfont.hxx | 8
sw/source/core/inc/tblrwcl.hxx | 2
sw/source/core/inc/txtfrm.hxx | 7
sw/source/core/layout/atrfrm.cxx | 20
sw/source/core/layout/calcmove.cxx | 18
sw/source/core/layout/dbg_lay.cxx | 10
sw/source/core/layout/flowfrm.cxx | 2
sw/source/core/layout/fly.cxx | 2
sw/source/core/layout/flycnt.cxx | 2
sw/source/core/layout/flylay.cxx | 24
sw/source/core/layout/frmtool.cxx | 2
sw/source/core/layout/ftnfrm.cxx | 9
sw/source/core/layout/layact.cxx | 27
sw/source/core/layout/laycache.cxx | 2
sw/source/core/layout/newfrm.cxx | 4
sw/source/core/layout/objectformatter.cxx | 2
sw/source/core/layout/pagechg.cxx | 4
sw/source/core/layout/paintfrm.cxx | 4
sw/source/core/layout/sectfrm.cxx | 10
sw/source/core/layout/sortedobjsimpl.cxx | 4
sw/source/core/layout/ssfrm.cxx | 2
sw/source/core/layout/tabfrm.cxx | 6
sw/source/core/layout/trvlfrm.cxx | 7
sw/source/core/layout/unusedf.cxx | 2
sw/source/core/layout/virtoutp.cxx | 2
sw/source/core/layout/wsfrm.cxx | 8
sw/source/core/objectpositioning/anchoredobjectposition.cxx | 2
sw/source/core/table/swnewtable.cxx | 6
sw/source/core/table/swtable.cxx | 7
sw/source/core/text/frmcrsr.cxx | 11
sw/source/core/text/frmform.cxx | 8
sw/source/core/text/guess.cxx | 6
sw/source/core/text/inftxt.cxx | 16
sw/source/core/text/inftxt.hxx | 6
sw/source/core/text/itratr.cxx | 2
sw/source/core/text/itratr.hxx | 2
sw/source/core/text/itrtxt.cxx | 5
sw/source/core/text/porglue.cxx | 2
sw/source/core/text/porlay.cxx | 8
sw/source/core/text/porlay.hxx | 4
sw/source/core/text/porlin.cxx | 21
sw/source/core/text/porlin.hxx | 8
sw/source/core/text/porrst.cxx | 2
sw/source/core/text/txtfly.cxx | 10
sw/source/core/text/txtfly.hxx | 4
sw/source/core/text/txtfrm.cxx | 5
sw/source/core/text/txtftn.cxx | 8
sw/source/core/text/txtinit.cxx | 2
sw/source/core/text/txtio.cxx | 4
sw/source/core/text/txtpaint.cxx | 2
sw/source/core/text/txtpaint.hxx | 2
sw/source/core/text/txttab.cxx | 9
sw/source/core/text/wrong.cxx | 4
sw/source/core/tox/toxhlp.cxx | 24
sw/source/core/tox/txmsrt.cxx | 9
sw/source/core/txtnode/fntcache.cxx | 4
sw/source/core/txtnode/ndhints.cxx | 8
sw/source/core/txtnode/ndtxt.cxx | 6
sw/source/core/txtnode/swfont.cxx | 16
sw/source/core/txtnode/thints.cxx | 18
sw/source/core/txtnode/txtedt.cxx | 2
sw/source/core/undo/undobj.cxx | 12
sw/source/core/undo/untbl.cxx | 12
sw/source/core/unocore/unochart.cxx | 6
sw/source/core/unocore/unodraw.cxx | 2
sw/source/core/unocore/unofield.cxx | 4
sw/source/core/unocore/unotbl.cxx | 4
sw/source/core/unocore/unotext.cxx | 10
sw/source/core/view/vdraw.cxx | 4
sw/source/core/view/viewpg.cxx | 4
sw/source/core/view/viewsh.cxx | 4
sw/source/core/view/vprint.cxx | 2
sw/source/filter/html/htmlcss1.cxx | 11
sw/source/filter/html/htmlftn.cxx | 4
sw/source/filter/html/htmltab.cxx | 15
sw/source/filter/html/htmltabw.cxx | 6
sw/source/filter/html/swhtml.cxx | 38 -
sw/source/filter/html/swhtml.hxx | 4
sw/source/filter/inc/wrtswtbl.hxx | 4
sw/source/filter/rtf/rtfnum.cxx | 2
sw/source/filter/rtf/swparrtf.cxx | 4
sw/source/filter/writer/wrtswtbl.cxx | 46 -
sw/source/filter/ww1/fltshell.cxx | 18
sw/source/filter/ww1/w1filter.cxx | 12
sw/source/filter/ww1/w1sprm.cxx | 8
sw/source/filter/ww8/WW8Sttbf.cxx | 2
sw/source/filter/ww8/WW8TableInfo.cxx | 52 -
sw/source/filter/ww8/WW8TableInfo.hxx | 8
sw/source/filter/ww8/wrtw8esh.cxx | 2
sw/source/filter/ww8/wrtww8.cxx | 14
sw/source/filter/ww8/wrtww8gr.cxx | 4
sw/source/filter/ww8/ww8par2.cxx | 14
sw/source/filter/ww8/ww8par6.cxx | 14
sw/source/filter/xml/swxml.cxx | 10
sw/source/filter/xml/xmlfmte.cxx | 2
sw/source/filter/xml/xmlimp.cxx | 2
sw/source/filter/xml/xmltble.cxx | 21
sw/source/filter/xml/xmltbli.cxx | 4
sw/source/ui/app/apphdl.cxx | 6
sw/source/ui/app/docsh2.cxx | 10
sw/source/ui/app/docshini.cxx | 4
sw/source/ui/config/cfgitems.cxx | 2
sw/source/ui/config/optpage.cxx | 2
sw/source/ui/config/viewopt.cxx | 70 +-
sw/source/ui/dbui/dbinsdlg.cxx | 3
sw/source/ui/dialog/swdlgfact.cxx | 9
sw/source/ui/docvw/edtwin.cxx | 6
sw/source/ui/docvw/edtwin2.cxx | 4
sw/source/ui/envelp/labprt.cxx | 7
sw/source/ui/inc/cfgitems.hxx | 4
sw/source/ui/inc/num.hxx | 2
sw/source/ui/inc/optpage.hxx | 4
sw/source/ui/misc/docfnote.cxx | 2
sw/source/ui/misc/num.cxx | 3
sw/source/ui/misc/numberingtypelistbox.cxx | 2
sw/source/ui/shells/basesh.cxx | 4
sw/source/ui/shells/txtattr.cxx | 4
sw/source/ui/uiview/pview.cxx | 2
sw/source/ui/uno/unotxdoc.cxx | 2
sw/source/ui/wrtsh/select.cxx | 3
200 files changed, 1022 insertions(+), 1447 deletions(-)
New commits:
commit 0d2a6999fc320843e4db0c99d961414416a8451c
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 24 00:53:21 2011 +0100
SwIndex, SwIndexReg::~SwIndexReg: deploy assert()
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 49356c1..081f87e 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -29,6 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <assert.h>
#include <stdlib.h> // fuer qsort
#include <tools/solar.h>
@@ -72,7 +73,7 @@ void SwIndex::Init(xub_StrLen const nIdx)
}
else if (!m_pIndexReg->m_pFirst) // first Index?
{
- OSL_ASSERT(!m_pIndexReg->m_pLast);
+ assert(!m_pIndexReg->m_pLast);
m_pIndexReg->m_pFirst = m_pIndexReg->m_pLast = this;
m_nIndex = nIdx;
}
@@ -89,7 +90,7 @@ void SwIndex::Init(xub_StrLen const nIdx)
SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
{
- OSL_ASSERT(m_pIndexReg == rIdx.m_pIndexReg);
+ assert(m_pIndexReg == rIdx.m_pIndexReg);
if (!m_pIndexReg)
{
return *this; // no IndexReg => no list to sort into; m_nIndex is 0
@@ -164,7 +165,7 @@ void SwIndex::Remove()
{
if (!m_pIndexReg)
{
- OSL_ASSERT(!m_pPrev && !m_pNext);
+ assert(!m_pPrev && !m_pNext);
return;
}
@@ -193,7 +194,7 @@ void SwIndex::Remove()
SwIndex& SwIndex::operator=( const SwIndex& rIdx )
{
bool bEqual;
- if (rIdx.m_pIndexReg != m_pIndexReg) // im alten abmelden !!
+ if (rIdx.m_pIndexReg != m_pIndexReg) // unregister!
{
Remove();
m_pIndexReg = rIdx.m_pIndexReg;
@@ -234,7 +235,7 @@ SwIndexReg::SwIndexReg()
SwIndexReg::~SwIndexReg()
{
- OSL_ENSURE( !m_pFirst || !m_pLast, "There are still indices registered" );
+ assert(!m_pFirst && !m_pLast); // There are still indices registered
}
void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff,
@@ -360,8 +361,8 @@ xub_StrLen SwIndex::operator-=( const SwIndex & rIndex )
*************************************************************************/
bool SwIndex::operator< ( const SwIndex & rIndex ) const
{
- OSL_ENSURE( m_pIndexReg == rIndex.m_pIndexReg,
- "Attempt to compare indices into different arrays.");
+ // Attempt to compare indices into different arrays
+ assert(m_pIndexReg == rIndex.m_pIndexReg);
return m_nIndex < rIndex.m_nIndex;
}
@@ -370,8 +371,8 @@ bool SwIndex::operator< ( const SwIndex & rIndex ) const
*************************************************************************/
bool SwIndex::operator<=( const SwIndex & rIndex ) const
{
- OSL_ENSURE( m_pIndexReg == rIndex.m_pIndexReg,
- "Attempt to compare indices into different arrays.");
+ // Attempt to compare indices into different arrays
+ assert(m_pIndexReg == rIndex.m_pIndexReg);
return m_nIndex <= rIndex.m_nIndex;
}
@@ -380,8 +381,8 @@ bool SwIndex::operator<=( const SwIndex & rIndex ) const
*************************************************************************/
bool SwIndex::operator> ( const SwIndex & rIndex ) const
{
- OSL_ENSURE( m_pIndexReg == rIndex.m_pIndexReg,
- "Attempt to compare indices into different arrays.");
+ // Attempt to compare indices into different arrays
+ assert(m_pIndexReg == rIndex.m_pIndexReg);
return m_nIndex > rIndex.m_nIndex;
}
@@ -390,8 +391,8 @@ bool SwIndex::operator> ( const SwIndex & rIndex ) const
*************************************************************************/
bool SwIndex::operator>=( const SwIndex & rIndex ) const
{
- OSL_ENSURE( m_pIndexReg == rIndex.m_pIndexReg,
- "Attempt to compare indices into different arrays.");
+ // Attempt to compare indices into different arrays
+ assert(m_pIndexReg == rIndex.m_pIndexReg);
return m_nIndex >= rIndex.m_nIndex;
}
commit 555ff26501d1bbd8a7872c20671c6303db1e1701
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 24 00:52:44 2011 +0100
SwIndex: remove global EmptyIndexArray
diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index cecb7bc..ec5a980 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -145,9 +145,6 @@ public:
void MoveTo( SwIndexReg& rArr );
};
-// A global array for holding indices that need to be "swapped" temporarily or
-// do not know a valid array (SwPaM/SwPosition!):
-struct EmptyIndexArray: rtl::Static< SwIndexReg, EmptyIndexArray > {};
#ifndef DBG_UTIL
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index e287c53..49356c1 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -44,12 +44,6 @@ SwIndex::SwIndex(SwIndexReg *const pReg, xub_StrLen const nIdx)
, m_pNext( 0 )
, m_pPrev( 0 )
{
- if (!m_pIndexReg)
- {
- m_pIndexReg = &EmptyIndexArray::get();
- m_nIndex = 0; // always 0 if no IndexReg
- }
-
Init(m_nIndex);
}
@@ -72,7 +66,11 @@ SwIndex::SwIndex( const SwIndex& rIdx )
void SwIndex::Init(xub_StrLen const nIdx)
{
- if (!m_pIndexReg->m_pFirst) // first Index?
+ if (!m_pIndexReg)
+ {
+ m_nIndex = 0; // always 0 if no IndexReg
+ }
+ else if (!m_pIndexReg->m_pFirst) // first Index?
{
OSL_ASSERT(!m_pIndexReg->m_pLast);
m_pIndexReg->m_pFirst = m_pIndexReg->m_pLast = this;
@@ -91,6 +89,11 @@ void SwIndex::Init(xub_StrLen const nIdx)
SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
{
+ OSL_ASSERT(m_pIndexReg == rIdx.m_pIndexReg);
+ if (!m_pIndexReg)
+ {
+ return *this; // no IndexReg => no list to sort into; m_nIndex is 0
+ }
SwIndex* pFnd = const_cast<SwIndex*>(&rIdx);
if (rIdx.m_nIndex > nNewValue) // move forwards
{
@@ -146,7 +149,6 @@ SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
else
m_pNext->m_pPrev = this;
}
- m_pIndexReg = rIdx.m_pIndexReg;
if (m_pIndexReg->m_pFirst == m_pNext)
m_pIndexReg->m_pFirst = this;
@@ -160,6 +162,12 @@ SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
void SwIndex::Remove()
{
+ if (!m_pIndexReg)
+ {
+ OSL_ASSERT(!m_pPrev && !m_pNext);
+ return;
+ }
+
if (m_pPrev)
{
m_pPrev->m_pNext = m_pNext;
@@ -205,12 +213,6 @@ SwIndex& SwIndex::operator=( const SwIndex& rIdx )
*************************************************************************/
SwIndex& SwIndex::Assign( SwIndexReg* pArr, xub_StrLen nIdx )
{
- if( !pArr )
- {
- pArr = &EmptyIndexArray::get();
- nIdx = 0; // always 0 if no IndexReg
- }
-
if (pArr != m_pIndexReg) // unregister!
{
Remove();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 9600bb7..0618f1c 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3156,7 +3156,7 @@ const SwStartNode* lcl_NodeContext( const SwNode& rNode )
bool lcl_PosOk(const SwPosition & aPos)
{
return NULL != aPos.nNode.GetNode().GetCntntNode() &&
- &EmptyIndexArray::get() != aPos.nContent.GetIdxReg();
+ aPos.nContent.GetIdxReg();
}
/**
commit 9a4dc4178c86f2639a23089acb6055cc0ca0321f
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 24 00:52:12 2011 +0100
SwIndex: cleanup: add Init method
diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index b1f73f7..cecb7bc 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -61,6 +61,7 @@ private:
SwIndex * m_pPrev;
SwIndex& ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue );
+ void Init(xub_StrLen const nIdx);
void Remove();
public:
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 9461c4e..e287c53 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -50,19 +50,7 @@ SwIndex::SwIndex(SwIndexReg *const pReg, xub_StrLen const nIdx)
m_nIndex = 0; // always 0 if no IndexReg
}
- if (!m_pIndexReg->m_pFirst || !m_pIndexReg->m_pLast) // first Index?
- {
- m_pIndexReg->m_pFirst = m_pIndexReg->m_pLast = this;
- }
- else if (nIdx > ((m_pIndexReg->m_pLast->m_nIndex
- - m_pIndexReg->m_pFirst->m_nIndex) / 2))
- {
- ChgValue( *m_pIndexReg->m_pLast, nIdx );
- }
- else
- {
- ChgValue( *m_pIndexReg->m_pFirst, nIdx );
- }
+ Init(m_nIndex);
}
SwIndex::SwIndex( const SwIndex& rIdx, xub_StrLen const nDiff )
@@ -82,6 +70,25 @@ SwIndex::SwIndex( const SwIndex& rIdx )
ChgValue( rIdx, rIdx.m_nIndex );
}
+void SwIndex::Init(xub_StrLen const nIdx)
+{
+ if (!m_pIndexReg->m_pFirst) // first Index?
+ {
+ OSL_ASSERT(!m_pIndexReg->m_pLast);
+ m_pIndexReg->m_pFirst = m_pIndexReg->m_pLast = this;
+ m_nIndex = nIdx;
+ }
+ else if (nIdx > ((m_pIndexReg->m_pLast->m_nIndex
+ - m_pIndexReg->m_pFirst->m_nIndex) / 2))
+ {
+ ChgValue( *m_pIndexReg->m_pLast, nIdx );
+ }
+ else
+ {
+ ChgValue( *m_pIndexReg->m_pFirst, nIdx );
+ }
+}
+
SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
{
SwIndex* pFnd = const_cast<SwIndex*>(&rIdx);
@@ -209,20 +216,7 @@ SwIndex& SwIndex::Assign( SwIndexReg* pArr, xub_StrLen nIdx )
Remove();
m_pIndexReg = pArr;
m_pNext = m_pPrev = 0;
- if (!pArr->m_pFirst) // first index?
- {
- pArr->m_pFirst = pArr->m_pLast = this;
- m_nIndex = nIdx;
- }
- else if (pArr->m_pLast && (nIdx > ((pArr->m_pLast->m_nIndex
- - pArr->m_pFirst->m_nIndex) / 2)))
- {
- ChgValue( *pArr->m_pLast, nIdx );
- }
- else
- {
- ChgValue( *pArr->m_pFirst, nIdx );
- }
+ Init(nIdx);
}
else if (m_nIndex != nIdx)
ChgValue( *this, nIdx );
commit d43417b5474eab1a10c9529e3b02e930a53d4171
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 24 00:52:11 2011 +0100
SwIndex: clean up Remove duplication
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index fc795c4..9461c4e 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -94,15 +94,7 @@ SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
if( pFnd != this )
{
// remove from list at old position
- if (m_pPrev)
- m_pPrev->m_pNext = m_pNext;
- else if (m_pIndexReg->m_pFirst == this)
- m_pIndexReg->m_pFirst = m_pNext;
-
- if (m_pNext)
- m_pNext->m_pPrev = m_pPrev;
- else if (m_pIndexReg->m_pLast == this)
- m_pIndexReg->m_pLast = m_pPrev;
+ Remove();
m_pNext = pFnd;
m_pPrev = pFnd->m_pPrev;
@@ -122,15 +114,7 @@ SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
if( pFnd != this )
{
// remove from list at old position
- if (m_pPrev)
- m_pPrev->m_pNext = m_pNext;
- else if (m_pIndexReg->m_pFirst == this)
- m_pIndexReg->m_pFirst = m_pNext;
-
- if (m_pNext)
- m_pNext->m_pPrev = m_pPrev;
- else if (m_pIndexReg->m_pLast == this)
- m_pIndexReg->m_pLast = m_pPrev;
+ Remove();
m_pPrev = pFnd;
m_pNext = pFnd->m_pNext;
@@ -144,17 +128,9 @@ SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
else if( pFnd != this )
{
// remove from list at old position
- if (m_pPrev)
- m_pPrev->m_pNext = m_pNext;
- else if (m_pIndexReg->m_pFirst == this)
- m_pIndexReg->m_pFirst = m_pNext;
-
- if (m_pNext)
- m_pNext->m_pPrev = m_pPrev;
- else if (m_pIndexReg->m_pLast == this)
- m_pIndexReg->m_pLast = m_pPrev;
+ Remove();
- m_pPrev = const_cast<SwIndex*>(&rIdx);
+ m_pPrev = pFnd; // == &rIdx here
m_pNext = rIdx.m_pNext;
m_pPrev->m_pNext = this;
@@ -177,15 +153,23 @@ SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
void SwIndex::Remove()
{
- if (!m_pPrev)
- m_pIndexReg->m_pFirst = m_pNext;
- else
+ if (m_pPrev)
+ {
m_pPrev->m_pNext = m_pNext;
+ }
+ else if (m_pIndexReg->m_pFirst == this)
+ {
+ m_pIndexReg->m_pFirst = m_pNext;
+ }
- if (!m_pNext)
- m_pIndexReg->m_pLast = m_pPrev;
- else
+ if (m_pNext)
+ {
m_pNext->m_pPrev = m_pPrev;
+ }
+ else if (m_pIndexReg->m_pLast == this)
+ {
+ m_pIndexReg->m_pLast = m_pPrev;
+ }
}
/*************************************************************************
@@ -199,7 +183,7 @@ SwIndex& SwIndex::operator=( const SwIndex& rIdx )
Remove();
m_pIndexReg = rIdx.m_pIndexReg;
m_pNext = m_pPrev = 0;
- bEqual = sal_False;
+ bEqual = false;
}
else
bEqual = rIdx.m_nIndex == m_nIndex;
commit ff151e28334a8478fc073d292d1233f99ad45fd2
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 24 00:52:10 2011 +0100
SwIndex: style cleanup
diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index a20ad49..b1f73f7 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -25,8 +25,8 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _INDEX_HXX
-#define _INDEX_HXX
+#ifndef SW_INDEX_HXX
+#define SW_INDEX_HXX
#include <limits.h>
@@ -36,9 +36,9 @@
#include <tools/string.hxx> // for xub_StrLen
#include <swdllapi.h>
+// Maximum index in IndexArray (for testing on overflows).
#define INVALID_INDEX STRING_NOTFOUND
-// Maximal count of indices in IndexArray (for testing on overflows).
class SwIndex;
class SwIndexReg;
struct SwPosition;
@@ -51,11 +51,14 @@ struct SwPosition;
class SW_DLLPUBLIC SwIndex
{
+private:
friend class SwIndexReg;
- xub_StrLen nIndex;
- SwIndexReg* pArray;
- SwIndex *pNext, *pPrev;
+ xub_StrLen m_nIndex;
+ SwIndexReg * m_pIndexReg;
+ // doubly linked list of Indexes registered at m_pIndexReg
+ SwIndex * m_pNext;
+ SwIndex * m_pPrev;
SwIndex& ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue );
void Remove();
@@ -63,46 +66,53 @@ class SW_DLLPUBLIC SwIndex
public:
explicit SwIndex(SwIndexReg *const pReg, xub_StrLen const nIdx = 0);
SwIndex( const SwIndex & );
- SwIndex( const SwIndex &, short nDiff );
+ SwIndex( const SwIndex &, xub_StrLen const nDiff );
~SwIndex() { Remove(); }
+ INLINE SwIndex& operator=( xub_StrLen const );
+ SwIndex& operator=( const SwIndex & );
+
INLINE xub_StrLen operator++();
INLINE xub_StrLen operator--();
INLINE xub_StrLen operator++(int);
INLINE xub_StrLen operator--(int);
- INLINE xub_StrLen operator+=( xub_StrLen );
- INLINE xub_StrLen operator-=( xub_StrLen );
+ INLINE xub_StrLen operator+=( xub_StrLen const );
+ INLINE xub_StrLen operator-=( xub_StrLen const );
INLINE xub_StrLen operator+=( const SwIndex& );
INLINE xub_StrLen operator-=( const SwIndex& );
- INLINE sal_Bool operator<( const SwIndex& ) const;
- INLINE sal_Bool operator<=( const SwIndex& ) const;
- INLINE sal_Bool operator>( const SwIndex& ) const;
- INLINE sal_Bool operator>=( const SwIndex& ) const;
- sal_Bool operator==( const SwIndex& rSwIndex ) const
- { return (nIndex == rSwIndex.nIndex) && (pArray == rSwIndex.pArray); }
+ INLINE bool operator< ( const SwIndex& ) const;
+ INLINE bool operator<=( const SwIndex& ) const;
+ INLINE bool operator> ( const SwIndex& ) const;
+ INLINE bool operator>=( const SwIndex& ) const;
- sal_Bool operator!=( const SwIndex& rSwIndex ) const
- { return (nIndex != rSwIndex.nIndex) || (pArray != rSwIndex.pArray); }
+ bool operator< ( xub_StrLen const nVal ) const { return m_nIndex < nVal; }
+ bool operator<=( xub_StrLen const nVal ) const { return m_nIndex <= nVal; }
+ bool operator> ( xub_StrLen const nVal ) const { return m_nIndex > nVal; }
+ bool operator>=( xub_StrLen const nVal ) const { return m_nIndex >= nVal; }
+ bool operator==( xub_StrLen const nVal ) const { return m_nIndex == nVal; }
+ bool operator!=( xub_StrLen const nVal ) const { return m_nIndex != nVal; }
- sal_Bool operator<( xub_StrLen nWert ) const { return nIndex < nWert; }
- sal_Bool operator<=( xub_StrLen nWert ) const { return nIndex <= nWert; }
- sal_Bool operator>( xub_StrLen nWert ) const { return nIndex > nWert; }
- sal_Bool operator>=( xub_StrLen nWert ) const { return nIndex >= nWert; }
- sal_Bool operator==( xub_StrLen nWert ) const { return nIndex == nWert; }
- sal_Bool operator!=( xub_StrLen nWert ) const { return nIndex != nWert; }
+ bool operator==( const SwIndex& rSwIndex ) const
+ {
+ return (m_nIndex == rSwIndex.m_nIndex)
+ && (m_pIndexReg == rSwIndex.m_pIndexReg);
+ }
- INLINE SwIndex& operator=( xub_StrLen );
- SwIndex& operator=( const SwIndex & );
+ bool operator!=( const SwIndex& rSwIndex ) const
+ {
+ return (m_nIndex != rSwIndex.m_nIndex)
+ || (m_pIndexReg != rSwIndex.m_pIndexReg);
+ }
- xub_StrLen GetIndex() const { return nIndex; }
+ xub_StrLen GetIndex() const { return m_nIndex; }
// Assignments without creating a temporary object.
SwIndex &Assign(SwIndexReg *,xub_StrLen);
// Returns pointer to IndexArray (for RTTI at SwIndexReg).
- const SwIndexReg* GetIdxReg() const { return pArray; }
+ const SwIndexReg* GetIdxReg() const { return m_pIndexReg; }
};
#undef INLINE
@@ -112,7 +122,8 @@ class SwIndexReg
friend class SwIndex;
friend bool lcl_PosOk(const SwPosition & aPos);
- const SwIndex *pFirst, *pLast, *pMiddle;
+ const SwIndex * m_pFirst;
+ const SwIndex * m_pLast;
protected:
virtual void Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
@@ -120,10 +131,10 @@ protected:
void ChkArr();
- sal_Bool HasAnyIndex() const { return 0 != pFirst; }
+ bool HasAnyIndex() const { return 0 != m_pFirst; }
public:
- SwIndexReg();
+ explicit SwIndexReg();
virtual ~SwIndexReg();
// rtti, abgeleitete moegens gleichtun oder nicht. Wenn sie es gleichtun
@@ -141,62 +152,64 @@ struct EmptyIndexArray: rtl::Static< SwIndexReg, EmptyIndexArray > {};
inline xub_StrLen SwIndex::operator++()
{
- return ChgValue( *this, nIndex+1 ).nIndex;
+ return ChgValue( *this, m_nIndex+1 ).m_nIndex;
}
inline xub_StrLen SwIndex::operator--()
{
- return ChgValue( *this, nIndex-1 ).nIndex;
+ return ChgValue( *this, m_nIndex-1 ).m_nIndex;
}
inline xub_StrLen SwIndex::operator++(int)
{
- xub_StrLen nOldIndex = nIndex;
- ChgValue( *this, nIndex+1 );
+ xub_StrLen const nOldIndex = m_nIndex;
+ ChgValue( *this, m_nIndex+1 );
return nOldIndex;
}
inline xub_StrLen SwIndex::operator--(int)
{
- xub_StrLen nOldIndex = nIndex;
- ChgValue( *this, nIndex-1 );
+ xub_StrLen const nOldIndex = m_nIndex;
+ ChgValue( *this, m_nIndex-1 );
return nOldIndex;
}
-inline xub_StrLen SwIndex::operator+=( xub_StrLen nWert )
+inline xub_StrLen SwIndex::operator+=( xub_StrLen const nVal )
{
- return ChgValue( *this, nIndex + nWert ).nIndex;
+ return ChgValue( *this, m_nIndex + nVal ).m_nIndex;
}
-inline xub_StrLen SwIndex::operator-=( xub_StrLen nWert )
+inline xub_StrLen SwIndex::operator-=( xub_StrLen const nVal )
{
- return ChgValue( *this, nIndex - nWert ).nIndex;
+ return ChgValue( *this, m_nIndex - nVal ).m_nIndex;
}
-inline xub_StrLen SwIndex::operator+=( const SwIndex& rIndex )
+inline xub_StrLen SwIndex::operator+=( const SwIndex& rIndex )
{
- return ChgValue( *this, nIndex + rIndex.nIndex ).nIndex;
+ return ChgValue( *this, m_nIndex + rIndex.m_nIndex ).m_nIndex;
}
inline xub_StrLen SwIndex::operator-=( const SwIndex& rIndex )
{
- return ChgValue( *this, nIndex - rIndex.nIndex ).nIndex;
+ return ChgValue( *this, m_nIndex - rIndex.m_nIndex ).m_nIndex;
}
-inline sal_Bool SwIndex::operator<( const SwIndex& rIndex ) const
+inline bool SwIndex::operator< ( const SwIndex& rIndex ) const
{
- return nIndex < rIndex.nIndex;
+ return m_nIndex < rIndex.m_nIndex;
}
-inline sal_Bool SwIndex::operator<=( const SwIndex& rIndex ) const
+inline bool SwIndex::operator<=( const SwIndex& rIndex ) const
{
- return nIndex <= rIndex.nIndex;
+ return m_nIndex <= rIndex.m_nIndex;
}
-inline sal_Bool SwIndex::operator>( const SwIndex& rIndex ) const
+inline bool SwIndex::operator> ( const SwIndex& rIndex ) const
{
- return nIndex > rIndex.nIndex;
+ return m_nIndex > rIndex.m_nIndex;
}
-inline sal_Bool SwIndex::operator>=( const SwIndex& rIndex ) const
+inline bool SwIndex::operator>=( const SwIndex& rIndex ) const
{
- return nIndex >= rIndex.nIndex;
+ return m_nIndex >= rIndex.m_nIndex;
}
-inline SwIndex& SwIndex::operator=( xub_StrLen nWert )
+inline SwIndex& SwIndex::operator= ( xub_StrLen const nVal )
{
- if( nIndex != nWert )
- ChgValue( *this, nWert );
+ if (m_nIndex != nVal)
+ {
+ ChgValue( *this, nVal );
+ }
return *this;
}
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 95e7df1..fc795c4 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <stdlib.h> // fuer qsort
#include <tools/solar.h>
@@ -39,254 +38,263 @@
TYPEINIT0(SwIndexReg); // rtti
-SwIndex::SwIndex(SwIndexReg *const pArr, xub_StrLen const nIdx)
- : nIndex( nIdx ), pArray( pArr ), pNext( 0 ), pPrev( 0 )
+SwIndex::SwIndex(SwIndexReg *const pReg, xub_StrLen const nIdx)
+ : m_nIndex( nIdx )
+ , m_pIndexReg( pReg )
+ , m_pNext( 0 )
+ , m_pPrev( 0 )
{
- if( !pArray )
+ if (!m_pIndexReg)
{
- pArray = &EmptyIndexArray::get();
- nIndex = 0; // steht immer auf 0 !!!
+ m_pIndexReg = &EmptyIndexArray::get();
+ m_nIndex = 0; // always 0 if no IndexReg
}
- if( !pArray->pFirst || !pArray->pLast ) // 1. Index ??
- pArray->pFirst = pArray->pLast = this;
- else if( nIdx > ((pArray->pLast->nIndex - pArray->pFirst->nIndex) / 2) )
- ChgValue( *pArray->pLast, nIdx );
+ if (!m_pIndexReg->m_pFirst || !m_pIndexReg->m_pLast) // first Index?
+ {
+ m_pIndexReg->m_pFirst = m_pIndexReg->m_pLast = this;
+ }
+ else if (nIdx > ((m_pIndexReg->m_pLast->m_nIndex
+ - m_pIndexReg->m_pFirst->m_nIndex) / 2))
+ {
+ ChgValue( *m_pIndexReg->m_pLast, nIdx );
+ }
else
- ChgValue( *pArray->pFirst, nIdx );
+ {
+ ChgValue( *m_pIndexReg->m_pFirst, nIdx );
+ }
}
-
-SwIndex::SwIndex( const SwIndex& rIdx, short nIdx )
- : pArray( rIdx.pArray ), pNext( 0 ), pPrev( 0 )
+SwIndex::SwIndex( const SwIndex& rIdx, xub_StrLen const nDiff )
+ : m_pIndexReg( rIdx.m_pIndexReg )
+ , m_pNext( 0 )
+ , m_pPrev( 0 )
{
- ChgValue( rIdx, rIdx.nIndex + nIdx );
+ ChgValue( rIdx, rIdx.m_nIndex + nDiff );
}
-
SwIndex::SwIndex( const SwIndex& rIdx )
- : nIndex( rIdx.nIndex ), pArray( rIdx.pArray ), pNext( 0 ), pPrev( 0 )
+ : m_nIndex( rIdx.m_nIndex )
+ , m_pIndexReg( rIdx.m_pIndexReg )
+ , m_pNext( 0 )
+ , m_pPrev( 0 )
{
- ChgValue( rIdx, rIdx.nIndex );
+ ChgValue( rIdx, rIdx.m_nIndex );
}
-
SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
{
- SwIndex* pFnd = (SwIndex*)&rIdx;
- if( rIdx.nIndex > nNewValue ) // nach vorne versuchen
+ SwIndex* pFnd = const_cast<SwIndex*>(&rIdx);
+ if (rIdx.m_nIndex > nNewValue) // move forwards
{
SwIndex* pPrv;
- while( 0 != ( pPrv = pFnd->pPrev ) && pPrv->nIndex > nNewValue )
+ while ((0 != (pPrv = pFnd->m_pPrev)) && (pPrv->m_nIndex > nNewValue))
pFnd = pPrv;
if( pFnd != this )
{
- // an alter Position ausketten
- // erstmal an alter Position ausketten
- if( pPrev )
- pPrev->pNext = pNext;
- else if( pArray->pFirst == this )
- pArray->pFirst = pNext;
-
- if( pNext )
- pNext->pPrev = pPrev;
- else if( pArray->pLast == this )
- pArray->pLast = pPrev;
-
- pNext = pFnd;
- pPrev = pFnd->pPrev;
- if( pPrev )
- pPrev->pNext = this;
+ // remove from list at old position
+ if (m_pPrev)
+ m_pPrev->m_pNext = m_pNext;
+ else if (m_pIndexReg->m_pFirst == this)
+ m_pIndexReg->m_pFirst = m_pNext;
+
+ if (m_pNext)
+ m_pNext->m_pPrev = m_pPrev;
+ else if (m_pIndexReg->m_pLast == this)
+ m_pIndexReg->m_pLast = m_pPrev;
+
+ m_pNext = pFnd;
+ m_pPrev = pFnd->m_pPrev;
+ if (m_pPrev)
+ m_pPrev->m_pNext = this;
else
- pArray->pFirst = this;
- pFnd->pPrev = this;
+ m_pIndexReg->m_pFirst = this;
+ pFnd->m_pPrev = this;
}
}
- else if( rIdx.nIndex < nNewValue )
+ else if (rIdx.m_nIndex < nNewValue)
{
SwIndex* pNxt;
- while( 0 != ( pNxt = pFnd->pNext ) && pNxt->nIndex < nNewValue )
+ while ((0 != (pNxt = pFnd->m_pNext)) && (pNxt->m_nIndex < nNewValue))
pFnd = pNxt;
if( pFnd != this )
{
- // erstmal an alter Position ausketten
- if( pPrev )
- pPrev->pNext = pNext;
- else if( pArray->pFirst == this )
- pArray->pFirst = pNext;
-
- if( pNext )
- pNext->pPrev = pPrev;
- else if( pArray->pLast == this )
- pArray->pLast = pPrev;
-
- pPrev = pFnd;
- pNext = pFnd->pNext;
- if( pNext )
- pNext->pPrev = this;
+ // remove from list at old position
+ if (m_pPrev)
+ m_pPrev->m_pNext = m_pNext;
+ else if (m_pIndexReg->m_pFirst == this)
+ m_pIndexReg->m_pFirst = m_pNext;
+
+ if (m_pNext)
+ m_pNext->m_pPrev = m_pPrev;
+ else if (m_pIndexReg->m_pLast == this)
+ m_pIndexReg->m_pLast = m_pPrev;
+
+ m_pPrev = pFnd;
+ m_pNext = pFnd->m_pNext;
+ if (m_pNext)
+ m_pNext->m_pPrev = this;
else
- pArray->pLast = this;
- pFnd->pNext = this;
+ m_pIndexReg->m_pLast = this;
+ pFnd->m_pNext = this;
}
}
else if( pFnd != this )
{
- // erstmal an alter Position ausketten
- if( pPrev )
- pPrev->pNext = pNext;
- else if( pArray->pFirst == this )
- pArray->pFirst = pNext;
-
- if( pNext )
- pNext->pPrev = pPrev;
- else if( pArray->pLast == this )
- pArray->pLast = pPrev;
-
- pPrev = (SwIndex*)&rIdx;
- pNext = rIdx.pNext;
- pPrev->pNext = this;
-
- if( !pNext ) // im IndexArray als letzes
- pArray->pLast = this;
+ // remove from list at old position
+ if (m_pPrev)
+ m_pPrev->m_pNext = m_pNext;
+ else if (m_pIndexReg->m_pFirst == this)
+ m_pIndexReg->m_pFirst = m_pNext;
+
+ if (m_pNext)
+ m_pNext->m_pPrev = m_pPrev;
+ else if (m_pIndexReg->m_pLast == this)
+ m_pIndexReg->m_pLast = m_pPrev;
+
+ m_pPrev = const_cast<SwIndex*>(&rIdx);
+ m_pNext = rIdx.m_pNext;
+ m_pPrev->m_pNext = this;
+
+ if (!m_pNext) // last in the list
+ m_pIndexReg->m_pLast = this;
else
- pNext->pPrev = this;
+ m_pNext->m_pPrev = this;
}
- pArray = rIdx.pArray;
+ m_pIndexReg = rIdx.m_pIndexReg;
- if( pArray->pFirst == pNext )
- pArray->pFirst = this;
- if( pArray->pLast == pPrev )
- pArray->pLast = this;
+ if (m_pIndexReg->m_pFirst == m_pNext)
+ m_pIndexReg->m_pFirst = this;
+ if (m_pIndexReg->m_pLast == m_pPrev)
+ m_pIndexReg->m_pLast = this;
- nIndex = nNewValue;
-
- return *this; }
+ m_nIndex = nNewValue;
+ return *this;
+}
void SwIndex::Remove()
{
- if( !pPrev )
- pArray->pFirst = pNext;
+ if (!m_pPrev)
+ m_pIndexReg->m_pFirst = m_pNext;
else
- pPrev->pNext = pNext;
+ m_pPrev->m_pNext = m_pNext;
- if( !pNext )
- pArray->pLast = pPrev;
+ if (!m_pNext)
+ m_pIndexReg->m_pLast = m_pPrev;
else
- pNext->pPrev = pPrev;
+ m_pNext->m_pPrev = m_pPrev;
}
/*************************************************************************
|* SwIndex & SwIndex::operator=( const SwIndex & aSwIndex )
*************************************************************************/
-
-
SwIndex& SwIndex::operator=( const SwIndex& rIdx )
{
- int bEqual;
- if( rIdx.pArray != pArray ) // im alten abmelden !!
+ bool bEqual;
+ if (rIdx.m_pIndexReg != m_pIndexReg) // im alten abmelden !!
{
Remove();
- pArray = rIdx.pArray;
- pNext = pPrev = 0;
+ m_pIndexReg = rIdx.m_pIndexReg;
+ m_pNext = m_pPrev = 0;
bEqual = sal_False;
}
else
- bEqual = rIdx.nIndex == nIndex;
+ bEqual = rIdx.m_nIndex == m_nIndex;
if( !bEqual )
- ChgValue( rIdx, rIdx.nIndex );
+ ChgValue( rIdx, rIdx.m_nIndex );
return *this;
}
/*************************************************************************
|* SwIndex &SwIndex::Assign
*************************************************************************/
-
-
SwIndex& SwIndex::Assign( SwIndexReg* pArr, xub_StrLen nIdx )
{
if( !pArr )
{
pArr = &EmptyIndexArray::get();
- nIdx = 0; // steht immer auf 0 !!!
+ nIdx = 0; // always 0 if no IndexReg
}
- if( pArr != pArray ) // im alten abmelden !!
+ if (pArr != m_pIndexReg) // unregister!
{
Remove();
- pArray = pArr;
- pNext = pPrev = 0;
- if( !pArr->pFirst ) // 1. Index ??
+ m_pIndexReg = pArr;
+ m_pNext = m_pPrev = 0;
+ if (!pArr->m_pFirst) // first index?
+ {
+ pArr->m_pFirst = pArr->m_pLast = this;
+ m_nIndex = nIdx;
+ }
+ else if (pArr->m_pLast && (nIdx > ((pArr->m_pLast->m_nIndex
+ - pArr->m_pFirst->m_nIndex) / 2)))
{
- pArr->pFirst = pArr->pLast = this;
- nIndex = nIdx;
+ ChgValue( *pArr->m_pLast, nIdx );
}
- else if( pArr->pLast && (nIdx > ((pArr->pLast->nIndex - pArr->pFirst->nIndex) / 2)) )
- ChgValue( *pArr->pLast, nIdx );
else
- ChgValue( *pArr->pFirst, nIdx );
+ {
+ ChgValue( *pArr->m_pFirst, nIdx );
+ }
}
- else if( nIndex != nIdx )
+ else if (m_nIndex != nIdx)
ChgValue( *this, nIdx );
return *this;
}
+// SwIndexReg ///////////////////////////////////////////////////////
SwIndexReg::SwIndexReg()
- : pFirst( 0 ), pLast( 0 )
+ : m_pFirst( 0 ), m_pLast( 0 )
{
}
-
-
SwIndexReg::~SwIndexReg()
{
- OSL_ENSURE( !pFirst || !pLast, "There are still indices registered" );
+ OSL_ENSURE( !m_pFirst || !m_pLast, "There are still indices registered" );
}
-
-
void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff,
const bool bNeg, const bool /* argument is only used in derived class*/ )
{
SwIndex* pStt = const_cast<SwIndex*>(&rIdx);
- xub_StrLen nNewVal = rIdx.nIndex;
+ xub_StrLen nNewVal = rIdx.m_nIndex;
if( bNeg )
{
xub_StrLen nLast = rIdx.GetIndex() + nDiff;
- while( pStt && pStt->nIndex == nNewVal )
+ while (pStt && pStt->m_nIndex == nNewVal)
{
- pStt->nIndex = nNewVal;
- pStt = pStt->pPrev;
+ pStt->m_nIndex = nNewVal;
+ pStt = pStt->m_pPrev;
}
- pStt = rIdx.pNext;
- while( pStt && pStt->nIndex >= nNewVal &&
- pStt->nIndex <= nLast )
+ pStt = rIdx.m_pNext;
+ while (pStt && pStt->m_nIndex >= nNewVal
+ && pStt->m_nIndex <= nLast)
{
- pStt->nIndex = nNewVal;
- pStt = pStt->pNext;
+ pStt->m_nIndex = nNewVal;
+ pStt = pStt->m_pNext;
}
while( pStt )
{
- pStt->nIndex = pStt->nIndex - nDiff;
- pStt = pStt->pNext;
+ pStt->m_nIndex = pStt->m_nIndex - nDiff;
+ pStt = pStt->m_pNext;
}
}
else
{
- while( pStt && pStt->nIndex == nNewVal )
+ while (pStt && pStt->m_nIndex == nNewVal)
{
- pStt->nIndex = pStt->nIndex + nDiff;
- pStt = pStt->pPrev;
+ pStt->m_nIndex = pStt->m_nIndex + nDiff;
+ pStt = pStt->m_pPrev;
}
- pStt = rIdx.pNext;
+ pStt = rIdx.m_pNext;
while( pStt )
{
- pStt->nIndex = pStt->nIndex + nDiff;
- pStt = pStt->pNext;
+ pStt->m_nIndex = pStt->m_nIndex + nDiff;
+ pStt = pStt->m_pNext;
}
}
}
@@ -298,132 +306,122 @@ void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff,
*************************************************************************/
xub_StrLen SwIndex::operator++(int)
{
- OSL_ASSERT( nIndex < INVALID_INDEX );
+ OSL_ASSERT( m_nIndex < INVALID_INDEX );
- xub_StrLen nOldIndex = nIndex;
- ChgValue( *this, nIndex+1 );
+ xub_StrLen nOldIndex = m_nIndex;
+ ChgValue( *this, m_nIndex+1 );
return nOldIndex;
}
-
xub_StrLen SwIndex::operator++()
{
- OSL_ASSERT( nIndex < INVALID_INDEX );
+ OSL_ASSERT( m_nIndex < INVALID_INDEX );
- ChgValue( *this, nIndex+1 );
- return nIndex;
+ ChgValue( *this, m_nIndex+1 );
+ return m_nIndex;
}
/*************************************************************************
|* SwIndex::operator--()
*************************************************************************/
-
-
xub_StrLen SwIndex::operator--(int)
{
- OSL_ASSERT( nIndex );
+ OSL_ASSERT( m_nIndex );
- xub_StrLen nOldIndex = nIndex;
- ChgValue( *this, nIndex-1 );
+ xub_StrLen nOldIndex = m_nIndex;
+ ChgValue( *this, m_nIndex-1 );
return nOldIndex;
}
-
xub_StrLen SwIndex::operator--()
{
- OSL_ASSERT( nIndex );
- return ChgValue( *this, nIndex-1 ).nIndex;
+ OSL_ASSERT( m_nIndex );
+ return ChgValue( *this, m_nIndex-1 ).m_nIndex;
}
/*************************************************************************
|* SwIndex::operator+=( xub_StrLen )
*************************************************************************/
-
-xub_StrLen SwIndex::operator+=( xub_StrLen nWert )
+xub_StrLen SwIndex::operator+=( xub_StrLen const nVal )
{
- OSL_ASSERT( nIndex < INVALID_INDEX - nWert );
- return ChgValue( *this, nIndex + nWert ).nIndex;
+ OSL_ASSERT( m_nIndex < INVALID_INDEX - nVal );
+ return ChgValue( *this, m_nIndex + nVal ).m_nIndex;
}
/*************************************************************************
|* SwIndex::operator-=( xub_StrLen )
*************************************************************************/
-
-xub_StrLen SwIndex::operator-=( xub_StrLen nWert )
+xub_StrLen SwIndex::operator-=( xub_StrLen const nVal )
{
- OSL_ASSERT( nIndex >= nWert );
- return ChgValue( *this, nIndex - nWert ).nIndex;
+ OSL_ASSERT( m_nIndex >= nVal );
+ return ChgValue( *this, m_nIndex - nVal ).m_nIndex;
}
/*************************************************************************
|* SwIndex::operator+=( const SwIndex & )
*************************************************************************/
-
xub_StrLen SwIndex::operator+=( const SwIndex & rIndex )
{
- OSL_ASSERT( nIndex < INVALID_INDEX - rIndex.nIndex );
- return ChgValue( *this, nIndex + rIndex.nIndex ).nIndex;
+ OSL_ASSERT( m_nIndex < INVALID_INDEX - rIndex.m_nIndex );
+ return ChgValue( *this, m_nIndex + rIndex.m_nIndex ).m_nIndex;
}
/*************************************************************************
|* SwIndex::operator-=( const SwIndex & )
*************************************************************************/
-
xub_StrLen SwIndex::operator-=( const SwIndex & rIndex )
{
- OSL_ASSERT( nIndex >= rIndex.nIndex );
- return ChgValue( *this, nIndex - rIndex.nIndex ).nIndex;
+ OSL_ASSERT( m_nIndex >= rIndex.m_nIndex );
+ return ChgValue( *this, m_nIndex - rIndex.m_nIndex ).m_nIndex;
}
/*************************************************************************
|* SwIndex::operator<( const SwIndex & )
*************************************************************************/
-
-sal_Bool SwIndex::operator<( const SwIndex & rIndex ) const
+bool SwIndex::operator< ( const SwIndex & rIndex ) const
{
- OSL_ENSURE( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
- return nIndex < rIndex.nIndex;
+ OSL_ENSURE( m_pIndexReg == rIndex.m_pIndexReg,
+ "Attempt to compare indices into different arrays.");
+ return m_nIndex < rIndex.m_nIndex;
}
/*************************************************************************
|* SwIndex::operator<=( const SwIndex & )
*************************************************************************/
-
-sal_Bool SwIndex::operator<=( const SwIndex & rIndex ) const
+bool SwIndex::operator<=( const SwIndex & rIndex ) const
{
- OSL_ENSURE( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
- return nIndex <= rIndex.nIndex;
+ OSL_ENSURE( m_pIndexReg == rIndex.m_pIndexReg,
+ "Attempt to compare indices into different arrays.");
+ return m_nIndex <= rIndex.m_nIndex;
}
/*************************************************************************
|* SwIndex::operator>( const SwIndex & )
*************************************************************************/
-
-sal_Bool SwIndex::operator>( const SwIndex & rIndex ) const
+bool SwIndex::operator> ( const SwIndex & rIndex ) const
{
- OSL_ENSURE( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
- return nIndex > rIndex.nIndex;
+ OSL_ENSURE( m_pIndexReg == rIndex.m_pIndexReg,
+ "Attempt to compare indices into different arrays.");
+ return m_nIndex > rIndex.m_nIndex;
}
/*************************************************************************
|* SwIndex::operator>=( const SwIndex & )
*************************************************************************/
-
-sal_Bool SwIndex::operator>=( const SwIndex & rIndex ) const
+bool SwIndex::operator>=( const SwIndex & rIndex ) const
{
- OSL_ENSURE( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
- return nIndex >= rIndex.nIndex;
+ OSL_ENSURE( m_pIndexReg == rIndex.m_pIndexReg,
+ "Attempt to compare indices into different arrays.");
+ return m_nIndex >= rIndex.m_nIndex;
}
/*************************************************************************
|* SwIndex & SwIndex::operator=( xub_StrLen )
*************************************************************************/
-
-SwIndex& SwIndex::operator=( xub_StrLen nWert )
+SwIndex& SwIndex::operator= ( xub_StrLen const nVal )
{
- // Werte kopieren und im neuen Array anmelden
- if( nIndex != nWert )
- ChgValue( *this, nWert );
+ if (m_nIndex != nVal)
+ ChgValue( *this, nVal );
return *this;
}
@@ -432,16 +430,17 @@ SwIndex& SwIndex::operator=( xub_StrLen nWert )
void SwIndexReg::MoveTo( SwIndexReg& rArr )
{
- if( this != &rArr && pFirst )
+ if (this != &rArr && m_pFirst)
{
- SwIndex* pIdx = (SwIndex*)pFirst, *pNext;
+ SwIndex * pIdx = const_cast<SwIndex*>(m_pFirst);
+ SwIndex * pNext;
while( pIdx )
{
- pNext = pIdx->pNext;
+ pNext = pIdx->m_pNext;
pIdx->Assign( &rArr, pIdx->GetIndex() );
pIdx = pNext;
}
- pFirst = 0, pLast = 0;
+ m_pFirst = 0, m_pLast = 0;
}
}
commit ae64bf305155b40af138e490e524e34a74ba6ad7
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 24 00:52:09 2011 +0100
sw: remove debug instance counting
There are various classes that in DBG_UTIL mode count their instances
with a global variable, and give each instance a unique serial number.
The purpose of this exercise is somewhat unclear to me.
This removes the instance counting from:
SwNumberTree, SwIndex, SwNodeIndex, SwNumRule
diff --git a/sw/inc/SwNumberTree.hxx b/sw/inc/SwNumberTree.hxx
index 4775f20..b3c3b05 100644
--- a/sw/inc/SwNumberTree.hxx
+++ b/sw/inc/SwNumberTree.hxx
@@ -347,11 +347,6 @@ public:
*/
const SwNumberTreeNode* GetPrecedingNodeOf( const SwNumberTreeNode& rNode ) const;
-#ifdef DBG_UTIL
- static unsigned long GetInstances();
- unsigned long GetSerial();
-#endif
-
#ifdef __SW_NUMBER_TREE_SANITY_CHECK
/**
Sanity check.
@@ -450,18 +445,6 @@ protected:
*/
mutable tSwNumberTreeChildren::const_iterator mItLastValid;
-#ifdef DBG_UTIL
- /**
- Counter for the number of created instances.
- */
- static unsigned long s_nInstances;
-
- /**
- Serial number.
- */
- unsigned long m_nSerial;
-#endif
-
SwNumberTreeNode(const SwNumberTreeNode& );
SwNumberTreeNode& operator=( const SwNumberTreeNode& );
diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index 5c56fd5..a20ad49 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -53,11 +53,6 @@ class SW_DLLPUBLIC SwIndex
{
friend class SwIndexReg;
-#ifdef DBG_UTIL
- static int s_nSerial;
- int m_nSerial;
-#endif
-
xub_StrLen nIndex;
SwIndexReg* pArray;
SwIndex *pNext, *pPrev;
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index af1028b..566d180 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -44,11 +44,6 @@ class SW_DLLPUBLIC SwNodeIndex
friend void SwNodes::DeRegisterIndex( SwNodeIndex& );
friend void SwNodes::RemoveNode( sal_uLong, sal_uLong, sal_Bool );
-#ifdef DBG_UTIL
- static int s_nSerial;
- int m_nSerial;
-#endif
-
SwNode* pNd;
SwNodeIndex *pNext, *pPrev;
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index 35cbb4e..eb7d83a 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -115,11 +115,6 @@ public:
private:
friend void _FinitCore();
-#if DBG_UTIL
- long int m_nSerial;
- static long int s_nInstances;
-#endif
-
static SwNumFmt* aBaseFmts [ RULE_END ][ MAXLEVEL ];
static sal_uInt16 aDefNumIndents[ MAXLEVEL ];
// default list level properties for position-and-space mode LABEL_ALIGNMENT
diff --git a/sw/source/core/SwNumberTree/SwNumberTree.cxx b/sw/source/core/SwNumberTree/SwNumberTree.cxx
index b333eac..441f0f1 100644
--- a/sw/source/core/SwNumberTree/SwNumberTree.cxx
+++ b/sw/source/core/SwNumberTree/SwNumberTree.cxx
@@ -36,9 +36,6 @@
using std::vector;
using std::find;
-#ifdef DBG_UTIL
-unsigned long SwNumberTreeNode::s_nInstances = 0;
-#endif
SwNumberTreeNode::SwNumberTreeNode()
: mChildren(),
@@ -49,11 +46,6 @@ SwNumberTreeNode::SwNumberTreeNode()
mItLastValid()
{
mItLastValid = mChildren.end();
-
-#ifdef DBG_UTIL
- m_nSerial = s_nInstances;
- s_nInstances++;
-#endif
}
SwNumberTreeNode::~SwNumberTreeNode()
@@ -75,10 +67,6 @@ SwNumberTreeNode::~SwNumberTreeNode()
OSL_ENSURE( IsPhantom() || mpParent == NULL, ": I'm not supposed to have a parent.");
-#ifdef DBG_UTIL
- s_nInstances--;
-#endif
-
mpParent = (SwNumberTreeNode *) 0xdeadbeef;
OSL_ENSURE(mChildren.empty(), "children left!");
@@ -997,18 +985,6 @@ SwNumberTreeNode::GetIterator(const SwNumberTreeNode * pChild) const
return aItResult;
}
-#ifdef DBG_UTIL
-unsigned long SwNumberTreeNode::GetInstances()
-{
- return s_nInstances;
-}
-
-unsigned long SwNumberTreeNode::GetSerial()
-{
- return m_nSerial;
-}
-#endif
-
bool SwNumberTreeNodeLessThan(const SwNumberTreeNode * pA,
const SwNumberTreeNode * pB)
{
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 6dac54b..95e7df1 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -35,10 +35,6 @@
#include "index.hxx"
-#ifdef DBG_UTIL
-int SwIndex::s_nSerial = 0;
-#endif
-
TYPEINIT0(SwIndexReg); // rtti
@@ -58,10 +54,6 @@ SwIndex::SwIndex(SwIndexReg *const pArr, xub_StrLen const nIdx)
ChgValue( *pArray->pLast, nIdx );
else
ChgValue( *pArray->pFirst, nIdx );
-
-#ifdef DBG_UTIL
- m_nSerial = ++s_nSerial;
-#endif
}
@@ -69,10 +61,6 @@ SwIndex::SwIndex( const SwIndex& rIdx, short nIdx )
: pArray( rIdx.pArray ), pNext( 0 ), pPrev( 0 )
{
ChgValue( rIdx, rIdx.nIndex + nIdx );
-
-#ifdef DBG_UTIL
- m_nSerial = ++s_nSerial;
-#endif
}
@@ -80,9 +68,6 @@ SwIndex::SwIndex( const SwIndex& rIdx )
: nIndex( rIdx.nIndex ), pArray( rIdx.pArray ), pNext( 0 ), pPrev( 0 )
{
ChgValue( rIdx, rIdx.nIndex );
-#ifdef DBG_UTIL
- m_nSerial = ++s_nSerial;
-#endif
}
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 8f1d281..18195cc 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -387,9 +387,6 @@ const SwFmtVertOrient* SwNumFmt::GetGraphicOrientation() const
}
}
-#ifdef DBG_UTIL
-long int SwNumRule::s_nInstances = 0;
-#endif
// handle new parameter <eDefaultNumberFormatPositionAndSpaceMode>
SwNumRule::SwNumRule( const String& rNm,
@@ -412,10 +409,6 @@ SwNumRule::SwNumRule( const String& rNm,
meDefaultNumberFormatPositionAndSpaceMode( eDefaultNumberFormatPositionAndSpaceMode ),
msDefaultListId()
{
-#ifdef DBG_UTIL
- m_nSerial = s_nInstances++;
-#endif
-
if( !nRefCount++ ) // zum erstmal, also initialisiern
{
SwNumFmt* pFmt;
@@ -514,10 +507,6 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule )
meDefaultNumberFormatPositionAndSpaceMode( rNumRule.meDefaultNumberFormatPositionAndSpaceMode ),
msDefaultListId( rNumRule.msDefaultListId )
{
-#ifdef DBG_UTIL
- m_nSerial = s_nInstances++;
-#endif
-
++nRefCount;
memset( aFmts, 0, sizeof( aFmts ));
for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
diff --git a/sw/source/core/docnode/ndindex.cxx b/sw/source/core/docnode/ndindex.cxx
index fd86292..edf5b41 100644
--- a/sw/source/core/docnode/ndindex.cxx
+++ b/sw/source/core/docnode/ndindex.cxx
@@ -31,10 +31,6 @@
#include "ndindex.hxx"
-#ifdef DBG_UTIL
-int SwNodeIndex::s_nSerial = 0;
-#endif
-
SwNodeRange::SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE )
: aStart( rS ), aEnd( rE )
@@ -64,10 +60,6 @@ SwNodeIndex::SwNodeIndex( SwNodes& rNds, sal_uLong nIdx )
: pNd( rNds[ nIdx ] ), pNext( 0 ), pPrev( 0 )
{
rNds.RegisterIndex( *this );
-
-#ifdef DBG_UTIL
- m_nSerial = ++s_nSerial;
-#endif
}
@@ -80,9 +72,6 @@ SwNodeIndex::SwNodeIndex( const SwNodeIndex& rIdx, long nDiff )
pNd = rIdx.pNd;
pNd->GetNodes().RegisterIndex( *this );
-#ifdef DBG_UTIL
- m_nSerial = ++s_nSerial;
-#endif
}
@@ -95,9 +84,6 @@ SwNodeIndex::SwNodeIndex( const SwNode& rNd, long nDiff )
pNd = (SwNode*)&rNd;
pNd->GetNodes().RegisterIndex( *this );
-#ifdef DBG_UTIL
- m_nSerial = ++s_nSerial;
-#endif
}
commit 772063ba8ad6b18f609cdc7da02534c15b785965
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 24 00:52:09 2011 +0100
sw: remove some debugging cruft
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 797bf29..d331a8b 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -364,11 +364,6 @@ protected:
SwRect aFrm; //Absolute Dokumentposition und groesse des Frm
SwRect aPrt; //Position der PrtArea rel zum Frm und groesse der PrtArea
- sal_uInt16 bFlag01: 1;
- sal_uInt16 bFlag02: 1;
- sal_uInt16 bFlag03: 1;
- sal_uInt16 bFlag04: 1;
- sal_uInt16 bFlag05: 1;
sal_uInt16 bReverse: 1; // Next line above/at the right side instead
// under/at the left side of the previous line.
sal_uInt16 bInvalidR2L: 1;
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index df50676..bfe3188 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -103,10 +103,6 @@ SwFrm::SwFrm( SwModify *pMod, SwFrm* pSib ) :
bInfFtn ( sal_False ),
bInfSct ( sal_False )
{
-#if OSL_DEBUG_LEVEL > 1
- bFlag01 = bFlag02 = bFlag03 = bFlag04 = bFlag05 = 0;
-#endif
-
OSL_ENSURE( pMod, "Kein Frameformat uebergeben." );
bInvalidR2L = bInvalidVert = 1;
//Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 2d9099f..3658ca7 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -58,9 +58,6 @@
#include "swfntcch.hxx" // SwFontAccess
#include "flyfrm.hxx"
-#if OSL_DEBUG_LEVEL > 1
-#include "txtpaint.hxx"
-#endif
#define MIN_OFFSET_STEP 10
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index 93cba31..6d85b3b 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -45,10 +45,7 @@
#include "itrtxt.hxx"
#include "txtfrm.hxx"
#include "porfly.hxx"
-
-#if OSL_DEBUG_LEVEL > 1
-#include "txtfrm.hxx" // GetFrmID,
-#endif
+#include "txtfrm.hxx"
/*************************************************************************
* SwTxtIter::CtorInitTxtIter()
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index e64d0ef..43ecfc2 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -65,9 +65,6 @@ sal_Bool ChkChain( SwLinePortion *pStart )
}
#endif
-#if OSL_DEBUG_LEVEL > 1
-const sal_Char *GetPortionName( const MSHORT nType );
-#endif
SwLinePortion::~SwLinePortion()
{
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index f623df5..31fceb3 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -660,7 +660,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint,
}
}
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
if( !rNode.GetDoc()->IsInReading() )
CHECK;
#endif
@@ -2770,7 +2770,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode,
{
SwpHintsArray::Insert( pHint );
CalcFlags();
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
if( !rNode.GetDoc()->IsInReading() )
CHECK;
#endif
@@ -2862,7 +2862,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode,
rNode.ModifyNotification( 0, &aHint );
}
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
if( !bNoHintAdjustMode && !rNode.GetDoc()->IsInReading() )
CHECK;
#endif
diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx
index 0e4ff69..d466bcc 100755
--- a/sw/source/core/view/vdraw.cxx
+++ b/sw/source/core/view/vdraw.cxx
@@ -41,10 +41,6 @@
#include <svx/svdoutl.hxx>
-#if OSL_DEBUG_LEVEL > 1
-#include <svx/fmglob.hxx>
-#endif
-
#include "fesh.hxx"
#include "pagefrm.hxx"
#include "rootfrm.hxx"
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index 0f047c4..2668166 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -145,11 +145,9 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck,
pCNd = GetCntntNode(pDoc, rRegion.GetPoint()->nNode, sal_False);
}
rRegion.GetPoint()->nContent.Assign(pCNd, rPtPos.m_nCntnt);
-#if OSL_DEBUG_LEVEL > 1
OSL_ENSURE( CheckNodesRange( rRegion.Start()->nNode,
rRegion.End()->nNode, sal_True ),
- "Attribut oder AEhnliches ueber Bereichs-Grenzen" );
-#endif
+ "atttribute or similar crosses section-boundaries" );
if( bCheck )
return CheckNodesRange( rRegion.Start()->nNode,
rRegion.End()->nNode, sal_True );
@@ -433,11 +431,6 @@ static void MakeBookRegionOrPoint(const SwFltStackEntry& rEntry, SwDoc* pDoc,
}
}
-#if OSL_DEBUG_LEVEL > 1
-extern sal_Bool CheckNodesRange( const SwNodeIndex& rStt,
- const SwNodeIndex& rEnd, sal_Bool bChkSection );
-#endif
-
// IterateNumrulePiece() sucht von rTmpStart bis rEnd den ersten
// fuer Numrules gueltigen Bereich heraus.
//
diff --git a/sw/source/filter/ww1/w1sprm.cxx b/sw/source/filter/ww1/w1sprm.cxx
index 9df1168..dfcfdb4 100644
--- a/sw/source/filter/ww1/w1sprm.cxx
+++ b/sw/source/filter/ww1/w1sprm.cxx
@@ -249,14 +249,14 @@ void Ww1SingleSprmPBrc::Start(
Ww1Shell& rOut, sal_uInt8,
W1_BRC10* pBrc,
sal_uInt16
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
nSize
#endif
,
Ww1Manager& /*rMan*/,
SvxBoxItem& aBox)
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE(sizeof(W1_BRC10) == nSize, "sizemissmatch");
#endif
if(pBrc->dxpSpaceGet())
@@ -446,14 +446,14 @@ void Ww1SingleSprmPFInTable::Start(
void Ww1SingleSprmPFInTable::Stop(
Ww1Shell&
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
rOut
#endif
,
sal_uInt8, sal_uInt8*, sal_uInt16,
Ww1Manager& /*rMan*/)
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE(rOut.IsInTable(), "");
#endif
}
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 65dc01d..b1a617f 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2371,16 +2371,6 @@ void WW8Export::SectionBreaksAndFrames( const SwTxtNode& rNode )
OutWW6FlyFrmsInCntnt( rNode );
}
-#if OSL_DEBUG_LEVEL > 1
-struct SwNodeHash
-{
- size_t operator()(SwNode * pNode) const { return reinterpret_cast<size_t>(pNode); }
-};
-
-typedef ::boost::unordered_set<SwNode *, SwNodeHash> SwNodeHashSet;
-typedef ::std::deque<SwNode *> SwNodeDeque;
-#endif
-
void MSWordExportBase::WriteText()
{
while( pCurPam->GetPoint()->nNode < pCurPam->GetMark()->nNode ||
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 3310e6f..bac663d 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -29,10 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-#if OSL_DEBUG_LEVEL > 1
-#include <cstdio>
-#endif
-
#include <com/sun/star/embed/XEmbedPersist.hpp>
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx
index d8a5fb2..fa8810f 100644
--- a/sw/source/ui/app/docshini.cxx
+++ b/sw/source/ui/app/docshini.cxx
@@ -612,10 +612,6 @@ sal_Bool SwDocShell::Load( SfxMedium& rMedium )
pDoc->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true);
}
}
-#if OSL_DEBUG_LEVEL > 0
- else
- OSL_ENSURE( !this, "it won't do without Sw3Reader" );
-#endif
}
break;
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index 9583155..2ef9b02 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -52,9 +52,6 @@
#include <crsskip.hxx>
#include <wordcountdialog.hxx>
-#if OSL_DEBUG_LEVEL > 1
-#include <pam.hxx>
-#endif
namespace com { namespace sun { namespace star { namespace util {
struct SearchOptions;
commit 9ace8bebd88ff41d65eeaa87a6d1f1dfd8875b6d
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 24 00:52:07 2011 +0100
sw: enable more debug code:
Whole bunch of code is #if OSL_DEBUG_LEVEL > 1, reduce that to > 0 so more
assertions are active when building --enable-debug or --enable-dbgutil.
diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx
index f3111e0..f2b6208 100644
--- a/sw/inc/swrect.hxx
+++ b/sw/inc/swrect.hxx
@@ -154,8 +154,10 @@ public:
sal_Bool OverStepRight( long ) const;
};
+#ifdef DBG_UTIL
// Implementation in swrect.cxx
extern SvStream &operator<<( SvStream &rStream, const SwRect &rRect );
+#endif
typedef void (SwRect:: *SwRectSet)( const long nNew );
typedef long (SwRect:: *SwRectGet)() const;
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 0b1916c..44f6b40 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -95,12 +95,12 @@ class SwAccessibleContextMap_Impl: public _SwAccessibleContextMap_Impl
{
public:
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
sal_Bool mbLocked;
#endif
SwAccessibleContextMap_Impl()
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
: mbLocked( sal_False )
#endif
{}
@@ -185,7 +185,7 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/,
catch( uno::RuntimeException const & r )
{
(void)r;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
rtl::OStringBuffer aError(RTL_CONSTASCII_STRINGPARAM("Runtime exception caught while notifying shape.:\n"));
aError.append(rtl::OUStringToOString(r.Message, RTL_TEXTENCODING_ASCII_US));
OSL_FAIL( aError.getStr() );
@@ -218,11 +218,11 @@ class SwAccessibleShapeMap_Impl: public _SwAccessibleShapeMap_Impl
public:
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
sal_Bool mbLocked;
#endif
SwAccessibleShapeMap_Impl( SwAccessibleMap *pMap )
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
: mbLocked( sal_False )
#endif
{
@@ -1175,7 +1175,7 @@ SwAccessibleMap::~SwAccessibleMap()
{
osl::MutexGuard aGuard( maMutex );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( !mpFrmMap || mpFrmMap->empty(),
"Frame map should be empty after disposing the root frame" );
if( mpFrmMap )
@@ -1226,7 +1226,7 @@ SwAccessibleMap::~SwAccessibleMap()
{
osl::MutexGuard aGuard( maEventMutex );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( !(mpEvents || mpEventMap), "pending events" );
if( mpEvents )
{
@@ -1265,12 +1265,12 @@ uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView(
if( !mpFrmMap )
{
mpFrmMap = new SwAccessibleContextMap_Impl;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
mpFrmMap->mbLocked = sal_False;
#endif
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( !mpFrmMap->mbLocked, "Map is locked" );
mpFrmMap->mbLocked = sal_True;
#endif
@@ -1302,7 +1302,7 @@ uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView(
}
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
mpFrmMap->mbLocked = sal_False;
#endif
}
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 3508aef..1820f61 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -234,7 +234,7 @@ void SwModify::Add(SwClient *pDepend)
if(pDepend->pRegisteredIn != this )
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
SwClientIter* pTmp = pClientIters;
while( pTmp )
{
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index 8070941..7fe479f 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -172,7 +172,7 @@ SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const
* Ist keines vorhanden, returnt ein 0-Pointer !!!
* Used to be inlined (hintids.hxx) in PRODUCT.
******************************************************************************/
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
{
OSL_ASSERT( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN );
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index 558f5ba..0de9bf0 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -374,9 +374,9 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
pNewListIdItem = 0;
}
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
else
- OSL_ENSURE( !this, "weder Format noch ContentNode - keine Attribute kopiert");
+ OSL_FAIL("neither Format nor ContentNode - no Attributes copied");
#endif
}
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 72e6ec4..e827673 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -756,8 +756,8 @@ void _FinitCore()
delete SwEditShell::pAutoFmtFlags;
-#if OSL_DEBUG_LEVEL > 1
- //Defaultattribut freigeben lassen um asserts zu vermeiden.
+#if OSL_DEBUG_LEVEL > 0
+ // free defaults to prevent assertions
if ( aAttrTab[0]->GetRefCount() )
SfxItemPool::ReleaseDefaults( aAttrTab, POOLATTR_END-POOLATTR_BEGIN, sal_False);
#endif
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx
index 9f5a7b6..d54bf06 100644
--- a/sw/source/core/bastyp/swrect.cxx
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -29,8 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
#include <tools/stream.hxx>
#endif
#include <stdlib.h>
@@ -289,13 +288,10 @@ void SwRect::SetUpperRightCorner( const Point& rNew )
void SwRect::SetLowerLeftCorner( const Point& rNew )
{ m_Point = Point(rNew.nA, rNew.nB - m_Size.getHeight()); }
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
/*************************************************************************
* operator<<( ostream&, SwRect&)
*************************************************************************/
-
-
-
SvStream &operator<<( SvStream &rStream, const SwRect &rRect )
{
rStream << '[' << rRect.Top() << '/' << rRect.Left()
diff --git a/sw/source/core/bastyp/tabcol.cxx b/sw/source/core/bastyp/tabcol.cxx
index bf6a87d..c88d0c8 100644
--- a/sw/source/core/bastyp/tabcol.cxx
+++ b/sw/source/core/bastyp/tabcol.cxx
@@ -53,7 +53,7 @@ SwTabCols::SwTabCols( const SwTabCols& rCpy ) :
bLastRowAllowedToChange( rCpy.IsLastRowAllowedToChange() ),
aData( rCpy.GetData() )
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
for ( sal_uInt16 i = 0; i < Count(); ++i )
{
SwTabColsEntry aEntry1 = aData[i];
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 5377c7d..9600bb7 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1442,12 +1442,10 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd )
Point aCentrPt( aCharRect.Center() );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
pTblFrm->GetCrsrOfst( pTblCrsr->GetPoint(), aCentrPt, &aTmpState );
-#if OSL_DEBUG_LEVEL > 1
- if ( !pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() ) )
- OSL_ENSURE( !this, "GetCharRect failed." );
-#else
- pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() );
-#endif
+ bool const bResult =
+ pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() );
+ OSL_ENSURE( bResult, "GetCharRect failed." );
+ (void) bResult; // non-debug: unused
}
pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
@@ -1988,12 +1986,10 @@ void SwCrsrShell::Combine()
SwCrsrSaveState aSaveState( *pCurCrsr );
if( pCrsrStk->HasMark() ) // nur wenn GetMark gesetzt wurde
{
-#if OSL_DEBUG_LEVEL > 1
- if( !CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, sal_True ))
- OSL_ENSURE( !this, "StackCrsr & akt. Crsr nicht in gleicher Section." );
-#else
+ bool const bResult =
CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, sal_True );
-#endif
+ OSL_ENSURE(bResult, "StackCrsr & act. Crsr not in same Section.");
+ (void) bResult; // non-debug: unused
// kopiere das GetMark
if( !pCurCrsr->HasMark() )
pCurCrsr->SetMark();
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 04d9c38..4493f98 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1354,7 +1354,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) &&
0 != ( pBox = pTblNd->GetTable().GetTblBox(
pSttNd->GetIndex() )) &&
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
RES_BOXATR_FORMULA, sal_False, &pItem ) ||
SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index 24afa46..ac2506f 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -303,7 +303,7 @@ sal_Bool SwCrsrShell::SelTblBox()
const SwStartNode* pStartNode =
pCurCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
// the old code checks whether we're in a table by asking the
// frame. This should yield the same result as searching for the
// table box start node, right?
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index 063aeb6..d08398a 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -56,7 +56,7 @@ class SwAutoCompleteClient : public SwClient
{
SwAutoCompleteWord* pAutoCompleteWord;
SwDoc* pDoc;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
static sal_uLong nSwAutoCompleteClientCount;
#endif
public:
@@ -67,7 +67,7 @@ public:
SwAutoCompleteClient& operator=(const SwAutoCompleteClient& rClient);
const SwDoc& GetDoc(){return *pDoc;}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
static sal_uLong GetElementCount() {return nSwAutoCompleteClientCount;}
#endif
protected:
@@ -91,7 +91,7 @@ typedef const SwDoc* SwDocPtr;
typedef std::vector<SwDocPtr> SwDocPtrVector;
class SwAutoCompleteString : public String
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
static sal_uLong nSwAutoCompleteStringCount;
#endif
SwDocPtrVector aSourceDocs;
@@ -102,11 +102,11 @@ class SwAutoCompleteString : public String
void AddDocument(const SwDoc& rDoc);
//returns true if last document reference has been removed
sal_Bool RemoveDocument(const SwDoc& rDoc);
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
static sal_uLong GetElementCount() {return nSwAutoCompleteStringCount;}
#endif
};
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
sal_uLong SwAutoCompleteClient::nSwAutoCompleteClientCount = 0;
sal_uLong SwAutoCompleteString::nSwAutoCompleteStringCount = 0;
#endif
@@ -116,7 +116,7 @@ SwAutoCompleteClient::SwAutoCompleteClient(SwAutoCompleteWord& rToTell, SwDoc& r
pDoc(&rSwDoc)
{
pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
++nSwAutoCompleteClientCount;
#endif
}
@@ -127,14 +127,14 @@ SwAutoCompleteClient::SwAutoCompleteClient(const SwAutoCompleteClient& rClient)
pDoc(rClient.pDoc)
{
pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
++nSwAutoCompleteClientCount;
#endif
}
SwAutoCompleteClient::~SwAutoCompleteClient()
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
--nSwAutoCompleteClientCount;
#endif
}
@@ -191,14 +191,14 @@ void SwAutoCompleteWord_Impl::RemoveDocument(const SwDoc& rDoc)
SwAutoCompleteString::SwAutoCompleteString(const String& rStr, xub_StrLen nPos, xub_StrLen nLen) :
String( rStr, nPos, nLen )
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
++nSwAutoCompleteStringCount;
#endif
}
SwAutoCompleteString::~SwAutoCompleteString()
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
--nSwAutoCompleteStringCount;
#endif
}
@@ -247,7 +247,7 @@ SwAutoCompleteWord::~SwAutoCompleteWord()
delete pCurrent;
}
delete pImpl;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
sal_uLong nStrings = SwAutoCompleteString::GetElementCount();
sal_uLong nClients = SwAutoCompleteClient::GetElementCount();
OSL_ENSURE(!nStrings && !nClients, "AutoComplete: clients or string count mismatch");
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index f841246..8160c8d 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -777,7 +777,7 @@ namespace sw { namespace mark
m_vFieldmarks.clear();
m_vBookmarks.clear();
m_aMarkNamesSet.clear();
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
for(iterator_t pBkmk = m_vMarks.begin();
pBkmk != m_vMarks.end();
++pBkmk)
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index bf2dcbb..f3b02b4 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -241,7 +241,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj);
// #i53320#
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
SwAnchoredDrawObject* pAnchoredDrawObj =
static_cast<SwAnchoredDrawObject*>(pContact->GetAnchoredObj( pObj ));
OSL_ENSURE( bGroupMembersNotPositioned == pAnchoredDrawObj->NotYetPositioned(),
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index e5cd57e..130cb62 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -576,15 +576,13 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt )
pFld->CalcField( aPara );
if( aPara.IsStackOverFlow() )
{
- if( aPara.CalcWithStackOverflow() )
- pFld->CalcField( aPara );
-#if OSL_DEBUG_LEVEL > 1
- else
+ bool const bResult = aPara.CalcWithStackOverflow();
+ if (bResult)
{
- // at least one ASSERT
- OSL_ENSURE( !this, "the chained formula could no be calculated" );
+ pFld->CalcField( aPara );
}
-#endif
+ OSL_ENSURE(bResult,
+ "the chained formula could no be calculated");
}
pCalc->SetCalcError( CALC_NOERR );
}
@@ -645,15 +643,13 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt )
if( aPara.IsStackOverFlow() )
{
- if( aPara.CalcWithStackOverflow() )
- pFml->Calc( aPara, nValue );
-#if OSL_DEBUG_LEVEL > 1
- else
+ bool const bResult = aPara.CalcWithStackOverflow();
+ if (bResult)
{
- // at least one ASSERT
- OSL_ENSURE( !this, "the chained formula could no be calculated" );
+ pFml->Calc( aPara, nValue );
}
-#endif
+ OSL_ENSURE(bResult,
+ "the chained formula could no be calculated");
}
SwFrmFmt* pFmt = pBox->ClaimFrmFmt();
@@ -877,11 +873,9 @@ void _SetGetExpFld::SetBodyPos( const SwCntntFrm& rFrm )
SwNodeIndex aIdx( *rFrm.GetNode() );
SwDoc& rDoc = *aIdx.GetNodes().GetDoc();
SwPosition aPos( aIdx );
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE( ::GetBodyTxtNode( rDoc, aPos, rFrm ), "Where is the field?" );
-#else
- ::GetBodyTxtNode( rDoc, aPos, rFrm );
-#endif
+ bool const bResult = ::GetBodyTxtNode( rDoc, aPos, rFrm );
+ OSL_ENSURE(bResult, "Where is the field?");
+ (void) bResult; // unused in non-debug
nNode = aPos.nNode.GetIndex();
nCntnt = aPos.nContent.GetIndex();
}
@@ -2418,11 +2412,9 @@ void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, sal_uInt16 nFldWhich )
{
// create index to determine the TextNode
SwPosition aPos( rDoc.GetNodes().GetEndOfPostIts() );
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" );
-#else
- GetBodyTxtNode( rDoc, aPos, *pFrm );
-#endif
+ bool const bResult = GetBodyTxtNode( rDoc, aPos, *pFrm );
+ OSL_ENSURE(bResult, "where is the Field");
+ (void) bResult; // unused in non-debug
pNew = new _SetGetExpFld( aPos.nNode, &rTFld, &aPos.nContent );
}
@@ -2466,11 +2458,9 @@ void SwDocUpdtFld::GetBodyNode( const SwSectionNode& rSectNd )
if( !pFrm )
break;
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" );
-#else
- GetBodyTxtNode( rDoc, aPos, *pFrm );
-#endif
+ bool const bResult = GetBodyTxtNode( rDoc, aPos, *pFrm );
+ OSL_ENSURE(bResult, "where is the Field");
+ (void) bResult; // unused in non-debug
pNew = new _SetGetExpFld( rSectNd, &aPos );
} while( sal_False );
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index b39f329..b056841 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -636,7 +636,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
// Continue with next selected object and assert, if this isn't excepted.
if ( !pContact )
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
bool bNoUserCallExcepted =
pObj->ISA(SwDrawVirtObj) &&
!static_cast<SwDrawVirtObj*>(pObj)->IsConnected();
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 6ea2f5e..6057404 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -198,7 +198,7 @@ SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet )
}
break;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
case FLY_AT_PAGE:
case FLY_AT_CHAR:
case FLY_AT_FLY:
@@ -1658,7 +1658,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
SwTxtAttr * const pHnt =
pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
"Missing FlyInCnt-Hint." );
OSL_ENSURE( pHnt && ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 11c6e6c..072281f 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -254,7 +254,7 @@ inline bool IsPrevPos( const SwPosition rPos1, const SwPosition rPos2 )
: false;
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
bool CheckPosition( const SwPosition* pStt, const SwPosition* pEnd )
{
int nError = 0;
@@ -2716,7 +2716,7 @@ sal_Bool SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, sal_uInt16* pInsP
}
else
aNewStt = *pNew->GetPoint();
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
CheckPosition( pNew->GetPoint(), pNew->GetMark() );
#endif
if( *pNew->GetPoint() != *pNew->GetMark() &&
@@ -3674,10 +3674,10 @@ void SwRedline::SetContentIdx( const SwNodeIndex* pIdx )
delete pCntntSect, pCntntSect = 0;
bIsVisible = sal_False;
}
-#if OSL_DEBUG_LEVEL > 1
else
- OSL_ENSURE( !this, "das ist keine gueltige Operation" );
-#endif
+ {
+ OSL_FAIL("SwRedline::SetContentIdx: invalid state");
+ }
}
sal_Bool SwRedline::CanCombine( const SwRedline& rRedl ) const
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 68ff6b9..737ff12 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -2254,7 +2254,7 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
delete pNew;
return;
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
else
OSL_FAIL("Bibliography entries cannot be found here");
#endif
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 177460a..f785a3e 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -63,9 +63,7 @@ namespace TxtFmtCollFunc
SwTxtFmtColl* pTxtFmtColl = dynamic_cast<SwTxtFmtColl*>(pFmt);
if ( !pTxtFmtColl )
{
- #if OSL_DEBUG_LEVEL > 1
OSL_FAIL( "<TxtFmtCollFunc::CheckTxtFmtCollFuncForDeletionOfAssignmentToOutlineStyle> - misuse of method - it's only for instances of <SwTxtFmtColl>" );
- #endif
return;
}
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index c94736a..6a2838c 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -1582,13 +1582,13 @@ static sal_Bool lcl_ResizeBox( const SwTableBox*& rpBox, void* pPara )
static sal_Bool lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara )
{
sal_uInt16 *pWidth = (sal_uInt16 *)pPara;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
sal_uInt16 nOldWidth = *pWidth;
#endif
*pWidth = 0;
((SwTableLine *)rpLine)->GetTabBoxes().ForEach( &lcl_ResizeBox, pWidth );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( !nOldWidth || Abs(*pWidth-nOldWidth) < COLFUZZY,
"Zeilen einer Box sind unterschiedlich lang" );
#endif
@@ -1699,7 +1699,7 @@ void SwHTMLTableLayout::SetWidths( sal_Bool bCallPass2, sal_uInt16 nAbsAvail,
}
}
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
{
// steht im tblrwcl.cxx
extern void _CheckBoxWidth( const SwTableLine&, SwTwips );
diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx
index b269451..f501f69 100644
--- a/sw/source/core/doc/visiturl.cxx
+++ b/sw/source/core/doc/visiturl.cxx
@@ -107,11 +107,6 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint )
// angegeben ist. Dann muss der Doc. Name davor gesetzt werden!
sal_Bool SwDoc::IsVisitedURL( const String& rURL ) const
{
-#if OSL_DEBUG_LEVEL > 1
- static long nTmp = 0;
- ++nTmp;
-#endif
-
sal_Bool bRet = sal_False;
if( rURL.Len() )
{
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index ab489eb..267db0e 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -1340,7 +1340,7 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndConte
aRedlRest.Restore();
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
{
//JP 17.06.99: Bug 66973 - check count only if the selection is in
// the same (or no) section. Becaus not full selected
diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx
index 5cbce94..b4689d7 100644
--- a/sw/source/core/docnode/ndnum.cxx
+++ b/sw/source/core/docnode/ndnum.cxx
@@ -48,7 +48,7 @@ sal_Bool SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, sal_uInt16* pFndPos
//JP 17.03.98: aufgrund des Bug 48592 - wo unter anderem nach Undo/Redo
// Nodes aus dem falschen NodesArray im OutlineArray standen,
// jetzt mal einen Check eingebaut.
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
{
for( sal_uInt16 n = 1; n < nO; ++n )
if( &(*this)[ n-1 ]->GetNodes() !=
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 98ba0b5..28474df 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -390,11 +390,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
pFrmNd = rNds.GoPrevSection( &aFrmNdIdx, sal_True, sal_False );
if( pFrmNd && !((SwCntntNode*)pFrmNd)->GetDepends() )
pFrmNd = 0;
-
-#if OSL_DEBUG_LEVEL > 1
- if( !pFrmNd )
- OSL_ENSURE( !this, "ChgNode() - kein FrameNode gefunden" );
-#endif
+ OSL_ENSURE( pFrmNd, "ChgNode() - no FrameNode found" );
}
if( pFrmNd )
while( aIdx != rInsPos )
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 43bc062..cf43e81 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -820,9 +820,7 @@ void SwDrawContact::SetMaster( SdrObject* _pNewMaster )
{
if ( _pNewMaster )
{
-#if OSL_DEBUG_LEVEL > 1
OSL_FAIL( "debug notification - master replaced!" );
-#endif
maAnchoredDrawObj.SetDrawObj( *_pNewMaster );
}
else
@@ -1583,7 +1581,7 @@ void SwDrawContact::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
{
// nothing to do
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
else
{
OSL_FAIL( "<SwDrawContact::Modify(..)> - unhandled attribute? - please inform od at openoffice.org" );
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 503a1ca..2aed507 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -313,7 +313,7 @@ void SwAutoFormat::_SetRedlineTxt( sal_uInt16 nActionId )
break;
}
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
else
sTxt = String::CreateFromAscii(
RTL_CONSTASCII_STRINGPARAM( "Action-Text fehlt" ));
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 494f780..339b154 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -276,7 +276,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
pDestShell->GetCrsr()->SetMark();
pDestShell->GetCrsr()->DeleteMark();
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
// pruefe ob die Indizies auch in den richtigen Nodes angemeldet sind
{
SwPaM* pCmp = (SwPaM*)pDestShell->GetCrsr(); // sicher den Pointer auf Cursor
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 1cf8205..c1cfdd8 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -278,22 +278,18 @@ const Graphic* SwEditShell::GetGraphic( sal_Bool bWait ) const
if( pGrf->IsSwapOut() ||
( pGrfNode->IsLinkedFile() && GRAPHIC_DEFAULT == pGrf->GetType() ) )
{
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" );
-#else
- pGrfNode->SwapIn( bWait );
-#endif
+ bool const bResult = pGrfNode->SwapIn(bWait);
+ OSL_ENSURE(bResult || !bWait, "Graphic could not be loaded" );
+ (void) bResult; // unused in non-debug
}
}
else
{
if ( pGrf->IsSwapOut() && !pGrfNode->IsLinkedFile() )
{
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" );
-#else
- pGrfNode->SwapIn( bWait );
-#endif
+ bool const bResult = pGrfNode->SwapIn(bWait);
+ OSL_ENSURE(bResult || !bWait, "Graphic could not be loaded" );
+ (void) bResult; // unused in non-debug
}
}
}
@@ -688,15 +684,14 @@ Graphic SwEditShell::GetIMapGraphic() const
SwNode *pNd =pCrsr->GetNode();
if( pNd->IsGrfNode() )
{
- const Graphic& rGrf = ((SwGrfNode*)pNd)->GetGrf();
- if( rGrf.IsSwapOut() || ( ((SwGrfNode*)pNd)->IsLinkedFile() &&
+ SwGrfNode & rGrfNode(*static_cast<SwGrfNode*>(pNd));
+ const Graphic& rGrf = rGrfNode.GetGrf();
+ if( rGrf.IsSwapOut() || ( rGrfNode.IsLinkedFile() &&
GRAPHIC_DEFAULT == rGrf.GetType() ) )
{
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE( ((SwGrfNode*)pNd)->SwapIn( sal_True ), "Grafik konnte nicht geladen werden" );
-#else
- ((SwGrfNode*)pNd)->SwapIn( sal_True );
-#endif
+ bool const bResult = rGrfNode.SwapIn(true);
+ OSL_ENSURE(bResult, "Graphic could not be loaded" );
+ (void) bResult; // unused in non-debug
}
aRet = rGrf;
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 1dba53c..ab79e2d 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -564,10 +564,10 @@ sal_Bool SwEditShell::IsProtectedOutlinePara() const
}
}
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
else
{
- OSL_ENSURE(!this, "Cursor not on an outline node" );
+ OSL_FAIL("Cursor not on an outline node");
}
#endif
return bRet;
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 69d6ddc..40bfe24 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -130,7 +130,7 @@ SwFieldType* SwAuthorityFieldType::Copy() const
void SwAuthorityFieldType::RemoveField(long nHandle)
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
sal_Bool bRemoved = sal_False;
#endif
for(sal_uInt16 j = 0; j < m_pDataArr->Count(); j++)
@@ -139,7 +139,7 @@ void SwAuthorityFieldType::RemoveField(long nHandle)
long nRet = (long)(void*)pTemp;
if(nRet == nHandle)
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
bRemoved = sal_True;
#endif
pTemp->RemoveRef();
@@ -152,7 +152,7 @@ void SwAuthorityFieldType::RemoveField(long nHandle)
break;
}
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE(bRemoved, "Field unknown" );
#endif
}
@@ -307,7 +307,7 @@ long SwAuthorityFieldType::GetHandle(sal_uInt16 nPos)
sal_uInt16 SwAuthorityFieldType::GetSequencePos(long nHandle)
{
//find the field in a sorted array of handles,
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
sal_Bool bCurrentFieldWithoutTextNode = sal_False;
#endif
if(!m_SequArr.empty() && m_SequArr.size() != m_pDataArr->Count())
@@ -324,7 +324,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(long nHandle)
const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
if(!pTxtFld || !pTxtFld->GetpTxtNode())
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
if(nHandle == ((SwAuthorityField*)pFmtFld->GetFld())->GetHandle())
bCurrentFieldWithoutTextNode = sal_True;
#endif
@@ -396,7 +396,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(long nHandle)
break;
}
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE(bCurrentFieldWithoutTextNode || nRet, "Handle not found");
#endif
return nRet;
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index e86c803..2fce0d0 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2201,12 +2201,9 @@ sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst )
{
// einen sdbcx::Index fuers bestimmen vom TextNode anlegen
SwPosition aPos( pDoc->GetNodes().GetEndOfPostIts() );
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE( GetBodyTxtNode( *pDoc, aPos, *pFrm ),
- "wo steht das Feld" );
-#else
- GetBodyTxtNode( *pDoc, aPos, *pFrm );
-#endif
+ bool const bResult = GetBodyTxtNode( *pDoc, aPos, *pFrm );
+ OSL_ENSURE(bResult, "where is the Field?");
+ (void) bResult; // unused in non-debug
pNew = new _SetGetExpFld( aPos.nNode, pTFld,
&aPos.nContent );
}
diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx
index 28becd7..4fea328 100644
--- a/sw/source/core/frmedt/fedesc.cxx
+++ b/sw/source/core/frmedt/fedesc.cxx
@@ -64,7 +64,7 @@ sal_uInt16 SwFEShell::GetPageDescCnt() const
void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc )
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
//Die SS veraendert keinen PageDesc, sondern setzt nur das Attribut.
//Der Pagedesc muss im Dokument vorhanden sein!
sal_Bool bFound = sal_False;
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 94f0062..d3dcc0d 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -217,7 +217,7 @@ sal_Bool lcl_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet )
SwDoc* pDoc = (SwDoc*)rFmt.GetDoc();
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( !(nNew == FLY_AT_PAGE &&
(FLY_AT_PARA==nOld || FLY_AT_CHAR==nOld || FLY_AS_CHAR==nOld ) &&
pDoc->IsInHeaderFooter( rOldAnch.GetCntntAnchor()->nNode )),
@@ -581,7 +581,7 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, sal_Bool bMoveIt )
SwRect aTmpRect( aRet, rAbsPos );
if( aTmpRect.HasArea() )
MakeVisible( aTmpRect );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
//TODO: That doesn't seem to be intended
if( Color(COL_TRANSPARENT) != GetOut()->GetLineColor() )
{
@@ -2113,7 +2113,7 @@ void SwFEShell::SetObjDescription( const String& rDescription )
void SwFEShell::AlignFormulaToBaseline( const uno::Reference < embed::XEmbeddedObject >& xObj, SwFlyFrm * pFly )
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
SvGlobalName aCLSID( xObj->getClassID() );
const bool bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 );
OSL_ENSURE( bStarMath, "AlignFormulaToBaseline should only be called for Math objects" );
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 1e2d9ee..8858075 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -706,23 +706,19 @@ void SwFmtPageDesc::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
//mich also bei meinem Format aus.
//Dabei werden ich Deletet!!!
if( IS_TYPE( SwFmt, pDefinedIn ))
-#if OSL_DEBUG_LEVEL > 1
{
- sal_Bool bDel = ((SwFmt*)pDefinedIn)->ResetFmtAttr( RES_PAGEDESC );
- OSL_ENSURE( bDel, ";-) FmtPageDesc nicht zerstoert." );
+ bool const bResult =
+ static_cast<SwFmt*>(pDefinedIn)->ResetFmtAttr(RES_PAGEDESC);
+ OSL_ENSURE( bResult, "FmtPageDesc not deleted" );
+ (void) bResult; // unused in non-debug
}
-#else
- ((SwFmt*)pDefinedIn)->ResetFmtAttr( RES_PAGEDESC );
-#endif
else if( IS_TYPE( SwCntntNode, pDefinedIn ))
-#if OSL_DEBUG_LEVEL > 1
{
- sal_Bool bDel = ((SwCntntNode*)pDefinedIn)->ResetAttr( RES_PAGEDESC );
- OSL_ENSURE( bDel, ";-) FmtPageDesc nicht zerstoert." );
+ bool const bResult = static_cast<SwCntntNode*>(pDefinedIn)
+ ->ResetAttr(RES_PAGEDESC);
+ OSL_ENSURE( bResult, "FmtPageDesc not deleted" );
+ (void) bResult; // unused in non-debug
}
-#else
- ((SwCntntNode*)pDefinedIn)->ResetAttr( RES_PAGEDESC );
-#endif
break;
default:
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 66e8d96..1b25644 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -840,14 +840,8 @@ void SwPageFrm::MakeAll()
if ( Frm() != aOldRect && GetUpper() )
static_cast<SwRootFrm*>(GetUpper())->CheckViewLayout( 0, 0 );
-#if OSL_DEBUG_LEVEL > 1
- //Der Upper (Root) muss mindestens so breit
- //sein, dass er die breiteste Seite aufnehmen kann.
- if ( GetUpper() )
- {
- OSL_ENSURE( GetUpper()->Prt().Width() >= aFrm.Width(), "Rootsize" );
- }
-#endif
+ OSL_ENSURE( !GetUpper() || GetUpper()->Prt().Width() >= aFrm.Width(),
+ "Upper (Root) must be wide enough to contain the widest page");
}
/*************************************************************************
@@ -1434,7 +1428,7 @@ void SwCntntFrm::MakeAll()
{
Format();
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
else
{
OSL_FAIL( "debug assertion: <SwCntntFrm::MakeAll()> - format of text frame suppressed by fix b6448963" );
@@ -1682,7 +1676,7 @@ void SwCntntFrm::MakeAll()
( !bSct || !FindSctFrm()->IsColLocked() ) )
bMoveOrFit = sal_True;
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
else
{
OSL_FAIL( "+TxtFrm hat WouldFit-Versprechen nicht eingehalten." );
@@ -1737,7 +1731,7 @@ void SwCntntFrm::MakeAll()
continue;
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
OSL_FAIL( "LoopControl in SwCntntFrm::MakeAll" );
#endif
}
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 3ca2604..002623d 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -2480,9 +2480,7 @@ sal_Bool SwFlowFrm::MoveBwd( sal_Bool &rbReformat )
pNextNewUpper->GetType() != rThis.GetUpper()->GetType() ) )
{
pNewUpper = 0L;
-#if OSL_DEBUG_LEVEL > 1
OSL_FAIL( "<SwFlowFrm::MoveBwd(..)> - layout loop control for layout action <Move Backward> applied!" );
-#endif
}
}
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 45da740..58db3de 100755
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1754,9 +1754,7 @@ void CalcCntnt( SwLayoutFrm *pLay,
if ( nLoopControlRuns < nLoopControlMax )
continue;
-#if OSL_DEBUG_LEVEL > 1
OSL_FAIL( "LoopControl in CalcCntnt" );
-#endif
}
}
if ( pFrm->IsTabFrm() )
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 016f39a..f005b04 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -497,9 +497,7 @@ void SwFlyAtCntFrm::MakeAll()
pFmt->SetFmtAttr( aSurround );
pFmt->UnlockModify();
bOsz = false;
-#if OSL_DEBUG_LEVEL > 1
OSL_FAIL( "<SwFlyAtCntFrm::MakeAll()> - special loop prevention for dedicated document of b6403541 applied" );
-#endif
}
}
}
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 1707796..1705582 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -231,9 +231,7 @@ void SwFlyFreeFrm::MakeAll()
{
++nLoopControlRuns;
-#if OSL_DEBUG_LEVEL > 1
OSL_ENSURE( nLoopControlRuns < nLoopControlMax, "LoopControl in SwFlyFreeFrm::MakeAll" );
-#endif
if ( nLoopControlRuns < nLoopControlMax )
CheckClip( *pSz );
@@ -243,7 +241,7 @@ void SwFlyFreeFrm::MakeAll()
}
Unlock();
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
SWRECTFN( this )
OSL_ENSURE( bHeightClipped || ( (Frm().*fnRect->fnGetHeight)() > 0 &&
(Prt().*fnRect->fnGetHeight)() > 0),
@@ -639,14 +637,9 @@ void SwPageFrm::AppendFlyToPage( SwFlyFrm *pNew )
if ( !pSortedObjs )
pSortedObjs = new SwSortedObjs();
-#if OSL_DEBUG_LEVEL > 1
- const bool bSucessInserted =
-#endif
- pSortedObjs->Insert( *pNew );
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE( bSucessInserted, "Fly nicht in Sorted eingetragen." );
+ const bool bSucessInserted = pSortedObjs->Insert( *pNew );
+ OSL_ENSURE( bSucessInserted, "Fly not inserted in Sorted." );
(void) bSucessInserted;
-#endif
// #i87493#
OSL_ENSURE( pNew->GetPageFrm() == 0 || pNew->GetPageFrm() == this,
@@ -801,14 +794,9 @@ void SwPageFrm::MoveFly( SwFlyFrm *pToMove, SwPageFrm *pDest )
if ( !pDest->GetSortedObjs() )
pDest->pSortedObjs = new SwSortedObjs();
-#if OSL_DEBUG_LEVEL > 1
- const bool bSucessInserted =
-#endif
- pDest->GetSortedObjs()->Insert( *pToMove );
-#if OSL_DEBUG_LEVEL > 1
- OSL_ENSURE( bSucessInserted, "Fly nicht in Sorted eingetragen." );
+ const bool bSucessInserted = pDest->GetSortedObjs()->Insert( *pToMove );
+ OSL_ENSURE( bSucessInserted, "Fly not inserted in Sorted." );
(void) bSucessInserted;
-#endif
// #i28701# - use new method <SetPageFrm(..)>
pToMove->SetPageFrm( pDest );
@@ -902,10 +890,8 @@ void SwPageFrm::AppendDrawObjToPage( SwAnchoredObject& _rNewObj )
}
if ( !pSortedObjs->Insert( _rNewObj ) )
{
-#if OSL_DEBUG_LEVEL > 1
OSL_ENSURE( pSortedObjs->Contains( _rNewObj ),
"Drawing object not appended into list <pSortedObjs>." );
-#endif
}
// #i87493#
OSL_ENSURE( _rNewObj.GetPageFrm() == 0 || _rNewObj.GetPageFrm() == this,
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 4e26ed4..f94c6a5 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -671,7 +671,7 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
pDel->Cut();
delete pDel;
}
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list