diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-13 10:20:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-13 15:46:47 +0200 |
commit | 1b1afc10f4d90e37c5e81961b8b8902133e65b00 (patch) | |
tree | fb6f68d743b334b8df4fc374afe68dc49fd6cbb8 /sfx2 | |
parent | cc233992dfe0fa9732c24774852d037d161546ce (diff) |
Fraction: make conversion operators and constructor explicit
and simplify some of the calculations that needed to be changed.
Which resulted in one unit test needing to change by one pixel,
let's hope not an indication of a real problem.
Change-Id: Ie56434f35f4e58d21ee6f671392e93dc7542fca3
Reviewed-on: https://gerrit.libreoffice.org/42240
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/ipclient.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/view/lokcharthelper.cxx | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 21f5de28970e..f0ec0e2e7f48 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -393,8 +393,8 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getPlacement() // apply scaling to object area and convert to pixels tools::Rectangle aRealObjArea( m_aObjArea ); - aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_aScaleWidth, - Fraction( aRealObjArea.GetHeight() ) * m_aScaleHeight ) ); + aRealObjArea.SetSize( Size( long( aRealObjArea.GetWidth() * m_aScaleWidth), + long( aRealObjArea.GetHeight() * m_aScaleHeight) ) ); // In Writer and Impress the map mode is disabled. So when a chart is // activated (for in place editing) we get the chart win size in 100th mm @@ -428,8 +428,8 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getClipRectangle() // currently(?) same as placement tools::Rectangle aRealObjArea( m_aObjArea ); - aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_aScaleWidth, - Fraction( aRealObjArea.GetHeight() ) * m_aScaleHeight ) ); + aRealObjArea.SetSize( Size( long( aRealObjArea.GetWidth() * m_aScaleWidth), + long( aRealObjArea.GetHeight() * m_aScaleHeight) ) ); // See comment for SfxInPlaceClient_Impl::getPlacement. if (comphelper::LibreOfficeKit::isActive()) @@ -499,8 +499,8 @@ void SAL_CALL SfxInPlaceClient_Impl::changedPlacement( const awt::Rectangle& aPo SfxBooleanFlagGuard aGuard( m_bResizeNoScale ); // new size of the object area without scaling - Size aNewObjSize( Fraction( aNewLogicRect.GetWidth() ) / m_aScaleWidth, - Fraction( aNewLogicRect.GetHeight() ) / m_aScaleHeight ); + Size aNewObjSize( long( aNewLogicRect.GetWidth() / m_aScaleWidth ), + long( aNewLogicRect.GetHeight() / m_aScaleHeight ) ); // now remove scaling from new placement and keep this a the new object area aNewLogicRect.SetSize( aNewObjSize ); @@ -738,8 +738,8 @@ const tools::Rectangle& SfxInPlaceClient::GetObjArea() const tools::Rectangle SfxInPlaceClient::GetScaledObjArea() const { tools::Rectangle aRealObjArea( m_xImp->m_aObjArea ); - aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_xImp->m_aScaleWidth, - Fraction( aRealObjArea.GetHeight() ) * m_xImp->m_aScaleHeight ) ); + aRealObjArea.SetSize( Size( long( aRealObjArea.GetWidth() * m_xImp->m_aScaleWidth ), + long( aRealObjArea.GetHeight() * m_xImp->m_aScaleHeight ) ) ); return aRealObjArea; } @@ -793,8 +793,8 @@ void SfxInPlaceClient::Invalidate() // the object area is provided in logical coordinates of the window but without scaling applied tools::Rectangle aRealObjArea( m_xImp->m_aObjArea ); - aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_xImp->m_aScaleWidth, - Fraction( aRealObjArea.GetHeight() ) * m_xImp->m_aScaleHeight ) ); + aRealObjArea.SetSize( Size( long( aRealObjArea.GetWidth() * m_xImp->m_aScaleWidth ), + long( aRealObjArea.GetHeight() * m_xImp->m_aScaleHeight ) ) ); m_pEditWin->Invalidate( aRealObjArea ); ViewChanged(); diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx index 65045013ca1d..6181920916c0 100644 --- a/sfx2/source/view/lokcharthelper.cxx +++ b/sfx2/source/view/lokcharthelper.cxx @@ -137,8 +137,8 @@ tools::Rectangle LokChartHelper::GetChartBoundingBox() // In all cases, the following code fragment // returns the chart bounding box in twips. MapMode aCWMapMode = pWindow->GetMapMode(); - double fXScale = aCWMapMode.GetScaleX(); - double fYScale = aCWMapMode.GetScaleY(); + double fXScale( aCWMapMode.GetScaleX() ); + double fYScale( aCWMapMode.GetScaleY() ); Point aOffset = pWindow->GetOffsetPixelFrom(*pRootWin); aOffset.X() *= (TWIPS_PER_PIXEL / fXScale); aOffset.Y() *= (TWIPS_PER_PIXEL / fYScale); |