summaryrefslogtreecommitdiff
path: root/include/svx
diff options
context:
space:
mode:
authorJuan Picca <jumapico@gmail.com>2014-09-19 14:19:30 -0300
committerDavid Tardon <dtardon@redhat.com>2014-10-09 11:33:33 +0000
commit47a2d7642d249d70b5da0c330a73f3a0032e4bba (patch)
tree202b04810382ea87cf8015a7b4de29e931408948 /include/svx
parentae77dc81c33ab0817264bcf5fc8bb71a55b78a73 (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/svx')
-rw-r--r--include/svx/obj3d.hxx2
-rw-r--r--include/svx/scene3d.hxx4
-rw-r--r--include/svx/sdr/properties/defaultproperties.hxx2
-rw-r--r--include/svx/sdr/properties/properties.hxx4
-rw-r--r--include/svx/svddrag.hxx6
-rw-r--r--include/svx/svddrgmt.hxx4
-rw-r--r--include/svx/svdedtv.hxx6
-rw-r--r--include/svx/svdetc.hxx6
-rw-r--r--include/svx/svdglev.hxx2
-rw-r--r--include/svx/svdmodel.hxx22
-rw-r--r--include/svx/svdoashp.hxx4
-rw-r--r--include/svx/svdobj.hxx4
-rw-r--r--include/svx/svdocapt.hxx2
-rw-r--r--include/svx/svdocirc.hxx2
-rw-r--r--include/svx/svdoedge.hxx2
-rw-r--r--include/svx/svdograf.hxx2
-rw-r--r--include/svx/svdogrp.hxx4
-rw-r--r--include/svx/svdomeas.hxx2
-rw-r--r--include/svx/svdoole2.hxx4
-rw-r--r--include/svx/svdopath.hxx2
-rw-r--r--include/svx/svdorect.hxx2
-rw-r--r--include/svx/svdotable.hxx2
-rw-r--r--include/svx/svdotext.hxx6
-rw-r--r--include/svx/svdouno.hxx2
-rw-r--r--include/svx/svdovirt.hxx4
-rw-r--r--include/svx/svdpoev.hxx2
-rw-r--r--include/svx/svdsnpv.hxx12
-rw-r--r--include/svx/svdtrans.hxx40
-rw-r--r--include/svx/sxfiitm.hxx10
-rw-r--r--include/svx/sxsiitm.hxx4
30 files changed, 84 insertions, 86 deletions
diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx
index ac7e52493ef7..c1e37963c70c 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 332fa2a7fa8d..b519126bea54 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 Fraction& rXFact,
- const Fraction& rYFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& rXFact,
+ const boost::rational<long>& 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 97fca16cb310..9e9defe1e65a 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 Fraction& rScale) SAL_OVERRIDE;
+ virtual void Scale(const boost::rational<long>& 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 6229e45e388e..2bb32dfae246 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;
-class Fraction;
+namespace boost { template<typename T> class rational; }
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 Fraction& rScale);
+ virtual void Scale(const boost::rational<long>& 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 fd43db2bf1d7..1a11e0c6f4bb 100644
--- a/include/svx/svddrag.hxx
+++ b/include/svx/svddrag.hxx
@@ -22,7 +22,7 @@
#include <tools/gen.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.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(); }
- Fraction GetXFact() const;
- Fraction GetYFact() const;
+ boost::rational<long> GetXFact() const;
+ boost::rational<long> 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 6e2fa4a87359..ad37eeee3099 100644
--- a/include/svx/svddrgmt.hxx
+++ b/include/svx/svddrgmt.hxx
@@ -258,8 +258,8 @@ public:
class SVX_DLLPUBLIC SdrDragResize : public SdrDragMethod
{
protected:
- Fraction aXFact;
- Fraction aYFact;
+ boost::rational<long> aXFact;
+ boost::rational<long> aYFact;
public:
TYPEINFO_OVERRIDE();
diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx
index 178282064075..12b27b84bb41 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 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);
+ 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);
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 Fraction& xFact, const Fraction& yFact, bool bCopy=false) { ResizeMarkedObj (rRef,xFact,yFact,bCopy); }
+ void ResizeAllMarked(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 e524364ed080..2ec177c4daa9 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;
- Fraction aMapFraction;
+ boost::rational<long> 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 Fraction& rMap) { GetDefaults().aMapFraction=rMap; }
- static Fraction GetMapFraction() { return GetDefaults().aMapFraction; }
+ static void SetMapFraction(const boost::rational<long>& rMap) { GetDefaults().aMapFraction=rMap; }
+ static boost::rational<long> 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 8a9e420815a2..b1576bda5047 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 Fraction& xFact, const Fraction& yFact, bool bCopy=false);
+ void ResizeMarkedGluePoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 0d9b03b3480a..850185edb581 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
- Fraction aObjUnit; // description of the coordinate units for ClipBoard, Drag&Drop, ...
+ boost::rational<long> 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()
- Fraction aUIScale; // see above
+ boost::rational<long> aUIScale; // see above
OUString aUIUnitStr; // see above
- Fraction aUIUnitFact; // see above
+ boost::rational<long> aUIUnitFact; // see above
int nUIUnitKomma; // see above
SdrLayerAdmin* pLayerAdmin;
@@ -374,10 +374,10 @@ public:
// with the correct sizes.
MapUnit GetScaleUnit() const { return eObjUnit; }
void SetScaleUnit(MapUnit eMap);
- const Fraction& GetScaleFraction() const { return aObjUnit; }
- void SetScaleFraction(const Fraction& rFrac);
+ const boost::rational<long>& GetScaleFraction() const { return aObjUnit; }
+ void SetScaleFraction(const boost::rational<long>& rFrac);
// Setting both simultaneously performs a little better
- void SetScaleUnit(MapUnit eMap, const Fraction& rFrac);
+ void SetScaleUnit(MapUnit eMap, const boost::rational<long>& rFrac);
// maximal size e.g. for auto growing texts
const Size& GetMaxObjSize() const { return aMaxObjSize; }
@@ -387,12 +387,12 @@ public:
void SetUIUnit(FieldUnit eUnit);
FieldUnit GetUIUnit() const { return eUIUnit; }
// The scale of the drawing. Default 1/1.
- void SetUIScale(const Fraction& rScale);
- const Fraction& GetUIScale() const { return aUIScale; }
+ void SetUIScale(const boost::rational<long>& rScale);
+ const boost::rational<long>& GetUIScale() const { return aUIScale; }
// Setting both simultaneously performs a little better
- void SetUIUnit(FieldUnit eUnit, const Fraction& rScale);
+ void SetUIUnit(FieldUnit eUnit, const boost::rational<long>& rScale);
- const Fraction& GetUIUnitFact() const { return aUIUnitFact; }
+ const boost::rational<long>& GetUIUnitFact() const { return aUIUnitFact; }
const OUString& GetUIUnitStr() const { return aUIUnitStr; }
int GetUIUnitKomma() const { return nUIUnitKomma; }
bool IsUIOnlyKomma() const { return bUIOnlyKomma; }
@@ -400,7 +400,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 Fraction& rVal, OUString& rStr, bool bNoPercentChar = false) const;
+ void TakePercentStr(const boost::rational<long>& 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 169dd13b9dca..bca9283c6f93 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 Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) 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 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 81b176a668f5..f1dc3a3bf94c 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 Fraction& xFact, const Fraction& yFact);
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true);
+ virtual void Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 e7e372866280..a10b0f7f6e1b 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 40386fdf989d..036a4bee4df4 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 438c5e764188..8161ca55cf2b 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 Fraction& aXFact, const Fraction& aYFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRefPnt, const boost::rational<long>& aXFact, const boost::rational<long>& 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 e60060968fae..3179369711e6 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 4a89e8f3a61d..4dc70df5b93d 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 Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) 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 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 5cea5fe2de8b..f0cb6a7b624c 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 f14646b20428..a27a35e8d0eb 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
+ bool CalculateNewScaling( boost::rational<long>& aScaleWidth, boost::rational<long>& 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 b9cb18f73630..f3e4a46b9004 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 Fraction& aXFact, const Fraction& aYFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRefPnt, const boost::rational<long>& aXFact, const boost::rational<long>& 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 afd1d57b08b4..db40274f3496 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 2594a3544e3d..8b461b6c6aaa 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 a2b7b1f3e21c..94a032c2b585 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -264,7 +264,7 @@ private:
Rectangle& rTextRect,
Rectangle& rAnchorRect,
Rectangle& rPaintRect,
- Fraction& aFitXKorreg ) const;
+ boost::rational<long>& 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, Fraction& rFitXKorreg) const;
+ void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, boost::rational<long>& rFitXKorreg) const;
void ImpJustifyRect(Rectangle& rRect) const;
void ImpCheckShear();
Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
@@ -465,7 +465,7 @@ public:
virtual Pointer GetCreatePointer() const SAL_OVERRIDE;
virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE;
- virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 0a796da753ba..f22cb57f161f 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 766b8070c9ec..82c311ef9c5f 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 Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) 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 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 ef73aa49b154..b0adf6d09f97 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 Fraction& xFact, const Fraction& yFact);
+ void ResizeMarkedPoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 815656a77a39..c963d8031ad9 100644
--- a/include/svx/svdsnpv.hxx
+++ b/include/svx/svdsnpv.hxx
@@ -51,10 +51,10 @@ protected:
class ImplHelpLineOverlay* mpHelpLineOverlay;
Size aMagnSiz;
- Fraction aSnapWdtX;
- Fraction aSnapWdtY;
+ boost::rational<long> aSnapWdtX;
+ boost::rational<long> 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 Fraction& rX, const Fraction& rY) { aSnapWdtX=rX; aSnapWdtY=rY; }
- const Fraction& GetSnapGridWidthX() const { return aSnapWdtX; }
- const Fraction& GetSnapGridWidthY() const { return aSnapWdtY; }
+ 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 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 b287c23816f3..d29ab1f77e9a 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/fract.hxx>
+#include <tools/rational.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 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);
+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);
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,12 +102,10 @@ void CrookStretchPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rR
/* Inline */
/**************************************************************************************************/
-inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact)
+inline void ResizePoint(Point& rPnt, const Point& rRef, boost::rational<long> xFact, boost::rational<long> yFact)
{
- 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());
+ 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());
}
inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs)
@@ -221,25 +219,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 Fraction.
+// Fehlerbehaftetes Kuerzen einer boost::rational<long>.
// nDigits gibt an, wieviele signifikante Stellen in
// Zaehler/Nenner mindestens erhalten bleiben sollen.
-void Kuerzen(Fraction& rF, unsigned nDigits);
+void Kuerzen(boost::rational<long>& rF, unsigned nDigits);
class FrPair {
- Fraction aX;
- Fraction aY;
+ boost::rational<long> aX;
+ boost::rational<long> aY;
public:
FrPair() : aX(0,1),aY(0,1) {}
- FrPair(const Fraction& rBoth) : aX(rBoth),aY(rBoth) {}
- FrPair(const Fraction& rX, const Fraction& rY) : aX(rX),aY(rY) {}
+ 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(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 Fraction& X() const { return aX; }
- const Fraction& Y() const { return aY; }
- Fraction& X() { return aX; }
- Fraction& Y() { return aY; }
+ 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; }
};
// Fuer die Umrechnung von Masseinheiten
@@ -265,7 +263,7 @@ inline bool IsInch(FieldUnit eU) {
}
class SVX_DLLPUBLIC SdrFormatter {
- Fraction aScale;
+ boost::rational<long> aScale;
long nMul_;
long nDiv_;
short nKomma_;
diff --git a/include/svx/sxfiitm.hxx b/include/svx/sxfiitm.hxx
index 570ebd02aa8c..6aa43ac3532d 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/fract.hxx>
+#include <tools/rational.hxx>
/*************************************************************************/
/* FractionItem */
/*************************************************************************/
class SdrFractionItem: public SfxPoolItem {
- Fraction nValue;
+ boost::rational<long> nValue;
public:
TYPEINFO_VISIBILITY( SVX_DLLPUBLIC );
SdrFractionItem(sal_uInt16 nId=0): SfxPoolItem(nId) {}
- SdrFractionItem(sal_uInt16 nId, const Fraction& rVal): SfxPoolItem(nId), nValue(rVal) {}
+ SdrFractionItem(sal_uInt16 nId, const boost::rational<long>& 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 Fraction& GetValue() const { return nValue; }
- void SetValue(const Fraction& rVal) { nValue = rVal; }
+ const boost::rational<long>& GetValue() const { return nValue; }
+ void SetValue(const boost::rational<long>& rVal) { nValue = rVal; }
};
diff --git a/include/svx/sxsiitm.hxx b/include/svx/sxsiitm.hxx
index 29fdf624dd81..8a7625a576ad 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,Fraction(1,1)) {}
- SdrScaleItem(sal_uInt16 nId, const Fraction& rVal): SdrFractionItem(nId,rVal) {}
+ 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, 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;