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 /starmath | |
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 'starmath')
-rw-r--r-- | starmath/inc/node.hxx | 12 | ||||
-rw-r--r-- | starmath/inc/pch/precompiled_sm.hxx | 2 | ||||
-rw-r--r-- | starmath/inc/utility.hxx | 24 | ||||
-rw-r--r-- | starmath/inc/view.hxx | 2 | ||||
-rw-r--r-- | starmath/source/ElementsDockingWindow.cxx | 2 | ||||
-rw-r--r-- | starmath/source/mathmlexport.cxx | 12 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 6 | ||||
-rw-r--r-- | starmath/source/node.cxx | 42 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 10 | ||||
-rw-r--r-- | starmath/source/utility.cxx | 6 | ||||
-rw-r--r-- | starmath/source/view.cxx | 26 | ||||
-rw-r--r-- | starmath/source/visitors.cxx | 2 |
12 files changed, 73 insertions, 73 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 93ed6210fcb4..220e30d2ffc9 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -134,8 +134,8 @@ public: SmFace & GetFont() { return aFace; }; void SetFont(const SmFace &rFace); - void SetFontSize(const boost::rational<long> &rRelSize, sal_uInt16 nType); - void SetSize(const boost::rational<long> &rScale); + void SetFontSize(const Fraction &rRelSize, sal_uInt16 nType); + void SetSize(const Fraction &rScale); virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); virtual void PrepareAttributes(); @@ -1240,18 +1240,18 @@ public: class SmFontNode : public SmStructureNode { sal_uInt16 nSizeType; - boost::rational<long> aFontSize; + Fraction aFontSize; public: SmFontNode(const SmToken &rNodeToken) : SmStructureNode(NFONT, rNodeToken) { nSizeType = FNTSIZ_MULTIPLY; - aFontSize = boost::rational<long>(1L); + aFontSize = Fraction(1L); } - void SetSizeParameter(const boost::rational<long> &rValue, sal_uInt16 nType); - const boost::rational<long> & GetSizeParameter() const {return aFontSize;} + void SetSizeParameter(const Fraction &rValue, sal_uInt16 nType); + const Fraction & GetSizeParameter() const {return aFontSize;} const sal_uInt16& GetSizeType() const {return nSizeType;} virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell) SAL_OVERRIDE; diff --git a/starmath/inc/pch/precompiled_sm.hxx b/starmath/inc/pch/precompiled_sm.hxx index db4b7509f2f4..0f75800fa407 100644 --- a/starmath/inc/pch/precompiled_sm.hxx +++ b/starmath/inc/pch/precompiled_sm.hxx @@ -162,7 +162,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <tools/color.hxx> #include <tools/diagnose_ex.h> -#include <tools/rational.hxx> +#include <tools/fract.hxx> #include <tools/gen.hxx> #include <tools/globname.hxx> #include <tools/mapunit.hxx> diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx index 8cb9254004f8..304c10c7e841 100644 --- a/starmath/inc/utility.hxx +++ b/starmath/inc/utility.hxx @@ -23,7 +23,7 @@ #include <vcl/fixed.hxx> #include <vcl/combobox.hxx> #include <vcl/lstbox.hxx> -#include <tools/rational.hxx> +#include <tools/fract.hxx> #include <deque> @@ -41,28 +41,28 @@ inline long SmPtsTo100th_mm(long nNumPts) } -inline long SmPtsTo100th_mm(const boost::rational<long> &rNumPts) - // as above but with argument 'rNumPts' as 'boost::rational<long>' +inline long SmPtsTo100th_mm(const Fraction &rNumPts) + // as above but with argument 'rNumPts' as 'Fraction' { - boost::rational<long> aTmp (254000L, 7227L); - return boost::rational_cast<long>(aTmp * rNumPts); + Fraction aTmp (254000L, 7227L); + return aTmp *= rNumPts; } -inline boost::rational<long> Sm100th_mmToPts(long nNum100th_mm) +inline Fraction Sm100th_mmToPts(long nNum100th_mm) // returns the length (in points) that corresponds to the length // 'nNum100th_mm' (in 100th of mm). { SAL_WARN_IF( nNum100th_mm < 0, "starmath", "Ooops..." ); - boost::rational<long> aTmp (7227L, 254000L); - return aTmp *= boost::rational<long>(nNum100th_mm); + Fraction aTmp (7227L, 254000L); + return aTmp *= Fraction(nNum100th_mm); } -inline long SmRoundFraction(const boost::rational<long> &rFrac) +inline long SmRoundFraction(const Fraction &rFrac) { - SAL_WARN_IF( rFrac <= boost::rational<long>(), "starmath", "Ooops..." ); - return (rFrac.numerator() + rFrac.denominator() / 2) / rFrac.denominator(); + SAL_WARN_IF( rFrac <= Fraction(), "starmath", "Ooops..." ); + return (rFrac.GetNumerator() + rFrac.GetDenominator() / 2) / rFrac.GetDenominator(); } @@ -109,7 +109,7 @@ public: SmFace & operator = (const SmFace &rFace); }; -SmFace & operator *= (SmFace &rFace, const boost::rational<long> &rFrac); +SmFace & operator *= (SmFace &rFace, const Fraction &rFrac); diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index b23572e2d1e9..e35cb244b485 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -276,7 +276,7 @@ protected: virtual void InnerResizePixel(const Point &rOfs, const Size &rSize) SAL_OVERRIDE; virtual void OuterResizePixel(const Point &rOfs, const Size &rSize) SAL_OVERRIDE; virtual void QueryObjAreaPixel( Rectangle& rRect ) const SAL_OVERRIDE; - virtual void SetZoomFactor( const boost::rational<long> &rX, const boost::rational<long> &rY ) SAL_OVERRIDE; + virtual void SetZoomFactor( const Fraction &rX, const Fraction &rY ) SAL_OVERRIDE; public: TYPEINFO_OVERRIDE(); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index a488ad15502b..5b5a8339ea4f 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -449,7 +449,7 @@ void SmElementsControl::addElement(const OUString& aElementVisual, const OUStrin SmNodePointer pNode(SmParser().ParseExpression(aElementVisual)); pNode->Prepare(maFormat, *mpDocShell); - pNode->SetSize(boost::rational<long>(10,8)); + pNode->SetSize(Fraction(10,8)); pNode->Arrange(*this, maFormat); Size aSizePixel = LogicToPixel(Size(pNode->GetWidth(), pNode->GetHeight()), MAP_100TH_MM); diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index a8183ed7388b..c55190b31059 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -1344,24 +1344,24 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) case TSIZE: { const SmFontNode *pFontNode = static_cast<const SmFontNode *>(pNode); - const boost::rational<long>& aFrac = pFontNode->GetSizeParameter(); + const Fraction &aFrac = pFontNode->GetSizeParameter(); OUStringBuffer sStrBuf; switch(pFontNode->GetSizeType()) { case FNTSIZ_MULTIPLY: ::sax::Converter::convertDouble(sStrBuf, - boost::rational_cast<double>(aFrac * rational_FromDouble(100.0))); + static_cast<double>(aFrac*Fraction(100.00))); sStrBuf.append('%'); break; case FNTSIZ_DIVIDE: ::sax::Converter::convertDouble(sStrBuf, - boost::rational_cast<double>(rational_FromDouble(100.0) / aFrac)); + static_cast<double>(Fraction(100.00)/aFrac)); sStrBuf.append('%'); break; case FNTSIZ_ABSOLUT: ::sax::Converter::convertDouble(sStrBuf, - boost::rational_cast<double>(aFrac)); + static_cast<double>(aFrac)); sStrBuf.append( GetXMLToken(XML_UNIT_PT)); break; @@ -1373,7 +1373,7 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) //value specified in points. //Must fix StarMath to retain the original pt values - boost::rational<long> aTemp = Sm100th_mmToPts(pFontNode->GetFont(). + Fraction aTemp = Sm100th_mmToPts(pFontNode->GetFont(). GetSize().Height()); if (pFontNode->GetSizeType() == FNTSIZ_MINUS) @@ -1381,7 +1381,7 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) else aTemp+=aFrac; - double mytest = static_cast<double>(boost::rational_cast<double>(aTemp)); + double mytest = static_cast<double>(aTemp); mytest = ::rtl::math::round(mytest,1); ::sax::Converter::convertDouble(sStrBuf,mytest); diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 1f5a07824d0c..0ea7bc2ee384 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -724,14 +724,14 @@ void SmXMLContext_Helper::ApplyAttrs() .GetMM100UnitConverter().GetXMLMeasureUnit()) { if (nFontSize < 100.00) - pFontNode->SetSizeParameter(rational_FromDouble(100.00/nFontSize), + pFontNode->SetSizeParameter(Fraction(100.00/nFontSize), FNTSIZ_DIVIDE); else - pFontNode->SetSizeParameter(rational_FromDouble(nFontSize/100.00), + pFontNode->SetSizeParameter(Fraction(nFontSize/100.00), FNTSIZ_MULTIPLY); } else - pFontNode->SetSizeParameter(rational_FromDouble(nFontSize),FNTSIZ_ABSOLUT); + pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT); pFontNode->SetSubNodes(0,lcl_popOrZero(rNodeStack)); rNodeStack.push(pFontNode); diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index dd1c51c4b4b9..06fdbf753175 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -30,7 +30,7 @@ #include <comphelper/string.hxx> #include <tools/color.hxx> -#include <tools/rational.hxx> +#include <tools/fract.hxx> #include <tools/gen.hxx> #include <vcl/outdev.hxx> @@ -165,16 +165,16 @@ void SmNode::SetFont(const SmFace &rFace) } -void SmNode::SetFontSize(const boost::rational<long>& rSize, sal_uInt16 nType) +void SmNode::SetFontSize(const Fraction &rSize, sal_uInt16 nType) //! 'rSize' is in units of pts { Size aFntSize; if (!(Flags() & FLG_SIZE)) { - boost::rational<long> aVal (SmPtsTo100th_mm(rSize.numerator()), - rSize.denominator()); - long nHeight = boost::rational_cast<long>(aVal); + Fraction aVal (SmPtsTo100th_mm(rSize.GetNumerator()), + rSize.GetDenominator()); + long nHeight = (long)aVal; aFntSize = GetFont().GetSize(); aFntSize.Width() = 0; @@ -193,12 +193,12 @@ void SmNode::SetFontSize(const boost::rational<long>& rSize, sal_uInt16 nType) break; case FNTSIZ_MULTIPLY: - aFntSize.Height() = boost::rational_cast<long>(aFntSize.Height() * rSize); + aFntSize.Height() = (long) (Fraction(aFntSize.Height()) * rSize); break; case FNTSIZ_DIVIDE: - if (rSize != boost::rational<long>(0L)) - aFntSize.Height() = boost::rational_cast<long>(aFntSize.Height() / rSize); + if (rSize != Fraction(0L)) + aFntSize.Height() = (long) (Fraction(aFntSize.Height()) / rSize); break; default: break; @@ -220,7 +220,7 @@ void SmNode::SetFontSize(const boost::rational<long>& rSize, sal_uInt16 nType) } -void SmNode::SetSize(const boost::rational<long>& rSize) +void SmNode::SetSize(const Fraction &rSize) { GetFont() *= rSize; @@ -906,7 +906,7 @@ void SmUnHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) OSL_ENSURE(pOper, "Sm: NULL pointer"); OSL_ENSURE(pBody, "Sm: NULL pointer"); - pOper->SetSize(boost::rational<long> (rFormat.GetRelSize(SIZ_OPERATOR), 100)); + pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100)); pOper->Arrange(rDev, rFormat); pBody->Arrange(rDev, rFormat); @@ -1003,7 +1003,7 @@ void SmRootNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) pRootSym->MoveTo(aPos); if (pExtra) - { pExtra->SetSize(boost::rational<long>(rFormat.GetRelSize(SIZ_INDEX), 100)); + { pExtra->SetSize(Fraction(rFormat.GetRelSize(SIZ_INDEX), 100)); pExtra->Arrange(rDev, rFormat); aPos = GetExtraPos(*pRootSym, *pExtra); @@ -1097,7 +1097,7 @@ void SmBinHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) OSL_ENSURE(pOper != NULL, "Sm: NULL pointer"); OSL_ENSURE(pRight != NULL, "Sm: NULL pointer"); - pOper->SetSize(boost::rational<long> (rFormat.GetRelSize(SIZ_OPERATOR), 100)); + pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100)); pLeft ->Arrange(rDev, rFormat); pOper ->Arrange(rDev, rFormat); @@ -1139,7 +1139,7 @@ void SmBinVerNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) bool bIsTextmode = rFormat.IsTextmode(); if (bIsTextmode) { - boost::rational<long> aFraction(rFormat.GetRelSize(SIZ_INDEX), 100); + Fraction aFraction(rFormat.GetRelSize(SIZ_INDEX), 100); pNum ->SetSize(aFraction); pLine ->SetSize(aFraction); pDenom->SetSize(aFraction); @@ -1502,7 +1502,7 @@ void SmSubSupNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) { sal_uInt16 nIndex = (eSubSup == CSUB || eSubSup == CSUP) ? SIZ_LIMITS : SIZ_INDEX; - boost::rational<long> aFraction ( rFormat.GetRelSize(nIndex), 100 ); + Fraction aFraction ( rFormat.GetRelSize(nIndex), 100 ); pSubSup->SetSize(aFraction); } @@ -1833,9 +1833,9 @@ void SmVerticalBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFor pBody->Arrange(aTmpDev, rFormat); // size is the same as for limits for this part - pScript->SetSize( boost::rational<long>( rFormat.GetRelSize(SIZ_LIMITS), 100 ) ); + pScript->SetSize( Fraction( rFormat.GetRelSize(SIZ_LIMITS), 100 ) ); // braces are a bit taller than usually - pBrace ->SetSize( boost::rational<long>(3, 2) ); + pBrace ->SetSize( Fraction(3, 2) ); long nItalicWidth = pBody->GetItalicWidth(); if (nItalicWidth > 0) @@ -1929,7 +1929,7 @@ void SmOperNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) OSL_ENSURE(pBody, "Sm: missing subnode"); SmNode *pSymbol = GetSymbol(); - pSymbol->SetSize(boost::rational<long>(CalcSymbolHeight(*pSymbol, rFormat), + pSymbol->SetSize(Fraction(CalcSymbolHeight(*pSymbol, rFormat), pSymbol->GetFont().GetSize().Height())); pBody->Arrange(rDev, rFormat); @@ -2062,7 +2062,7 @@ void SmFontNode::CreateTextFromNode(OUString &rText) break; } rText += ::rtl::math::doubleToUString( - static_cast<double>(boost::rational_cast<double>(this->aFontSize)), + static_cast<double>(aFontSize), rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', true); rText += " "; @@ -2174,7 +2174,7 @@ void SmFontNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) } -void SmFontNode::SetSizeParameter(const boost::rational<long>& rValue, sal_uInt16 Type) +void SmFontNode::SetSizeParameter(const Fraction& rValue, sal_uInt16 Type) { nSizeType = Type; aFontSize = rValue; @@ -2367,7 +2367,7 @@ void SmTextNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) sal_uInt16 nSizeDesc = GetFontDesc() == FNT_FUNCTION ? SIZ_FUNCTION : SIZ_TEXT; - GetFont() *= boost::rational<long> (rFormat.GetRelSize(nSizeDesc), 100); + GetFont() *= Fraction (rFormat.GetRelSize(nSizeDesc), 100); SmTmpDevice aTmpDev ((OutputDevice &) rDev, true); aTmpDev.SetFont(GetFont()); @@ -2729,7 +2729,7 @@ void SmMathSymbolNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat PrepareAttributes(); - GetFont() *= boost::rational<long> (rFormat.GetRelSize(SIZ_TEXT), 100); + GetFont() *= Fraction (rFormat.GetRelSize(SIZ_TEXT), 100); SmTmpDevice aTmpDev ((OutputDevice &) rDev, true); aTmpDev.SetFont(GetFont()); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 54254bb20fd0..b7373f122434 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -1947,7 +1947,7 @@ void SmParser::FontSize() } // get number argument - boost::rational<long> aValue( 1L ); + Fraction aValue( 1L ); if (lcl_IsNumber( m_aCurToken.aText )) { double fTmp = OUString(m_aCurToken.aText).toDouble(); @@ -1960,16 +1960,16 @@ void SmParser::FontSize() //!! (for example in SmNode::SetFontSize the font size calculated //!! may become 0 because of this!!! Happens e.g. for ftmp = 2.9 with Linux //!! or ftmp = 1.11111111111111111... (11/9) on every platform.) - if (aValue.denominator() > 1000) + if (aValue.GetDenominator() > 1000) { - long nNum = aValue.numerator(); - long nDenom = aValue.denominator(); + long nNum = aValue.GetNumerator(); + long nDenom = aValue.GetDenominator(); while (nDenom > 1000) { nNum /= 10; nDenom /= 10; } - aValue = boost::rational<long>( nNum, nDenom ); + aValue = Fraction( nNum, nDenom ); } } } diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx index a47df4a62a9b..47fad4ebb097 100644 --- a/starmath/source/utility.cxx +++ b/starmath/source/utility.cxx @@ -284,14 +284,14 @@ SmFace & SmFace::operator = (const SmFace &rFace) } -SmFace & operator *= (SmFace &rFace, const boost::rational<long>& rFrac) +SmFace & operator *= (SmFace &rFace, const Fraction &rFrac) // scales the width and height of 'rFace' by 'rFrac' and returns a // reference to 'rFace'. // It's main use is to make scaling fonts look easier. { const Size &rFaceSize = rFace.GetSize(); - rFace.SetSize(Size(rFaceSize.Width() * boost::rational_cast<long>(rFrac), - rFaceSize.Height() * boost::rational_cast<long>(rFrac))); + rFace.SetSize(Size(Fraction(rFaceSize.Width()) *= rFrac, + Fraction(rFaceSize.Height()) *= rFrac)); return rFace; } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 55874794153a..6261019fb31e 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -103,7 +103,7 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell): // resource) and will be shown by the sfx framework. Hide(); - const boost::rational<long> aFraction (1,1); + const Fraction aFraction (1,1); SetMapMode( MapMode(MAP_100TH_MM, Point(), aFraction, aFraction)); ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); @@ -613,7 +613,7 @@ IMPL_LINK_INLINE_END( SmGraphicWindow, MenuSelectHdl, Menu *, pMenu ) void SmGraphicWindow::SetZoom(sal_uInt16 Factor) { nZoom = std::min(std::max((sal_uInt16) Factor, (sal_uInt16) MINZOOM), (sal_uInt16) MAXZOOM); - boost::rational<long> aFraction (nZoom, 100); + Fraction aFraction (nZoom, 100); SetMapMode( MapMode(MAP_100TH_MM, Point(), aFraction, aFraction) ); SetTotalSize(); SmViewShell *pViewSh = GetView(); @@ -960,8 +960,8 @@ void SmViewShell::InnerResizePixel(const Point &rOfs, const Size &rSize) if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 ) { Size aProvidedSize = GetWindow()->PixelToLogic( rSize, MAP_100TH_MM ); - SfxViewShell::SetZoomFactor( boost::rational<long>( aProvidedSize.Width(), aObjSize.Width() ), - boost::rational<long>( aProvidedSize.Height(), aObjSize.Height() ) ); + SfxViewShell::SetZoomFactor( Fraction( aProvidedSize.Width(), aObjSize.Width() ), + Fraction( aProvidedSize.Height(), aObjSize.Height() ) ); } SetBorderPixel( SvBorder() ); @@ -986,10 +986,10 @@ void SmViewShell::QueryObjAreaPixel( Rectangle& rRect ) const } -void SmViewShell::SetZoomFactor( const boost::rational<long>& rX, const boost::rational<long>& rY ) +void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY ) { - const boost::rational<long>& rFrac = rX < rY ? rX : rY; - GetGraphicWindow().SetZoom( (sal_uInt16) boost::rational_cast<long>(rFrac * 100) ); + const Fraction &rFrac = rX < rY ? rX : rY; + GetGraphicWindow().SetZoom( (sal_uInt16) long(rFrac * Fraction( 100, 1 )) ); //To avoid rounding errors base class regulates crooked values too //if necessary @@ -1284,9 +1284,9 @@ void SmViewShell::Impl_Print( Size OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(), aOutRect.GetHeight()), MapMode(MAP_100TH_MM))); Size GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MAP_100TH_MM))); - sal_uInt16 nZ = (sal_uInt16) std::min( boost::rational_cast<long>( boost::rational<long>(OutputSize.Width() * 100L, GraphicSize.Width()) ), - boost::rational_cast<long>( boost::rational<long>(OutputSize.Height() * 100L, GraphicSize.Height()) ) ); - boost::rational<long> aFraction ((sal_uInt16) std::max ((sal_uInt16) MINZOOM, std::min((sal_uInt16) MAXZOOM, (sal_uInt16) (nZ - 10))), (sal_uInt16) 100); + sal_uInt16 nZ = (sal_uInt16) std::min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()), + (long)Fraction(OutputSize.Height() * 100L, GraphicSize.Height())); + Fraction aFraction ((sal_uInt16) std::max ((sal_uInt16) MINZOOM, std::min((sal_uInt16) MAXZOOM, (sal_uInt16) (nZ - 10))), (sal_uInt16) 100); OutputMapMode = MapMode(MAP_100TH_MM, aZeroPoint, aFraction, aFraction); } @@ -1296,7 +1296,7 @@ void SmViewShell::Impl_Print( case PRINT_SIZE_ZOOMED: { - boost::rational<long> aFraction( nZoomFactor, 100 ); + Fraction aFraction( nZoomFactor, 100 ); OutputMapMode = MapMode(MAP_100TH_MM, aZeroPoint, aFraction, aFraction); break; @@ -1788,8 +1788,8 @@ void SmViewShell::Execute(SfxRequest& rReq) Size OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(), OutputRect.GetHeight()), aMap)); Size GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap)); - sal_uInt16 nZ = (sal_uInt16) std::min( boost::rational_cast<long>( boost::rational<long>(OutputSize.Width() * 100L, GraphicSize.Width())), - boost::rational_cast<long>( boost::rational<long>(OutputSize.Height() * 100L, GraphicSize.Height()) ) ); + sal_uInt16 nZ = (sal_uInt16) std::min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()), + (long)Fraction(OutputSize.Height() * 100L, GraphicSize.Height())); aGraphic.SetZoom (nZ); break; } diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index 9ffdc4d7f291..b0bf0df399d9 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -2313,7 +2313,7 @@ void SmNodeToTextVisitor::Visit( SmFontNode* pNode ) break; } Append( ::rtl::math::doubleToUString( - boost::rational_cast<double>(pNode->GetSizeParameter()), + static_cast<double>( pNode->GetSizeParameter( ) ), rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', true ) ); Append( " " ); |