diff options
author | Philipp Riemer <ruderphilipp@gmail.com> | 2012-07-02 02:20:33 +0200 |
---|---|---|
committer | Philipp Riemer <ruderphilipp@gmail.com> | 2012-07-02 02:20:33 +0200 |
commit | 517d3875fef75c72768fbd9211d6480ec4b17355 (patch) | |
tree | 6c3518dade6848238ab259a18fb9cb17603cd099 /sw/source | |
parent | e3865adb873baa862bfc53339a6867f30f83643a (diff) |
Moving code for better readability in sw/source/core/bastyp/
Change-Id: Ibee47704db9c4fa2a15004c1ba7566dae2aa1d1c
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/bastyp/bparr.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/bastyp/index.cxx | 32 | ||||
-rw-r--r-- | sw/source/core/bastyp/swcache.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/bastyp/swrect.cxx | 18 |
4 files changed, 32 insertions, 37 deletions
diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx index 1851cd6ae780..015a0d789c08 100644 --- a/sw/source/core/bastyp/bparr.cxx +++ b/sw/source/core/bastyp/bparr.cxx @@ -330,8 +330,8 @@ void BigPtrArray::Insert( const ElementPtr& rElem, sal_uLong pos ) if( pos != p->nElem ) { int nCount = p->nElem - sal_uInt16(pos); - ElementPtr *pFrom = p->pData + p->nElem, - *pTo = pFrom + 1; + ElementPtr *pFrom = p->pData + p->nElem; + ElementPtr *pTo = pFrom + 1; while( nCount-- ) ++( *--pTo = *--pFrom )->nOffset; } @@ -368,8 +368,8 @@ void BigPtrArray::Remove( sal_uLong pos, sal_uLong n ) // move elements if needed if( ( pos + nel ) < sal_uLong(p->nElem) ) { - ElementPtr *pTo = p->pData + pos, - *pFrom = pTo + nel; + ElementPtr *pTo = p->pData + pos; + ElementPtr *pFrom = pTo + nel; int nCount = p->nElem - nel - sal_uInt16(pos); while( nCount-- ) { diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx index 833cb162c9f9..787d4219961a 100644 --- a/sw/source/core/bastyp/index.cxx +++ b/sw/source/core/bastyp/index.cxx @@ -278,6 +278,22 @@ void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff, } } +void SwIndexReg::MoveTo( SwIndexReg& rArr ) +{ + if (this != &rArr && m_pFirst) + { + SwIndex * pIdx = const_cast<SwIndex*>(m_pFirst); + SwIndex * pNext; + while( pIdx ) + { + pNext = pIdx->m_pNext; + pIdx->Assign( &rArr, pIdx->GetIndex() ); + pIdx = pNext; + } + m_pFirst = 0, m_pLast = 0; + } +} + #ifdef DBG_UTIL // ------- @@ -378,20 +394,4 @@ SwIndex& SwIndex::operator= ( xub_StrLen const nVal ) #endif -void SwIndexReg::MoveTo( SwIndexReg& rArr ) -{ - if (this != &rArr && m_pFirst) - { - SwIndex * pIdx = const_cast<SwIndex*>(m_pFirst); - SwIndex * pNext; - while( pIdx ) - { - pNext = pIdx->m_pNext; - pIdx->Assign( &rArr, pIdx->GetIndex() ); - pIdx = pNext; - } - m_pFirst = 0, m_pLast = 0; - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx index 4aa3108fcb0d..ab1854b0351d 100644 --- a/sw/source/core/bastyp/swcache.cxx +++ b/sw/source/core/bastyp/swcache.cxx @@ -30,12 +30,6 @@ #include <rtl/strbuf.hxx> #ifdef DBG_UTIL -#define INCREMENT( nVar ) ++nVar -#else -#define INCREMENT( nVar ) -#endif - -#ifdef DBG_UTIL void SwCache::Check() { if ( !pRealFirst ) @@ -70,11 +64,12 @@ void SwCache::Check() size() == nCurMax && nCurMax != aFreePositions.size() + nCnt, "sw", "Lost FreePositions." ); } -#endif -#ifdef DBG_UTIL +#define INCREMENT( nVar ) ++nVar #define CHECK Check(); + #else +#define INCREMENT( nVar ) #define CHECK #endif diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx index 4b8c4c48d3f7..a905dd300945 100644 --- a/sw/source/core/bastyp/swrect.cxx +++ b/sw/source/core/bastyp/swrect.cxx @@ -129,20 +129,20 @@ sal_Bool SwRect::IsInside( const Point& rPoint ) const // mouse moving of table borders sal_Bool SwRect::IsNear( const Point& rPoint, long nTolerance ) const { - return IsInside(rPoint) || - (((Left() - nTolerance) <= rPoint.X()) - && ((Top() - nTolerance) <= rPoint.Y()) - && ((Right() + nTolerance) >= rPoint.X()) - && ((Bottom() + nTolerance)>= rPoint.Y())); + sal_Bool InTolerance = (((Left() - nTolerance) <= rPoint.X()) && + ((Top() - nTolerance) <= rPoint.Y()) && + ((Right() + nTolerance) >= rPoint.X()) && + ((Bottom() + nTolerance) >= rPoint.Y())); + return IsInside(rPoint) || InTolerance; } sal_Bool SwRect::IsOver( const SwRect& rRect ) const { - return (Top() <= rRect.Bottom()) - && (Left() <= rRect.Right()) - && (Right() >= rRect.Left()) - && (Bottom()>= rRect.Top()) ? sal_True : sal_False; + return (Top() <= rRect.Bottom()) && + (Left() <= rRect.Right()) && + (Right() >= rRect.Left()) && + (Bottom()>= rRect.Top()); } void SwRect::Justify() |