stoc/source/inspect/introspection.cxx | 2 sw/inc/swcrsr.hxx | 50 +++++++------- sw/inc/unocrsr.hxx | 26 ++++--- sw/inc/viscrs.hxx | 46 ++++++------- sw/source/core/bastyp/init.cxx | 4 - sw/source/core/crsr/swcrsr.cxx | 119 ++++++++++++++++++---------------- sw/source/core/crsr/trvlreg.cxx | 4 - sw/source/core/crsr/unocrsr.cxx | 22 +++--- sw/source/core/crsr/viscrs.cxx | 115 ++++++++++++++++---------------- 9 files changed, 204 insertions(+), 184 deletions(-)
New commits: commit 7f3628e54d4470cac6d51659d1b1bec5fb4f4e70 Author: Michael Stahl <[email protected]> Date: Sat Mar 14 00:24:24 2015 +0100 sw: prefix members of SwSelPaintRects Change-Id: I527151198635ced3d1be917bc0396f7f062ed868 diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx index 855107d..a96d366 100644 --- a/sw/inc/viscrs.hxx +++ b/sw/inc/viscrs.hxx @@ -66,21 +66,21 @@ class SwSelPaintRects : public SwRects friend void _InitCore(); friend void _FinitCore(); - static long nPixPtX, nPixPtY; - static MapMode *pMapMode; + static long s_nPixPtX, s_nPixPtY; + static MapMode *s_pMapMode; - const SwCrsrShell* pCShell; + const SwCrsrShell* m_pCursorShell; #if HAVE_FEATURE_DESKTOP || defined(ANDROID) - sdr::overlay::OverlayObject* mpCursorOverlay; + sdr::overlay::OverlayObject* m_pCursorOverlay; - // access to mpCursorOverlay for swapContent - sdr::overlay::OverlayObject* getCursorOverlay() const { return mpCursorOverlay; } - void setCursorOverlay(sdr::overlay::OverlayObject* pNew) { mpCursorOverlay = pNew; } + // access to m_pCursorOverlay for swapContent + sdr::overlay::OverlayObject* getCursorOverlay() const { return m_pCursorOverlay; } + void setCursorOverlay(sdr::overlay::OverlayObject* pNew) { m_pCursorOverlay = pNew; } #endif - bool mbShowTxtInputFldOverlay; - sw::overlay::OverlayRangesOutline* mpTxtInputFldOverlay; + bool m_bShowTxtInputFldOverlay; + sw::overlay::OverlayRangesOutline* m_pTxtInputFldOverlay; void HighlightInputFld(); @@ -93,7 +93,7 @@ public: virtual void FillStartEnd(SwRect& rStart, SwRect& rEnd) const = 0; // #i75172# in SwCrsrShell::CreateCrsr() the content of SwSelPaintRects is exchanged. To - // make a complete swap access to mpCursorOverlay is needed there + // make a complete swap access to m_pCursorOverlay is needed there void swapContent(SwSelPaintRects& rSwap); void Show(); @@ -102,10 +102,10 @@ public: inline void SetShowTxtInputFldOverlay( const bool bShow ) { - mbShowTxtInputFldOverlay = bShow; + m_bShowTxtInputFldOverlay = bShow; } - const SwCrsrShell* GetShell() const { return pCShell; } + const SwCrsrShell* GetShell() const { return m_pCursorShell; } // check current MapMode of the shell and set possibly the static members. // Optional set the parameters pX, pY static void Get1PixelInLogic( const SwViewShell& rSh, diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 697309c..074e372 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -734,7 +734,7 @@ void _InitCore() _FrmInit(); _TextInit(); - SwSelPaintRects::pMapMode = new MapMode; + SwSelPaintRects::s_pMapMode = new MapMode; SwFntObj::pPixMap = new MapMode; pGlobalOLEExcludeList = new std::vector<SvGlobalName*>; @@ -758,7 +758,7 @@ void _FinitCore() // destroy default TableAutoFormat delete SwTableAutoFmt::pDfltBoxAutoFmt; - delete SwSelPaintRects::pMapMode; + delete SwSelPaintRects::s_pMapMode; delete SwFntObj::pPixMap; delete SwEditShell::pAutoFmtFlags; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index b4475f2..2e8543d 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -61,9 +61,9 @@ // MapMode. This is done so that on ShowCrsr the same size does not have to be // expensively determined again and again. -long SwSelPaintRects::nPixPtX = 0; -long SwSelPaintRects::nPixPtY = 0; -MapMode* SwSelPaintRects::pMapMode = 0; +long SwSelPaintRects::s_nPixPtX = 0; +long SwSelPaintRects::s_nPixPtY = 0; +MapMode* SwSelPaintRects::s_pMapMode = 0; // Starting from here: classes / methods for the non-text-cursor SwVisCrsr::SwVisCrsr( const SwCrsrShell * pCShell ) @@ -204,11 +204,11 @@ void SwVisCrsr::_SetPosAndShow() SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh ) : SwRects() - , pCShell( &rCSh ) + , m_pCursorShell( &rCSh ) #if HAVE_FEATURE_DESKTOP - , mpCursorOverlay( 0 ) - , mbShowTxtInputFldOverlay( true ) - , mpTxtInputFldOverlay( NULL ) + , m_pCursorOverlay(nullptr) + , m_bShowTxtInputFldOverlay(true) + , m_pTxtInputFldOverlay(nullptr) #endif { } @@ -223,34 +223,34 @@ void SwSelPaintRects::swapContent(SwSelPaintRects& rSwap) SwRects::swap(rSwap); #if HAVE_FEATURE_DESKTOP - // #i75172# also swap mpCursorOverlay + // #i75172# also swap m_pCursorOverlay sdr::overlay::OverlayObject* pTempOverlay = getCursorOverlay(); setCursorOverlay(rSwap.getCursorOverlay()); rSwap.setCursorOverlay(pTempOverlay); - const bool bTempShowTxtInputFldOverlay = mbShowTxtInputFldOverlay; - mbShowTxtInputFldOverlay = rSwap.mbShowTxtInputFldOverlay; - rSwap.mbShowTxtInputFldOverlay = bTempShowTxtInputFldOverlay; + const bool bTempShowTxtInputFldOverlay = m_bShowTxtInputFldOverlay; + m_bShowTxtInputFldOverlay = rSwap.m_bShowTxtInputFldOverlay; + rSwap.m_bShowTxtInputFldOverlay = bTempShowTxtInputFldOverlay; - sw::overlay::OverlayRangesOutline* pTempTxtInputFldOverlay = mpTxtInputFldOverlay; - mpTxtInputFldOverlay = rSwap.mpTxtInputFldOverlay; - rSwap.mpTxtInputFldOverlay = pTempTxtInputFldOverlay; + sw::overlay::OverlayRangesOutline* pTempTxtInputFldOverlay = m_pTxtInputFldOverlay; + m_pTxtInputFldOverlay = rSwap.m_pTxtInputFldOverlay; + rSwap.m_pTxtInputFldOverlay = pTempTxtInputFldOverlay; #endif } void SwSelPaintRects::Hide() { #if HAVE_FEATURE_DESKTOP - if(mpCursorOverlay) + if (m_pCursorOverlay) { - delete mpCursorOverlay; - mpCursorOverlay = 0; + delete m_pCursorOverlay; + m_pCursorOverlay = nullptr; } - if ( mpTxtInputFldOverlay != NULL ) + if (m_pTxtInputFldOverlay != nullptr) { - delete mpTxtInputFldOverlay; - mpTxtInputFldOverlay = NULL; + delete m_pTxtInputFldOverlay; + m_pTxtInputFldOverlay = nullptr; } #endif @@ -283,7 +283,7 @@ void SwShellCrsr::FillStartEnd(SwRect& rStart, SwRect& rEnd) const void SwSelPaintRects::Show() { - SdrView* pView = (SdrView*)pCShell->GetDrawView(); + SdrView *const pView = const_cast<SdrView*>(m_pCursorShell->GetDrawView()); if(pView && pView->PaintWindowCount()) { @@ -305,16 +305,16 @@ void SwSelPaintRects::Show() aPntRect.Right() + 1, aPntRect.Bottom() + 1)); } - if(mpCursorOverlay) + if (m_pCursorOverlay) { if(!aNewRanges.empty()) { - static_cast< sdr::overlay::OverlaySelection* >(mpCursorOverlay)->setRanges(aNewRanges); + static_cast<sdr::overlay::OverlaySelection*>(m_pCursorOverlay)->setRanges(aNewRanges); } else { - delete mpCursorOverlay; - mpCursorOverlay = 0; + delete m_pCursorOverlay; + m_pCursorOverlay = nullptr; } } else if(!empty()) @@ -329,13 +329,13 @@ void SwSelPaintRects::Show() const Color aHighlight(aSvtOptionsDrawinglayer.getHilightColor()); // create correct selection - mpCursorOverlay = new sdr::overlay::OverlaySelection( + m_pCursorOverlay = new sdr::overlay::OverlaySelection( sdr::overlay::OVERLAY_TRANSPARENT, aHighlight, aNewRanges, true); - xTargetOverlay->add(*mpCursorOverlay); + xTargetOverlay->add(*m_pCursorOverlay); } } @@ -395,7 +395,7 @@ void SwSelPaintRects::HighlightInputFld() { std::vector< basegfx::B2DRange > aInputFldRanges; - if ( mbShowTxtInputFldOverlay ) + if (m_bShowTxtInputFldOverlay) { SwTxtInputFld* pCurTxtInputFldAtCrsr = dynamic_cast<SwTxtInputFld*>(GetShell()->GetTxtFldAtPos( GetShell()->GetCrsr()->Start(), false )); @@ -424,9 +424,9 @@ void SwSelPaintRects::HighlightInputFld() if ( aInputFldRanges.size() > 0 ) { - if ( mpTxtInputFldOverlay != NULL ) + if (m_pTxtInputFldOverlay != nullptr) { - mpTxtInputFldOverlay->setRanges( aInputFldRanges ); + m_pTxtInputFldOverlay->setRanges( aInputFldRanges ); } else { @@ -441,17 +441,18 @@ void SwSelPaintRects::HighlightInputFld() Color aHighlight(aSvtOptionsDrawinglayer.getHilightColor()); aHighlight.DecreaseLuminance( 128 ); - mpTxtInputFldOverlay = new sw::overlay::OverlayRangesOutline( aHighlight, aInputFldRanges ); - xTargetOverlay->add( *mpTxtInputFldOverlay ); + m_pTxtInputFldOverlay = new sw::overlay::OverlayRangesOutline( + aHighlight, aInputFldRanges ); + xTargetOverlay->add( *m_pTxtInputFldOverlay ); } } } else { - if ( mpTxtInputFldOverlay != NULL ) + if (m_pTxtInputFldOverlay != nullptr) { - delete mpTxtInputFldOverlay; - mpTxtInputFldOverlay = NULL; + delete m_pTxtInputFldOverlay; + m_pTxtInputFldOverlay = nullptr; } } } @@ -480,9 +481,9 @@ void SwSelPaintRects::Invalidate( const SwRect& rRect ) { SwRect& rRectIt = *it; if( rRectIt.Right() == GetShell()->m_aOldRBPos.X() ) - rRectIt.Right( rRectIt.Right() + nPixPtX ); + rRectIt.Right( rRectIt.Right() + s_nPixPtX ); if( rRectIt.Bottom() == GetShell()->m_aOldRBPos.Y() ) - rRectIt.Bottom( rRectIt.Bottom() + nPixPtY ); + rRectIt.Bottom( rRectIt.Bottom() + s_nPixPtY ); } } } @@ -497,20 +498,20 @@ void SwSelPaintRects::Get1PixelInLogic( const SwViewShell& rSh, pOut = rSh.GetOut(); const MapMode& rMM = pOut->GetMapMode(); - if( pMapMode->GetMapUnit() != rMM.GetMapUnit() || - pMapMode->GetScaleX() != rMM.GetScaleX() || - pMapMode->GetScaleY() != rMM.GetScaleY() ) + if (s_pMapMode->GetMapUnit() != rMM.GetMapUnit() || + s_pMapMode->GetScaleX() != rMM.GetScaleX() || + s_pMapMode->GetScaleY() != rMM.GetScaleY()) { - *pMapMode = rMM; + *s_pMapMode = rMM; Size aTmp( 1, 1 ); aTmp = pOut->PixelToLogic( aTmp ); - nPixPtX = aTmp.Width(); - nPixPtY = aTmp.Height(); + s_nPixPtX = aTmp.Width(); + s_nPixPtY = aTmp.Height(); } if( pX ) - *pX = nPixPtX; + *pX = s_nPixPtX; if( pY ) - *pY = nPixPtY; + *pY = s_nPixPtY; } SwShellCrsr::SwShellCrsr( commit be500fc6edfcc192ac71f1a4cc2bd7ab33328489 Author: Michael Stahl <[email protected]> Date: Sat Mar 14 00:05:53 2015 +0100 sw: prefix members of SwShellCrsr Change-Id: I0be44b2686bf5f6d54cda4e26a1b61cb0c078656 diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx index db3a964..855107d 100644 --- a/sw/inc/viscrs.hxx +++ b/sw/inc/viscrs.hxx @@ -114,9 +114,11 @@ public: class SwShellCrsr : public virtual SwCursor, public SwSelPaintRects { +private: // Document positions of start/end characters of a SSelection. - Point aMkPt, aPtPt; - const SwPosition* pPt; // For assignment of GetPoint() to aPtPt. + Point m_MarkPt; + Point m_PointPt; + const SwPosition* m_pInitialPoint; // For assignment of GetPoint() to m_PointPt. using SwCursor::UpDown; @@ -135,14 +137,14 @@ public: void Hide(); // Hide all selections. void Invalidate( const SwRect& rRect ); - const Point& GetPtPos() const { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); } - Point& GetPtPos() { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); } - const Point& GetMkPos() const { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); } - Point& GetMkPos() { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); } - const Point& GetSttPos() const { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); } - Point& GetSttPos() { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); } - const Point& GetEndPos() const { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); } - Point& GetEndPos() { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); } + const Point& GetPtPos() const { return (SwPaM::GetPoint() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + Point& GetPtPos() { return (SwPaM::GetPoint() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + const Point& GetMkPos() const { return (SwPaM::GetMark() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + Point& GetMkPos() { return (SwPaM::GetMark() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + const Point& GetSttPos() const { return (SwPaM::Start() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + Point& GetSttPos() { return (SwPaM::Start() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + const Point& GetEndPos() const { return (SwPaM::End() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + Point& GetEndPos() { return (SwPaM::End() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } virtual void SetMark() SAL_OVERRIDE; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 4219bbd..b4475f2 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -518,7 +518,7 @@ SwShellCrsr::SwShellCrsr( const SwPosition &rPos ) : SwCursor(rPos,0,false) , SwSelPaintRects(rCShell) - , pPt(SwPaM::GetPoint()) + , m_pInitialPoint(SwPaM::GetPoint()) {} SwShellCrsr::SwShellCrsr( @@ -528,17 +528,17 @@ SwShellCrsr::SwShellCrsr( SwPaM* pRing ) : SwCursor(rPos, pRing, false) , SwSelPaintRects(rCShell) - , aMkPt(rPtPos) - , aPtPt(rPtPos) - , pPt(SwPaM::GetPoint()) + , m_MarkPt(rPtPos) + , m_PointPt(rPtPos) + , m_pInitialPoint(SwPaM::GetPoint()) {} SwShellCrsr::SwShellCrsr( SwShellCrsr& rICrsr ) : SwCursor(rICrsr) , SwSelPaintRects(*rICrsr.GetShell()) - , aMkPt(rICrsr.GetMkPos()) - , aPtPt(rICrsr.GetPtPos()) - , pPt(SwPaM::GetPoint()) + , m_MarkPt(rICrsr.GetMkPos()) + , m_PointPt(rICrsr.GetPtPos()) + , m_pInitialPoint(SwPaM::GetPoint()) {} SwShellCrsr::~SwShellCrsr() @@ -551,10 +551,10 @@ bool SwShellCrsr::IsReadOnlyAvailable() const void SwShellCrsr::SetMark() { - if( SwPaM::GetPoint() == pPt ) - aMkPt = aPtPt; + if (SwPaM::GetPoint() == m_pInitialPoint) + m_MarkPt = m_PointPt; else - aPtPt = aMkPt; + m_PointPt = m_MarkPt; SwPaM::SetMark(); } commit ce0e635a65dd637d96f63931950f7571b051d128 Author: Michael Stahl <[email protected]> Date: Fri Mar 13 23:54:45 2015 +0100 sw: prefix members of SwTableCursor Change-Id: Ib53119f01a97f2fb2e277a0b949465e4de9928b7 diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 1dadeca..1e84b16 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -226,10 +226,11 @@ public: **/ class SwCrsrSaveState { - SwCursor& rCrsr; +private: + SwCursor& m_rCrsr; public: - SwCrsrSaveState( SwCursor& rC ) : rCrsr( rC ) { rC.SaveState(); } - ~SwCrsrSaveState() { rCrsr.RestoreState(); } + SwCrsrSaveState( SwCursor& rC ) : m_rCrsr( rC ) { rC.SaveState(); } + ~SwCrsrSaveState() { m_rCrsr.RestoreState(); } }; // internal, used by SwCursor::SaveState() etc. @@ -253,12 +254,13 @@ class SwTableCursor : public virtual SwCursor { protected: - sal_uLong nTblPtNd, nTblMkNd; - sal_Int32 nTblPtCnt; - sal_Int32 nTblMkCnt; + sal_uLong m_nTblPtNd; + sal_uLong m_nTblMkNd; + sal_Int32 m_nTblPtCnt; + sal_Int32 m_nTblMkCnt; SwSelBoxes m_SelectedBoxes; - bool bChg : 1; - bool bParked : 1; // Table-cursor was parked. + bool m_bChanged : 1; + bool m_bParked : 1; // Table-cursor was parked. virtual bool IsSelOvrCheck(int eFlags) SAL_OVERRIDE; @@ -286,13 +288,13 @@ public: // Has table cursor been changed? bool IsCrsrMoved() const { - return nTblMkNd != GetMark()->nNode.GetIndex() || - nTblPtNd != GetPoint()->nNode.GetIndex() || - nTblMkCnt != GetMark()->nContent.GetIndex() || - nTblPtCnt != GetPoint()->nContent.GetIndex(); + return m_nTblMkNd != GetMark()->nNode.GetIndex() || + m_nTblPtNd != GetPoint()->nNode.GetIndex() || + m_nTblMkCnt != GetMark()->nContent.GetIndex() || + m_nTblPtCnt != GetPoint()->nContent.GetIndex(); } - bool IsChgd() const { return bChg; } + bool IsChgd() const { return m_bChanged; } // Park table cursor at start node of boxes. void ParkCrsr(); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 2d5492b..80ea9b1 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -2111,10 +2111,10 @@ void SwCursor::RestoreSavePos() SwTableCursor::SwTableCursor( const SwPosition &rPos, SwPaM* pRing ) : SwCursor( rPos, pRing, false ) { - bParked = false; - bChg = false; - nTblPtNd = 0, nTblMkNd = 0; - nTblPtCnt = 0, nTblMkCnt = 0; + m_bParked = false; + m_bChanged = false; + m_nTblPtNd = 0, m_nTblMkNd = 0; + m_nTblPtCnt = 0, m_nTblMkCnt = 0; } SwTableCursor::~SwTableCursor() {} @@ -2151,19 +2151,19 @@ lcl_SeekEntry(const SwSelBoxes& rTmp, SwStartNode const*const pSrch, SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr ) { - if( bChg ) + if (m_bChanged) { - if( bParked ) + if (m_bParked) { // move back into content Exchange(); Move( fnMoveForward ); Exchange(); Move( fnMoveForward ); - bParked = false; + m_bParked = false; } - bChg = false; + m_bChanged = false; // create temporary copies so that all boxes that // have already cursors can be removed @@ -2252,13 +2252,13 @@ void SwTableCursor::InsertBox( const SwTableBox& rTblBox ) { SwTableBox* pBox = (SwTableBox*)&rTblBox; m_SelectedBoxes.insert(pBox); - bChg = true; + m_bChanged = true; } void SwTableCursor::DeleteBox(size_t const nPos) { m_SelectedBoxes.erase(m_SelectedBoxes.begin() + nPos); - bChg = true; + m_bChanged = true; } bool SwTableCursor::NewTableSelection() @@ -2322,10 +2322,10 @@ bool SwTableCursor::IsCrsrMovedUpdt() if( !IsCrsrMoved() ) return false; - nTblMkNd = GetMark()->nNode.GetIndex(); - nTblPtNd = GetPoint()->nNode.GetIndex(); - nTblMkCnt = GetMark()->nContent.GetIndex(); - nTblPtCnt = GetPoint()->nContent.GetIndex(); + m_nTblMkNd = GetMark()->nNode.GetIndex(); + m_nTblPtNd = GetPoint()->nNode.GetIndex(); + m_nTblMkCnt = GetMark()->nContent.GetIndex(); + m_nTblPtCnt = GetPoint()->nContent.GetIndex(); return true; } @@ -2345,8 +2345,8 @@ void SwTableCursor::ParkCrsr() GetMark()->nNode = *pNd; GetMark()->nContent.Assign( 0, 0 ); - bChg = true; - bParked = true; + m_bChanged = true; + m_bParked = true; } bool SwTableCursor::HasReadOnlyBoxSel() const diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index cbb55e8..4219bbd 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -710,7 +710,7 @@ void SwShellTableCrsr::SaveTblBoxCntnt( const SwPosition* pPos ) void SwShellTableCrsr::FillRects() { // Calculate the new rectangles. If the cursor is still "parked" do nothing - if (m_SelectedBoxes.empty() || bParked || !GetPoint()->nNode.GetIndex()) + if (m_SelectedBoxes.empty() || m_bParked || !GetPoint()->nNode.GetIndex()) return; bool bStart = true; @@ -779,7 +779,7 @@ void SwShellTableCrsr::FillStartEnd(SwRect& rStart, SwRect& rEnd) const bool SwShellTableCrsr::IsInside( const Point& rPt ) const { // Calculate the new rectangles. If the cursor is still "parked" do nothing - if (m_SelectedBoxes.empty() || bParked || !GetPoint()->nNode.GetIndex()) + if (m_SelectedBoxes.empty() || m_bParked || !GetPoint()->nNode.GetIndex()) return false; SwNodes& rNds = GetDoc()->GetNodes(); commit 49fe851cdcd8106bb4c4f1038363bec1f58cb5de Author: Michael Stahl <[email protected]> Date: Fri Mar 13 23:42:36 2015 +0100 sw: prefix members of SwUnoCrsr, SwUnoTableCrsr Change-Id: Ie0e8041d6d62176e68c953be39e513c862d01c63 diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx index aa33f99..66aa05a 100644 --- a/sw/inc/unocrsr.hxx +++ b/sw/inc/unocrsr.hxx @@ -18,14 +18,16 @@ */ #ifndef INCLUDED_SW_INC_UNOCRSR_HXX #define INCLUDED_SW_INC_UNOCRSR_HXX + #include <swcrsr.hxx> #include <calbck.hxx> class SwUnoCrsr : public virtual SwCursor, public SwModify { - bool bRemainInSection : 1; - bool bSkipOverHiddenSections : 1; - bool bSkipOverProtectSections : 1; +private: + bool m_bRemainInSection : 1; + bool m_bSkipOverHiddenSections : 1; + bool m_bSkipOverProtectSections : 1; public: SwUnoCrsr( const SwPosition &rPos, SwPaM* pRing = 0 ); @@ -48,18 +50,18 @@ public: virtual bool IsReadOnlyAvailable() const SAL_OVERRIDE; - bool IsRemainInSection() const { return bRemainInSection; } - void SetRemainInSection( bool bFlag ) { bRemainInSection = bFlag; } + bool IsRemainInSection() const { return m_bRemainInSection; } + void SetRemainInSection( bool bFlag ) { m_bRemainInSection = bFlag; } virtual bool IsSkipOverProtectSections() const SAL_OVERRIDE - { return bSkipOverProtectSections; } + { return m_bSkipOverProtectSections; } void SetSkipOverProtectSections( bool bFlag ) - { bSkipOverProtectSections = bFlag; } + { m_bSkipOverProtectSections = bFlag; } virtual bool IsSkipOverHiddenSections() const SAL_OVERRIDE - { return bSkipOverHiddenSections; } + { return m_bSkipOverHiddenSections; } void SetSkipOverHiddenSections( bool bFlag ) - { bSkipOverHiddenSections = bFlag; } + { m_bSkipOverHiddenSections = bFlag; } // make copy of cursor virtual SwUnoCrsr * Clone() const; @@ -72,7 +74,7 @@ class SwUnoTableCrsr : public virtual SwUnoCrsr, public virtual SwTableCursor // The selection has the same order as the table boxes, i.e. // if something is deleted from the one array at a certain position // it has also to be deleted from the other! - SwCursor aTblSel; + SwCursor m_aTblSel; using SwTableCursor::MakeBoxSels; @@ -91,8 +93,8 @@ public: void MakeBoxSels(); - SwCursor& GetSelRing() { return aTblSel; } - const SwCursor& GetSelRing() const { return aTblSel; } + SwCursor& GetSelRing() { return m_aTblSel; } + const SwCursor& GetSelRing() const { return m_aTblSel; } }; #endif diff --git a/sw/source/core/crsr/unocrsr.cxx b/sw/source/core/crsr/unocrsr.cxx index 69b7821..3d755db 100644 --- a/sw/source/core/crsr/unocrsr.cxx +++ b/sw/source/core/crsr/unocrsr.cxx @@ -27,10 +27,11 @@ IMPL_FIXEDMEMPOOL_NEWDEL( SwUnoCrsr ) SwUnoCrsr::SwUnoCrsr( const SwPosition &rPos, SwPaM* pRing ) - : SwCursor( rPos, pRing, false ), SwModify( 0 ), - bRemainInSection( true ), - bSkipOverHiddenSections( false ), - bSkipOverProtectSections( false ) + : SwCursor( rPos, pRing, false ) + , SwModify(nullptr) + , m_bRemainInSection(true) + , m_bSkipOverHiddenSections(false) + , m_bSkipOverProtectSections(false) {} SwUnoCrsr::~SwUnoCrsr() @@ -98,7 +99,7 @@ void SwUnoCrsr::DoSetBidiLevelUpDown() bool SwUnoCrsr::IsSelOvr( int eFlags ) { - if( bRemainInSection ) + if (m_bRemainInSection) { SwDoc* pDoc = GetDoc(); SwNodeIndex aOldIdx( *pDoc->GetNodes()[ GetSavePos()->nNode ] ); @@ -183,15 +184,18 @@ bool SwUnoCrsr::IsSelOvr( int eFlags ) } SwUnoTableCrsr::SwUnoTableCrsr(const SwPosition& rPos) - : SwCursor(rPos,0,false), SwUnoCrsr(rPos), SwTableCursor(rPos), aTblSel(rPos,0,false) + : SwCursor(rPos, 0, false) + , SwUnoCrsr(rPos) + , SwTableCursor(rPos) + , m_aTblSel(rPos, 0, false) { SetRemainInSection(false); } SwUnoTableCrsr::~SwUnoTableCrsr() { - while( aTblSel.GetNext() != &aTblSel ) - delete aTblSel.GetNext(); + while (m_aTblSel.GetNext() != &m_aTblSel) + delete m_aTblSel.GetNext(); } bool SwUnoTableCrsr::IsSelOvr( int eFlags ) @@ -227,7 +231,7 @@ void SwUnoTableCrsr::MakeBoxSels() if( IsChgd() ) { - SwTableCursor::MakeBoxSels( &aTblSel ); + SwTableCursor::MakeBoxSels( &m_aTblSel ); if (!GetSelectedBoxesCount()) { const SwTableBox* pBox; commit 5f76b2e563bc4d6b82d1241e0a0ab371b968af08 Author: Michael Stahl <[email protected]> Date: Fri Mar 13 23:36:12 2015 +0100 sw: prefix members of SwCursor Change-Id: Ica526f053c5e3870c7496ec0de83dc142ca9b583 diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 839face..1dadeca 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -60,10 +60,10 @@ class SW_DLLPUBLIC SwCursor : public SwPaM { friend class SwCrsrSaveState; - _SwCursor_SavePos* pSavePos; - long mnRowSpanOffset; // required for travelling in tabs with rowspans - sal_uInt8 nCursorBidiLevel; // bidi level of the cursor - bool mbColumnSelection; // true: cursor is aprt of a column selection + _SwCursor_SavePos* m_pSavePos; + long m_nRowSpanOffset; // required for travelling in tabs with rowspans + sal_uInt8 m_nCursorBidiLevel; // bidi level of the cursor + bool m_bColumnSelection; // true: cursor is aprt of a column selection sal_uLong FindAll( SwFindParas& , SwDocPositions, SwDocPositions, FindRanges, bool& bCancel ); @@ -74,7 +74,7 @@ protected: void SaveState(); void RestoreState(); - const _SwCursor_SavePos* GetSavePos() const { return pSavePos; } + const _SwCursor_SavePos* GetSavePos() const { return m_pSavePos; } virtual const SwCntntFrm* DoSetBidiLevelLeftRight( bool & io_rbLeft, bool bVisualAllowed, bool bInsertCrsr); @@ -205,14 +205,14 @@ public: virtual bool IsSkipOverProtectSections() const; virtual bool IsSkipOverHiddenSections() const; - sal_uInt8 GetCrsrBidiLevel() const { return nCursorBidiLevel; } - void SetCrsrBidiLevel( sal_uInt8 nNewLevel ) { nCursorBidiLevel = nNewLevel; } + sal_uInt8 GetCrsrBidiLevel() const { return m_nCursorBidiLevel; } + void SetCrsrBidiLevel( sal_uInt8 nNewLevel ) { m_nCursorBidiLevel = nNewLevel; } - bool IsColumnSelection() const { return mbColumnSelection; } - void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; } + bool IsColumnSelection() const { return m_bColumnSelection; } + void SetColumnSelection( bool bNew ) { m_bColumnSelection = bNew; } - long GetCrsrRowSpanOffset() const { return mnRowSpanOffset; } - void SetCrsrRowSpanOffset( long nNew ) { mnRowSpanOffset = nNew; } + long GetCrsrRowSpanOffset() const { return m_nRowSpanOffset; } + void SetCrsrRowSpanOffset( long nNew ) { m_nRowSpanOffset = nNew; } DECL_FIXEDMEMPOOL_NEWDEL( SwCursor ) }; diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 94a7216..2d5492b 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -114,25 +114,31 @@ struct _PercentHdl }; SwCursor::SwCursor( const SwPosition &rPos, SwPaM* pRing, bool bColumnSel ) - : SwPaM( rPos, pRing ), pSavePos( 0 ), mnRowSpanOffset( 0 ), nCursorBidiLevel( 0 ), - mbColumnSelection( bColumnSel ) + : SwPaM( rPos, pRing ) + , m_pSavePos(nullptr) + , m_nRowSpanOffset(0) + , m_nCursorBidiLevel(0) + , m_bColumnSelection(bColumnSel) { } // @@@ semantic: no copy ctor. SwCursor::SwCursor( SwCursor& rCpy ) - : SwPaM( rCpy ), pSavePos( 0 ), mnRowSpanOffset( rCpy.mnRowSpanOffset ), - nCursorBidiLevel( rCpy.nCursorBidiLevel ), mbColumnSelection( rCpy.mbColumnSelection ) + : SwPaM( rCpy ) + , m_pSavePos(nullptr) + , m_nRowSpanOffset(rCpy.m_nRowSpanOffset) + , m_nCursorBidiLevel(rCpy.m_nCursorBidiLevel) + , m_bColumnSelection(rCpy.m_bColumnSelection) { } SwCursor::~SwCursor() { - while( pSavePos ) + while( m_pSavePos ) { - _SwCursor_SavePos* pNxt = pSavePos->pNext; - delete pSavePos; - pSavePos = pNxt; + _SwCursor_SavePos* pNxt = m_pSavePos->pNext; + delete m_pSavePos; + m_pSavePos = pNxt; } } @@ -161,16 +167,16 @@ bool SwCursor::IsSkipOverProtectSections() const void SwCursor::SaveState() { _SwCursor_SavePos* pNew = CreateNewSavePos(); - pNew->pNext = pSavePos; - pSavePos = pNew; + pNew->pNext = m_pSavePos; + m_pSavePos = pNew; } void SwCursor::RestoreState() { - if( pSavePos ) // Robust + if (m_pSavePos) // Robust { - _SwCursor_SavePos* pDel = pSavePos; - pSavePos = pSavePos->pNext; + _SwCursor_SavePos* pDel = m_pSavePos; + m_pSavePos = m_pSavePos->pNext; delete pDel; } } @@ -235,7 +241,7 @@ bool SwCursor::IsSelOvr( int eFlags ) return true; } - if( pSavePos->nNode != GetPoint()->nNode.GetIndex() && + if (m_pSavePos->nNode != GetPoint()->nNode.GetIndex() && // (1997) in UI-ReadOnly everything is allowed ( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() )) { @@ -255,8 +261,8 @@ bool SwCursor::IsSelOvr( int eFlags ) // set cursor to new position: SwNodeIndex aIdx( rPtIdx ); - sal_Int32 nCntntPos = pSavePos->nCntnt; - bool bGoNxt = pSavePos->nNode < rPtIdx.GetIndex(); + sal_Int32 nCntntPos = m_pSavePos->nCntnt; + bool bGoNxt = m_pSavePos->nNode < rPtIdx.GetIndex(); SwCntntNode* pCNd = bGoNxt ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections) : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections); @@ -272,7 +278,7 @@ bool SwCursor::IsSelOvr( int eFlags ) ::CheckNodesRange( rPtIdx, aIdx, true ); if( !bValidNodesRange ) { - rPtIdx = pSavePos->nNode; + rPtIdx = m_pSavePos->nNode; if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) ) { bIsValidPos = false; @@ -342,7 +348,7 @@ bool SwCursor::IsSelOvr( int eFlags ) { // skip to the next/prev valid paragraph with a layout SwNodeIndex& rPtIdx = GetPoint()->nNode; - bool bGoNxt = pSavePos->nNode < rPtIdx.GetIndex(); + bool bGoNxt = m_pSavePos->nNode < rPtIdx.GetIndex(); while( 0 != ( pFrm = ( bGoNxt ? pFrm->GetNextCntntFrm() : pFrm->GetPrevCntntFrm() )) && 0 == pFrm->Frm().Height() ) ; @@ -370,8 +376,8 @@ bool SwCursor::IsSelOvr( int eFlags ) const sal_Int32 nTmpPos = bGoNxt ? 0 : pCNd->Len(); GetPoint()->nContent.Assign( pCNd, nTmpPos ); - if ( rPtIdx.GetIndex() == pSavePos->nNode - && nTmpPos == pSavePos->nCntnt ) + if (rPtIdx.GetIndex() == m_pSavePos->nNode + && nTmpPos == m_pSavePos->nCntnt) { // new position equals saved one // --> trigger restore of saved pos by setting <pFrm> to NULL - see below @@ -432,11 +438,11 @@ bool SwCursor::IsSelOvr( int eFlags ) { const sal_uLong nRefNodeIdx = ( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags ) - ? pSavePos->nNode + ? m_pSavePos->nNode : GetMark()->nNode.GetIndex(); const sal_Int32 nRefContentIdx = ( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags ) - ? pSavePos->nCntnt + ? m_pSavePos->nCntnt : GetMark()->nContent.GetIndex(); const bool bIsForwardSelection = nRefNodeIdx < GetPoint()->nNode.GetIndex() @@ -481,8 +487,8 @@ bool SwCursor::IsSelOvr( int eFlags ) if (nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags) { bool bSelTop = GetPoint()->nNode.GetIndex() < - (( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags ) ? pSavePos->nNode - : GetMark()->nNode.GetIndex()); + ((nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags) + ? m_pSavePos->nNode : GetMark()->nNode.GetIndex()); do { // loop for table after table sal_uLong nSEIdx = pPtNd->EndOfSectionIndex(); @@ -549,7 +555,7 @@ bool SwCursor::IsInProtectTable( bool bMove, bool bChgCrsr ) return false; // Current position == last save position? - if ( pSavePos->nNode == GetPoint()->nNode.GetIndex() ) + if (m_pSavePos->nNode == GetPoint()->nNode.GetIndex()) return false; // Check for convered cell: @@ -584,7 +590,7 @@ bool SwCursor::IsInProtectTable( bool bMove, bool bChgCrsr ) } // We are in a protected table cell. Traverse top to bottom? - if( pSavePos->nNode < GetPoint()->nNode.GetIndex() ) + if (m_pSavePos->nNode < GetPoint()->nNode.GetIndex()) { // search next valid box // if there is another StartNode after the EndNode of a cell then @@ -1642,7 +1648,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, // corrected, we check if the last move has moved the cursor to a // different table cell. In this case we set the cursor to the stored // covered position and redo the move: - if ( mnRowSpanOffset ) + if (m_nRowSpanOffset) { const SwNode* pOldTabBoxSttNode = aOldNodeIdx.GetNode().FindTableBoxStartNode(); const SwTableNode* pOldTabSttNode = pOldTabBoxSttNode ? pOldTabBoxSttNode->FindTableNode() : 0; @@ -1660,7 +1666,9 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, SwTableBox* pTableBox = pOldTabBoxSttNode->GetTblBox(); if ( pTableBox && pTableBox->getRowSpan() > 1 ) { - pTableBox = & pTableBox->FindEndOfRowSpan( pOldTabSttNode->GetTable(), (sal_uInt16)(pTableBox->getRowSpan() + mnRowSpanOffset ) ); + pTableBox = & pTableBox->FindEndOfRowSpan( + pOldTabSttNode->GetTable(), + static_cast<sal_uInt16>(pTableBox->getRowSpan() + m_nRowSpanOffset)); SwNodeIndex& rPtIdx = GetPoint()->nNode; SwNodeIndex aNewIdx( *pTableBox->GetSttNd() ); rPtIdx = aNewIdx; @@ -1676,7 +1684,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, break; } } - mnRowSpanOffset = 0; + m_nRowSpanOffset = 0; } } @@ -1689,7 +1697,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, if ( pTableBox && pTableBox->getRowSpan() < 1 ) { // Store the row span offset: - mnRowSpanOffset = pTableBox->getRowSpan(); + m_nRowSpanOffset = pTableBox->getRowSpan(); // Move cursor to non-covered cell: const SwTableNode* pTblNd = pTableBoxStartNode->FindTableNode(); @@ -1935,16 +1943,17 @@ bool SwCursor::GoPrevNextCell( bool bNext, sal_uInt16 nCnt ) // Check if we have to move the cursor to a covered cell before // proceeding: - if ( mnRowSpanOffset ) + if (m_nRowSpanOffset) { if ( pTableBox && pTableBox->getRowSpan() > 1 ) { - pTableBox = & pTableBox->FindEndOfRowSpan( pTblNd->GetTable(), (sal_uInt16)(pTableBox->getRowSpan() + mnRowSpanOffset) ); + pTableBox = & pTableBox->FindEndOfRowSpan( pTblNd->GetTable(), + static_cast<sal_uInt16>(pTableBox->getRowSpan() + m_nRowSpanOffset)); SwNodeIndex aNewIdx( *pTableBox->GetSttNd() ); rPtIdx = aNewIdx; pTableBoxStartNode = rPtIdx.GetNode().FindTableBoxStartNode(); } - mnRowSpanOffset = 0; + m_nRowSpanOffset = 0; } const SwNode* pTmpNode = bNext ? @@ -1962,7 +1971,7 @@ bool SwCursor::GoPrevNextCell( bool bNext, sal_uInt16 nCnt ) pTableBox = pTableBoxStartNode->GetTblBox(); if ( pTableBox && pTableBox->getRowSpan() < 1 ) { - mnRowSpanOffset = pTableBox->getRowSpan(); + m_nRowSpanOffset = pTableBox->getRowSpan(); // move cursor to non-covered cell: pTableBox = & pTableBox->FindStartOfRowSpan( pTblNd->GetTable(), USHRT_MAX ); SwNodeIndex aNewIdx( *pTableBox->GetSttNd() ); @@ -2077,18 +2086,18 @@ void SwCursor::RestoreSavePos() // This method is not supposed to be used in cases when nodes may be // deleted; detect such cases, but do not crash (example: fdo#40831). sal_uLong uNodeCount = GetPoint()->nNode.GetNodes().Count(); - OSL_ENSURE(!pSavePos || pSavePos->nNode < uNodeCount, + OSL_ENSURE(!m_pSavePos || m_pSavePos->nNode < uNodeCount, "SwCursor::RestoreSavePos: invalid node: " "probably something was deleted; consider using SwUnoCrsr instead"); - if( pSavePos && pSavePos->nNode < uNodeCount ) + if (m_pSavePos && m_pSavePos->nNode < uNodeCount) { - GetPoint()->nNode = pSavePos->nNode; + GetPoint()->nNode = m_pSavePos->nNode; sal_Int32 nIdx = 0; if ( GetCntntNode() ) { - if ( pSavePos->nCntnt <= GetCntntNode()->Len() ) - nIdx = pSavePos->nCntnt; + if (m_pSavePos->nCntnt <= GetCntntNode()->Len()) + nIdx = m_pSavePos->nCntnt; else { nIdx = GetCntntNode()->Len(); diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx index 231d7ca..1cb8fe4 100644 --- a/sw/source/core/crsr/trvlreg.cxx +++ b/sw/source/core/crsr/trvlreg.cxx @@ -216,8 +216,8 @@ bool SwCursor::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion return !dynamic_cast<SwTableCursor*>(this) && (*fnWhichRegion)( *this, fnPosRegion, IsReadOnlyAvailable() ) && !IsSelOvr() && - ( GetPoint()->nNode.GetIndex() != pSavePos->nNode || - GetPoint()->nContent.GetIndex() != pSavePos->nCntnt ); + (GetPoint()->nNode.GetIndex() != m_pSavePos->nNode || + GetPoint()->nContent.GetIndex() != m_pSavePos->nCntnt); } bool SwCrsrShell::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion ) commit d19249c66d13c779a4a46f34e1d8094c74bbb20f Author: Michael Stahl <[email protected]> Date: Fri Mar 13 18:43:21 2015 +0100 stoc: must check *both* bDisposed and bInDispose Implementation::inspect() was crashing with a null reflection_ in CppunitTest_libreofficekit_tiledrendering because another thread was disposing it. Actually, why are there 2 bools for this and not one enum with 3 values? Change-Id: Icd27145d3203e1f48a9841ee6251a50cb73f7988 diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 20b6826..11b84aa 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -1575,7 +1575,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( throw (css::uno::RuntimeException, std::exception) { osl::MutexGuard g(m_aMutex); - if (rBHelper.bDisposed) { + if (rBHelper.bDisposed || rBHelper.bInDispose) { throw css::lang::DisposedException( getImplementationName(), static_cast<OWeakObject *>(this)); } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
