summaryrefslogtreecommitdiff
path: root/sw/source/ui/uiview
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@gmx.com>2012-10-28 23:23:53 +0100
committerMichael Stahl <mstahl@redhat.com>2012-11-20 19:32:43 +0000
commit53ad646f54f8aa33b86c696c04500fd08ea6f3b6 (patch)
tree3eef1a050a5cf7b8b531f56e125d7252f4aab8fe /sw/source/ui/uiview
parent5e5c11c664f67ff9fd1120905b09a32bea3b2f6c (diff)
Enforce use of accessors on gen.hxx structures
Change-Id: Icd1b2937fdeaba6de1877258731f53ddf996002e Reviewed-on: https://gerrit.libreoffice.org/936 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw/source/ui/uiview')
-rw-r--r--sw/source/ui/uiview/viewport.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
index 6b0b80668eac..967b410e5577 100644
--- a/sw/source/ui/uiview/viewport.cxx
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -89,14 +89,13 @@ static void lcl_GetPos(SwView* pView,
const Size aDocSz( rSh.GetDocSize() );
const long lBorder = bBorder ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
- sal_Bool bHori = pScrollbar->IsHoriScroll();
+ const bool bHori = pScrollbar->IsHoriScroll();
const long lPos = pScrollbar->GetThumbPos() + (bBorder ? DOCUMENTBORDER : 0);
- long Point:: *pPt = bHori ? &Point::nA : &Point::nB;
- long Size:: *pSz = bHori ? &Size::nA : &Size::nB;
- long lDelta = lPos - rSh.VisArea().Pos().*pPt;
- const long lSize = aDocSz.*pSz + lBorder;
+ long lDelta = lPos - (bHori ? rSh.VisArea().Pos().X() : rSh.VisArea().Pos().Y());
+
+ const long lSize = (bHori ? aDocSz.A() : aDocSz.B()) + lBorder;
// sollte rechts oder unten zuviel Wiese sein, dann muss
// diese von der VisArea herausgerechnet werden!
long nTmp = pView->GetVisArea().Right()+lDelta;
@@ -106,9 +105,12 @@ static void lcl_GetPos(SwView* pView,
if ( !bHori && nTmp > lSize )
lDelta -= nTmp - lSize;
- rPos.*pPt += lDelta;
- if ( bBorder && rPos.*pPt < DOCUMENTBORDER )
- rPos.*pPt = DOCUMENTBORDER;
+ // use a reference to access/moodify the correct coordinate
+ // returned by accessors to non-const object
+ long & rCoord = bHori ? rPos.X() : rPos.Y();
+ rCoord += lDelta;
+ if ( bBorder && rCoord < DOCUMENTBORDER )
+ rCoord = DOCUMENTBORDER;
}
/*--------------------------------------------------------------------