From 31af61ea091cc895b893c849f2130aa35792b7db Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Thu, 23 Oct 2014 17:41:47 +0200 Subject: Fraction: Revert "fdo#81356: convert Fraction to boost::rational - wip" This reverts commit 47a2d7642d249d70b5da0c330a73f3a0032e4bba. Conflicts: cui/source/tabpages/transfrm.cxx svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdibrow.cxx sw/source/filter/ww1/w1filter.cxx tools/source/generic/rational.cxx Change-Id: I4849916f5f277a4afef0e279b0135c76b36b9d15 --- sfx2/source/doc/objembed.cxx | 8 ++++---- sfx2/source/view/ipclient.cxx | 40 ++++++++++++++++++++-------------------- sfx2/source/view/viewfrm2.cxx | 2 +- sfx2/source/view/viewsh.cxx | 4 ++-- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx index d491b702f9d4..1ce7b6717fdb 100644 --- a/sfx2/source/doc/objembed.cxx +++ b/sfx2/source/doc/objembed.cxx @@ -180,8 +180,8 @@ void SfxObjectShell::DoDraw( OutputDevice* pDev, aSize = pDev->LogicToLogic( aSize, &aWilliMode, &aMod ); if( aSize.Width() && aSize.Height() ) { - boost::rational aXF( rSize.Width(), aSize.Width() ); - boost::rational aYF( rSize.Height(), aSize.Height() ); + Fraction aXF( rSize.Width(), aSize.Width() ); + Fraction aYF( rSize.Height(), aSize.Height() ); DoDraw_Impl( pDev, rObjPos, aXF, aYF, rSetup, nAspect ); } @@ -190,8 +190,8 @@ void SfxObjectShell::DoDraw( OutputDevice* pDev, void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev, const Point & rViewPos, - const boost::rational& rScaleX, - const boost::rational& rScaleY, + const Fraction & rScaleX, + const Fraction & rScaleY, const JobSetup & rSetup, sal_uInt16 nAspect ) { diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index ea49352d9f11..ef03157900e2 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include #include @@ -99,8 +99,8 @@ class SfxInPlaceClient_Impl : public ::cppu::WeakImplHelper5< embed::XEmbeddedCl public: Timer m_aTimer; // activation timeout, starts after object connection Rectangle m_aObjArea; // area of object in coordinate system of the container (without scaling) - boost::rational m_aScaleWidth; // scaling that was applied to the object when it was not active - boost::rational m_aScaleHeight; + Fraction m_aScaleWidth; // scaling that was applied to the object when it was not active + Fraction m_aScaleHeight; SfxInPlaceClient* m_pClient; sal_Int64 m_nAspect; // ViewAspect that is assigned from the container Rectangle m_aLastObjAreaPixel; // area of object in coordinate system of the container (without scaling) @@ -427,8 +427,8 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getPlacement() // apply scaling to object area and convert to pixels Rectangle aRealObjArea( m_aObjArea ); - aRealObjArea.SetSize( Size( boost::rational_cast( aRealObjArea.GetWidth() * m_aScaleWidth ), - boost::rational_cast( aRealObjArea.GetHeight() * m_aScaleHeight ) ) ); + aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_aScaleWidth, + Fraction( aRealObjArea.GetHeight() ) * m_aScaleHeight ) ); aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea ); return AWTRectangle( aRealObjArea ); @@ -444,8 +444,8 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getClipRectangle() // currently(?) same as placement Rectangle aRealObjArea( m_aObjArea ); - aRealObjArea.SetSize( Size( boost::rational_cast( aRealObjArea.GetWidth() * m_aScaleWidth ), - boost::rational_cast( aRealObjArea.GetHeight() * m_aScaleHeight ) ) ); + aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_aScaleWidth, + Fraction( aRealObjArea.GetHeight() ) * m_aScaleHeight ) ); aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea ); return AWTRectangle( aRealObjArea ); @@ -507,8 +507,8 @@ void SAL_CALL SfxInPlaceClient_Impl::changedPlacement( const awt::Rectangle& aPo SfxBooleanFlagGuard aGuard( m_bResizeNoScale, true ); // new size of the object area without scaling - Size aNewObjSize( boost::rational_cast( aNewLogicRect.GetWidth() / m_aScaleWidth ), - boost::rational_cast( aNewLogicRect.GetHeight() / m_aScaleHeight ) ); + Size aNewObjSize( Fraction( aNewLogicRect.GetWidth() ) / m_aScaleWidth, + Fraction( aNewLogicRect.GetHeight() ) / m_aScaleHeight ); // now remove scaling from new placement and keep this a the new object area aNewLogicRect.SetSize( aNewObjSize ); @@ -615,7 +615,7 @@ SfxInPlaceClient::SfxInPlaceClient( SfxViewShell* pViewShell, vcl::Window *pDraw m_pImp->acquire(); m_pImp->m_pClient = this; m_pImp->m_nAspect = nAspect; - m_pImp->m_aScaleWidth = m_pImp->m_aScaleHeight = boost::rational(1); + m_pImp->m_aScaleWidth = m_pImp->m_aScaleHeight = Fraction(1,1); m_pImp->m_xClient = static_cast< embed::XEmbeddedClient* >( m_pImp ); pViewShell->NewIPClient_Impl(this); m_pImp->m_aTimer.SetTimeout( SFX_CLIENTACTIVATE_TIMEOUT ); @@ -754,13 +754,13 @@ Rectangle SfxInPlaceClient::GetObjArea() const Rectangle SfxInPlaceClient::GetScaledObjArea() const { Rectangle aRealObjArea( m_pImp->m_aObjArea ); - aRealObjArea.SetSize( Size( boost::rational_cast( aRealObjArea.GetWidth() * m_pImp->m_aScaleWidth ), - boost::rational_cast( aRealObjArea.GetHeight() * m_pImp->m_aScaleHeight ) ) ); + aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_pImp->m_aScaleWidth, + Fraction( aRealObjArea.GetHeight() ) * m_pImp->m_aScaleHeight ) ); return aRealObjArea; } -void SfxInPlaceClient::SetSizeScale( const boost::rational& rScaleWidth, const boost::rational& rScaleHeight ) +void SfxInPlaceClient::SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight ) { if ( m_pImp->m_aScaleWidth != rScaleWidth || m_pImp->m_aScaleHeight != rScaleHeight ) { @@ -776,7 +776,7 @@ void SfxInPlaceClient::SetSizeScale( const boost::rational& rScaleWidth, c } -bool SfxInPlaceClient::SetObjAreaAndScale( const Rectangle& rArea, const boost::rational& rScaleWidth, const boost::rational& rScaleHeight ) +bool SfxInPlaceClient::SetObjAreaAndScale( const Rectangle& rArea, const Fraction& rScaleWidth, const Fraction& rScaleHeight ) { if( rArea != m_pImp->m_aObjArea || m_pImp->m_aScaleWidth != rScaleWidth || m_pImp->m_aScaleHeight != rScaleHeight ) { @@ -794,13 +794,13 @@ bool SfxInPlaceClient::SetObjAreaAndScale( const Rectangle& rArea, const boost:: } -const boost::rational& SfxInPlaceClient::GetScaleWidth() const +const Fraction& SfxInPlaceClient::GetScaleWidth() const { return m_pImp->m_aScaleWidth; } -const boost::rational& SfxInPlaceClient::GetScaleHeight() const +const Fraction& SfxInPlaceClient::GetScaleHeight() const { return m_pImp->m_aScaleHeight; } @@ -812,8 +812,8 @@ void SfxInPlaceClient::Invalidate() // the object area is provided in logical coordinates of the window but without scaling applied Rectangle aRealObjArea( m_pImp->m_aObjArea ); - aRealObjArea.SetSize( Size( boost::rational_cast( aRealObjArea.GetWidth() * m_pImp->m_aScaleWidth ), - boost::rational_cast( aRealObjArea.GetHeight() * m_pImp->m_aScaleHeight ) ) ); + aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_pImp->m_aScaleWidth, + Fraction( aRealObjArea.GetHeight() ) * m_pImp->m_aScaleHeight ) ); m_pEditWin->Invalidate( aRealObjArea ); ViewChanged(); @@ -955,8 +955,8 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) Rectangle aScaledArea = GetScaledObjArea(); m_pImp->m_aObjArea.SetSize( aNewSize ); - m_pImp->m_aScaleWidth = boost::rational( aScaledArea.GetWidth(), aNewSize.Width() ); - m_pImp->m_aScaleHeight = boost::rational( aScaledArea.GetHeight(), aNewSize.Height() ); + m_pImp->m_aScaleWidth = Fraction( aScaledArea.GetWidth(), aNewSize.Width() ); + m_pImp->m_aScaleHeight = Fraction( aScaledArea.GetHeight(), aNewSize.Height() ); } } catch (uno::Exception const& e) diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx index cd9f43c1494b..cad0bcda3814 100644 --- a/sfx2/source/view/viewfrm2.cxx +++ b/sfx2/source/view/viewfrm2.cxx @@ -385,7 +385,7 @@ void SfxViewFrame::INetState_Impl( SfxItemSet &rItemSet ) rItemSet.DisableItem( SID_CREATELINK ); } -void SfxViewFrame::SetZoomFactor( const boost::rational& rZoomX, const boost::rational& rZoomY ) +void SfxViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) { GetViewShell()->SetZoomFactor( rZoomX, rZoomY ); } diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 4eb4d4b375ee..479a458b6a4f 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -853,8 +853,8 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) -void SfxViewShell::SetZoomFactor( const boost::rational& rZoomX, - const boost::rational& rZoomY ) +void SfxViewShell::SetZoomFactor( const Fraction &rZoomX, + const Fraction &rZoomY ) { DBG_ASSERT( GetWindow(), "no window" ); MapMode aMap( GetWindow()->GetMapMode() ); -- cgit