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/svx/svdtrans.hxx | |
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/svx/svdtrans.hxx')
-rw-r--r-- | include/svx/svdtrans.hxx | 40 |
1 files changed, 21 insertions, 19 deletions
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_; |