From 582ef22d3e8e30ffd58f092d37ffda30bd07bd9e Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Thu, 16 Oct 2014 15:30:32 +0200
Subject: 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
---
 svtools/source/brwbox/brwbox1.cxx      |  2 +-
 svtools/source/brwbox/datwin.cxx       |  6 +++---
 svtools/source/brwbox/datwin.hxx       |  6 +++---
 svtools/source/control/ctrltool.cxx    |  2 +-
 svtools/source/control/ruler.cxx       |  4 ++--
 svtools/source/filter/exportdialog.cxx |  4 ++--
 svtools/source/graphic/grfmgr.cxx      |  2 +-
 svtools/source/misc/imap.cxx           | 12 ++++++------
 8 files changed, 19 insertions(+), 19 deletions(-)

(limited to 'svtools')

diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index f7374bf91db1..026c7c1de4ab 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -2423,7 +2423,7 @@ long BrowseBox::CalcReverseZoom(long nVal)
 {
     if (IsZoom())
     {
-        const boost::rational<long>& rZoom = GetZoom();
+        const boost::rational<sal_Int64>& rZoom = GetZoom();
         double n = (double)nVal;
         n *= (double)rZoom.denominator();
         n /= (double)rZoom.numerator();
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index e8ac1d0e6d3b..fa1965e0431d 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -104,7 +104,7 @@ void ButtonFrame::Draw( OutputDevice& rDev )
 
 
 BrowserColumn::BrowserColumn( sal_uInt16 nItemId, const class Image &rImage,
-                              const OUString& rTitle, sal_uLong nWidthPixel, const boost::rational<long>& rCurrentZoom )
+                              const OUString& rTitle, sal_uLong nWidthPixel, const boost::rational<sal_Int64>& rCurrentZoom )
 :   _nId( nItemId ),
     _nWidth( nWidthPixel ),
     _aImage( rImage ),
@@ -123,7 +123,7 @@ BrowserColumn::~BrowserColumn()
 
 
 
-void BrowserColumn::SetWidth(sal_uLong nNewWidthPixel, const boost::rational<long>& rCurrentZoom)
+void BrowserColumn::SetWidth(sal_uLong nNewWidthPixel, const boost::rational<sal_Int64>& rCurrentZoom)
 {
     _nWidth = nNewWidthPixel;
     double n = (double)_nWidth;
@@ -174,7 +174,7 @@ void BrowserColumn::Draw( BrowseBox& rBox, OutputDevice& rDev, const Point& rPos
 
 
 
-void BrowserColumn::ZoomChanged(const boost::rational<long>& rNewZoom)
+void BrowserColumn::ZoomChanged(const boost::rational<sal_Int64>& rNewZoom)
 {
     double n = (double)_nOriginalWidth;
     n *= (double)rNewZoom.numerator();
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
index 1bbe57a684d9..838a0874004a 100644
--- a/svtools/source/brwbox/datwin.hxx
+++ b/svtools/source/brwbox/datwin.hxx
@@ -76,7 +76,7 @@ class BrowserColumn
 
 public:
                         BrowserColumn( sal_uInt16 nItemId, const Image &rImage,
-                                        const OUString& rTitle, sal_uLong nWidthPixel, const boost::rational<long>& rCurrentZoom );
+                                        const OUString& rTitle, sal_uLong nWidthPixel, const boost::rational<sal_Int64>& rCurrentZoom );
     virtual            ~BrowserColumn();
 
     sal_uInt16          GetId() const { return _nId; }
@@ -91,8 +91,8 @@ public:
     virtual void        Draw( BrowseBox& rBox, OutputDevice& rDev,
                               const Point& rPos, bool bCurs  );
 
-    void                SetWidth(sal_uLong nNewWidthPixel, const boost::rational<long>& rCurrentZoom);
-    void                ZoomChanged(const boost::rational<long>& rNewZoom);
+    void                SetWidth(sal_uLong nNewWidthPixel, const boost::rational<sal_Int64>& rCurrentZoom);
+    void                ZoomChanged(const boost::rational<sal_Int64>& rNewZoom);
 };
 
 
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 587174e88491..fed7da731080 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -737,7 +737,7 @@ const sal_IntPtr* FontList::GetSizeAry( const vcl::FontInfo& rInfo ) const
         return aStdSizeAry;
 
     MapMode aOldMapMode = pDevice->GetMapMode();
-    MapMode aMap( MAP_10TH_INCH, Point(), boost::rational<long>( 1, 72 ), boost::rational<long>( 1, 72 ) );
+    MapMode aMap( MAP_10TH_INCH, Point(), boost::rational<sal_Int64>( 1, 72 ), boost::rational<sal_Int64>( 1, 72 ) );
     pDevice->SetMapMode( aMap );
 
     sal_uInt16  i;
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index a85a474293e2..f3011b27d73a 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -256,7 +256,7 @@ void Ruler::ImplInit( WinBits nWinBits )
     // Initialize Units
     mnUnitIndex     = RULER_UNIT_CM;
     meUnit          = FUNIT_CM;
-    maZoom          = boost::rational<long>( 1, 1 );
+    maZoom          = boost::rational<sal_Int64>( 1, 1 );
     meSourceUnit    = MAP_100TH_MM;
 
     // Recalculate border widths
@@ -2478,7 +2478,7 @@ void Ruler::SetUnit( FieldUnit eNewUnit )
     }
 }
 
