diff options
author | Juan Picca <jumapico@gmail.com> | 2014-09-19 14:19:30 -0300 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-10-09 11:33:33 +0000 |
commit | 47a2d7642d249d70b5da0c330a73f3a0032e4bba (patch) | |
tree | 202b04810382ea87cf8015a7b4de29e931408948 /include/sfx2 | |
parent | ae77dc81c33ab0817264bcf5fc8bb71a55b78a73 (diff) |
fdo#81356: convert Fraction to boost::rational<long> - wip
* Added rational util functions used by Fraction class not
available in the boost::rational class.
* Replaced usage of Fraction by boost::rational<long>
* Removed code that relies on:
1. fraction.IsValid() -- rational only allow valid values, ie
denominator() != 0
2. rational.denominator() == 0 -- always false
3. rational.denominator() < 0 -- always false but implementation
detail: http://www.boost.org/doc/libs/release/libs/rational/rational.html#Internal%20representation
* Simplified code that relies on:
1. rational.denominator() != 0 -- always true
* BUGS EXIST because Fraction allows the creation of invalid values but
boost::rational throws the exception boost::bad_rational
Change-Id: I84970a4956afb3f91ac0c8f726547466319420f9
Reviewed-on: https://gerrit.libreoffice.org/11551
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'include/sfx2')
-rw-r--r-- | include/sfx2/ipclient.hxx | 10 | ||||
-rw-r--r-- | include/sfx2/objsh.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/viewfrm.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/viewsh.hxx | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx index 10ab174bbdbd..350c7ac14944 100644 --- a/include/sfx2/ipclient.hxx +++ b/include/sfx2/ipclient.hxx @@ -34,7 +34,7 @@ class SfxInPlaceClient_Impl; class SfxViewShell; class SfxObjectShell; namespace vcl { class Window; } -class Fraction; +namespace boost { template<typename T> class rational; } @@ -74,10 +74,10 @@ public: bool SetObjArea( const Rectangle & ); Rectangle GetObjArea() const; Rectangle GetScaledObjArea() const; - void SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight ); - bool SetObjAreaAndScale( const Rectangle&, const Fraction&, const Fraction& ); - const Fraction& GetScaleWidth() const; - const Fraction& GetScaleHeight() const; + void SetSizeScale( const boost::rational<long> & rScaleWidth, const boost::rational<long> & rScaleHeight ); + bool SetObjAreaAndScale( const Rectangle&, const boost::rational<long>&, const boost::rational<long>& ); + const boost::rational<long>& GetScaleWidth() const; + const boost::rational<long>& GetScaleHeight() const; void Invalidate(); static SfxInPlaceClient* GetClient( SfxObjectShell* pDoc, const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObject ); sal_Int64 GetAspect() const; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index d9d4e956e5cd..42487bcc8333 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -638,8 +638,8 @@ public: SAL_DLLPRIVATE void DoDraw_Impl( OutputDevice* pDev, const Point & rViewPos, - const Fraction & rScaleX, - const Fraction & rScaleY, + const boost::rational<long>& rScaleX, + const boost::rational<long>& rScaleY, const JobSetup & rSetup, sal_uInt16 nAspect ); diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index 1d043fcd2ded..9acc0e23fd85 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -43,7 +43,7 @@ class SfxProgress; class SvData; class SfxViewShell; class SystemWindow; -class Fraction; +namespace boost { template<typename T> class rational; } class Point; class Size; class SfxChildWindow; @@ -118,7 +118,7 @@ public: SfxBindings& GetBindings() { return *pBindings; } const SfxBindings& GetBindings() const { return *pBindings; } vcl::Window& GetWindow() const; - virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); + virtual void SetZoomFactor( const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY ); SfxProgress* GetProgress() const; diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 20114cfac991..827bdfd8a615 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -39,7 +39,7 @@ class SfxBaseController; class Size; -class Fraction; +namespace boost { template<typename T> class rational; } namespace vcl { class Window; } class KeyEvent; class WorkWindow; @@ -146,7 +146,7 @@ protected: virtual void InnerResizePixel( const Point &rOfs, const Size &rSize ); virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ); - virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); + virtual void SetZoomFactor( const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY ); virtual void Move(); |