diff options
author | Juan Picca <jumapico@gmail.com> | 2014-09-19 14:19:30 -0300 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-10-09 11:33:33 +0000 |
commit | 47a2d7642d249d70b5da0c330a73f3a0032e4bba (patch) | |
tree | 202b04810382ea87cf8015a7b4de29e931408948 /svx/source | |
parent | ae77dc81c33ab0817264bcf5fc8bb71a55b78a73 (diff) |
fdo#81356: convert Fraction to boost::rational<long> - wip
* Added rational util functions used by Fraction class not
available in the boost::rational class.
* Replaced usage of Fraction by boost::rational<long>
* Removed code that relies on:
1. fraction.IsValid() -- rational only allow valid values, ie
denominator() != 0
2. rational.denominator() == 0 -- always false
3. rational.denominator() < 0 -- always false but implementation
detail: http://www.boost.org/doc/libs/release/libs/rational/rational.html#Internal%20representation
* Simplified code that relies on:
1. rational.denominator() != 0 -- always true
* BUGS EXIST because Fraction allows the creation of invalid values but
boost::rational throws the exception boost::bad_rational
Change-Id: I84970a4956afb3f91ac0c8f726547466319420f9
Reviewed-on: https://gerrit.libreoffice.org/11551
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'svx/source')
55 files changed, 338 insertions, 389 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 92967399c1da..0a810de128d1 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -262,11 +262,11 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con if ( pModel ) { fMap = 1.0; - Fraction aFraction( pModel->GetScaleFraction() ); - if ( ( aFraction.GetNumerator() ) != 1 || ( aFraction.GetDenominator() != 1 ) ) + boost::rational<long> aFraction( pModel->GetScaleFraction() ); + if ( ( aFraction.numerator() ) != 1 || ( aFraction.denominator() != 1 ) ) { - fMap *= aFraction.GetNumerator(); - fMap /= aFraction.GetDenominator(); + fMap *= aFraction.numerator(); + fMap /= aFraction.denominator(); pMap = &fMap; } if ( pModel->GetScaleUnit() != MAP_100TH_MM ) diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx index 4f546e1b1c0c..661af54f66e8 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx @@ -19,7 +19,7 @@ #include "svx/EnhancedCustomShape2d.hxx" #include <rtl/ustring.hxx> -#include <tools/fract.hxx> +#include <tools/rational.hxx> // Makes parser a static resource, // we're synchronized externally. @@ -116,19 +116,19 @@ public: virtual EnhancedCustomShapeParameter fillNode( std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* /* pOptionalArg */, sal_uInt32 /* nFlags */ ) SAL_OVERRIDE { EnhancedCustomShapeParameter aRet; - Fraction aFract( maValue ); - if ( aFract.GetDenominator() == 1 ) + boost::rational<long> aFract( maValue ); + if ( aFract.denominator() == 1 ) { aRet.Type = EnhancedCustomShapeParameterType::NORMAL; - aRet.Value <<= (sal_Int32)aFract.GetNumerator(); + aRet.Value <<= (sal_Int32)aFract.numerator(); } else { EnhancedCustomShapeEquation aEquation; aEquation.nOperation = 1; aEquation.nPara[ 0 ] = 1; - aEquation.nPara[ 1 ] = (sal_Int16)aFract.GetNumerator(); - aEquation.nPara[ 2 ] = (sal_Int16)aFract.GetDenominator(); + aEquation.nPara[ 1 ] = (sal_Int16)aFract.numerator(); + aEquation.nPara[ 2 ] = (sal_Int16)aFract.denominator(); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; aRet.Value <<= (sal_Int32)rEquations.size(); rEquations.push_back( aEquation ); diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx index a2c56212eec2..97454dc46219 100644 --- a/svx/source/dialog/connctrl.cxx +++ b/svx/source/dialog/connctrl.cxx @@ -113,9 +113,9 @@ void SvxXConnectionPreview::AdaptSize() aNewSize.Height()= (long) ( (double) nWidth / fRectWH ); } - Fraction aFrac1( aWinSize.Width(), aRect.GetWidth() ); - Fraction aFrac2( aWinSize.Height(), aRect.GetHeight() ); - Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 ); + boost::rational<long> aFrac1( aWinSize.Width(), aRect.GetWidth() ); + boost::rational<long> aFrac2( aWinSize.Height(), aRect.GetHeight() ); + boost::rational<long> aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 ); // Implement MapMode aDisplayMap.SetScaleX( aMinFrac ); @@ -261,29 +261,29 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt ) if( bZoomIn || bZoomOut ) { MapMode aMapMode = GetMapMode(); - Fraction aXFrac = aMapMode.GetScaleX(); - Fraction aYFrac = aMapMode.GetScaleY(); - boost::scoped_ptr<Fraction> pMultFrac; + boost::rational<long> aXFrac = aMapMode.GetScaleX(); + boost::rational<long> aYFrac = aMapMode.GetScaleY(); + boost::scoped_ptr<boost::rational<long>> pMultFrac; if( bZoomIn ) { if( bCtrl ) - pMultFrac.reset(new Fraction( 3, 2 )); + pMultFrac.reset(new boost::rational<long>( 3, 2 )); else - pMultFrac.reset(new Fraction( 11, 10 )); + pMultFrac.reset(new boost::rational<long>( 11, 10 )); } else { if( bCtrl ) - pMultFrac.reset(new Fraction( 2, 3 )); + pMultFrac.reset(new boost::rational<long>( 2, 3 )); else - pMultFrac.reset(new Fraction( 10, 11 )); + pMultFrac.reset(new boost::rational<long>( 10, 11 )); } aXFrac *= *pMultFrac; aYFrac *= *pMultFrac; - if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 && - (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 ) + if( boost::rational_cast<double>(aXFrac) > 0.001 && boost::rational_cast<double>(aXFrac) < 1000.0 && + boost::rational_cast<double>(aYFrac) > 0.001 && boost::rational_cast<double>(aYFrac) < 1000.0 ) { aMapMode.SetScaleX( aXFrac ); aMapMode.SetScaleY( aYFrac ); @@ -292,8 +292,8 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt ) Size aOutSize( GetOutputSize() ); Point aPt( aMapMode.GetOrigin() ); - long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); - long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); + long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * boost::rational_cast<double>(* pMultFrac) ) ) / 2.0 + 0.5 ); + long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * boost::rational_cast<double>(* pMultFrac) ) ) / 2.0 + 0.5 ); aPt.X() += nX; aPt.Y() += nY; diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 0c590d3becce..59f402538299 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -128,7 +128,7 @@ void GraphCtrl::InitSdrModel() pModel = new SdrModel; pModel->GetItemPool().FreezeIdRanges(); pModel->SetScaleUnit( aMap100.GetMapUnit() ); - pModel->SetScaleFraction( Fraction( 1, 1 ) ); + pModel->SetScaleFraction( boost::rational<long>( 1, 1 ) ); pModel->SetDefaultFontHeight( 500 ); pPage = new SdrPage( *pModel ); @@ -225,8 +225,8 @@ void GraphCtrl::Resize() aNewPos.Y() = ( nHeight - aNewSize.Height() ) >> 1; // Implementing MapMode for Engine - aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), aGraphSize.Width() ) ); - aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), aGraphSize.Height() ) ); + aDisplayMap.SetScaleX( boost::rational<long>( aNewSize.Width(), aGraphSize.Width() ) ); + aDisplayMap.SetScaleY( boost::rational<long>( aNewSize.Height(), aGraphSize.Height() ) ); aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMap100, aDisplayMap ) ); SetMapMode( aDisplayMap ); diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx index 8810a874ba91..8206ea373637 100644 --- a/svx/source/dialog/measctrl.cxx +++ b/svx/source/dialog/measctrl.cxx @@ -34,8 +34,8 @@ SvxXMeasurePreview::SvxXMeasurePreview( vcl::Window* pParent, WinBits nStyle) // Scale: 1:2 MapMode aMapMode = GetMapMode(); - aMapMode.SetScaleX( Fraction( 1, 2 ) ); - aMapMode.SetScaleY( Fraction( 1, 2 ) ); + aMapMode.SetScaleX( boost::rational<long>( 1, 2 ) ); + aMapMode.SetScaleY( boost::rational<long>( 1, 2 ) ); SetMapMode( aMapMode ); Size aSize = GetOutputSize(); @@ -109,29 +109,29 @@ void SvxXMeasurePreview::MouseButtonDown( const MouseEvent& rMEvt ) if( bZoomIn || bZoomOut ) { MapMode aMapMode = GetMapMode(); - Fraction aXFrac = aMapMode.GetScaleX(); - Fraction aYFrac = aMapMode.GetScaleY(); - boost::scoped_ptr<Fraction> pMultFrac; + boost::rational<long> aXFrac = aMapMode.GetScaleX(); + boost::rational<long> aYFrac = aMapMode.GetScaleY(); + boost::scoped_ptr<boost::rational<long>> pMultFrac; if( bZoomIn ) { if( bCtrl ) - pMultFrac.reset(new Fraction( 3, 2 )); + pMultFrac.reset(new boost::rational<long>( 3, 2 )); else - pMultFrac.reset(new Fraction( 11, 10 )); + pMultFrac.reset(new boost::rational<long>( 11, 10 )); } else { if( bCtrl ) - pMultFrac.reset(new Fraction( 2, 3 )); + pMultFrac.reset(new boost::rational<long>( 2, 3 )); else - pMultFrac.reset(new Fraction( 10, 11 )); + pMultFrac.reset(new boost::rational<long>( 10, 11 )); } aXFrac *= *pMultFrac; aYFrac *= *pMultFrac; - if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 && - (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 ) + if( boost::rational_cast<double>(aXFrac) > 0.001 && boost::rational_cast<double>(aXFrac) < 1000.0 && + boost::rational_cast<double>(aYFrac) > 0.001 && boost::rational_cast<double>(aYFrac) < 1000.0 ) { aMapMode.SetScaleX( aXFrac ); aMapMode.SetScaleY( aYFrac ); @@ -140,8 +140,8 @@ void SvxXMeasurePreview::MouseButtonDown( const MouseEvent& rMEvt ) Size aOutSize( GetOutputSize() ); Point aPt( aMapMode.GetOrigin() ); - long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); - long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); + long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * boost::rational_cast<double>(* pMultFrac) ) ) / 2.0 + 0.5 ); + long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * boost::rational_cast<double>(* pMultFrac) ) ) / 2.0 + 0.5 ); aPt.X() += nX; aPt.Y() += nY; diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index fa7b9befa814..7aa7e8b167ed 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -102,8 +102,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxPageWindow(vcl::Win void SvxPageWindow::Paint(const Rectangle&) { - Fraction aXScale(aWinSize.Width(),std::max((long)(aSize.Width() * 2 + aSize.Width() / 8),1L)); - Fraction aYScale(aWinSize.Height(),std::max(aSize.Height(),1L)); + boost::rational<long> aXScale(aWinSize.Width(),std::max((long)(aSize.Width() * 2 + aSize.Width() / 8),1L)); + boost::rational<long> aYScale(aWinSize.Height(),std::max(aSize.Height(),1L)); MapMode aMapMode(GetMapMode()); if(aYScale < aXScale) @@ -126,9 +126,9 @@ void SvxPageWindow::Paint(const Rectangle&) if (aSize.Width() > aSize.Height()) { // Draw Landscape page of the same size - Fraction aX = aMapMode.GetScaleX(); - Fraction aY = aMapMode.GetScaleY(); - Fraction a2(1.5); + boost::rational<long> aX = aMapMode.GetScaleX(); + boost::rational<long> aY = aMapMode.GetScaleY(); + boost::rational<long> a2(1.5); aX *= a2; aY *= a2; aMapMode.SetScaleX(aX); diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index 06eac9c647d7..998d9d80dbbc 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -322,7 +322,7 @@ void E3dObject::SetModel(SdrModel* pNewModel) // resize object, used from old 2d interfaces, e.g. in Move/Scale dialog (F4) -void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void E3dObject::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { // Movement in X, Y in the eye coordinate system E3dScene* pScene = GetScene(); @@ -345,8 +345,8 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti aScaleCenter3D = aInverseViewToEye * aScaleCenter3D; // Get scale factors - double fScaleX(xFact); - double fScaleY(yFact); + double fScaleX(boost::rational_cast<double>(xFact)); + double fScaleY(boost::rational_cast<double>(yFact)); // build transform basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 9d5336f02c8c..54c582bd2392 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -323,8 +323,8 @@ void E3dScene::NbcMove(const Size& rSize) NbcSetSnapRect(aNewSnapRect); } -void E3dScene::NbcResize(const Point& rRef, const Fraction& rXFact, - const Fraction& rYFact) +void E3dScene::NbcResize(const Point& rRef, const boost::rational<long>& rXFact, + const boost::rational<long>& rYFact) { Rectangle aNewSnapRect = GetSnapRect(); ResizeRect(aNewSnapRect, rRef, rXFact, rYFact); diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index d9e92c3be61f..317e2d1069b8 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -736,7 +736,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) case STATE_CHANGE_ZOOM: { - Fraction aZoom = GetZoom(); + boost::rational<long> aZoom = GetZoom(); // not all of these controls need to know the new zoom, but to be sure ... vcl::Font aFont( GetSettings().GetStyleSettings().GetFieldFont() ); diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 653feff1774a..212c9de8123d 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -1450,8 +1450,8 @@ SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor const sal_uInt16 nObjID = OBJ_FM_BUTTON; ::Size controlSize(4000, 500); FmFormObj *pControl = static_cast<FmFormObj*>(SdrObjFactory::MakeNewObject( FmFormInventor, nObjID, NULL, NULL )); - controlSize.Width() = Fraction(controlSize.Width(), 1) * eTargetMode.GetScaleX(); - controlSize.Height() = Fraction(controlSize.Height(), 1) * eTargetMode.GetScaleY(); + controlSize.Width() = boost::rational_cast<long>(controlSize.Width() * eTargetMode.GetScaleX()); + controlSize.Height() = boost::rational_cast<long>(controlSize.Height() * eTargetMode.GetScaleY()); ::Point controlPos( OutputDevice::LogicToLogic( ::Point( controlSize.Width(), 0 ), eSourceMode, eTargetMode ) ); ::Rectangle controlRect( controlPos, OutputDevice::LogicToLogic( controlSize, eSourceMode, eTargetMode ) ); pControl->SetLogicRect(controlRect); @@ -1541,8 +1541,8 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO aRealSize.Height()= aDefSize.Height(); // adjust to scaling of the target device (#53523#) - aRealSize.Width() = long(Fraction(aRealSize.Width(), 1) * eTargetMode.GetScaleX()); - aRealSize.Height() = long(Fraction(aRealSize.Height(), 1) * eTargetMode.GetScaleY()); + aRealSize.Width() = boost::rational_cast<long>(aRealSize.Width() * eTargetMode.GetScaleX()); + aRealSize.Height() = boost::rational_cast<long>(aRealSize.Height() * eTargetMode.GetScaleY()); // for boolean fields, we do not create a label, but just a checkbox bool bNeedLabel = ( _nControlObjectID != OBJ_FM_CHECKBOX ); @@ -1608,8 +1608,8 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO if ( OBJ_FM_IMAGECONTROL == _nControlObjectID ) aControlSize = aDefImageSize; - aControlSize.Width() = long(Fraction(aControlSize.Width(), 1) * eTargetMode.GetScaleX()); - aControlSize.Height() = long(Fraction(aControlSize.Height(), 1) * eTargetMode.GetScaleY()); + aControlSize.Width() = boost::rational_cast<long>(aControlSize.Width() * eTargetMode.GetScaleX()); + aControlSize.Height() = boost::rational_cast<long>(aControlSize.Height() * eTargetMode.GetScaleY()); pControl->SetLogicRect( ::Rectangle( OutputDevice::LogicToLogic( ::Point( aRealSize.Width() + _nXOffsetMM, _nYOffsetMM ), eSourceMode, eTargetMode ), diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 096da89be126..a87b44850ca0 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -279,9 +279,9 @@ namespace sdr { namespace contact { ::basegfx::B2DVector aZoom( 1, 1 ); if ( pWindow ) { - const Fraction& rZoom( pWindow->GetZoom() ); - aZoom.setX( (double)rZoom ); - aZoom.setY( (double)rZoom ); + const boost::rational<long>& rZoom( pWindow->GetZoom() ); + aZoom.setX( boost::rational_cast<double>(rZoom) ); + aZoom.setY( boost::rational_cast<double>(rZoom) ); } return aZoom; } @@ -867,8 +867,8 @@ namespace sdr { namespace contact { ::basegfx::B2DHomMatrix aScaleNormalization; MapMode aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() ); - aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() ); - aScaleNormalization.set( 1, 1, (double)aCurrentDeviceMapMode.GetScaleY() ); + aScaleNormalization.set( 0, 0, boost::rational_cast<double>(aCurrentDeviceMapMode.GetScaleX()) ); + aScaleNormalization.set( 1, 1, boost::rational_cast<double>(aCurrentDeviceMapMode.GetScaleY()) ); m_aZoomLevelNormalization *= aScaleNormalization; #if OSL_DEBUG_LEVEL > 1 diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 78c6895208f0..21738416f926 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -318,7 +318,7 @@ namespace sdr MapUnit aOldUnit(pOldModel->GetScaleUnit()); MapUnit aNewUnit(pNewModel->GetScaleUnit()); bool bScaleUnitChanged(aNewUnit != aOldUnit); - Fraction aMetricFactor; + boost::rational<long> aMetricFactor; if(bScaleUnitChanged) { diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index c6f09bd5bb7f..08ff3d349397 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -211,7 +211,7 @@ namespace sdr { } - void DefaultProperties::Scale(const Fraction& rScale) + void DefaultProperties::Scale(const boost::rational<long>& rScale) { if(mpItemSet) { diff --git a/svx/source/sdr/properties/itemsettools.cxx b/svx/source/sdr/properties/itemsettools.cxx index 835f23552c64..e7826272fa2f 100644 --- a/svx/source/sdr/properties/itemsettools.cxx +++ b/svx/source/sdr/properties/itemsettools.cxx @@ -93,15 +93,10 @@ namespace sdr { namespace properties { - void ScaleItemSet(SfxItemSet& rSet, const Fraction& rScale) + void ScaleItemSet(SfxItemSet& rSet, const boost::rational<long>& rScale) { - sal_Int32 nMul(rScale.GetNumerator()); - sal_Int32 nDiv(rScale.GetDenominator()); - - if(!rScale.IsValid() || !nDiv) - { - return; - } + sal_Int32 nMul(rScale.numerator()); + sal_Int32 nDiv(rScale.denominator()); SfxWhichIter aIter(rSet); sal_uInt16 nWhich(aIter.FirstWhich()); diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx index 16af145d4946..5865948e405f 100644 --- a/svx/source/sdr/properties/properties.cxx +++ b/svx/source/sdr/properties/properties.cxx @@ -74,7 +74,7 @@ namespace sdr ClearObjectItem(nWhich); } - void BaseProperties::Scale(const Fraction& /*rScale*/) + void BaseProperties::Scale(const boost::rational<long>& /*rScale*/) { // default implementation does nothing; overload where // an ItemSet is implemented. diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 0ef3d8ec540f..2e1346de8355 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -508,7 +508,7 @@ IMPL_LINK( PosSizePropertyPanel, AngleModifiedHdl, void *, EMPTYARG ) sal_Int64 nTmp = dTmp*100; // #i123993# Need to take UIScale into account when executing rotations - const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0); + const double fUIScale(mpView && mpView->GetModel() ? boost::rational_cast<double>(mpView->GetModel()->GetUIScale()) : 1.0); SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale)); SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale)); @@ -526,7 +526,7 @@ IMPL_LINK( PosSizePropertyPanel, RotationHdl, void *, EMPTYARG ) sal_Int32 nTmp = mpDial->GetRotation(); // #i123993# Need to take UIScale into account when executing rotations - const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0); + const double fUIScale(mpView && mpView->GetModel() ? boost::rational_cast<double>(mpView->GetModel()->GetUIScale()) : 1.0); SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale)); SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale)); @@ -604,7 +604,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( { long mlOldWidth1 = pWidthItem->GetValue(); - mlOldWidth1 = Fraction( mlOldWidth1 ) / maUIScale; + mlOldWidth1 = boost::rational_cast<long>(mlOldWidth1 / maUIScale); SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); SetMetricValue( *mpMtrWidth, mlOldWidth1, mePoolUnit ); mlOldWidth = mlOldWidth1; @@ -624,7 +624,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( { long mlOldHeight1 = pHeightItem->GetValue(); - mlOldHeight1 = Fraction( mlOldHeight1 ) / maUIScale; + mlOldHeight1 = boost::rational_cast<long>(mlOldHeight1 / maUIScale); SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); SetMetricValue( *mpMtrHeight, mlOldHeight1, mePoolUnit ); mlOldHeight = mlOldHeight1; @@ -643,7 +643,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pItem) { long nTmp = pItem->GetValue(); - nTmp = Fraction( nTmp ) / maUIScale; + nTmp = boost::rational_cast<long>(nTmp / maUIScale); SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); SetMetricValue( *mpMtrPosX, nTmp, mePoolUnit ); break; @@ -661,7 +661,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pItem) { long nTmp = pItem->GetValue(); - nTmp = Fraction( nTmp ) / maUIScale; + nTmp = boost::rational_cast<long>(nTmp / maUIScale); SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); SetMetricValue( *mpMtrPosY, nTmp, mePoolUnit ); break; @@ -679,7 +679,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pItem) { mlRotX = pItem->GetValue(); - mlRotX = Fraction( mlRotX ) / maUIScale; + mlRotX = boost::rational_cast<long>(mlRotX / maUIScale); } } break; @@ -692,7 +692,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pItem) { mlRotY = pItem->GetValue(); - mlRotY = Fraction( mlRotY ) / maUIScale; + mlRotY = boost::rational_cast<long>(mlRotY / maUIScale); } } break; @@ -898,19 +898,19 @@ void PosSizePropertyPanel::executeSize() { if ( mpMtrWidth->IsValueModified() || mpMtrHeight->IsValueModified()) { - Fraction aUIScale = mpView->GetModel()->GetUIScale(); + boost::rational<long> aUIScale = mpView->GetModel()->GetUIScale(); // get Width double nWidth = (double)mpMtrWidth->GetValue( meDlgUnit ); nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); - long lWidth = (long)(nWidth * (double)aUIScale); + long lWidth = (long)(nWidth * boost::rational_cast<double>(aUIScale)); lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit ); lWidth = (long)mpMtrWidth->Denormalize( lWidth ); // get Height double nHeight = (double)mpMtrHeight->GetValue( meDlgUnit ); nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); - long lHeight = (long)(nHeight * (double)aUIScale); + long lHeight = (long)(nHeight * boost::rational_cast<double>(aUIScale)); lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit ); lHeight = (long)mpMtrWidth->Denormalize( lHeight ); @@ -953,11 +953,11 @@ void PosSizePropertyPanel::executePosX() maRect = mpView->GetAllMarkedRect(); aRect = mpView->GetAllMarkedRect(); - Fraction aUIScale = mpView->GetModel()->GetUIScale(); + boost::rational<long> aUIScale = mpView->GetModel()->GetUIScale(); lX += maAnchorPos.X(); - lX = Fraction( lX ) * aUIScale; + lX = boost::rational_cast<long>(lX * aUIScale); lY += maAnchorPos.Y(); - lY = Fraction( lY ) * aUIScale; + lY = boost::rational_cast<long>(lY * aUIScale); SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); @@ -980,11 +980,11 @@ void PosSizePropertyPanel::executePosY() maRect = mpView->GetAllMarkedRect(); aRect = mpView->GetAllMarkedRect(); - Fraction aUIScale = mpView->GetModel()->GetUIScale(); + boost::rational<long> aUIScale = mpView->GetModel()->GetUIScale(); lX += maAnchorPos.X(); - lX = Fraction( lX ) * aUIScale; + lX = boost::rational_cast<long>(lX * aUIScale); lY += maAnchorPos.Y(); - lY = Fraction( lY ) * aUIScale; + lY = boost::rational_cast<long>(lY * aUIScale); SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); @@ -1158,7 +1158,7 @@ void PosSizePropertyPanel::DisableControls() void PosSizePropertyPanel::UpdateUIScale() { - const Fraction aUIScale (mpView->GetModel()->GetUIScale()); + const boost::rational<long> aUIScale (mpView->GetModel()->GetUIScale()); if (maUIScale != aUIScale) { // UI scale has changed. diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx index 8983c23deac6..b5718ef54b69 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -102,7 +102,7 @@ private: Point maAnchorPos; //anchor position long mlRotX; long mlRotY; - Fraction maUIScale; + boost::rational<long> maUIScale; SfxMapUnit mePoolUnit; FieldUnit meDlgUnit; diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 1e012d96bac3..216107aa9930 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -630,7 +630,7 @@ SdrFractionItem::SdrFractionItem(sal_uInt16 nId, SvStream& rIn): sal_Int32 nMul,nDiv; rIn.ReadInt32( nMul ); rIn.ReadInt32( nDiv ); - nValue=Fraction(nMul,nDiv); + nValue=boost::rational<long>(nMul,nDiv); } bool SdrFractionItem::operator==(const SfxPoolItem& rCmp) const @@ -643,19 +643,12 @@ bool SdrFractionItem::GetPresentation( SfxItemPresentation ePresentation, SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresentationMetric*/, OUString &rText, const IntlWrapper *) const { - if(nValue.IsValid()) - { - sal_Int32 nDiv = nValue.GetDenominator(); - rText = OUString::number(nValue.GetNumerator()); + sal_Int32 nDiv = nValue.denominator(); + rText = OUString::number(nValue.numerator()); - if(nDiv != 1) - { - rText = rText + "/" + OUString::number(nDiv); - } - } - else + if(nDiv != 1) { - rText = "?"; + rText = rText + "/" + OUString::number(nDiv); } if(ePresentation == SFX_ITEM_PRESENTATION_COMPLETE) @@ -679,8 +672,8 @@ SfxPoolItem* SdrFractionItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const SvStream& SdrFractionItem::Store(SvStream& rOut, sal_uInt16 /*nItemVers*/) const { - rOut.WriteInt32( nValue.GetNumerator() ); - rOut.WriteInt32( nValue.GetDenominator() ); + rOut.WriteInt32( nValue.numerator() ); + rOut.WriteInt32( nValue.denominator() ); return rOut; } @@ -699,16 +692,9 @@ bool SdrScaleItem::GetPresentation( SfxItemPresentation ePresentation, SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresentationMetric*/, OUString &rText, const IntlWrapper *) const { - if(GetValue().IsValid()) - { - sal_Int32 nDiv = GetValue().GetDenominator(); + sal_Int32 nDiv = GetValue().denominator(); - rText = OUString::number(GetValue().GetNumerator()) + ":" + OUString::number(nDiv); - } - else - { - rText = "?"; - } + rText = OUString::number(GetValue().numerator()) + ":" + OUString::number(nDiv); if(ePresentation == SFX_ITEM_PRESENTATION_COMPLETE) { diff --git a/svx/source/svdraw/svddrag.cxx b/svx/source/svdraw/svddrag.cxx index 3c0f109954b0..fda560eb2a43 100644 --- a/svx/source/svdraw/svddrag.cxx +++ b/svx/source/svdraw/svddrag.cxx @@ -106,22 +106,22 @@ bool SdrDragStat::CheckMinMoved(const Point& rPnt) return bMinMoved; } -Fraction SdrDragStat::GetXFact() const +boost::rational<long> SdrDragStat::GetXFact() const { long nMul=GetNow().X()-aRef1.X(); long nDiv=GetPrev().X()-aRef1.X(); if (nDiv==0) nDiv=1; if (bHorFixed) { nMul=1; nDiv=1; } - return Fraction(nMul,nDiv); + return boost::rational<long>(nMul,nDiv); } -Fraction SdrDragStat::GetYFact() const +boost::rational<long> SdrDragStat::GetYFact() const { long nMul=GetNow().Y()-aRef1.Y(); long nDiv=GetPrev().Y()-aRef1.Y(); if (nDiv==0) nDiv=1; if (bVerFixed) { nMul=1; nDiv=1; } - return Fraction(nMul,nDiv); + return boost::rational<long>(nMul,nDiv); } void SdrDragStat::TakeCreateRect(Rectangle& rRect) const diff --git a/svx/source/svdraw/svddrgm1.hxx b/svx/source/svdraw/svddrgm1.hxx index 972c17de91ac..7b038800b5e2 100644 --- a/svx/source/svdraw/svddrgm1.hxx +++ b/svx/source/svdraw/svddrgm1.hxx @@ -74,7 +74,7 @@ public: class SdrDragShear : public SdrDragMethod { private: - Fraction aFact; + boost::rational<long> aFact; long nWink0; long nWink; double nTan; @@ -151,7 +151,7 @@ private: Point aMarkCenter; Point aCenter; Point aStart; - Fraction aFact; + boost::rational<long> aFact; Point aRad; bool bContortionAllowed; bool bNoContortionAllowed; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 9c92001b56af..a5b671cbd38a 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -1779,7 +1779,7 @@ SdrDragResize::SdrDragResize(SdrDragView& rNewView) void SdrDragResize::TakeSdrDragComment(OUString& rStr) const { ImpTakeDescriptionStr(STR_DragMethResize, rStr); - Fraction aFact1(1,1); + boost::rational<long> aFact1(1,1); Point aStart(DragStat().GetStart()); Point aRef(DragStat().GetRef1()); sal_Int32 nXDiv(aStart.X() - aRef.X()); @@ -1878,7 +1878,7 @@ basegfx::B2DHomMatrix SdrDragResize::getCurrentTransformation() { basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix( -DragStat().Ref1().X(), -DragStat().Ref1().Y())); - aRetval.scale(aXFact, aYFact); + aRetval.scale(boost::rational_cast<double>(aXFact), boost::rational_cast<double>(aYFact)); aRetval.translate(DragStat().Ref1().X(), DragStat().Ref1().Y()); return aRetval; @@ -1889,7 +1889,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt) Point aPnt(GetSnapPos(rNoSnapPnt)); Point aStart(DragStat().GetStart()); Point aRef(DragStat().GetRef1()); - Fraction aMaxFact(0x7FFFFFFF,1); + boost::rational<long> aMaxFact(0x7FFFFFFF,1); Rectangle aLR(getSdrDragView().GetWorkArea()); bool bWorkArea=!aLR.IsEmpty(); bool bDragLimit=IsDragLimit(); @@ -1920,7 +1920,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt) if (aRef.X()>aSR.Left()) { - Fraction aMax(aRef.X()-aLR.Left(),aRef.X()-aSR.Left()); + boost::rational<long> aMax(aRef.X()-aLR.Left(),aRef.X()-aSR.Left()); if (aMax<aMaxFact) aMaxFact=aMax; @@ -1928,7 +1928,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt) if (aRef.X()<aSR.Right()) { - Fraction aMax(aLR.Right()-aRef.X(),aSR.Right()-aRef.X()); + boost::rational<long> aMax(aLR.Right()-aRef.X(),aSR.Right()-aRef.X()); if (aMax<aMaxFact) aMaxFact=aMax; @@ -1936,7 +1936,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt) if (aRef.Y()>aSR.Top()) { - Fraction aMax(aRef.Y()-aLR.Top(),aRef.Y()-aSR.Top()); + boost::rational<long> aMax(aRef.Y()-aLR.Top(),aRef.Y()-aSR.Top()); if (aMax<aMaxFact) aMaxFact=aMax; @@ -1944,7 +1944,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt) if (aRef.Y()<aSR.Bottom()) { - Fraction aMax(aLR.Bottom()-aRef.Y(),aSR.Bottom()-aRef.Y()); + boost::rational<long> aMax(aLR.Bottom()-aRef.Y(),aSR.Bottom()-aRef.Y()); if (aMax<aMaxFact) aMaxFact=aMax; @@ -1979,7 +1979,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt) if (bOrtho) { - if ((Fraction(nXMul,nXDiv)>Fraction(nYMul,nYDiv)) !=getSdrDragView().IsBigOrtho()) + if ((boost::rational<long>(nXMul,nXDiv)>boost::rational<long>(nYMul,nYDiv)) !=getSdrDragView().IsBigOrtho()) { nXMul=nYMul; nXDiv=nYDiv; @@ -2027,8 +2027,8 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt) } } - Fraction aNeuXFact(nXMul,nXDiv); - Fraction aNeuYFact(nYMul,nYDiv); + boost::rational<long> aNeuXFact(nXMul,nXDiv); + boost::rational<long> aNeuYFact(nYMul,nYDiv); if (bOrtho) { @@ -2046,10 +2046,10 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt) } if (bXNeg) - aNeuXFact=Fraction(-aNeuXFact.GetNumerator(),aNeuXFact.GetDenominator()); + aNeuXFact=boost::rational<long>(-aNeuXFact.numerator(),aNeuXFact.denominator()); if (bYNeg) - aNeuYFact=Fraction(-aNeuYFact.GetNumerator(),aNeuYFact.GetDenominator()); + aNeuYFact=boost::rational<long>(-aNeuYFact.numerator(),aNeuYFact.denominator()); if (DragStat().CheckMinMoved(aPnt)) { @@ -2317,12 +2317,12 @@ basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation() { if (bVertical) { - aRetval.scale(aFact, 1.0); + aRetval.scale(boost::rational_cast<double>(aFact), 1.0); aRetval.shearY(-nTan); } else { - aRetval.scale(1.0, aFact); + aRetval.scale(1.0, boost::rational_cast<double>(aFact)); aRetval.shearX(-nTan); } } @@ -2344,7 +2344,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt) Point aP0(DragStat().GetStart()); Point aPnt(rPnt); - Fraction aNeuFact(1,1); + boost::rational<long> aNeuFact(1,1); // if angle snapping not activated, snap to raster (except when using slant) if (nSA==0 && !bSlant) @@ -2389,11 +2389,11 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt) if (bVertical) { - aNeuFact=Fraction(aPt2.X()-aRef.X(),aP0.X()-aRef.X()); + aNeuFact=boost::rational<long>(aPt2.X()-aRef.X(),aP0.X()-aRef.X()); } else { - aNeuFact=Fraction(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y()); + aNeuFact=boost::rational<long>(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y()); } } } @@ -2451,11 +2451,11 @@ void SdrDragShear::applyCurrentTransformationToSdrObject(SdrObject& rTarget) { if (bVertical) { - rTarget.Resize(DragStat().GetRef1(),aFact,Fraction(1,1)); + rTarget.Resize(DragStat().GetRef1(),aFact,boost::rational<long>(1,1)); } else { - rTarget.Resize(DragStat().GetRef1(),Fraction(1,1),aFact); + rTarget.Resize(DragStat().GetRef1(),boost::rational<long>(1,1),aFact); } } @@ -2469,7 +2469,7 @@ bool SdrDragShear::EndSdrDrag(bool bCopy) { Hide(); - if (bResize && aFact==Fraction(1,1)) + if (bResize && aFact==boost::rational<long>(1,1)) bResize=false; if (nWink!=0 || bResize) @@ -2489,11 +2489,11 @@ bool SdrDragShear::EndSdrDrag(bool bCopy) { if (bVertical) { - getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aFact,Fraction(1,1),bCopy); + getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aFact,boost::rational<long>(1,1),bCopy); } else { - getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),Fraction(1,1),aFact,bCopy); + getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),boost::rational<long>(1,1),aFact,bCopy); } bCopy=false; @@ -3016,7 +3016,7 @@ void SdrDragCrook::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget) if (bResize) { - Fraction aFact1(1,1); + boost::rational<long> aFact1(1,1); if (bVertical) { @@ -3108,7 +3108,7 @@ void SdrDragCrook::_MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2) if (bResize) { - Fraction aFact1(1,1); + boost::rational<long> aFact1(1,1); if (bVert) { @@ -3184,7 +3184,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt) else bAtCenter=true; - Fraction aNeuFact(1,1); + boost::rational<long> aNeuFact(1,1); long dx1=aPnt.X()-aNeuCenter.X(); long dy1=aPnt.Y()-aNeuCenter.Y(); bValid=bVertical ? dx1!=0 : dy1!=0; @@ -3254,7 +3254,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt) if (bAtCenter) nMul*=2; - aNeuFact=Fraction(nMul,nMarkSize); + aNeuFact=boost::rational<long>(nMul,nMarkSize); nWink=nPntWink; } else @@ -3287,7 +3287,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt) nMul = std::abs(nMul); } - aNeuFact=Fraction(nMul,nDiv); + aNeuFact=boost::rational<long>(nMul,nDiv); } if (aNeuCenter!=aCenter || bNeuContortion!=bContortion || aNeuFact!=aFact || @@ -3301,7 +3301,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt) aCenter=aNeuCenter; aFact=aNeuFact; aRad=Point(nNeuRad,nNeuRad); - bResize=aFact!=Fraction(1,1) && aFact.GetDenominator()!=0 && aFact.IsValid(); + bResize=aFact!=boost::rational<long>(1,1); DragStat().NextMove(aPnt); Show(); } @@ -3310,14 +3310,14 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt) void SdrDragCrook::applyCurrentTransformationToSdrObject(SdrObject& rTarget) { - const bool bDoResize(aFact!=Fraction(1,1)); + const bool bDoResize(aFact!=boost::rational<long>(1,1)); const bool bDoCrook(aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0); if (bDoCrook || bDoResize) { if (bDoResize) { - Fraction aFact1(1,1); + boost::rational<long> aFact1(1,1); if (bContortion) { @@ -3370,7 +3370,7 @@ bool SdrDragCrook::EndSdrDrag(bool bCopy) { Hide(); - if (bResize && aFact==Fraction(1,1)) + if (bResize && aFact==boost::rational<long>(1,1)) bResize=false; const bool bUndo = getSdrDragView().IsUndoEnabled(); @@ -3392,7 +3392,7 @@ bool SdrDragCrook::EndSdrDrag(bool bCopy) if (bResize) { - Fraction aFact1(1,1); + boost::rational<long> aFact1(1,1); if (bContortion) { diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 500633aa3ca1..d0a34a13cf08 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -212,7 +212,7 @@ void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy) EndUndo(); } -void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy) +void SdrEditView::ResizeMarkedObj(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy) { const bool bUndo = IsUndoEnabled(); if( bUndo ) @@ -245,8 +245,8 @@ void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, cons EndUndo(); } void SdrEditView::ResizeMultMarkedObj(const Point& rRef, - const Fraction& xFact, - const Fraction& yFact, + const boost::rational<long>& xFact, + const boost::rational<long>& yFact, const bool bCopy, const bool bWdh, const bool bHgt) @@ -276,7 +276,7 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef, AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); } - Fraction aFrac(1,1); + boost::rational<long> aFrac(1,1); if (bWdh && bHgt) pO->Resize(rRef, xFact, yFact); else if (bWdh) @@ -755,12 +755,12 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr, bool /*bRep SetMarkedObjRect(aRect); } if (rAttr.GetItemState(SDRATTR_RESIZEXALL,true,&pPoolItem)==SfxItemState::SET) { - Fraction aXFact=((const SdrResizeXAllItem*)pPoolItem)->GetValue(); - ResizeMarkedObj(aAllSnapRect.TopLeft(),aXFact,Fraction(1,1)); + boost::rational<long> aXFact=((const SdrResizeXAllItem*)pPoolItem)->GetValue(); + ResizeMarkedObj(aAllSnapRect.TopLeft(),aXFact,boost::rational<long>(1,1)); } if (rAttr.GetItemState(SDRATTR_RESIZEYALL,true,&pPoolItem)==SfxItemState::SET) { - Fraction aYFact=((const SdrResizeYAllItem*)pPoolItem)->GetValue(); - ResizeMarkedObj(aAllSnapRect.TopLeft(),Fraction(1,1),aYFact); + boost::rational<long> aYFact=((const SdrResizeYAllItem*)pPoolItem)->GetValue(); + ResizeMarkedObj(aAllSnapRect.TopLeft(),boost::rational<long>(1,1),aYFact); } if (rAttr.GetItemState(SDRATTR_ROTATEALL,true,&pPoolItem)==SfxItemState::SET) { long nAngle=((const SdrRotateAllItem*)pPoolItem)->GetValue(); @@ -1608,8 +1608,8 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) // change size and height if (bChgSiz && (bResizeFreeAllowed || bResizePropAllowed)) { - Fraction aWdt(nSizX,aRect.Right()-aRect.Left()); - Fraction aHgt(nSizY,aRect.Bottom()-aRect.Top()); + boost::rational<long> aWdt(nSizX,aRect.Right()-aRect.Left()); + boost::rational<long> aHgt(nSizY,aRect.Bottom()-aRect.Top()); Point aRef(ImpGetPoint(aRect,eSizePoint)); if(GetSdrPageView()) diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index c98757922408..5b6a1f4dfcc0 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -241,18 +241,18 @@ size_t ImpSdrGDIMetaFileImport::DoImport( mbMov = maOfs.X()!=0 || maOfs.Y()!=0; mbSize = false; - maScaleX = Fraction( 1, 1 ); - maScaleY = Fraction( 1, 1 ); + maScaleX = boost::rational<long>( 1, 1 ); + maScaleY = boost::rational<long>( 1, 1 ); if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1)) { - maScaleX = Fraction(maScaleRect.GetWidth() - 1, aMtfSize.Width()); + maScaleX = boost::rational<long>(maScaleRect.GetWidth() - 1, aMtfSize.Width()); mbSize = true; } if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1)) { - maScaleY = Fraction(maScaleRect.GetHeight() - 1, aMtfSize.Height()); + maScaleY = boost::rational<long>(maScaleRect.GetHeight() - 1, aMtfSize.Height()); mbSize = true; } diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx index 16e2dddcc5ce..d394e97463b3 100644 --- a/svx/source/svdraw/svdfmtf.hxx +++ b/svx/source/svdraw/svdfmtf.hxx @@ -63,8 +63,8 @@ protected: Point maOfs; double mfScaleX; double mfScaleY; - Fraction maScaleX; - Fraction maScaleY; + boost::rational<long> maScaleX; + boost::rational<long> maScaleY; bool mbFntDirty; diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx index e6947d92b9f5..279c84631190 100644 --- a/svx/source/svdraw/svdglev.cxx +++ b/svx/source/svdraw/svdglev.cxx @@ -378,10 +378,10 @@ void SdrGlueEditView::MoveMarkedGluePoints(const Size& rSiz, bool bCopy) static void ImpResize(Point& rPt, const void* p1, const void* p2, const void* p3, const void* /*p4*/, const void* /*p5*/) { - ResizePoint(rPt,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3); + ResizePoint(rPt,*(const Point*)p1,*(const boost::rational<long>*)p2,*(const boost::rational<long>*)p3); } -void SdrGlueEditView::ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy) +void SdrGlueEditView::ResizeMarkedGluePoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy) { ForceUndirtyMrkPnt(); OUString aStr(ImpGetResStr(STR_EditResize)); diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx index e8a03aa36850..be76208d988e 100644 --- a/svx/source/svdraw/svdibrow.cxx +++ b/svx/source/svdraw/svdibrow.cxx @@ -1217,7 +1217,7 @@ IMPL_LINK(SdrItemBrowser,ChangedHdl,_SdrItemBrowserControl*,pBrowse) case ITEM_FRACTION: { if (!bPairX) nLongX=1; if (!bPairY) nLongY=1; - ((SdrFractionItem*)pNewItem)->SetValue(Fraction(nLongX,nLongY)); + ((SdrFractionItem*)pNewItem)->SetValue(boost::rational<long>(nLongX,nLongY)); } break; case ITEM_XCOLOR: break; case ITEM_COLOR: break; diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index c197fa7f0dd4..e7171b1c3961 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -113,7 +113,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe aObjUnit=SdrEngineDefaults::GetMapFraction(); eObjUnit=SdrEngineDefaults::GetMapUnit(); eUIUnit=FUNIT_MM; - aUIScale=Fraction(1,1); + aUIScale=boost::rational<long>(1,1); nUIUnitKomma=0; bUIOnlyKomma=false; pLayerAdmin=NULL; @@ -927,9 +927,9 @@ void SdrModel::SetDefaultTabulator(sal_uInt16 nVal) void SdrModel::ImpSetUIUnit() { - if(0 == aUIScale.GetNumerator() || 0 == aUIScale.GetDenominator()) + if(0 == aUIScale.numerator()) { - aUIScale = Fraction(1,1); + aUIScale = boost::rational<long>(1,1); } // set start values @@ -1015,17 +1015,17 @@ void SdrModel::ImpSetUIUnit() // may need to be changed in the future, too if(1 != nMul || 1 != nDiv) { - const Fraction aTemp(static_cast< long >(nMul), static_cast< long >(nDiv)); - nMul = aTemp.GetNumerator(); - nDiv = aTemp.GetDenominator(); + const boost::rational<long> aTemp(static_cast< long >(nMul), static_cast< long >(nDiv)); + nMul = aTemp.numerator(); + nDiv = aTemp.denominator(); } // #i89872# take Unit of Measurement into account - if(1 != aUIScale.GetDenominator() || 1 != aUIScale.GetNumerator()) + if(1 != aUIScale.denominator() || 1 != aUIScale.numerator()) { // divide by UIScale - nMul *= aUIScale.GetDenominator(); - nDiv *= aUIScale.GetNumerator(); + nMul *= aUIScale.denominator(); + nDiv *= aUIScale.numerator(); } // shorten trailing zeros for dividend @@ -1043,12 +1043,12 @@ void SdrModel::ImpSetUIUnit() } // end preparations, set member values - aUIUnitFact = Fraction(sal_Int32(nMul), sal_Int32(nDiv)); + aUIUnitFact = boost::rational<long>(sal_Int32(nMul), sal_Int32(nDiv)); bUIOnlyKomma = (nMul == nDiv); TakeUnitStr(eUIUnit, aUIUnitStr); } -void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac) +void SdrModel::SetScaleUnit(MapUnit eMap, const boost::rational<long>& rFrac) { if (eObjUnit!=eMap || aObjUnit!=rFrac) { eObjUnit=eMap; @@ -1073,7 +1073,7 @@ void SdrModel::SetScaleUnit(MapUnit eMap) } } -void SdrModel::SetScaleFraction(const Fraction& rFrac) +void SdrModel::SetScaleFraction(const boost::rational<long>& rFrac) { if (aObjUnit!=rFrac) { aObjUnit=rFrac; @@ -1093,7 +1093,7 @@ void SdrModel::SetUIUnit(FieldUnit eUnit) } } -void SdrModel::SetUIScale(const Fraction& rScale) +void SdrModel::SetUIScale(const boost::rational<long>& rScale) { if (aUIScale!=rScale) { aUIScale=rScale; @@ -1102,7 +1102,7 @@ void SdrModel::SetUIScale(const Fraction& rScale) } } -void SdrModel::SetUIUnit(FieldUnit eUnit, const Fraction& rScale) +void SdrModel::SetUIUnit(FieldUnit eUnit, const boost::rational<long>& rScale) { if (eUIUnit!=eUnit || aUIScale!=rScale) { eUIUnit=eUnit; @@ -1193,7 +1193,7 @@ void SdrModel::TakeMetricStr(long nVal, OUString& rStr, bool bNoUnitChars, sal_I const bool bNegative(nVal < 0L); SvtSysLocale aSysLoc; const LocaleDataWrapper& rLoc(aSysLoc.GetLocaleData()); - double fLocalValue(double(nVal) * double(aUIUnitFact)); + double fLocalValue(double(nVal) * boost::rational_cast<double>(aUIUnitFact)); if(bNegative) { @@ -1333,10 +1333,10 @@ void SdrModel::TakeWinkStr(long nWink, OUString& rStr, bool bNoDegChar) const rStr = aBuf.makeStringAndClear(); } -void SdrModel::TakePercentStr(const Fraction& rVal, OUString& rStr, bool bNoPercentChar) const +void SdrModel::TakePercentStr(const boost::rational<long>& rVal, OUString& rStr, bool bNoPercentChar) const { - sal_Int32 nMul(rVal.GetNumerator()); - sal_Int32 nDiv(rVal.GetDenominator()); + sal_Int32 nMul(rVal.numerator()); + sal_Int32 nDiv(rVal.denominator()); bool bNeg(nMul < 0); if(nDiv < 0) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 687ed35740e4..858772c5ec14 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1564,15 +1564,15 @@ void SdrObjCustomShape::NbcMove( const Size& rSiz ) mpLastShadowGeometry->NbcMove( rSiz ); } } -void SdrObjCustomShape::Resize( const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative ) +void SdrObjCustomShape::Resize( const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative ) { SdrTextObj::Resize( rRef, xFact, yFact, bUnsetRelative ); } -void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, const Fraction& ryFact ) +void SdrObjCustomShape::NbcResize( const Point& rRef, const boost::rational<long>& rxFact, const boost::rational<long>& ryFact ) { - Fraction xFact( rxFact ); - Fraction yFact( ryFact ); + boost::rational<long> xFact( rxFact ); + boost::rational<long> yFact( ryFact ); // taking care of handles that should not been changed Rectangle aOld( aRect ); @@ -1580,16 +1580,16 @@ void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, co SdrTextObj::NbcResize( rRef, xFact, yFact ); - if ( ( xFact.GetNumerator() != xFact.GetDenominator() ) - || ( yFact.GetNumerator()!= yFact.GetDenominator() ) ) + if ( ( xFact.numerator() != xFact.denominator() ) + || ( yFact.numerator()!= yFact.denominator() ) ) { - if ( ( ( xFact.GetNumerator() < 0 ) && ( xFact.GetDenominator() > 0 ) ) || - ( ( xFact.GetNumerator() > 0 ) && ( xFact.GetDenominator() < 0 ) ) ) + if ( ( ( xFact.numerator() < 0 ) && ( xFact.denominator() > 0 ) ) || + ( ( xFact.numerator() > 0 ) && ( xFact.denominator() < 0 ) ) ) { SetMirroredX( IsMirroredX() == false ); } - if ( ( ( yFact.GetNumerator() < 0 ) && ( yFact.GetDenominator() > 0 ) ) || - ( ( yFact.GetNumerator() > 0 ) && ( yFact.GetDenominator() < 0 ) ) ) + if ( ( ( yFact.numerator() < 0 ) && ( yFact.denominator() > 0 ) ) || + ( ( yFact.numerator() > 0 ) && ( yFact.denominator() < 0 ) ) ) { SetMirroredY( IsMirroredY() == false ); } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index a7c12191e318..c98acb0570b6 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1338,12 +1338,12 @@ Rectangle SdrObject::ImpDragCalcRect(const SdrDragStat& rDrag) const nYMul=std::abs(nYMul); nXDiv=std::abs(nXDiv); nYDiv=std::abs(nYDiv); - Fraction aXFact(nXMul,nXDiv); // fractions for canceling - Fraction aYFact(nYMul,nYDiv); // and for comparing - nXMul=aXFact.GetNumerator(); - nYMul=aYFact.GetNumerator(); - nXDiv=aXFact.GetDenominator(); - nYDiv=aYFact.GetDenominator(); + boost::rational<long> aXFact(nXMul,nXDiv); // fractions for canceling + boost::rational<long> aYFact(nYMul,nYDiv); // and for comparing + nXMul=aXFact.numerator(); + nYMul=aYFact.numerator(); + nXDiv=aXFact.denominator(); + nYDiv=aYFact.denominator(); if (bEcke) { // corner point handles bool bUseX=(aXFact<aYFact) != bBigOrtho; if (bUseX) { @@ -1495,10 +1495,10 @@ void SdrObject::NbcMove(const Size& rSiz) SetRectsDirty(); } -void SdrObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrObject::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { - bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); - bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); + bool bXMirr = xFact.numerator() < 0; + bool bYMirr = yFact.numerator() < 0; if (bXMirr || bYMirr) { Point aRef1(GetSnapRect().Center()); if (bXMirr) { @@ -1593,9 +1593,9 @@ void SdrObject::Move(const Size& rSiz) } } -void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative) +void SdrObject::Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative) { - if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) { + if (xFact.numerator()!=xFact.denominator() || yFact.numerator()!=yFact.denominator()) { if (bUnsetRelative) { mnRelativeWidth.reset( ); @@ -2262,15 +2262,15 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr) if (aNewLogic!=rLogic) { NbcSetLogicRect(aNewLogic); } - Fraction aResizeX(1,1); - Fraction aResizeY(1,1); + boost::rational<long> aResizeX(1,1); + boost::rational<long> aResizeY(1,1); if (rAttr.GetItemState(SDRATTR_RESIZEXONE,true,&pPoolItem)==SfxItemState::SET) { aResizeX*=((const SdrResizeXOneItem*)pPoolItem)->GetValue(); } if (rAttr.GetItemState(SDRATTR_RESIZEYONE,true,&pPoolItem)==SfxItemState::SET) { aResizeY*=((const SdrResizeYOneItem*)pPoolItem)->GetValue(); } - if (aResizeX!=Fraction(1,1) || aResizeY!=Fraction(1,1)) { + if (aResizeX!=boost::rational<long>(1,1) || aResizeY!=boost::rational<long>(1,1)) { NbcResize(aRef1,aResizeX,aResizeY); } } diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index 583222a1cab2..85f7502f9d33 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -608,7 +608,7 @@ void SdrCaptionObj::NbcMove(const Size& rSiz) SetTailPos(GetFixedTailPos()); } -void SdrCaptionObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrCaptionObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { SdrRectObj::NbcResize(rRef,xFact,yFact); ResizePoly(aTailPoly,rRef,xFact,yFact); diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index db836dd721e0..81a9c413a95b 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -811,15 +811,15 @@ void SdrCircObj::NbcMove(const Size& aSiz) SetRectsDirty(true); } -void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrCircObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { long nWink0=aGeo.nDrehWink; bool bNoShearRota=(aGeo.nDrehWink==0 && aGeo.nShearWink==0); SdrTextObj::NbcResize(rRef,xFact,yFact); bNoShearRota|=(aGeo.nDrehWink==0 && aGeo.nShearWink==0); if (meCircleKind!=OBJ_CIRC) { - bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); - bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); + bool bXMirr = xFact.numerator() < 0; + bool bYMirr = yFact.numerator() < 0; if (bXMirr || bYMirr) { // At bXMirr!=bYMirr we should actually swap both line ends. // That, however, is pretty bad (because of forced "hard" formatting). @@ -1031,7 +1031,7 @@ void SdrCircObj::NbcSetSnapRect(const Rectangle& rRect) long nHgt0=aSR0.Bottom()-aSR0.Top(); long nWdt1=rRect.Right()-rRect.Left(); long nHgt1=rRect.Bottom()-rRect.Top(); - NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0)); + NbcResize(maSnapRect.TopLeft(),boost::rational<long>(nWdt1,nWdt0),boost::rational<long>(nHgt1,nHgt0)); NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top())); } else { aRect=rRect; diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index a743cc3ce901..c73a6d167f73 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -2244,8 +2244,8 @@ void SdrEdgeObj::NbcSetSnapRect(const Rectangle& rRect) long nDivY = aOld.Bottom() - aOld.Top(); if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } - Fraction aX(nMulX, nDivX); - Fraction aY(nMulY, nDivY); + boost::rational<long> aX(nMulX, nDivX); + boost::rational<long> aY(nMulY, nDivY); NbcResize(aOld.TopLeft(), aX, aY); NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); } @@ -2258,7 +2258,7 @@ void SdrEdgeObj::NbcMove(const Size& rSiz) MoveXPoly(*pEdgeTrack,rSiz); } -void SdrEdgeObj::NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) +void SdrEdgeObj::NbcResize(const Point& rRefPnt, const boost::rational<long>& aXFact, const boost::rational<long>& aYFact) { SdrTextObj::NbcResize(rRefPnt,aXFact,aXFact); ResizeXPoly(*pEdgeTrack,rRefPnt,aXFact,aYFact); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 8c6a4892435b..b101d0311bff 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -897,12 +897,12 @@ SdrHdl* SdrGrafObj::GetHdl(sal_uInt32 nHdlNum) const return SdrRectObj::GetHdl( nHdlNum + 1L ); } -void SdrGrafObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrGrafObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { SdrRectObj::NbcResize( rRef, xFact, yFact ); - bool bMirrX = xFact.GetNumerator() < 0; - bool bMirrY = yFact.GetNumerator() < 0; + bool bMirrX = xFact.numerator() < 0; + bool bMirrY = yFact.numerator() < 0; if( bMirrX != bMirrY ) bMirrored = !bMirrored; diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 87634138df20..dd79cc445854 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -403,8 +403,8 @@ void SdrObjGroup::NbcSetSnapRect(const Rectangle& rRect) if (nDivX==0) { nMulX=1; nDivX=1; } if (nDivY==0) { nMulY=1; nDivY=1; } if (nMulX!=nDivX || nMulY!=nDivY) { - Fraction aX(nMulX,nDivX); - Fraction aY(nMulY,nDivY); + boost::rational<long> aX(nMulX,nDivX); + boost::rational<long> aY(nMulY,nDivY); NbcResize(aOld.TopLeft(),aX,aY); } if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) { @@ -436,10 +436,10 @@ void SdrObjGroup::NbcMove(const Size& rSiz) } -void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrObjGroup::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { - bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); - bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); + bool bXMirr = xFact.numerator() < 0; + bool bYMirr = yFact.numerator() < 0; if (bXMirr || bYMirr) { Point aRef1(GetSnapRect().Center()); if (bXMirr) { @@ -538,8 +538,8 @@ void SdrObjGroup::SetSnapRect(const Rectangle& rRect) if (nDivX==0) { nMulX=1; nDivX=1; } if (nDivY==0) { nMulY=1; nDivY=1; } if (nMulX!=nDivX || nMulY!=nDivY) { - Fraction aX(nMulX,nDivX); - Fraction aY(nMulY,nDivY); + boost::rational<long> aX(nMulX,nDivX); + boost::rational<long> aY(nMulY,nDivY); Resize(aOld.TopLeft(),aX,aY); } if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) { @@ -587,11 +587,11 @@ void SdrObjGroup::Move(const Size& rSiz) } -void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative) +void SdrObjGroup::Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative) { - if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) { - bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); - bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); + if (xFact.numerator()!=xFact.denominator() || yFact.numerator()!=yFact.denominator()) { + bool bXMirr = xFact.numerator() < 0; + bool bYMirr = yFact.numerator() < 0; if (bXMirr || bYMirr) { Point aRef1(GetSnapRect().Center()); if (bXMirr) { diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 007c97350afa..dd3998b21d72 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -80,7 +80,7 @@ SdrMeasureObjGeoData::~SdrMeasureObjGeoData() {} OUString SdrMeasureObj::TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind) const { OUString aStr; - Fraction aMeasureScale(1, 1); + boost::rational<long> aMeasureScale(1, 1); bool bTextRota90(false); bool bShowUnit(false); FieldUnit eMeasureUnit(FUNIT_NONE); @@ -105,7 +105,7 @@ OUString SdrMeasureObj::TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind eMeasureUnit = eModUIUnit; sal_Int32 nLen(GetLen(aPt2 - aPt1)); - Fraction aFact(1,1); + boost::rational<long> aFact(1,1); if(eMeasureUnit != eModUIUnit) { @@ -113,27 +113,21 @@ OUString SdrMeasureObj::TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind aFact *= GetMapFactor(eModUIUnit, eMeasureUnit).X(); } - if(aMeasureScale.GetNumerator() != aMeasureScale.GetDenominator()) + if(aMeasureScale.numerator() != aMeasureScale.denominator()) { aFact *= aMeasureScale; } - if(aFact.GetNumerator() != aFact.GetDenominator()) + if(aFact.numerator() != aFact.denominator()) { // scale via BigInt, to avoid overruns - nLen = BigMulDiv(nLen, aFact.GetNumerator(), aFact.GetDenominator()); + nLen = BigMulDiv(nLen, aFact.numerator(), aFact.denominator()); } OUString aTmp; pModel->TakeMetricStr(nLen, aTmp, true, nNumDigits); aStr = aTmp; - if(!aFact.IsValid()) - { - aStr = ""; - aStr += "?"; - } - sal_Unicode cDec(SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]); if(aStr.indexOf(cDec) != -1) @@ -281,7 +275,7 @@ struct ImpMeasureRec : public SdrDragStatUserData bool bTextUpsideDown; long nMeasureOverhang; FieldUnit eMeasureUnit; - Fraction aMeasureScale; + boost::rational<long> aMeasureScale; bool bShowUnit; OUString aFormatString; bool bTextAutoAngle; @@ -1035,7 +1029,7 @@ void SdrMeasureObj::NbcMove(const Size& rSiz) MovePoint(aPt2,rSiz); } -void SdrMeasureObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrMeasureObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { SdrTextObj::NbcResize(rRef,xFact,yFact); ResizePoint(aPt1,rRef,xFact,yFact); diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index df431560a8d2..cb9dd89ffc04 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -114,22 +114,22 @@ class SdrLightEmbeddedClient_Impl : public ::cppu::WeakImplHelper5 uno::Reference< awt::XWindow > m_xWindow; SdrOle2Obj* mpObj; - Fraction m_aScaleWidth; - Fraction m_aScaleHeight; + boost::rational<long> m_aScaleWidth; + boost::rational<long> m_aScaleHeight; public: SdrLightEmbeddedClient_Impl( SdrOle2Obj* pObj ); void Release(); - void SetSizeScale( const Fraction& aScaleWidth, const Fraction& aScaleHeight ) + void SetSizeScale( const boost::rational<long>& aScaleWidth, const boost::rational<long>& aScaleHeight ) { m_aScaleWidth = aScaleWidth; m_aScaleHeight = aScaleHeight; } - Fraction GetScaleWidth() const { return m_aScaleWidth; } - Fraction GetScaleHeight() const { return m_aScaleHeight; } + boost::rational<long> GetScaleWidth() const { return m_aScaleWidth; } + boost::rational<long> GetScaleHeight() const { return m_aScaleHeight; } void setWindow(const uno::Reference< awt::XWindow >& _xWindow); @@ -177,8 +177,8 @@ Rectangle SdrLightEmbeddedClient_Impl::impl_getScaledRect_nothrow() const { Rectangle aLogicRect( mpObj->GetLogicRect() ); // apply scaling to object area and convert to pixels - aLogicRect.SetSize( Size( Fraction( aLogicRect.GetWidth() ) * m_aScaleWidth, - Fraction( aLogicRect.GetHeight() ) * m_aScaleHeight ) ); + aLogicRect.SetSize( Size( boost::rational_cast<long>(aLogicRect.GetWidth() * m_aScaleWidth), + boost::rational_cast<long>(aLogicRect.GetHeight() * m_aScaleHeight) ) ); return aLogicRect; } @@ -262,8 +262,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::notifyEvent( const document::EventObj aVisArea.SetSize( Size( aSz.Width, aSz.Height ) ); aVisArea = OutputDevice::LogicToLogic( aVisArea, aObjMapUnit, aContainerMapUnit ); - Size aScaledSize( static_cast< long >( m_aScaleWidth * Fraction( aVisArea.GetWidth() ) ), - static_cast< long >( m_aScaleHeight * Fraction( aVisArea.GetHeight() ) ) ); + Size aScaledSize( boost::rational_cast<long>( m_aScaleWidth * aVisArea.GetWidth() ), + boost::rational_cast<long>( m_aScaleHeight * aVisArea.GetHeight() ) ); Rectangle aLogicRect( mpObj->GetLogicRect() ); // react to the change if the difference is bigger than one pixel @@ -548,8 +548,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::changedPlacement( const awt::Rectangl //SfxBooleanFlagGuard aGuard( m_bResizeNoScale, true ); // new size of the object area without scaling - Size aNewObjSize( Fraction( aNewLogicRect.GetWidth() ) / m_aScaleWidth, - Fraction( aNewLogicRect.GetHeight() ) / m_aScaleHeight ); + Size aNewObjSize( boost::rational_cast<long>(aNewLogicRect.GetWidth() / m_aScaleWidth), + boost::rational_cast<long>(aNewLogicRect.GetHeight() / m_aScaleHeight) ); // now remove scaling from new placement and keep this a the new object area aNewLogicRect.SetSize( aNewObjSize ); @@ -1762,8 +1762,8 @@ void SdrOle2Obj::ImpSetVisAreaSize() || mpImpl->mxObjRef->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE ) { - Fraction aScaleWidth; - Fraction aScaleHeight; + boost::rational<long> aScaleWidth; + boost::rational<long> aScaleHeight; if ( pClient ) { aScaleWidth = pClient->GetScaleWidth(); @@ -1781,8 +1781,8 @@ void SdrOle2Obj::ImpSetVisAreaSize() // objects' visual area. The scaling will not change, but it might exist already and must // be used in calculations MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( mpImpl->mxObjRef->getMapUnit( GetAspect() ) ); - Size aVisSize( (long)( Fraction( aRect.GetWidth() ) / aScaleWidth ), - (long)( Fraction( aRect.GetHeight() ) / aScaleHeight ) ); + Size aVisSize( boost::rational_cast<long>(aRect.GetWidth() / aScaleWidth), + boost::rational_cast<long>(aRect.GetHeight() / aScaleHeight) ); aVisSize = OutputDevice::LogicToLogic( aVisSize, pModel->GetScaleUnit(), aMapUnit); awt::Size aSz; @@ -1798,8 +1798,8 @@ void SdrOle2Obj::ImpSetVisAreaSize() {} Rectangle aAcceptedVisArea; - aAcceptedVisArea.SetSize( Size( (long)( Fraction( long( aSz.Width ) ) * aScaleWidth ), - (long)( Fraction( long( aSz.Height ) ) * aScaleHeight ) ) ); + aAcceptedVisArea.SetSize( Size( boost::rational_cast<long>(long(aSz.Width) * aScaleWidth), + boost::rational_cast<long>(long(aSz.Height) * aScaleHeight) ) ); if (aVisSize != aAcceptedVisArea.GetSize()) { // server changed VisArea to its liking and the VisArea is different than the suggested one @@ -1826,8 +1826,8 @@ void SdrOle2Obj::ImpSetVisAreaSize() { // The object isn't active and does not want to resize itself so the changed object area size // will be reflected in a changed object scaling - Fraction aScaleWidth; - Fraction aScaleHeight; + boost::rational<long> aScaleWidth; + boost::rational<long> aScaleHeight; Size aObjAreaSize; if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) ) { @@ -1865,7 +1865,7 @@ void SdrOle2Obj::ImpSetVisAreaSize() -void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrOle2Obj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { if( pModel && !pModel->isLocked() ) { @@ -2211,7 +2211,7 @@ uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const } -bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize ) +bool SdrOle2Obj::CalculateNewScaling( boost::rational<long>& aScaleWidth, boost::rational<long>& aScaleHeight, Size& aObjAreaSize ) { // TODO/LEAN: to avoid rounding errors scaling always uses the VisArea. // If we don't cache it for own objects also we must load the object here @@ -2222,8 +2222,8 @@ bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHei aObjAreaSize = mpImpl->mxObjRef.GetSize( &aMapMode ); Size aSize = aRect.GetSize(); - aScaleWidth = Fraction(aSize.Width(), aObjAreaSize.Width() ); - aScaleHeight = Fraction(aSize.Height(), aObjAreaSize.Height() ); + aScaleWidth = boost::rational<long>(aSize.Width(), aObjAreaSize.Width() ); + aScaleHeight = boost::rational<long>(aSize.Height(), aObjAreaSize.Height() ); // reduce to 10 binary digits Kuerzen(aScaleHeight, 10); @@ -2243,8 +2243,8 @@ bool SdrOle2Obj::AddOwnLightClient() if ( mpImpl->mxObjRef.is() && mpImpl->pLightClient ) { - Fraction aScaleWidth; - Fraction aScaleHeight; + boost::rational<long> aScaleWidth; + boost::rational<long> aScaleHeight; Size aObjAreaSize; if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) ) { diff --git a/svx/source/svdraw/svdoopengl.cxx b/svx/source/svdraw/svdoopengl.cxx index 1b3398359c83..b1e8e8f0e945 100644 --- a/svx/source/svdraw/svdoopengl.cxx +++ b/svx/source/svdraw/svdoopengl.cxx @@ -35,7 +35,7 @@ sdr::contact::ViewContact* SdrOpenGLObj::CreateObjectSpecificViewContact() } -void SdrOpenGLObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrOpenGLObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { SdrObject::NbcResize(rRef, xFact, yFact); diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 702493ea69c9..7a20ab068ce2 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2352,11 +2352,11 @@ void SdrPathObj::NbcMove(const Size& rSiz) SdrTextObj::NbcMove(rSiz); } -void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrPathObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRef.X(), -rRef.Y())); aTrans = basegfx::tools::createScaleTranslateB2DHomMatrix( - double(xFact), double(yFact), rRef.X(), rRef.Y()) * aTrans; + boost::rational_cast<double>(xFact), boost::rational_cast<double>(yFact), rRef.X(), rRef.Y()) * aTrans; maPathPolygon.transform(aTrans); // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) @@ -2454,8 +2454,8 @@ void SdrPathObj::NbcSetSnapRect(const Rectangle& rRect) long nDivY = aOld.Bottom() - aOld.Top(); if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } - Fraction aX(nMulX,nDivX); - Fraction aY(nMulY,nDivY); + boost::rational<long> aX(nMulX,nDivX); + boost::rational<long> aY(nMulY,nDivY); NbcResize(aOld.TopLeft(), aX, aY); NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); } diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index 387f57910cde..75385b40e995 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -494,7 +494,7 @@ void SdrRectObj::NbcMove(const Size& rSiz) SetXPolyDirty(); } -void SdrRectObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrRectObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { SdrTextObj::NbcResize(rRef,xFact,yFact); SetXPolyDirty(); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 011418d57844..bdf85d0e5c69 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -871,7 +871,7 @@ OutlinerParaObject* SdrTextObj::GetEditOutlinerParaObject() const return pPara; } -void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXKorreg) const +void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, boost::rational<long>& rFitXKorreg) const { OutputDevice* pOut = rOutliner.GetRefDevice(); bool bNoStretching(false); @@ -963,7 +963,7 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextS nLoopCount++; Size aSiz(rOutliner.CalcTextSize()); long nXDiff=aSiz.Width()-nWantWdt; - rFitXKorreg=Fraction(nWantWdt,aSiz.Width()); + rFitXKorreg=boost::rational<long>(nWantWdt,aSiz.Width()); if (((nXDiff>=nXTolMi || !bChkX) && nXDiff<=nXTolPl) || nXDiff==nXDiff0) { bNoMoreLoop = true; } else { @@ -1245,7 +1245,7 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( bool bContourFrame, Rectangle& rTextRect, Rectangle& rAnchorRect, Rectangle& rPaintRect, - Fraction& rFitXKorreg ) const + boost::rational<long>& rFitXKorreg ) const { if (!bContourFrame) { @@ -1349,7 +1349,7 @@ void SdrTextObj::UpdateOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaint { Rectangle aTextRect; Rectangle aAnchorRect; - Fraction aFitXKorreg(1,1); + boost::rational<long> aFitXKorreg(1,1); bool bContourFrame=IsContourTextFrame(); @@ -1837,7 +1837,7 @@ GDIMetaFile* SdrTextObj::GetTextScrollMetaFileAndRectangle( Rectangle aTextRect; Rectangle aAnchorRect; Rectangle aPaintRect; - Fraction aFitXKorreg(1,1); + boost::rational<long> aFitXKorreg(1,1); bool bContourFrame(IsContourTextFrame()); // get outliner set up. To avoid getting a somehow rotated MetaFile, diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx index dd00cee48de7..d7d563157c8d 100644 --- a/svx/source/svdraw/svdotxdr.cxx +++ b/svx/source/svdraw/svdotxdr.cxx @@ -104,12 +104,12 @@ Rectangle SdrTextObj::ImpDragCalcRect(const SdrDragStat& rDrag) const nYMul=std::abs(nYMul); nXDiv=std::abs(nXDiv); nYDiv=std::abs(nYDiv); - Fraction aXFact(nXMul,nXDiv); // fractions for canceling - Fraction aYFact(nYMul,nYDiv); // and for comparing - nXMul=aXFact.GetNumerator(); - nYMul=aYFact.GetNumerator(); - nXDiv=aXFact.GetDenominator(); - nYDiv=aYFact.GetDenominator(); + boost::rational<long> aXFact(nXMul,nXDiv); // fractions for canceling + boost::rational<long> aYFact(nYMul,nYDiv); // and for comparing + nXMul=aXFact.numerator(); + nYMul=aYFact.numerator(); + nXDiv=aXFact.denominator(); + nYDiv=aYFact.denominator(); if (bEcke) { // corner point handles bool bUseX=(aXFact<aYFact) != bBigOrtho; if (bUseX) { diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx index 4c7754ed074d..1f5693854f57 100644 --- a/svx/source/svdraw/svdotxed.cxx +++ b/svx/source/svdraw/svdotxed.cxx @@ -95,7 +95,7 @@ bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl) Rectangle aTextRect; TakeTextRect(rOutl, aTextRect, false, &aAnchorRect); - Fraction aFitXKorreg(1,1); + boost::rational<long> aFitXKorreg(1,1); ImpSetCharStretching(rOutl,aTextRect.GetSize(),aAnchorRect.GetSize(),aFitXKorreg); } else if (IsAutoFit()) diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx index e4da47df32eb..b627d591fbed 100644 --- a/svx/source/svdraw/svdotxtr.cxx +++ b/svx/source/svdraw/svdotxtr.cxx @@ -48,7 +48,7 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect) long nHgt0=aSR0.Bottom()-aSR0.Top(); long nWdt1=rRect.Right()-rRect.Left(); long nHgt1=rRect.Bottom()-rRect.Top(); - SdrTextObj::NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0)); + SdrTextObj::NbcResize(maSnapRect.TopLeft(),boost::rational<long>(nWdt1,nWdt0),boost::rational<long>(nHgt1,nHgt0)); SdrTextObj::NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top())); } else { long nHDist=GetTextLeftDistance()+GetTextRightDistance(); @@ -118,7 +118,7 @@ void SdrTextObj::NbcMove(const Size& rSiz) SetRectsDirty(true); } -void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrTextObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { bool bNoShearMerk=aGeo.nShearWink==0; bool bRota90Merk=bNoShearMerk && aGeo.nDrehWink % 9000 ==0; @@ -126,8 +126,8 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract long nVDist=GetTextUpperDistance()+GetTextLowerDistance(); long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0; long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0; - bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); - bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); + bool bXMirr = xFact.numerator() < 0; + bool bYMirr = yFact.numerator() < 0; if (bXMirr || bYMirr) { Point aRef1(GetSnapRect().Center()); if (bXMirr) { diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index 3c5f21ede3c0..eceb1f3f9844 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -320,7 +320,7 @@ SdrUnoObj& SdrUnoObj::operator= (const SdrUnoObj& rObj) return *this; } -void SdrUnoObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrUnoObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { SdrRectObj::NbcResize(rRef,xFact,yFact); diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 122e8a59477c..ae99c80b2e5c 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -355,7 +355,7 @@ void SdrVirtObj::NbcMove(const Size& rSiz) SetRectsDirty(); } -void SdrVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrVirtObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { rRefObj.NbcResize(rRef-aAnchor,xFact,yFact); SetRectsDirty(); @@ -392,9 +392,9 @@ void SdrVirtObj::Move(const Size& rSiz) } } -void SdrVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative) +void SdrVirtObj::Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative) { - if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) { + if (xFact.numerator()!=xFact.denominator() || yFact.numerator()!=yFact.denominator()) { Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); rRefObj.Resize(rRef-aAnchor,xFact,yFact, bUnsetRelative); SetRectsDirty(); diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 4eb1b6d1981c..e7a713ec74f5 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -1149,11 +1149,11 @@ void SdrPaintView::MakeVisible(const Rectangle& rRect, vcl::Window& rWin) { bNewScale=true; // set new MapMode (Size+Org) and invalidate everything - Fraction aXFact(aNewSize.Width(),aActualSize.Width()); - Fraction aYFact(aNewSize.Height(),aActualSize.Height()); + boost::rational<long> aXFact(aNewSize.Width(),aActualSize.Width()); + boost::rational<long> aYFact(aNewSize.Height(),aActualSize.Height()); if (aYFact>aXFact) aXFact=aYFact; aXFact*=aMap.GetScaleX(); - aXFact.ReduceInaccurate(10); // to avoid runovers and BigInt mapping + rational_ReduceInaccurate(aXFact, 10); // to avoid runovers and BigInt mapping aMap.SetScaleX(aXFact); aMap.SetScaleY(aYFact); rWin.SetMapMode(aMap); diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx index 2d9394db6b2c..8ee050116a7c 100644 --- a/svx/source/svdraw/svdpoev.cxx +++ b/svx/source/svdraw/svdpoev.cxx @@ -672,12 +672,12 @@ void SdrPolyEditView::MoveMarkedPoints(const Size& rSiz) static void ImpResize(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* p2, const void* p3, const void* /*p4*/, const void* /*p5*/) { - ResizePoint(rPt,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3); - if (pC1!=NULL) ResizePoint(*pC1,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3); - if (pC2!=NULL) ResizePoint(*pC2,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3); + ResizePoint(rPt,*(const Point*)p1,*(const boost::rational<long>*)p2,*(const boost::rational<long>*)p3); + if (pC1!=NULL) ResizePoint(*pC1,*(const Point*)p1,*(const boost::rational<long>*)p2,*(const boost::rational<long>*)p3); + if (pC2!=NULL) ResizePoint(*pC2,*(const Point*)p1,*(const boost::rational<long>*)p2,*(const boost::rational<long>*)p3); } -void SdrPolyEditView::ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrPolyEditView::ResizeMarkedPoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { ForceUndirtyMrkPnt(); OUString aStr(ImpGetResStr(STR_EditResize)); diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx index 00a61b109137..c80176c79725 100644 --- a/svx/source/svdraw/svdsnpv.cxx +++ b/svx/source/svdraw/svdsnpv.cxx @@ -393,7 +393,7 @@ sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const } if(bGridSnap) { - double fSnapWidth = aSnapWdtX; + double fSnapWidth = boost::rational_cast<double>(aSnapWdtX); if(dx == NOT_SNAPPED && fSnapWidth != 0.0) { double fx = (double)x; @@ -408,7 +408,7 @@ sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const x = (long)((double)x * fSnapWidth + (double)pPV->GetPageOrigin().X()); dx = 0; } - fSnapWidth = aSnapWdtY; + fSnapWidth = boost::rational_cast<double>(aSnapWdtY); if(dy == NOT_SNAPPED && fSnapWidth) { double fy = (double)y; diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx index ed99ae31008f..acd1546b1cad 100644 --- a/svx/source/svdraw/svdtext.cxx +++ b/svx/source/svdraw/svdtext.cxx @@ -153,12 +153,12 @@ void SdrText::SetModel( SdrModel* pNewModel ) mpOutlinerParaObject=0; if (bScaleUnitChanged) { - Fraction aMetricFactor=GetMapFactor(aOldUnit,aNewUnit).X(); + boost::rational<long> aMetricFactor=GetMapFactor(aOldUnit,aNewUnit).X(); if (bSetHgtItem) { // Now correct the frame attribute - nOldFontHgt=BigMulDiv(nOldFontHgt,aMetricFactor.GetNumerator(),aMetricFactor.GetDenominator()); + nOldFontHgt=BigMulDiv(nOldFontHgt,aMetricFactor.numerator(),aMetricFactor.denominator()); SetObjectItem(SvxFontHeightItem(nOldFontHgt, 100, EE_CHAR_FONTHEIGHT)); } } diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx index 10ea4007a055..442f3e71d532 100644 --- a/svx/source/svdraw/svdtrans.cxx +++ b/svx/source/svdraw/svdtrans.cxx @@ -32,46 +32,20 @@ void MoveXPoly(XPolygon& rPoly, const Size& S) rPoly.Move(S.Width(),S.Height()); } -void ResizeRect(Rectangle& rRect, const Point& rRef, const Fraction& rxFact, const Fraction& ryFact, bool bNoJustify) +void ResizeRect(Rectangle& rRect, const Point& rRef, const boost::rational<long>& rxFact, const boost::rational<long>& ryFact, bool bNoJustify) { - Fraction xFact(rxFact); - Fraction yFact(ryFact); + boost::rational<long> xFact(rxFact); + boost::rational<long> yFact(ryFact); - { - if (xFact.GetDenominator()==0) { - long nWdt=rRect.Right()-rRect.Left(); - if (xFact.GetNumerator()>=0) { // catch divisions by zero - xFact=Fraction(xFact.GetNumerator(),1); - if (nWdt==0) rRect.Right()++; - } else { - xFact=Fraction(xFact.GetNumerator(),-1); - if (nWdt==0) rRect.Left()--; - } - } - rRect.Left() =rRef.X()+Round(((double)(rRect.Left() -rRef.X())*xFact.GetNumerator())/xFact.GetDenominator()); - rRect.Right() =rRef.X()+Round(((double)(rRect.Right() -rRef.X())*xFact.GetNumerator())/xFact.GetDenominator()); - } - { - if (yFact.GetDenominator()==0) { - long nHgt=rRect.Bottom()-rRect.Top(); - if (yFact.GetNumerator()>=0) { // catch divisions by zero - yFact=Fraction(yFact.GetNumerator(),1); - if (nHgt==0) rRect.Bottom()++; - } else { - yFact=Fraction(yFact.GetNumerator(),-1); - if (nHgt==0) rRect.Top()--; - } - - yFact=Fraction(yFact.GetNumerator(),1); // catch divisions by zero - } - rRect.Top() =rRef.Y()+Round(((double)(rRect.Top() -rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator()); - rRect.Bottom()=rRef.Y()+Round(((double)(rRect.Bottom()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator()); - } + rRect.Left() =rRef.X()+Round(((double)(rRect.Left() -rRef.X())*xFact.numerator())/xFact.denominator()); + rRect.Right() =rRef.X()+Round(((double)(rRect.Right() -rRef.X())*xFact.numerator())/xFact.denominator()); + rRect.Top() =rRef.Y()+Round(((double)(rRect.Top() -rRef.Y())*yFact.numerator())/yFact.denominator()); + rRect.Bottom()=rRef.Y()+Round(((double)(rRect.Bottom()-rRef.Y())*yFact.numerator())/yFact.denominator()); if (!bNoJustify) rRect.Justify(); } -void ResizePoly(Polygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void ResizePoly(Polygon& rPoly, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { sal_uInt16 nAnz=rPoly.GetSize(); for (sal_uInt16 i=0; i<nAnz; i++) { @@ -79,7 +53,7 @@ void ResizePoly(Polygon& rPoly, const Point& rRef, const Fraction& xFact, const } } -void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { sal_uInt16 nAnz=rPoly.GetPointCount(); for (sal_uInt16 i=0; i<nAnz; i++) { @@ -596,10 +570,10 @@ long BigMulDiv(long nVal, long nMul, long nDiv) return 0x7fffffff; } -void Kuerzen(Fraction& rF, unsigned nDigits) +void Kuerzen(boost::rational<long>& rF, unsigned nDigits) { - sal_Int32 nMul=rF.GetNumerator(); - sal_Int32 nDiv=rF.GetDenominator(); + sal_Int32 nMul=rF.numerator(); + sal_Int32 nDiv=rF.denominator(); bool bNeg = false; if (nMul<0) { nMul=-nMul; bNeg=!bNeg; } if (nDiv<0) { nDiv=-nDiv; bNeg=!bNeg; } @@ -625,7 +599,7 @@ void Kuerzen(Fraction& rF, unsigned nDigits) return; } if (bNeg) nMul=-nMul; - rF=Fraction(nMul,nDiv); + rF=boost::rational<long>(nMul,nDiv); } @@ -661,7 +635,7 @@ FrPair GetInchOrMM(MapUnit eU) } default: break; } - return Fraction(1,1); + return boost::rational<long>(1,1); } FrPair GetInchOrMM(FieldUnit eU) @@ -680,7 +654,7 @@ FrPair GetInchOrMM(FieldUnit eU) case FUNIT_MILE : return FrPair( 1,63360); default: break; } - return Fraction(1,1); + return boost::rational<long>(1,1); } // Calculate the factor that we need to convert units from eS to eD. @@ -694,8 +668,8 @@ FrPair GetMapFactor(MapUnit eS, MapUnit eD) bool bSInch=IsInch(eS); bool bDInch=IsInch(eD); FrPair aRet(aD.X()/aS.X(),aD.Y()/aS.Y()); - if (bSInch && !bDInch) { aRet.X()*=Fraction(127,5); aRet.Y()*=Fraction(127,5); } - if (!bSInch && bDInch) { aRet.X()*=Fraction(5,127); aRet.Y()*=Fraction(5,127); } + if (bSInch && !bDInch) { aRet.X()*=boost::rational<long>(127,5); aRet.Y()*=boost::rational<long>(127,5); } + if (!bSInch && bDInch) { aRet.X()*=boost::rational<long>(5,127); aRet.Y()*=boost::rational<long>(5,127); } return aRet; }; @@ -707,8 +681,8 @@ FrPair GetMapFactor(FieldUnit eS, FieldUnit eD) bool bSInch=IsInch(eS); bool bDInch=IsInch(eD); FrPair aRet(aD.X()/aS.X(),aD.Y()/aS.Y()); - if (bSInch && !bDInch) { aRet.X()*=Fraction(127,5); aRet.Y()*=Fraction(127,5); } - if (!bSInch && bDInch) { aRet.X()*=Fraction(5,127); aRet.Y()*=Fraction(5,127); } + if (bSInch && !bDInch) { aRet.X()*=boost::rational<long>(127,5); aRet.Y()*=boost::rational<long>(127,5); } + if (!bSInch && bDInch) { aRet.X()*=boost::rational<long>(5,127); aRet.Y()*=boost::rational<long>(5,127); } return aRet; }; @@ -789,7 +763,7 @@ void GetMeterOrInch(FieldUnit eFU, short& rnKomma, long& rnMul, long& rnDiv, boo void SdrFormatter::Undirty() { - if (aScale.GetNumerator()==0 || aScale.GetDenominator()==0) aScale=Fraction(1,1); + if (aScale.numerator()==0) aScale=boost::rational<long>(1,1); bool bSrcMetr,bSrcInch,bDstMetr,bDstInch; long nMul1,nDiv1,nMul2,nDiv2; short nKomma1,nKomma2; @@ -818,9 +792,9 @@ void SdrFormatter::Undirty() } // temporary fraction for canceling - Fraction aTempFract(nMul1,nDiv1); - nMul1=aTempFract.GetNumerator(); - nDiv1=aTempFract.GetDenominator(); + boost::rational<long> aTempFract(nMul1,nDiv1); + nMul1=aTempFract.numerator(); + nDiv1=aTempFract.denominator(); nMul_=nMul1; nDiv_=nDiv1; diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index 981659fb2bc4..e3a50cd0135e 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -478,8 +478,8 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co // account for FitToSize bool bFitToSize(pTextObj->IsFitToSize()); if (bFitToSize) { - Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1); - Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1); + boost::rational<long> aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1); + boost::rational<long> aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1); ResizePoint(aTemporaryTextRelativePosition,Point(),aX,aY); } // account for rotation diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index fc4e732e4851..1b070a17f1f2 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -160,7 +160,7 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList* pObj->FitFrameToTextSize(); Size aSiz(pObj->GetLogicRect().GetSize()); MapUnit eMap=pMod->GetScaleUnit(); - Fraction aMap=pMod->GetScaleFraction(); + boost::rational<long> aMap=pMod->GetScaleFraction(); ImpPasteObject(pObj,*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions); return true; } @@ -197,7 +197,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, const OUString& rBaseURL, sal_uInt pObj->FitFrameToTextSize(); Size aSiz(pObj->GetLogicRect().GetSize()); MapUnit eMap=pMod->GetScaleUnit(); - Fraction aMap=pMod->GetScaleFraction(); + boost::rational<long> aMap=pMod->GetScaleFraction(); ImpPasteObject(pObj,*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions); // b4967543 @@ -267,7 +267,7 @@ bool SdrExchangeView::Paste( MapUnit eSrcUnit=pSrcMod->GetScaleUnit(); MapUnit eDstUnit=pMod->GetScaleUnit(); bool bResize=eSrcUnit!=eDstUnit; - Fraction xResize,yResize; + boost::rational<long> xResize,yResize; Point aPt0; if (bResize) { @@ -403,19 +403,19 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po MapUnit eSrcMU=rMap.GetMapUnit(); MapUnit eDstMU=pMod->GetScaleUnit(); FrPair aMapFact(GetMapFactor(eSrcMU,eDstMU)); - Fraction aDstFr(pMod->GetScaleFraction()); - nSizX*=aMapFact.X().GetNumerator(); - nSizX*=rMap.GetScaleX().GetNumerator(); - nSizX*=aDstFr.GetDenominator(); - nSizX/=aMapFact.X().GetDenominator(); - nSizX/=rMap.GetScaleX().GetDenominator(); - nSizX/=aDstFr.GetNumerator(); - nSizY*=aMapFact.Y().GetNumerator(); - nSizY*=rMap.GetScaleY().GetNumerator(); - nSizX*=aDstFr.GetDenominator(); - nSizY/=aMapFact.Y().GetDenominator(); - nSizY/=rMap.GetScaleY().GetDenominator(); - nSizY/=aDstFr.GetNumerator(); + boost::rational<long> aDstFr(pMod->GetScaleFraction()); + nSizX*=aMapFact.X().numerator(); + nSizX*=rMap.GetScaleX().numerator(); + nSizX*=aDstFr.denominator(); + nSizX/=aMapFact.X().denominator(); + nSizX/=rMap.GetScaleX().denominator(); + nSizX/=aDstFr.numerator(); + nSizY*=aMapFact.Y().numerator(); + nSizY*=rMap.GetScaleY().numerator(); + nSizX*=aDstFr.denominator(); + nSizY/=aMapFact.Y().denominator(); + nSizY/=rMap.GetScaleY().denominator(); + nSizY/=aDstFr.numerator(); long xs=nSizX; long ys=nSizY; Point aPos(rCenter.X()-xs/2,rCenter.Y()-ys/2); diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 95dd3e673ad3..fb66230a3d00 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1965,7 +1965,7 @@ void SdrTableObj::NbcMove(const Size& rSiz) -void SdrTableObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrTableObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) { Rectangle aOldRect( maLogicRect ); ResizeRect(maLogicRect,rRef,xFact,yFact); diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 6e9ab225d123..6155adc4913a 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -111,8 +111,8 @@ namespace { Sequence< PropertyValue > maFilterData; - Fraction maScaleX; - Fraction maScaleY; + boost::rational<long> maScaleX; + boost::rational<long> maScaleY; ExportSettings( SdrModel* pDoc ); }; @@ -407,7 +407,7 @@ VirtualDevice* GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWid // use scaling? if( nWidthPixel ) { - const Fraction aFrac( (long) nWidthPixel, pVDev->LogicToPixel( aPageSize, aMM ).Width() ); + const boost::rational<long> aFrac( (long) nWidthPixel, pVDev->LogicToPixel( aPageSize, aMM ).Width() ); aMM.SetScaleX( aFrac ); @@ -417,7 +417,7 @@ VirtualDevice* GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWid if( nHeightPixel ) { - const Fraction aFrac( (long) nHeightPixel, pVDev->LogicToPixel( aPageSize, aMM ).Height() ); + const boost::rational<long> aFrac( (long) nHeightPixel, pVDev->LogicToPixel( aPageSize, aMM ).Height() ); if( nWidthPixel == 0 ) aMM.SetScaleX( aFrac ); @@ -577,25 +577,25 @@ void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& aDescripto { sal_Int32 nVal = 1; if( pDataValues->Value >>= nVal ) - rSettings.maScaleX = Fraction( nVal, rSettings.maScaleX.GetDenominator() ); + rSettings.maScaleX = boost::rational<long>( nVal, rSettings.maScaleX.denominator() ); } else if ( pDataValues->Name == "ScaleXDenominator" ) { sal_Int32 nVal = 1; if( pDataValues->Value >>= nVal ) - rSettings.maScaleX = Fraction( rSettings.maScaleX.GetNumerator(), nVal ); + rSettings.maScaleX = boost::rational<long>( rSettings.maScaleX.numerator(), nVal ); } else if ( pDataValues->Name == "ScaleYNumerator" ) { sal_Int32 nVal = 1; if( pDataValues->Value >>= nVal ) - rSettings.maScaleY = Fraction( nVal, rSettings.maScaleY.GetDenominator() ); + rSettings.maScaleY = boost::rational<long>( nVal, rSettings.maScaleY.denominator() ); } else if ( pDataValues->Name == "ScaleYDenominator" ) { sal_Int32 nVal = 1; if( pDataValues->Value >>= nVal ) - rSettings.maScaleY = Fraction( rSettings.maScaleY.GetNumerator(), nVal ); + rSettings.maScaleY = boost::rational<long>( rSettings.maScaleY.numerator(), nVal ); } pDataValues++; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 5c283429e435..c3d17a585557 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1219,8 +1219,8 @@ void SAL_CALL SvxShape::setSize( const awt::Size& rSize ) if(mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_MEASURE ) { - Fraction aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left()); - Fraction aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top()); + boost::rational<long> aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left()); + boost::rational<long> aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top()); Point aPt = mpObj->GetSnapRect().TopLeft(); mpObj->Resize(aPt,aWdt,aHgt); } |