-void Ruler::SetZoom( const boost::rational<long>& rNewZoom )
+void Ruler::SetZoom( const boost::rational<sal_Int64>& rNewZoom )
 {
     DBG_ASSERT( rNewZoom.numerator(), "Ruler::SetZoom() with scale 0 is not allowed" );
 
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index 808a4205d37f..031a43160806 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -1017,7 +1017,7 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeX)
     }
     else
     {
-        boost::rational<long> aFract( 1, 100 );
+        boost::rational<sal_Int64> aFract( 1, 100 );
         sal_Int32 nWidth = mpMfSizeX->GetValue();
         sal_Int32 nHeight= static_cast< sal_Int32 >( nWidth * fRatio );
         const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) );
@@ -1051,7 +1051,7 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeY)
     }
     else
     {
-        boost::rational<long> aFract( 1, 100 );
+        boost::rational<sal_Int64> aFract( 1, 100 );
         sal_Int32 nHeight= mpMfSizeY->GetValue();
         sal_Int32 nWidth = static_cast< sal_Int32 >( nHeight * fRatio );
         const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) );
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 69c710991d5b..8b853e2b0e11 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -887,7 +887,7 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo
         }
         else
         {
-            aMtf.Scale( boost::rational<long>( rDestSize.Width(), aSrcSize.Width() ), boost::rational<long>( rDestSize.Height(), aSrcSize.Height() ) );
+            aMtf.Scale( boost::rational<sal_Int64>( rDestSize.Width(), aSrcSize.Width() ), boost::rational<sal_Int64>( rDestSize.Height(), aSrcSize.Height() ) );
             aMtf.SetPrefMapMode( rDestMap );
         }
 
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index 967724923ed8..c3698d4f4f13 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -226,7 +226,7 @@ Rectangle IMapRectangleObject::GetRectangle( bool bPixelCoords ) const
     return aNewRect;
 }
 
-void IMapRectangleObject::Scale( const boost::rational<long>& rFracX, const boost::rational<long>& rFracY )
+void IMapRectangleObject::Scale( const boost::rational<sal_Int64>& rFracX, const boost::rational<sal_Int64>& rFracY )
 {
     Point   aTL( aRect.TopLeft() );
     Point   aBR( aRect.BottomRight() );
@@ -368,12 +368,12 @@ Rectangle IMapCircleObject::GetBoundRect() const
                       Size( nWidth, nWidth ) );
 }
 
-void IMapCircleObject::Scale( const boost::rational<long>& rFracX, const boost::rational<long>& rFracY )
+void IMapCircleObject::Scale( const boost::rational<sal_Int64>& rFracX, const boost::rational<sal_Int64>& rFracY )
 {
-    boost::rational<long> aAverage( rFracX );
+    boost::rational<sal_Int64> aAverage( rFracX );
 
     aAverage += rFracY;
-    aAverage *= boost::rational<long>( 1, 2 );
+    aAverage *= boost::rational<sal_Int64>( 1, 2 );
 
     SCALEPOINT( aCenter, rFracX, rFracY );
 
@@ -487,7 +487,7 @@ void IMapPolygonObject::SetExtraEllipse( const Rectangle& rEllipse )
     }
 }
 
-void IMapPolygonObject::Scale( const boost::rational<long>& rFracX, const boost::rational<long>& rFracY )
+void IMapPolygonObject::Scale( const boost::rational<sal_Int64>& rFracX, const boost::rational<sal_Int64>& rFracY )
 {
     sal_uInt16 nCount = aPoly.GetSize();
 
@@ -812,7 +812,7 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize,
     return( pObj ? ( pObj->IsActive() ? pObj : NULL ) : NULL );
 }
 
-void ImageMap::Scale( const boost::rational<long>& rFracX, const boost::rational<long>& rFracY )
+void ImageMap::Scale( const boost::rational<sal_Int64>& rFracX, const boost::rational<sal_Int64>& rFracY )
 {
     size_t nCount = maList.size();
 
-- 
cgit