diff options
author | David Tardon <dtardon@redhat.com> | 2014-10-16 15:30:32 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-10-16 17:44:44 +0200 |
commit | 582ef22d3e8e30ffd58f092d37ffda30bd07bd9e (patch) | |
tree | 80c42b34da7e7ee05843b572f7311b3c230de9dd /starmath/source | |
parent | ada4862afc3227b04c12960ded761db24f61257e (diff) |
fdo#84854 it seems long is not enough on 32 bit
Fraction used BigInt internally for computations, rational does nothing
like that.
Change-Id: I3e9b25074f979bc291208f7c6362c3c40eb77ff5
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/ElementsDockingWindow.cxx | 2 | ||||
-rw-r--r-- | starmath/source/mathmlexport.cxx | 4 | ||||
-rw-r--r-- | starmath/source/node.cxx | 30 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 4 | ||||
-rw-r--r-- | starmath/source/utility.cxx | 2 | ||||
-rw-r--r-- | starmath/source/view.cxx | 24 |
6 files changed, 33 insertions, 33 deletions
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 9ea3b2cebfb7..f39570567a80 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(boost::rational<sal_Int64>(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..aaa494dfd3e5 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -1344,7 +1344,7 @@ 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 boost::rational<sal_Int64>& aFrac = pFontNode->GetSizeParameter(); OUStringBuffer sStrBuf; switch(pFontNode->GetSizeType()) @@ -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(). + boost::rational<sal_Int64> aTemp = Sm100th_mmToPts(pFontNode->GetFont(). GetSize().Height()); if (pFontNode->GetSizeType() == FNTSIZ_MINUS) diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index dd1c51c4b4b9..a2cd19d0fe32 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -165,14 +165,14 @@ void SmNode::SetFont(const SmFace &rFace) } -void SmNode::SetFontSize(const boost::rational<long>& rSize, sal_uInt16 nType) +void SmNode::SetFontSize(const boost::rational<sal_Int64>& rSize, sal_uInt16 nType) //! 'rSize' is in units of pts { Size aFntSize; if (!(Flags() & FLG_SIZE)) { - boost::rational<long> aVal (SmPtsTo100th_mm(rSize.numerator()), + boost::rational<sal_Int64> aVal (SmPtsTo100th_mm(rSize.numerator()), rSize.denominator()); long nHeight = boost::rational_cast<long>(aVal); @@ -197,7 +197,7 @@ void SmNode::SetFontSize(const boost::rational<long>& rSize, sal_uInt16 nType) break; case FNTSIZ_DIVIDE: - if (rSize != boost::rational<long>(0L)) + if (rSize != boost::rational<sal_Int64>(0L)) aFntSize.Height() = boost::rational_cast<long>(aFntSize.Height() / rSize); break; default: @@ -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 boost::rational<sal_Int64>& 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(boost::rational<sal_Int64> (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(boost::rational<sal_Int64>(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(boost::rational<sal_Int64> (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); + boost::rational<sal_Int64> 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 ); + boost::rational<sal_Int64> 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( boost::rational<sal_Int64>( rFormat.GetRelSize(SIZ_LIMITS), 100 ) ); // braces are a bit taller than usually - pBrace ->SetSize( boost::rational<long>(3, 2) ); + pBrace ->SetSize( boost::rational<sal_Int64>(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(boost::rational<sal_Int64>(CalcSymbolHeight(*pSymbol, rFormat), pSymbol->GetFont().GetSize().Height())); pBody->Arrange(rDev, rFormat); @@ -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 boost::rational<sal_Int64>& 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() *= boost::rational<sal_Int64> (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() *= boost::rational<sal_Int64> (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..e83fccfcd101 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 ); + boost::rational<sal_Int64> aValue( 1L ); if (lcl_IsNumber( m_aCurToken.aText )) { double fTmp = OUString(m_aCurToken.aText).toDouble(); @@ -1969,7 +1969,7 @@ void SmParser::FontSize() nNum /= 10; nDenom /= 10; } - aValue = boost::rational<long>( nNum, nDenom ); + aValue = boost::rational<sal_Int64>( nNum, nDenom ); } } } diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx index a47df4a62a9b..81f2abbb3023 100644 --- a/starmath/source/utility.cxx +++ b/starmath/source/utility.cxx @@ -284,7 +284,7 @@ SmFace & SmFace::operator = (const SmFace &rFace) } -SmFace & operator *= (SmFace &rFace, const boost::rational<long>& rFrac) +SmFace & operator *= (SmFace &rFace, const boost::rational<sal_Int64>& 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. diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 55874794153a..865db90fdc64 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 boost::rational<sal_Int64> 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); + boost::rational<sal_Int64> 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( boost::rational<sal_Int64>( aProvidedSize.Width(), aObjSize.Width() ), + boost::rational<sal_Int64>( aProvidedSize.Height(), aObjSize.Height() ) ); } SetBorderPixel( SvBorder() ); @@ -986,9 +986,9 @@ void SmViewShell::QueryObjAreaPixel( Rectangle& rRect ) const } -void SmViewShell::SetZoomFactor( const boost::rational<long>& rX, const boost::rational<long>& rY ) +void SmViewShell::SetZoomFactor( const boost::rational<sal_Int64>& rX, const boost::rational<sal_Int64>& rY ) { - const boost::rational<long>& rFrac = rX < rY ? rX : rY; + const boost::rational<sal_Int64>& rFrac = rX < rY ? rX : rY; GetGraphicWindow().SetZoom( (sal_uInt16) boost::rational_cast<long>(rFrac * 100) ); //To avoid rounding errors base class regulates crooked values too @@ -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( boost::rational_cast<long>( boost::rational<sal_Int64>(OutputSize.Width() * 100L, GraphicSize.Width()) ), + boost::rational_cast<long>( boost::rational<sal_Int64>(OutputSize.Height() * 100L, GraphicSize.Height()) ) ); + boost::rational<sal_Int64> 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 ); + boost::rational<sal_Int64> 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( boost::rational_cast<long>( boost::rational<sal_Int64>(OutputSize.Width() * 100L, GraphicSize.Width())), + boost::rational_cast<long>( boost::rational<sal_Int64>(OutputSize.Height() * 100L, GraphicSize.Height()) ) ); aGraphic.SetZoom (nZ); break; } |