summaryrefslogtreecommitdiff
path: root/tools
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 /tools
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 'tools')
-rw-r--r--tools/inc/tools/gen.hxx18
-rw-r--r--tools/inc/tools/vector2d.hxx14
2 files changed, 17 insertions, 15 deletions
diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx
index 7c93792b3c4b..6c93e2b36926 100644
--- a/tools/inc/tools/gen.hxx
+++ b/tools/inc/tools/gen.hxx
@@ -31,9 +31,6 @@ class SvStream;
class SAL_WARN_UNUSED Pair
{
public:
- long nA;
- long nB;
-
Pair();
Pair( long nA, long nB );
@@ -48,6 +45,10 @@ public:
TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Pair& rPair );
TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Pair& rPair );
+
+protected:
+ long nA;
+ long nB;
};
inline Pair::Pair()
@@ -329,11 +330,6 @@ inline void Selection::Justify()
class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Rectangle
{
public:
- long nLeft;
- long nTop;
- long nRight;
- long nBottom;
-
Rectangle();
Rectangle( const Point& rLT, const Point& rRB );
Rectangle( long nLeft, long nTop,
@@ -404,6 +400,12 @@ public:
void setY( long n ) { nBottom += n-nTop; nTop = n; }
void setWidth( long n ) { nRight = nLeft + n; }
void setHeight( long n ) { nBottom = nTop + n; }
+
+private:
+ long nLeft;
+ long nTop;
+ long nRight;
+ long nBottom;
};
inline Rectangle::Rectangle()
diff --git a/tools/inc/tools/vector2d.hxx b/tools/inc/tools/vector2d.hxx
index 50c6bc882859..d3d1c5c0c805 100644
--- a/tools/inc/tools/vector2d.hxx
+++ b/tools/inc/tools/vector2d.hxx
@@ -33,7 +33,7 @@ public:
inline Vector2D() : mfX( 0.0 ), mfY( 0.0 ) {}
inline Vector2D( double fX, double fY ) : mfX( fX ), mfY( fY ) {}
inline Vector2D( const Vector2D& rVec ) : mfX( rVec.mfX ), mfY( rVec.mfY ) {}
- inline Vector2D( const Pair& rPair ) : mfX( rPair.nA ), mfY( rPair.nB ) {};
+ inline Vector2D( const Pair& rPair ) : mfX( rPair.A() ), mfY( rPair.B() ) {};
inline ~Vector2D() {}
inline const double& X() const { return mfX; }
@@ -79,13 +79,13 @@ public:
inline sal_Bool operator!=( const Vector2D& rVec ) const { return !( *this == rVec ); }
inline Vector2D& operator=( const Vector2D& rVec ) { mfX = rVec.mfX, mfY = rVec.mfY; return *this; }
- inline Vector2D& operator=( const Pair& rPair ) { mfX = rPair.nA, mfY = rPair.nB; return *this; }
- inline Vector2D& operator-=( const Pair& rPair ) { mfX -= rPair.nA, mfY -= rPair.nB; return *this; }
- inline Vector2D& operator+=( const Pair& rPair ) { mfX += rPair.nA, mfY += rPair.nB; return *this; }
- inline Vector2D& operator*=( const Pair& rPair ) { mfX *= rPair.nA, mfY *= rPair.nB; return *this; }
- inline Vector2D& operator/=( const Pair& rPair ) { mfX /= rPair.nA, mfY /= rPair.nB; return *this; }
+ inline Vector2D& operator=( const Pair& rPair ) { mfX = rPair.A(), mfY = rPair.B(); return *this; }
+ inline Vector2D& operator-=( const Pair& rPair ) { mfX -= rPair.A(), mfY -= rPair.B(); return *this; }
+ inline Vector2D& operator+=( const Pair& rPair ) { mfX += rPair.A(), mfY += rPair.B(); return *this; }
+ inline Vector2D& operator*=( const Pair& rPair ) { mfX *= rPair.A(), mfY *= rPair.B(); return *this; }
+ inline Vector2D& operator/=( const Pair& rPair ) { mfX /= rPair.A(), mfY /= rPair.B(); return *this; }
- inline sal_Bool operator==( const Pair& rPair ) const { return( mfX == rPair.nA && mfY == rPair.nB ); }
+ inline sal_Bool operator==( const Pair& rPair ) const { return( mfX == rPair.A() && mfY == rPair.B() ); }
inline sal_Bool operator!=( const Pair& rPair ) const { return !( *this == rPair ); }
inline sal_Bool IsPositive( Vector2D& rVec ) const { return( ( mfX * rVec.mfY - mfY * rVec.mfX ) >= 0.0 ); }