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/view.cxx | |
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/view.cxx')
-rw-r--r-- | starmath/source/view.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
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; } |