summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-05 04:07:44 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-05 16:10:34 +0100
commitee9344b68fcca2d1db8eba99d39874edc4aec822 (patch)
treee06dcd5dd42adccc3c5f5045d1b6f2e1e6f1e761
parentd150ace12b6d8fbb30664d1de1001622720bd53b (diff)
more const correctness
Change-Id: I786269210a7906c0d6b74e2cdb32100c8ae07666
-rw-r--r--sw/inc/ring.hxx14
-rw-r--r--sw/source/core/crsr/findtxt.cxx2
-rw-r--r--sw/source/core/crsr/viscrs.cxx18
-rw-r--r--sw/source/core/doc/doccomp.cxx4
-rw-r--r--sw/source/core/doc/docruby.cxx8
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx2
-rw-r--r--sw/source/core/edit/ednumber.cxx2
-rw-r--r--sw/source/core/unocore/unoobj2.cxx2
8 files changed, 26 insertions, 26 deletions
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index b2c341e305ce..3589cef4b87d 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -66,10 +66,16 @@ namespace sw
std::swap(*(&pPrev), *(&pDestRing->pPrev));
}
/** @return the next item in the ring container */
- value_type* GetNext() const
+ value_type* GetNext()
{ return pNext; }
/** @return the previous item in the ring container */
- value_type* GetPrev() const
+ value_type* GetPrev()
+ { return pPrev; }
+ /** @return the next item in the ring container */
+ const_value_type* GetNext() const
+ { return pNext; }
+ /** @return the previous item in the ring container */
+ const_value_type* GetPrev() const
{ return pPrev; }
/** @return a stl-like container with begin()/end() for iteration */
ring_container GetRingContainer();
@@ -99,9 +105,9 @@ namespace sw
typedef value_type node;
typedef value_type* node_ptr;
typedef const value_type* const_node_ptr;
- static node_ptr get_next(const_node_ptr n) { return n->GetNext(); };
+ static node_ptr get_next(const_node_ptr n) { return const_cast<node_ptr>(static_cast<const_node_ptr>(n))->GetNext(); };
static void set_next(node_ptr n, node_ptr next) { n->pNext = next; };
- static node_ptr get_previous(const_node_ptr n) { return n->GetPrev(); };
+ static node_ptr get_previous(const_node_ptr n) { return const_cast<node_ptr>(static_cast<const_node_ptr>(n))->GetPrev(); };
static void set_previous(node_ptr n, node_ptr previous) { n->pPrev = previous; };
};
friend typename ring_container::iterator;
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 66143b31ce6b..40af2a84a7a9 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -578,7 +578,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
SwPaM* pPrev(nullptr);
if( bRegExp )
{
- pPrev = pRegion->GetPrev();
+ pPrev = const_cast<SwPaM*>(pRegion)->GetPrev();
const_cast<SwPaM*>(pRegion)->MoveRingTo( &rCursor );
}
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 937fcf0065e2..3bc4b7caef84 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -545,24 +545,14 @@ void SwShellCrsr::Show()
// area is invalid.
void SwShellCrsr::Invalidate( const SwRect& rRect )
{
- SwShellCrsr * pTmp = this;
-
- do
+ for(SwPaM& rPaM : GetRingContainer())
{
- pTmp->SwSelPaintRects::Invalidate( rRect );
-
+ SwShellCrsr* pShCrsr = dynamic_cast<SwShellCrsr*>(&rPaM);
// skip any non SwShellCrsr objects in the ring
// see also: SwAutoFormat::DeleteSel()
- Ring* pTmpRing = pTmp;
- pTmp = 0;
- do
- {
- pTmpRing = pTmpRing->GetNext();
- pTmp = dynamic_cast<SwShellCrsr*>(pTmpRing);
- }
- while ( !pTmp );
+ if(pShCrsr)
+ pShCrsr->SwSelPaintRects::Invalidate(rRect);
}
- while( this != pTmp );
}
void SwShellCrsr::Hide()
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 8b8a223dcc51..588051ef3f56 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1836,6 +1836,10 @@ public:
_SaveMergeRedlines( const SwNode& rDstNd,
const SwRangeRedline& rSrcRedl, _SaveMergeRedlines* pRing );
sal_uInt16 InsertRedline();
+ _SaveMergeRedlines* GetNext()
+ { return GetNext(); }
+ _SaveMergeRedlines* GetPrev()
+ { return GetPrev(); }
};
_SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd,
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index 8e07ca24927d..e2e676410500 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -48,7 +48,7 @@ using namespace ::com::sun::star::i18n;
sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList,
sal_uInt16 nMode )
{
- const SwPaM *_pStartCrsr = static_cast<SwPaM*>(rPam.GetNext()),
+ const SwPaM *_pStartCrsr = rPam.GetNext(),
*__pStartCrsr = _pStartCrsr;
bool bCheckEmpty = &rPam != _pStartCrsr;
do {
@@ -86,7 +86,7 @@ sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList,
} while( 30 > rList.size() && *aPam.GetPoint() < *pEnd );
}
} while( 30 > rList.size() &&
- (_pStartCrsr = static_cast<SwPaM *>(_pStartCrsr->GetNext())) != __pStartCrsr );
+ (_pStartCrsr = _pStartCrsr->GetNext()) != __pStartCrsr );
return rList.size();
}
@@ -100,7 +100,7 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
sal_uInt16 nListEntry = 0;
- const SwPaM *_pStartCrsr = static_cast<SwPaM*>(rPam.GetNext()),
+ const SwPaM *_pStartCrsr = rPam.GetNext(),
*__pStartCrsr = _pStartCrsr;
bool bCheckEmpty = &rPam != _pStartCrsr;
do {
@@ -173,7 +173,7 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
} while( nListEntry < rList.size() && *aPam.GetPoint() < *pEnd );
}
} while( 30 > rList.size() &&
- (_pStartCrsr = static_cast<SwPaM *>(_pStartCrsr->GetNext())) != __pStartCrsr );
+ (_pStartCrsr = _pStartCrsr->GetNext()) != __pStartCrsr );
GetIDocumentUndoRedo().EndUndo( UNDO_SETRUBYATTR, NULL );
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index 4e9b0380d22a..a731e4d11e9b 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -139,7 +139,7 @@ static bool lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes,
rBoxes.insert( pBox );
}
} while( bAllCrsr &&
- pSttPam != ( pCurPam = static_cast<SwPaM*>(pCurPam->GetNext())) );
+ pSttPam != ( pCurPam = pCurPam->GetNext()) );
}
return !rBoxes.empty();
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index e118362f4eae..92f24287db2b 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -30,7 +30,7 @@
SwPamRanges::SwPamRanges( const SwPaM& rRing )
{
- for(const SwPaM& rTmp : rRing.GetRingContainer())
+ for(SwPaM& rTmp : const_cast<SwPaM*>(&rRing)->GetRingContainer())
Insert( rTmp.GetMark()->nNode, rTmp.GetPoint()->nNode );
}
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index ec47affffb87..476a8cd459ea 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -140,7 +140,7 @@ void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget)
if (rSource.GetNext() != &rSource)
{
- SwPaM *pPam = rSource.GetNext();
+ SwPaM *pPam = const_cast<SwPaM*>(rSource.GetNext());
do
{
// create new PaM