diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-10-23 17:41:47 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-10-23 18:34:39 +0200 |
commit | 31af61ea091cc895b893c849f2130aa35792b7db (patch) | |
tree | 6c7b63c5b538034bd5d356c5a8667b7e95d59b9c /include | |
parent | e92c0d6f9b7a6251e00dc55219a203a7e53c96e2 (diff) |
Fraction: Revert "fdo#81356: convert Fraction to boost::rational<long> - wip"
This reverts commit 47a2d7642d249d70b5da0c330a73f3a0032e4bba.
Conflicts:
cui/source/tabpages/transfrm.cxx
svx/source/svdraw/svdedtv1.cxx
svx/source/svdraw/svdibrow.cxx
sw/source/filter/ww1/w1filter.cxx
tools/source/generic/rational.cxx
Change-Id: I4849916f5f277a4afef0e279b0135c76b36b9d15
Diffstat (limited to 'include')
48 files changed, 268 insertions, 145 deletions
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx index 74f9236119d4..02ee8f19bba4 100644 --- a/include/oox/export/chartexport.hxx +++ b/include/oox/export/chartexport.hxx @@ -84,7 +84,7 @@ public: private: sal_Int32 mnXmlNamespace; sal_Int32 mnSeriesCount; - boost::rational<long> maFraction; + Fraction maFraction; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel; com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram; com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram; diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx index 250729b243a3..995ef356bae7 100644 --- a/include/oox/export/shapes.hxx +++ b/include/oox/export/shapes.hxx @@ -66,7 +66,7 @@ protected: private: sal_Int32 mnXmlNamespace; - boost::rational<long> maFraction; + Fraction maFraction; MapMode maMapModeSrc, maMapModeDest; ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const; diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx index 350c7ac14944..10ab174bbdbd 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; } -namespace boost { template<typename T> class rational; } +class Fraction; @@ -74,10 +74,10 @@ public: bool SetObjArea( const Rectangle & ); Rectangle GetObjArea() const; Rectangle GetScaledObjArea() 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 SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight ); + bool SetObjAreaAndScale( const Rectangle&, const Fraction&, const Fraction& ); + const Fraction& GetScaleWidth() const; + const Fraction& 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 42487bcc8333..d9d4e956e5cd 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 boost::rational<long>& rScaleX, - const boost::rational<long>& rScaleY, + const Fraction & rScaleX, + const Fraction & rScaleY, const JobSetup & rSetup, sal_uInt16 nAspect ); diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index 9acc0e23fd85..1d043fcd2ded 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -43,7 +43,7 @@ class SfxProgress; class SvData; class SfxViewShell; class SystemWindow; -namespace boost { template<typename T> class rational; } +class Fraction; 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 boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY ); + virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); SfxProgress* GetProgress() const; diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 827bdfd8a615..20114cfac991 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -39,7 +39,7 @@ class SfxBaseController; class Size; -namespace boost { template<typename T> class rational; } +class Fraction; 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 boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY ); + virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); virtual void Move(); diff --git a/include/svtools/imap.hxx b/include/svtools/imap.hxx index 37a513352778..951251d11bf0 100644 --- a/include/svtools/imap.hxx +++ b/include/svtools/imap.hxx @@ -27,7 +27,7 @@ class Point; class Rectangle; class Size; -namespace boost { template<typename T> class rational; } +class Fraction; class IMapObject; typedef ::std::vector< IMapObject* > IMapObjectList_impl; @@ -117,7 +117,7 @@ public: void SetName( const OUString& rName ) { aName = rName; } // skaliert alle Objekte der ImageMap entpr. dem uebergebenen Faktor - void Scale( const boost::rational<long>& rFractX, const boost::rational<long>& rFracY ); + void Scale( const Fraction& rFractX, const Fraction& rFracY ); // Im-/Export void Write ( SvStream& rOStm, const OUString& rBaseURL ) const; diff --git a/include/svtools/imapcirc.hxx b/include/svtools/imapcirc.hxx index fd6c164c439a..2ce4127b1bc7 100644 --- a/include/svtools/imapcirc.hxx +++ b/include/svtools/imapcirc.hxx @@ -23,7 +23,7 @@ #include <tools/gen.hxx> #include <svtools/imapobj.hxx> -namespace boost { template<typename T> class rational; } +class Fraction; class SVT_DLLPUBLIC IMapCircleObject : public IMapObject { @@ -60,7 +60,7 @@ public: // liefert das BoundRect des Kreis-Objektes in 1/100mm virtual Rectangle GetBoundRect() const SAL_OVERRIDE; - void Scale( const boost::rational<long>& rFractX, const boost::rational<long>& rFracY ); + void Scale( const Fraction& rFractX, const Fraction& rFracY ); using IMapObject::IsEqual; bool IsEqual( const IMapCircleObject& rEqObj ); diff --git a/include/svtools/imappoly.hxx b/include/svtools/imappoly.hxx index e01b3114205b..79ca52a0a1c7 100644 --- a/include/svtools/imappoly.hxx +++ b/include/svtools/imappoly.hxx @@ -24,7 +24,7 @@ #include <svtools/imapobj.hxx> #include <tools/poly.hxx> -namespace boost { template<typename T> class rational; } +class Fraction; class SVT_DLLPUBLIC IMapPolygonObject : public IMapObject { @@ -66,7 +66,7 @@ public: const Rectangle& GetExtraEllipse() const { return aEllipse; } void SetExtraEllipse( const Rectangle& rEllipse ); - void Scale( const boost::rational<long>& rFractX, const boost::rational<long>& rFracY ); + void Scale( const Fraction& rFractX, const Fraction& rFracY ); using IMapObject::IsEqual; bool IsEqual( const IMapPolygonObject& rEqObj ); diff --git a/include/svtools/imaprect.hxx b/include/svtools/imaprect.hxx index 6855fb36926c..17c96841a5d1 100644 --- a/include/svtools/imaprect.hxx +++ b/include/svtools/imaprect.hxx @@ -23,7 +23,7 @@ #include <svtools/imapobj.hxx> #include <tools/gen.hxx> -namespace boost { template<typename T> class rational; } +class Fraction; class SVT_DLLPUBLIC IMapRectangleObject : public IMapObject { @@ -58,7 +58,7 @@ public: // liefert das BoundRect des Rechteck-Objektes in 1/100mm virtual Rectangle GetBoundRect() const SAL_OVERRIDE { return aRect; } - void Scale( const boost::rational<long>& rFractX, const boost::rational<long>& rFracY ); + void Scale( const Fraction& rFractX, const Fraction& rFracY ); using IMapObject::IsEqual; bool IsEqual( const IMapRectangleObject& rEqObj ); diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index a27a92175a5f..49d4e424da4b 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -644,7 +644,7 @@ private: RulerType meDragType; MapUnit meSourceUnit; FieldUnit meUnit; - boost::rational<long> maZoom; + Fraction maZoom; bool mbCalc; bool mbFormat; bool mbDrag; @@ -745,8 +745,8 @@ public: void SetUnit( FieldUnit eNewUnit ); FieldUnit GetUnit() const { return meUnit; } - void SetZoom( const boost::rational<long>& rNewZoom ); - boost::rational<long> GetZoom() const { return maZoom; } + void SetZoom( const Fraction& rNewZoom ); + Fraction GetZoom() const { return maZoom; } void SetSourceUnit( MapUnit eNewUnit ) { meSourceUnit = eNewUnit; } MapUnit GetSourceUnit() const { return meSourceUnit; } diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx index c1e37963c70c..ac7e52493ef7 100644 --- a/include/svx/obj3d.hxx +++ b/include/svx/obj3d.hxx @@ -153,7 +153,7 @@ public: virtual void SetPage(SdrPage* pNewPage) SAL_OVERRIDE; virtual void SetModel(SdrModel* pNewModel) SAL_OVERRIDE; virtual void NbcMove(const Size& rSize) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual SdrObjList* GetSubList() const SAL_OVERRIDE; // Insert 3D object into the group; transfer to other owner! diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx index b519126bea54..332fa2a7fa8d 100644 --- a/include/svx/scene3d.hxx +++ b/include/svx/scene3d.hxx @@ -191,8 +191,8 @@ public: virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE; virtual void NbcMove(const Size& rSize) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& rXFact, - const boost::rational<long>& rYFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& rXFact, + const Fraction& rYFact) SAL_OVERRIDE; virtual void RecalcSnapRect() SAL_OVERRIDE; virtual E3dScene* GetScene() const SAL_OVERRIDE; diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx index 9e9defe1e65a..97fca16cb310 100644 --- a/include/svx/sdr/properties/defaultproperties.hxx +++ b/include/svx/sdr/properties/defaultproperties.hxx @@ -94,7 +94,7 @@ namespace sdr virtual void ForceDefaultAttributes(); // Scale the included ItemSet. - virtual void Scale(const boost::rational<long>& rScale) SAL_OVERRIDE; + virtual void Scale(const Fraction& rScale) SAL_OVERRIDE; }; } // end of namespace properties } // end of namespace sdr diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx index 2bb32dfae246..6229e45e388e 100644 --- a/include/svx/sdr/properties/properties.hxx +++ b/include/svx/sdr/properties/properties.hxx @@ -30,7 +30,7 @@ class SdrObject; class SfxItemSet; class SfxPoolItem; class SfxStyleSheet; -namespace boost { template<typename T> class rational; } +class Fraction; class SfxItemPool; class SdrModel; @@ -146,7 +146,7 @@ namespace sdr // Scale the local ItemSet as far as it contains metric items. This needs to be // overloaded to do it for hierarchical objects like e.g. groups. - virtual void Scale(const boost::rational<long>& rScale); + virtual void Scale(const Fraction& rScale); // Move local items to a new ItemPool. This needs to be // overloaded to do it for hierarchical objects like e.g. groups. diff --git a/include/svx/svddrag.hxx b/include/svx/svddrag.hxx index 1a11e0c6f4bb..fd43db2bf1d7 100644 --- a/include/svx/svddrag.hxx +++ b/include/svx/svddrag.hxx @@ -22,7 +22,7 @@ #include <tools/gen.hxx> -#include <tools/rational.hxx> +#include <tools/fract.hxx> #include <svx/svxdllapi.h> // Status information for specialized object dragging. In order for the model @@ -146,8 +146,8 @@ public: bool CheckMinMoved(const Point& rPnt); long GetDX() const { return GetNow().X()-GetPrev().X(); } long GetDY() const { return GetNow().Y()-GetPrev().Y(); } - boost::rational<long> GetXFact() const; - boost::rational<long> GetYFact() const; + Fraction GetXFact() const; + Fraction GetYFact() const; SdrDragMethod* GetDragMethod() const { return pDragMethod; } void SetDragMethod(SdrDragMethod* pMth) { pDragMethod=pMth; } diff --git a/include/svx/svddrgmt.hxx b/include/svx/svddrgmt.hxx index ad37eeee3099..6e2fa4a87359 100644 --- a/include/svx/svddrgmt.hxx +++ b/include/svx/svddrgmt.hxx @@ -258,8 +258,8 @@ public: class SVX_DLLPUBLIC SdrDragResize : public SdrDragMethod { protected: - boost::rational<long> aXFact; - boost::rational<long> aYFact; + Fraction aXFact; + Fraction aYFact; public: TYPEINFO_OVERRIDE(); diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx index 12b27b84bb41..178282064075 100644 --- a/include/svx/svdedtv.hxx +++ b/include/svx/svdedtv.hxx @@ -212,8 +212,8 @@ public: // waagerechte Linie hat z.B. immer eine Hoehe von 0. void SetMarkedObjRect(const Rectangle& rRect, bool bCopy=false); void MoveMarkedObj(const Size& rSiz, bool bCopy=false); - void ResizeMarkedObj(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy=false); - void ResizeMultMarkedObj(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, const bool bCopy, const bool bWdh, const bool bHgt); + void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false); + void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, const bool bCopy, const bool bWdh, const bool bHgt); long GetMarkedObjRotate() const; void RotateMarkedObj(const Point& rRef, long nWink, bool bCopy=false); void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy=false); @@ -228,7 +228,7 @@ public: void CopyMarkedObj(); void SetAllMarkedRect(const Rectangle& rRect, bool bCopy=false) { SetMarkedObjRect(rRect,bCopy); } void MoveAllMarked(const Size& rSiz, bool bCopy=false) { MoveMarkedObj (rSiz,bCopy); } - void ResizeAllMarked(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy=false) { ResizeMarkedObj (rRef,xFact,yFact,bCopy); } + void ResizeAllMarked(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false) { ResizeMarkedObj (rRef,xFact,yFact,bCopy); } long GetAllMarkedRotate() const { return GetMarkedObjRotate(); } void RotateAllMarked(const Point& rRef, long nWink, bool bCopy=false) { RotateMarkedObj(rRef,nWink,bCopy); } void MirrorAllMarked(const Point& rRef1, const Point& rRef2, bool bCopy=false) { MirrorMarkedObj(rRef1,rRef2,bCopy); } diff --git a/include/svx/svdetc.hxx b/include/svx/svdetc.hxx index 2ec177c4daa9..e524364ed080 100644 --- a/include/svx/svdetc.hxx +++ b/include/svx/svdetc.hxx @@ -62,7 +62,7 @@ friend class SdrAttrObj; Color aFontColor; sal_uIntPtr nFontHeight; MapUnit eMapUnit; - boost::rational<long> aMapFraction; + Fraction aMapFraction; private: static SdrEngineDefaults& GetDefaults(); @@ -92,8 +92,8 @@ public: static void SetMapUnit(MapUnit eMap) { GetDefaults().eMapUnit=eMap; } static MapUnit GetMapUnit() { return GetDefaults().eMapUnit; } // Default MapFraction ist 1/1. - static void SetMapFraction(const boost::rational<long>& rMap) { GetDefaults().aMapFraction=rMap; } - static boost::rational<long> GetMapFraction() { return GetDefaults().aMapFraction; } + static void SetMapFraction(const Fraction& rMap) { GetDefaults().aMapFraction=rMap; } + static Fraction GetMapFraction() { return GetDefaults().aMapFraction; } // Einen Outliner mit den engineglobalen // Defaulteinstellungen auf dem Heap erzeugen. diff --git a/include/svx/svdglev.hxx b/include/svx/svdglev.hxx index a4feb7e0eba7..564831d58576 100644 --- a/include/svx/svdglev.hxx +++ b/include/svx/svdglev.hxx @@ -78,7 +78,7 @@ public: void DeleteMarkedGluePoints(); void MoveMarkedGluePoints (const Size& rSiz, bool bCopy=false); - void ResizeMarkedGluePoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy=false); + void ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false); void RotateMarkedGluePoints(const Point& rRef, long nWink, bool bCopy=false); void MirrorMarkedGluePoints(const Point& rRef1, const Point& rRef2, bool bCopy=false); void MirrorMarkedGluePointsHorizontal(bool bCopy=false); diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index c140de15a925..dbc295fc2dda 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -155,12 +155,12 @@ protected: Link aIOProgressLink; OUString aTablePath; Size aMaxObjSize; // e.g. for auto-growing text - boost::rational<long> aObjUnit; // description of the coordinate units for ClipBoard, Drag&Drop, ... + Fraction aObjUnit; // description of the coordinate units for ClipBoard, Drag&Drop, ... MapUnit eObjUnit; // see above FieldUnit eUIUnit; // unit, scale (e.g. 1/1000) for the UI (status bar) is set by ImpSetUIUnit() - boost::rational<long> aUIScale; // see above + Fraction aUIScale; // see above OUString aUIUnitStr; // see above - boost::rational<long> aUIUnitFact; // see above + Fraction aUIUnitFact; // see above int nUIUnitKomma; // see above SdrLayerAdmin* pLayerAdmin; @@ -376,10 +376,10 @@ public: // with the correct sizes. MapUnit GetScaleUnit() const { return eObjUnit; } void SetScaleUnit(MapUnit eMap); - const boost::rational<long>& GetScaleFraction() const { return aObjUnit; } - void SetScaleFraction(const boost::rational<long>& rFrac); + const Fraction& GetScaleFraction() const { return aObjUnit; } + void SetScaleFraction(const Fraction& rFrac); // Setting both simultaneously performs a little better - void SetScaleUnit(MapUnit eMap, const boost::rational<long>& rFrac); + void SetScaleUnit(MapUnit eMap, const Fraction& rFrac); // maximal size e.g. for auto growing texts const Size& GetMaxObjSize() const { return aMaxObjSize; } @@ -389,12 +389,12 @@ public: void SetUIUnit(FieldUnit eUnit); FieldUnit GetUIUnit() const { return eUIUnit; } // The scale of the drawing. Default 1/1. - void SetUIScale(const boost::rational<long>& rScale); - const boost::rational<long>& GetUIScale() const { return aUIScale; } + void SetUIScale(const Fraction& rScale); + const Fraction& GetUIScale() const { return aUIScale; } // Setting both simultaneously performs a little better - void SetUIUnit(FieldUnit eUnit, const boost::rational<long>& rScale); + void SetUIUnit(FieldUnit eUnit, const Fraction& rScale); - const boost::rational<long>& GetUIUnitFact() const { return aUIUnitFact; } + const Fraction& GetUIUnitFact() const { return aUIUnitFact; } const OUString& GetUIUnitStr() const { return aUIUnitStr; } int GetUIUnitKomma() const { return nUIUnitKomma; } bool IsUIOnlyKomma() const { return bUIOnlyKomma; } @@ -402,7 +402,7 @@ public: static void TakeUnitStr(FieldUnit eUnit, OUString& rStr); void TakeMetricStr(long nVal, OUString& rStr, bool bNoUnitChars = false, sal_Int32 nNumDigits = -1) const; void TakeWinkStr(long nWink, OUString& rStr, bool bNoDegChar = false) const; - void TakePercentStr(const boost::rational<long>& rVal, OUString& rStr, bool bNoPercentChar = false) const; + void TakePercentStr(const Fraction& rVal, OUString& rStr, bool bNoPercentChar = false) const; // RecalcPageNums is ordinarily only called by the Page. bool IsPagNumsDirty() const { return bPagNumsDirty; }; diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx index bca9283c6f93..169dd13b9dca 100644 --- a/include/svx/svdoashp.hxx +++ b/include/svx/svdoashp.hxx @@ -188,13 +188,13 @@ public: virtual const Rectangle& GetLogicRect() const SAL_OVERRIDE; virtual void Move(const Size& rSiz) SAL_OVERRIDE; - virtual void Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative = true) SAL_OVERRIDE; + virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) SAL_OVERRIDE; virtual void Shear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; virtual void SetSnapRect(const Rectangle& rRect) SAL_OVERRIDE; virtual void SetLogicRect(const Rectangle& rRect) SAL_OVERRIDE; virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index f1dc3a3bf94c..81b176a668f5 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -672,13 +672,13 @@ public: // Objekte sollten i.d.R. nur die Nbc-Methoden ueberladen. // Nbc bedeutet: 'NoBroadcast'. virtual void NbcMove (const Size& rSiz); - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact); + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs); virtual void NbcMirror(const Point& rRef1, const Point& rRef2); virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear); virtual void Move (const Size& rSiz); - virtual void Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative = true); + virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true); virtual void Rotate(const Point& rRef, long nWink, double sn, double cs); virtual void Mirror(const Point& rRef1, const Point& rRef2); virtual void Shear (const Point& rRef, long nWink, double tn, bool bVShear); diff --git a/include/svx/svdocapt.hxx b/include/svx/svdocapt.hxx index a10b0f7f6e1b..e7e372866280 100644 --- a/include/svx/svdocapt.hxx +++ b/include/svx/svdocapt.hxx @@ -116,7 +116,7 @@ public: virtual Pointer GetCreatePointer() const SAL_OVERRIDE; virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcSetRelativePos(const Point& rPnt) SAL_OVERRIDE; virtual Point GetRelativePos() const SAL_OVERRIDE; diff --git a/include/svx/svdocirc.hxx b/include/svx/svdocirc.hxx index 036a4bee4df4..40386fdf989d 100644 --- a/include/svx/svdocirc.hxx +++ b/include/svx/svdocirc.hxx @@ -112,7 +112,7 @@ public: virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const SAL_OVERRIDE; virtual Pointer GetCreatePointer() const SAL_OVERRIDE; virtual void NbcMove(const Size& aSiz) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE; diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx index 8161ca55cf2b..438c5e764188 100644 --- a/include/svx/svdoedge.hxx +++ b/include/svx/svdoedge.hxx @@ -264,7 +264,7 @@ public: virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE; virtual void NbcMove(const Size& aSize) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRefPnt, const boost::rational<long>& aXFact, const boost::rational<long>& aYFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) SAL_OVERRIDE; // #i54102# added rotate, mirrorn and shear support virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index 3179369711e6..e60060968fae 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -162,7 +162,7 @@ public: virtual sal_uInt32 GetHdlCount() const SAL_OVERRIDE; virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx index 4dc70df5b93d..4a89e8f3a61d 100644 --- a/include/svx/svdogrp.hxx +++ b/include/svx/svdogrp.hxx @@ -85,7 +85,7 @@ public: virtual long GetShearAngle(bool bVertical = false) const SAL_OVERRIDE; virtual void Move(const Size& rSiz) SAL_OVERRIDE; - virtual void Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative = true) SAL_OVERRIDE; + virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) SAL_OVERRIDE; virtual void Rotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; virtual void Mirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void Shear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; @@ -95,7 +95,7 @@ public: virtual void SetLogicRect(const Rectangle& rRect) SAL_OVERRIDE; virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx index f0cb6a7b624c..5cea5fe2de8b 100644 --- a/include/svx/svdomeas.hxx +++ b/include/svx/svdomeas.hxx @@ -117,7 +117,7 @@ public: virtual Pointer GetCreatePointer() const SAL_OVERRIDE; virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx index a27a35e8d0eb..f14646b20428 100644 --- a/include/svx/svdoole2.hxx +++ b/include/svx/svdoole2.hxx @@ -136,7 +136,7 @@ public: SdrOle2Obj& operator=(const SdrOle2Obj& rObj); virtual void NbcMove(const Size& rSize) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE; virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE; virtual void SetGeoData(const SdrObjGeoData& rGeo) SAL_OVERRIDE; @@ -167,7 +167,7 @@ public: const OUString& aMediaType ); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetParentXModel() const; - bool CalculateNewScaling( boost::rational<long>& aScaleWidth, boost::rational<long>& aScaleHeight, Size& aObjAreaSize ); + bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize ); bool AddOwnLightClient(); // handy to get the empty replacement graphic without accessing all the old stuff diff --git a/include/svx/svdopath.hxx b/include/svx/svdopath.hxx index f3e4a46b9004..b9cb18f73630 100644 --- a/include/svx/svdopath.hxx +++ b/include/svx/svdopath.hxx @@ -114,7 +114,7 @@ public: basegfx::B2DPolyPolygon getDragPolyPolygon(const SdrDragStat& rDrag) const; virtual void NbcMove(const Size& aSize) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRefPnt, const boost::rational<long>& aXFact, const boost::rational<long>& aYFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) SAL_OVERRIDE; virtual void NbcRotate(const Point& rRefPnt, long nAngle, double fSin, double fCos) SAL_OVERRIDE; virtual void NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2) SAL_OVERRIDE; virtual void NbcShear(const Point& rRefPnt, long nAngle, double fTan, bool bVShear) SAL_OVERRIDE; diff --git a/include/svx/svdorect.hxx b/include/svx/svdorect.hxx index db40274f3496..afd1d57b08b4 100644 --- a/include/svx/svdorect.hxx +++ b/include/svx/svdorect.hxx @@ -105,7 +105,7 @@ public: virtual Pointer GetCreatePointer() const SAL_OVERRIDE; virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx index 8b461b6c6aaa..2594a3544e3d 100644 --- a/include/svx/svdotable.hxx +++ b/include/svx/svdotable.hxx @@ -241,7 +241,7 @@ public: virtual Pointer GetCreatePointer() const SAL_OVERRIDE; virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual bool BegTextEdit(SdrOutliner& rOutl) SAL_OVERRIDE; virtual void EndTextEdit(SdrOutliner& rOutl) SAL_OVERRIDE; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 42eac31e692d..40cbacd4c469 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -264,7 +264,7 @@ private: Rectangle& rTextRect, Rectangle& rAnchorRect, Rectangle& rPaintRect, - boost::rational<long>& aFitXKorreg ) const; + Fraction& aFitXKorreg ) const; void ImpAutoFitText( SdrOutliner& rOutliner ) const; static void ImpAutoFitText( SdrOutliner& rOutliner, const Size& rShapeSize, bool bIsVerticalWriting ); SVX_DLLPRIVATE SdrObject* ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const; @@ -284,7 +284,7 @@ protected: SdrObject* ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed, bool bBezier, bool bNoSetAttr = false) const; SdrObject* ImpConvertAddText(SdrObject* pObj, bool bBezier) const; void ImpSetTextStyleSheetListeners(); - void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, boost::rational<long>& rFitXKorreg) const; + void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXKorreg) const; void ImpJustifyRect(Rectangle& rRect) const; void ImpCheckShear(); Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const; @@ -468,7 +468,7 @@ public: virtual Pointer GetCreatePointer() const SAL_OVERRIDE; virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; diff --git a/include/svx/svdouno.hxx b/include/svx/svdouno.hxx index f22cb57f161f..0a796da753ba 100644 --- a/include/svx/svdouno.hxx +++ b/include/svx/svdouno.hxx @@ -80,7 +80,7 @@ public: virtual SdrUnoObj* Clone() const SAL_OVERRIDE; SdrUnoObj& operator= (const SdrUnoObj& rObj); - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcSetLayer(SdrLayerID nLayer) SAL_OVERRIDE; // SpecialDrag support diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx index 82c311ef9c5f..766b8070c9ec 100644 --- a/include/svx/svdovirt.hxx +++ b/include/svx/svdovirt.hxx @@ -101,13 +101,13 @@ public: virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const SAL_OVERRIDE; virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE; - virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE; virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; virtual void Move(const Size& rSiz) SAL_OVERRIDE; - virtual void Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative = true) SAL_OVERRIDE; + virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) SAL_OVERRIDE; virtual void Rotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE; virtual void Mirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE; virtual void Shear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE; diff --git a/include/svx/svdpoev.hxx b/include/svx/svdpoev.hxx index b0adf6d09f97..ef73aa49b154 100644 --- a/include/svx/svdpoev.hxx +++ b/include/svx/svdpoev.hxx @@ -64,7 +64,7 @@ public: bool IsDeleteMarkedPointsPossible() const SAL_OVERRIDE; void MoveMarkedPoints(const Size& rSiz); - void ResizeMarkedPoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact); + void ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact); void RotateMarkedPoints(const Point& rRef, long nWink); // Hierbei entstehen eventuell beliebig viele neue Objekte: diff --git a/include/svx/svdsnpv.hxx b/include/svx/svdsnpv.hxx index c963d8031ad9..815656a77a39 100644 --- a/include/svx/svdsnpv.hxx +++ b/include/svx/svdsnpv.hxx @@ -51,10 +51,10 @@ protected: class ImplHelpLineOverlay* mpHelpLineOverlay; Size aMagnSiz; - boost::rational<long> aSnapWdtX; - boost::rational<long> aSnapWdtY; + Fraction aSnapWdtX; + Fraction aSnapWdtY; - sal_uInt16 nMagnSizPix; + sal_uInt16 nMagnSizPix; long nSnapAngle; long nEliminatePolyPointLimitAngle; @@ -98,9 +98,9 @@ public: virtual void BrkAction() SAL_OVERRIDE; // f.abg.Klassen Actions z,B, Draggen abbrechen. virtual void TakeActionRect(Rectangle& rRect) const SAL_OVERRIDE; - void SetSnapGridWidth(const boost::rational<long>& rX, const boost::rational<long>& rY) { aSnapWdtX=rX; aSnapWdtY=rY; } - const boost::rational<long>& GetSnapGridWidthX() const { return aSnapWdtX; } - const boost::rational<long>& GetSnapGridWidthY() const { return aSnapWdtY; } + void SetSnapGridWidth(const Fraction& rX, const Fraction& rY) { aSnapWdtX=rX; aSnapWdtY=rY; } + const Fraction& GetSnapGridWidthX() const { return aSnapWdtX; } + const Fraction& GetSnapGridWidthY() const { return aSnapWdtY; } void SetSnapMagnetic(const Size& rSiz) { if (rSiz!=aMagnSiz) { aMagnSiz=rSiz; } } const Size& GetSnapMagnetic() const { return aMagnSiz; } diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx index 6bb8b3aaf943..8bce42661918 100644 --- a/include/svx/svdtrans.hxx +++ b/include/svx/svdtrans.hxx @@ -22,7 +22,7 @@ #include <rtl/ustring.hxx> #include <svx/svxdllapi.h> -#include <tools/rational.hxx> +#include <tools/fract.hxx> #include <tools/gen.hxx> #include <tools/poly.hxx> #include <vcl/field.hxx> @@ -55,10 +55,10 @@ inline void MovePoly(Polygon& rPoly, const Size& S) { rPoly.Move(S.Width(), inline void MovePoly(tools::PolyPolygon& rPoly, const Size& S) { rPoly.Move(S.Width(),S.Height()); } void MoveXPoly(XPolygon& rPoly, const Size& S); -SVX_DLLPUBLIC void ResizeRect(Rectangle& rRect, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bNoJustify = false); -inline void ResizePoint(Point& rPnt, const Point& rRef, boost::rational<long> xFact, boost::rational<long> yFact); -void ResizePoly(Polygon& rPoly, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact); -void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact); +SVX_DLLPUBLIC void ResizeRect(Rectangle& rRect, const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bNoJustify = false); +inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact); +void ResizePoly(Polygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact); +void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact); inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs); SVX_DLLPUBLIC void RotatePoly(Polygon& rPoly, const Point& rRef, double sn, double cs); @@ -102,10 +102,12 @@ void CrookStretchPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rR /* Inline */ /**************************************************************************************************/ -inline void ResizePoint(Point& rPnt, const Point& rRef, boost::rational<long> xFact, boost::rational<long> yFact) +inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact) { - rPnt.X()=rRef.X()+ Round(((double)(rPnt.X()-rRef.X())*xFact.numerator())/xFact.denominator()); - rPnt.Y()=rRef.Y()+ Round(((double)(rPnt.Y()-rRef.Y())*yFact.numerator())/yFact.denominator()); + if (xFact.GetDenominator()==0) xFact=Fraction(xFact.GetNumerator(),1); // DivZero abfangen + if (yFact.GetDenominator()==0) yFact=Fraction(yFact.GetNumerator(),1); // DivZero abfangen + rPnt.X()=rRef.X()+ Round(((double)(rPnt.X()-rRef.X())*xFact.GetNumerator())/xFact.GetDenominator()); + rPnt.Y()=rRef.Y()+ Round(((double)(rPnt.Y()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator()); } inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs) @@ -219,25 +221,25 @@ SVX_DLLPUBLIC void OrthoDistance4(const Point& rPt0, Point& rPt, bool bBigOrtho) // Rechnung und Zwischenergebnis sind BigInt. SVX_DLLPUBLIC long BigMulDiv(long nVal, long nMul, long nDiv); -// Fehlerbehaftetes Kuerzen einer boost::rational<long>. +// Fehlerbehaftetes Kuerzen einer Fraction. // nDigits gibt an, wieviele signifikante Stellen in // Zaehler/Nenner mindestens erhalten bleiben sollen. -void Kuerzen(boost::rational<long>& rF, unsigned nDigits); +void Kuerzen(Fraction& rF, unsigned nDigits); class FrPair { - boost::rational<long> aX; - boost::rational<long> aY; + Fraction aX; + Fraction aY; public: FrPair() : aX(0,1),aY(0,1) {} - FrPair(const boost::rational<long>& rBoth) : aX(rBoth),aY(rBoth) {} - FrPair(const boost::rational<long>& rX, const boost::rational<long>& rY) : aX(rX),aY(rY) {} + FrPair(const Fraction& rBoth) : aX(rBoth),aY(rBoth) {} + FrPair(const Fraction& rX, const Fraction& rY) : aX(rX),aY(rY) {} FrPair(long nMul, long nDiv) : aX(nMul,nDiv),aY(nMul,nDiv) {} FrPair(long xMul, long xDiv, long yMul, long yDiv): aX(xMul,xDiv),aY(yMul,yDiv) {} - const boost::rational<long>& X() const { return aX; } - const boost::rational<long>& Y() const { return aY; } - boost::rational<long>& X() { return aX; } - boost::rational<long>& Y() { return aY; } + const Fraction& X() const { return aX; } + const Fraction& Y() const { return aY; } + Fraction& X() { return aX; } + Fraction& Y() { return aY; } }; // Fuer die Umrechnung von Masseinheiten @@ -263,7 +265,7 @@ inline bool IsInch(FieldUnit eU) { } class SVX_DLLPUBLIC SdrFormatter { - boost::rational<long> aScale; + Fraction aScale; long nMul_; long nDiv_; short nKomma_; diff --git a/include/svx/sxfiitm.hxx b/include/svx/sxfiitm.hxx index 6aa43ac3532d..570ebd02aa8c 100644 --- a/include/svx/sxfiitm.hxx +++ b/include/svx/sxfiitm.hxx @@ -20,26 +20,26 @@ #define INCLUDED_SVX_SXFIITM_HXX #include <svl/poolitem.hxx> -#include <tools/rational.hxx> +#include <tools/fract.hxx> /*************************************************************************/ /* FractionItem */ /*************************************************************************/ class SdrFractionItem: public SfxPoolItem { - boost::rational<long> nValue; + Fraction nValue; public: TYPEINFO_VISIBILITY( SVX_DLLPUBLIC ); SdrFractionItem(sal_uInt16 nId=0): SfxPoolItem(nId) {} - SdrFractionItem(sal_uInt16 nId, const boost::rational<long>& rVal): SfxPoolItem(nId), nValue(rVal) {} + SdrFractionItem(sal_uInt16 nId, const Fraction& rVal): SfxPoolItem(nId), nValue(rVal) {} SdrFractionItem(sal_uInt16 nId, SvStream& rIn); virtual bool operator==(const SfxPoolItem&) const SAL_OVERRIDE; virtual bool GetPresentation(SfxItemPresentation ePresentation, SfxMapUnit eCoreMetric, SfxMapUnit ePresentationMetric, OUString &rText, const IntlWrapper * = 0) const SAL_OVERRIDE; virtual SfxPoolItem* Create(SvStream&, sal_uInt16 nVer) const SAL_OVERRIDE; virtual SvStream& Store(SvStream&, sal_uInt16 nItemVers) const SAL_OVERRIDE; virtual SfxPoolItem* Clone(SfxItemPool *pPool=NULL) const SAL_OVERRIDE; - const boost::rational<long>& GetValue() const { return nValue; } - void SetValue(const boost::rational<long>& rVal) { nValue = rVal; } + const Fraction& GetValue() const { return nValue; } + void SetValue(const Fraction& rVal) { nValue = rVal; } }; diff --git a/include/svx/sxsiitm.hxx b/include/svx/sxsiitm.hxx index 8a7625a576ad..29fdf624dd81 100644 --- a/include/svx/sxsiitm.hxx +++ b/include/svx/sxsiitm.hxx @@ -24,8 +24,8 @@ class SdrScaleItem: public SdrFractionItem { public: TYPEINFO_OVERRIDE(); - SdrScaleItem(sal_uInt16 nId=0): SdrFractionItem(nId, boost::rational<long>(1,1) ) {} - SdrScaleItem(sal_uInt16 nId, const boost::rational<long>& rVal): SdrFractionItem(nId,rVal) {} + SdrScaleItem(sal_uInt16 nId=0): SdrFractionItem(nId,Fraction(1,1)) {} + SdrScaleItem(sal_uInt16 nId, const Fraction& rVal): SdrFractionItem(nId,rVal) {} SdrScaleItem(sal_uInt16 nId, SvStream& rIn): SdrFractionItem(nId,rIn) {} virtual bool GetPresentation(SfxItemPresentation ePresentation, SfxMapUnit eCoreMetric, SfxMapUnit ePresentationMetric, OUString &rText, const IntlWrapper * = 0) const SAL_OVERRIDE; virtual SfxPoolItem* Create(SvStream&, sal_uInt16 nVer) const SAL_OVERRIDE; diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx index 4236692b51bb..c5564e700dec 100644 --- a/include/tools/bigint.hxx +++ b/include/tools/bigint.hxx @@ -28,6 +28,8 @@ class SvStream; #define MAX_DIGITS 8 +class Fraction; + class TOOLS_DLLPUBLIC SAL_WARN_UNUSED BigInt { private: @@ -145,6 +147,8 @@ public: TOOLS_DLLPUBLIC friend bool operator> ( const BigInt& rVal1, const BigInt& rVal2 ); friend inline bool operator<=( const BigInt& rVal1, const BigInt& rVal2 ); friend inline bool operator>=( const BigInt& rVal1, const BigInt& rVal2 ); + + friend class Fraction; }; inline BigInt::operator short() const diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx new file mode 100644 index 000000000000..10e810ecb4ca --- /dev/null +++ b/include/tools/fract.hxx @@ -0,0 +1,142 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_TOOLS_FRACT_HXX +#define INCLUDED_TOOLS_FRACT_HXX + +#include <tools/toolsdllapi.h> + +class SvStream; + +class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Fraction +{ +private: + long nNumerator; + long nDenominator; + +public: + Fraction() { nNumerator = 0; nDenominator = 1; } + Fraction( const Fraction & rFrac ); + Fraction( long nNum, long nDen=1 ); + Fraction( double dVal ); + + bool IsValid() const; + + long GetNumerator() const { return nNumerator; } + long GetDenominator() const { return nDenominator; } + + operator long() const; + operator double() const; + + Fraction& operator=( const Fraction& rfrFrac ); + + Fraction& operator+=( const Fraction& rfrFrac ); + Fraction& operator-=( const Fraction& rfrFrac ); + Fraction& operator*=( const Fraction& rfrFrac ); + Fraction& operator/=( const Fraction& rfrFrac ); + + void ReduceInaccurate( unsigned nSignificantBits ); + + friend inline Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 ); + friend inline Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 ); + friend inline Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 ); + friend inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 ); + + TOOLS_DLLPUBLIC friend bool operator==( const Fraction& rVal1, const Fraction& rVal2 ); + friend inline bool operator!=( const Fraction& rVal1, const Fraction& rVal2 ); + TOOLS_DLLPUBLIC friend bool operator< ( const Fraction& rVal1, const Fraction& rVal2 ); + TOOLS_DLLPUBLIC friend bool operator> ( const Fraction& rVal1, const Fraction& rVal2 ); + friend inline bool operator<=( const Fraction& rVal1, const Fraction& rVal2 ); + friend inline bool operator>=( const Fraction& rVal1, const Fraction& rVal2 ); + + TOOLS_DLLPUBLIC friend SvStream& ReadFraction( SvStream& rIStream, Fraction& rFract ); + TOOLS_DLLPUBLIC friend SvStream& WriteFraction( SvStream& rOStream, const Fraction& rFract ); +}; + +inline Fraction::Fraction( const Fraction& rFrac ) +{ + nNumerator = rFrac.nNumerator; + nDenominator = rFrac.nDenominator; +} + +inline Fraction& Fraction::operator=( const Fraction& rFrac ) +{ + nNumerator = rFrac.nNumerator; + nDenominator = rFrac.nDenominator; + return *this; +} + +inline bool Fraction::IsValid() const +{ + return (nDenominator > 0); +} + +inline Fraction::operator long() const +{ + if ( nDenominator > 0 ) + return (nNumerator / nDenominator); + else + return 0; +} + +inline Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 ) +{ + Fraction aErg( rVal1 ); + aErg += rVal2; + return aErg; +} + +inline Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 ) +{ + Fraction aErg( rVal1 ); + aErg -= rVal2; + return aErg; +} + +inline Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 ) +{ + Fraction aErg( rVal1 ); + aErg *= rVal2; + return aErg; +} + +inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 ) +{ + Fraction aErg( rVal1 ); + aErg /= rVal2; + return aErg; +} + +inline bool operator !=( const Fraction& rVal1, const Fraction& rVal2 ) +{ + return !(rVal1 == rVal2); +} + +inline bool operator <=( const Fraction& rVal1, const Fraction& rVal2 ) +{ + return !(rVal1 > rVal2); +} + +inline bool operator >=( const Fraction& rVal1, const Fraction& rVal2 ) +{ + return !(rVal1 < rVal2); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/tools/rational.hxx b/include/tools/rational.hxx deleted file mode 100644 index 0eeb1032a83c..000000000000 --- a/include/tools/rational.hxx +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - */ -#ifndef INCLUDED_TOOLS_RATIONAL_HXX -#define INCLUDED_TOOLS_RATIONAL_HXX - -#include <boost/rational.hpp> -#include <tools/toolsdllapi.h> - -class SvStream; - -TOOLS_DLLPUBLIC boost::rational<long> rational_FromDouble(double dVal); -TOOLS_DLLPUBLIC void rational_ReduceInaccurate(boost::rational<long>& rRational, unsigned nSignificantBits); -TOOLS_DLLPUBLIC SvStream& ReadFraction(SvStream& rIStream, boost::rational<long>& rRational); -TOOLS_DLLPUBLIC SvStream& WriteFraction(SvStream& rOStream, const boost::rational<long>& rRational); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx index 128895fc0675..5a80213a7550 100644 --- a/include/vcl/gdimtf.hxx +++ b/include/vcl/gdimtf.hxx @@ -136,7 +136,7 @@ public: // additional Move method getting specifics how to handle MapMode( MAP_PIXEL ) void Move( long nX, long nY, long nDPIX, long nDPIY ); void Scale( double fScaleX, double fScaleY ); - void Scale( const boost::rational<long>& rScaleX, const boost::rational<long>& rScaleY ); + void Scale( const Fraction& rScaleX, const Fraction& rScaleY ); void Rotate( long nAngle10 ); void Clip( const Rectangle& ); /* get the bound rect of the contained actions diff --git a/include/vcl/mapmod.hxx b/include/vcl/mapmod.hxx index 211727f39660..10e06d2e9ca3 100644 --- a/include/vcl/mapmod.hxx +++ b/include/vcl/mapmod.hxx @@ -21,7 +21,7 @@ #define INCLUDED_VCL_MAPMOD_HXX #include <tools/gen.hxx> -#include <tools/rational.hxx> +#include <tools/fract.hxx> #include <tools/solar.h> #include <vcl/dllapi.h> #include <tools/resid.hxx> @@ -44,8 +44,8 @@ private: sal_uLong mnRefCount; MapUnit meUnit; Point maOrigin; - boost::rational<long> maScaleX; - boost::rational<long> maScaleY; + Fraction maScaleX; + Fraction maScaleY; bool mbSimple; friend SvStream& ReadImplMapMode( SvStream& rIStm, ImplMapMode& rMapMode ); @@ -75,7 +75,7 @@ public: MapMode( const MapMode& rMapMode ); MapMode( MapUnit eUnit ); MapMode( MapUnit eUnit, const Point& rLogicOrg, - const boost::rational<long>& rScaleX, const boost::rational<long>& rScaleY ); + const Fraction& rScaleX, const Fraction& rScaleY ); ~MapMode(); void SetMapUnit( MapUnit eUnit ); @@ -86,11 +86,11 @@ public: const Point& GetOrigin() const { return mpImplMapMode->maOrigin; } - void SetScaleX( const boost::rational<long>& rScaleX ); - const boost::rational<long>& GetScaleX() const + void SetScaleX( const Fraction& rScaleX ); + const Fraction& GetScaleX() const { return mpImplMapMode->maScaleX; } - void SetScaleY( const boost::rational<long>& rScaleY ); - const boost::rational<long>& GetScaleY() const + void SetScaleY( const Fraction& rScaleY ); + const Fraction& GetScaleY() const { return mpImplMapMode->maScaleY; } MapMode& operator=( const MapMode& rMapMode ); diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index 4886410bd2aa..624cb2f0f31a 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -124,7 +124,7 @@ public: bool SetOutputSizePixel( const Size& rNewSize, bool bErase = true ); bool SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, - const boost::rational<long>& rScale, + const Fraction& rScale, const Point& rNewOffset, const basebmp::RawMemorySharedArray &pBuffer, const bool bTopDown = false ); diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index af8d587a1750..44ab2c0b5ae9 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1011,8 +1011,8 @@ public: void SetCursor( vcl::Cursor* pCursor ); vcl::Cursor* GetCursor() const; - void SetZoom( const boost::rational<long>& rZoom ); - const boost::rational<long>& GetZoom() const; + void SetZoom( const Fraction& rZoom ); + const Fraction& GetZoom() const; bool IsZoom() const; long CalcZoom( long n ) const; |