diff options
34 files changed, 151 insertions, 151 deletions
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx index 1b5ffa817373..c0f9d242610c 100644 --- a/chart2/source/controller/main/ChartWindow.cxx +++ b/chart2/source/controller/main/ChartWindow.cxx @@ -343,8 +343,8 @@ void ChartWindow::LogicInvalidate(const tools::Rectangle* pRectangle) if (pEditWin) { MapMode aCWMapMode = GetMapMode(); - double fXScale = aCWMapMode.GetScaleX(); - double fYScale = aCWMapMode.GetScaleY(); + double fXScale( aCWMapMode.GetScaleX() ); + double fYScale( aCWMapMode.GetScaleY() ); if (!IsMapModeEnabled()) { @@ -410,8 +410,8 @@ tools::Rectangle ChartWindow::GetBoundingBox() // In all cases, the following code fragment // returns the chart bounding box in twips. MapMode aCWMapMode = GetMapMode(); - double fXScale = aCWMapMode.GetScaleX(); - double fYScale = aCWMapMode.GetScaleY(); + double fXScale( aCWMapMode.GetScaleX() ); + double fYScale( aCWMapMode.GetScaleY() ); Point aOffset = GetOffsetPixelFrom(*pRootWin); aOffset.X() *= (TWIPS_PER_PIXEL / fXScale); aOffset.Y() *= (TWIPS_PER_PIXEL / fYScale); diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index fd024e1295fc..71221cacd3b9 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -487,8 +487,7 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs) if( m_pMtrRadius->IsValueChangedFromSaved() ) { Fraction aUIScale = pView->GetModel()->GetUIScale(); - long nTmp = GetCoreValue( *m_pMtrRadius, ePoolUnit ); - nTmp = Fraction( nTmp ) * aUIScale; + long nTmp = long(GetCoreValue( *m_pMtrRadius, ePoolUnit ) * aUIScale); rAttrs->Put( makeSdrEckenradiusItem( nTmp ) ); bModified = true; diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 7f4dd74e9982..6a30a3ffd4fd 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -1141,8 +1141,8 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) Point aOrigin( OutputDevice::LogicToLogic( aPoint, rVDev.GetMapMode(), aMapMode ) ); aOrigin.Y() += aOutSize.Height(); aMapMode.SetOrigin( aOrigin ); - aMapMode.SetScaleX( aOutSize.Width() / ( nBoundingBox[ 2 ] - nBoundingBox[ 0 ] ) ); - aMapMode.SetScaleY( aOutSize.Height() / ( nBoundingBox[ 3 ] - nBoundingBox[ 1 ] ) ); + aMapMode.SetScaleX( Fraction(aOutSize.Width() / ( nBoundingBox[ 2 ] - nBoundingBox[ 0 ] )) ); + aMapMode.SetScaleY( Fraction(aOutSize.Height() / ( nBoundingBox[ 3 ] - nBoundingBox[ 1 ] )) ); ImplWriteLine( "gs" ); ImplGetMapMode( aMapMode ); ImplWriteLine( "%%BeginDocument:" ); diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx index 64e694fb12df..4cde7db061db 100644 --- a/include/tools/fract.hxx +++ b/include/tools/fract.hxx @@ -27,7 +27,7 @@ class SvStream; // This class uses the platform defined type 'long' as valid values but do all // calculations using sal_Int64 with checks for 'long' overflows. -class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Fraction +class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Fraction final { struct Impl; @@ -40,7 +40,7 @@ public: Fraction( const Fraction & rFrac ); Fraction( Fraction && rFrac ); Fraction( long nNum, long nDen ); - Fraction( double dVal ); + explicit Fraction( double dVal ); ~Fraction(); bool IsValid() const; @@ -48,16 +48,21 @@ public: long GetNumerator() const; long GetDenominator() const; - operator long() const; - operator double() const; + explicit operator long() const; + explicit operator double() const; Fraction& operator=( const Fraction& rfrFrac ); Fraction& operator=( Fraction&& rfrFrac ); + Fraction& operator=( double v ) { return operator=(Fraction(v)); } Fraction& operator+=( const Fraction& rfrFrac ); Fraction& operator-=( const Fraction& rfrFrac ); Fraction& operator*=( const Fraction& rfrFrac ); Fraction& operator/=( const Fraction& rfrFrac ); + Fraction& operator+=( double v ) { return operator+=(Fraction(v)); } + Fraction& operator-=( double v ) { return operator-=(Fraction(v)); } + Fraction& operator*=( double v ) { return operator*=(Fraction(v)); } + Fraction& operator/=( double v ) { return operator/=(Fraction(v)); } void ReduceInaccurate( unsigned nSignificantBits ); @@ -85,6 +90,16 @@ TOOLS_DLLPUBLIC bool operator !=( const Fraction& rVal1, const Fraction& rVal2 ) TOOLS_DLLPUBLIC bool operator <=( const Fraction& rVal1, const Fraction& rVal2 ); TOOLS_DLLPUBLIC bool operator >=( const Fraction& rVal1, const Fraction& rVal2 ); +inline Fraction operator+( double v1, const Fraction& rVal2 ) { return Fraction(v1) + rVal2; } +inline Fraction operator-( double v1, const Fraction& rVal2 ) { return Fraction(v1) - rVal2; } +inline Fraction operator*( double v1, const Fraction& rVal2 ) { return Fraction(v1) * rVal2; } +inline Fraction operator/( double v1, const Fraction& rVal2 ) { return Fraction(v1) / rVal2; } + +inline Fraction operator+( const Fraction& rVal1, double v2 ) { return rVal1 + Fraction(v2); } +inline Fraction operator-( const Fraction& rVal1, double v2 ) { return rVal1 - Fraction(v2); } +inline Fraction operator*( const Fraction& rVal1, double v2 ) { return rVal1 * Fraction(v2); } +inline Fraction operator/( const Fraction& rVal1, double v2 ) { return rVal1 / Fraction(v2); } + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/report/EndMarker.cxx b/reportdesign/source/ui/report/EndMarker.cxx index 99580472a49f..57c48e312bb7 100644 --- a/reportdesign/source/ui/report/EndMarker.cxx +++ b/reportdesign/source/ui/report/EndMarker.cxx @@ -46,7 +46,7 @@ void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl { Fraction aCornerSpace(long(CORNER_SPACE)); aCornerSpace *= rRenderContext.GetMapMode().GetScaleX(); - const long nCornerSpace = aCornerSpace; + const long nCornerSpace = long(aCornerSpace); Size aSize = GetSizePixel(); aSize.Width() += nCornerSpace; diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx index 625e17543713..b28de3b9d9c5 100644 --- a/reportdesign/source/ui/report/ReportWindow.cxx +++ b/reportdesign/source/ui/report/ReportWindow.cxx @@ -156,10 +156,9 @@ sal_Int32 OReportWindow::GetTotalWidth() const Fraction aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH )); const Fraction aZoom(m_pView->getController().getZoomValue(),100); aStartWidth *= aZoom; - const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width; - Fraction aPaperWidth(nPaperWidth,1); - aPaperWidth *= aZoom; - const Size aPageSize = LogicToPixel(Size(aPaperWidth,0)); + sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width; + nPaperWidth = long(nPaperWidth * aZoom); + const Size aPageSize = LogicToPixel(Size(nPaperWidth,0)); nWidth = aPageSize.Width() + long(aStartWidth); } return nWidth; diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx index dcf30ca73fad..c342e995eb95 100644 --- a/reportdesign/source/ui/report/SectionWindow.cxx +++ b/reportdesign/source/ui/report/SectionWindow.cxx @@ -229,8 +229,7 @@ void OSectionWindow::Resize() Window::Resize(); Size aOutputSize = GetOutputSizePixel(); - Fraction aEndWidth(long(REPORT_ENDMARKER_WIDTH)); - aEndWidth *= GetMapMode().GetScaleX(); + long nEndWidth = long(REPORT_ENDMARKER_WIDTH * GetMapMode().GetScaleX()); const Point aThumbPos = m_pParent->getView()->getThumbPos(); aOutputSize.Width() -= aThumbPos.X(); @@ -245,19 +244,18 @@ void OSectionWindow::Resize() { const bool bShowEndMarker = m_pParent->getView()->GetTotalWidth() <= (aThumbPos.X() + aOutputSize.Width() ); - Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)); - aStartWidth *= GetMapMode().GetScaleX(); + long nStartWidth = long(REPORT_STARTMARKER_WIDTH * GetMapMode().GetScaleX()); // set start marker - m_aStartMarker->SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height())); + m_aStartMarker->SetPosSizePixel(Point(0,0),Size(nStartWidth,aOutputSize.Height())); // set report section const uno::Reference< report::XSection> xSection = m_aReportSection->getSection(); Size aSectionSize = LogicToPixel( Size( 0,xSection->getHeight() ) ); - Point aReportPos(aStartWidth,0); - aSectionSize.Width() = aOutputSize.Width() - (long)aStartWidth; + Point aReportPos(nStartWidth,0); + aSectionSize.Width() = aOutputSize.Width() - nStartWidth; if ( bShowEndMarker ) - aSectionSize.Width() -= (long)aEndWidth; + aSectionSize.Width() -= nEndWidth; m_aReportSection->SetPosSizePixel(aReportPos,aSectionSize); @@ -265,13 +263,13 @@ void OSectionWindow::Resize() aReportPos.Y() += aSectionSize.Height(); m_aSplitter->SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter->GetSizePixel().Height())); aSectionSize.Height() = (long)(1000 * (double)GetMapMode().GetScaleY()); - m_aSplitter->SetDragRectPixel( tools::Rectangle(Point(aStartWidth,0),aSectionSize)); + m_aSplitter->SetDragRectPixel( tools::Rectangle(Point(nStartWidth,0),aSectionSize)); // set end marker aReportPos.X() += aSectionSize.Width(); aReportPos.Y() = 0; m_aEndMarker->Show(bShowEndMarker); - m_aEndMarker->SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height())); + m_aEndMarker->SetPosSizePixel(aReportPos,Size(nEndWidth,aOutputSize.Height())); } } diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx index 5e38e7a0b47e..dbd7e896411a 100644 --- a/reportdesign/source/ui/report/StartMarker.cxx +++ b/reportdesign/source/ui/report/StartMarker.cxx @@ -233,14 +233,13 @@ void OStartMarker::Resize() aImageSize.Width() = long(aImageSize.Width() * (double)rMapMode.GetScaleX()); aImageSize.Height() = long(aImageSize.Height() * (double)rMapMode.GetScaleY()); - Fraction aExtraWidth(long(REPORT_EXTRA_SPACE)); - aExtraWidth *= rMapMode.GetScaleX(); + long nExtraWidth = long(REPORT_EXTRA_SPACE * rMapMode.GetScaleX()); - Point aPos(aImageSize.Width() + (long)(aExtraWidth + aExtraWidth), aExtraWidth); + Point aPos(aImageSize.Width() + (nExtraWidth * 2), nExtraWidth); const long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText->GetTextHeight())).Height()); m_aText->SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight)); - aPos.X() = aExtraWidth; + aPos.X() = nExtraWidth; aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ; m_aImage->SetPosSizePixel(aPos,aImageSize); } diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index af7c34346a4a..2ec17b1abc7e 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -260,13 +260,12 @@ void OViewsWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan rRenderContext.SetTextFillColor(Application::GetSettings().GetStyleSettings().GetDialogColor()); Size aOut(GetOutputSizePixel()); - Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)); - aStartWidth *= rRenderContext.GetMapMode().GetScaleX(); + long nStartWidth = long(REPORT_STARTMARKER_WIDTH * rRenderContext.GetMapMode().GetScaleX()); - aOut.Width() -= long(aStartWidth); + aOut.Width() -= nStartWidth; aOut = rRenderContext.PixelToLogic(aOut); - tools::Rectangle aRect(rRenderContext.PixelToLogic(Point(aStartWidth,0)), aOut); + tools::Rectangle aRect(rRenderContext.PixelToLogic(Point(nStartWidth,0)), aOut); Wallpaper aWall(m_aColorConfig.GetColorValue(::svtools::APPBACKGROUND).nColor); rRenderContext.DrawWallpaper(aRect, aWall); } @@ -1709,7 +1708,7 @@ void OViewsWindow::zoom(const Fraction& _aZoom) Resize(); Size aOut = GetOutputSizePixel(); - aOut.Width() = aStartWidth; + aOut.Width() = long(aStartWidth); aOut = PixelToLogic(aOut); tools::Rectangle aRect(PixelToLogic(Point(0,0)),aOut); diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx index 241aacbc5a2e..7318d66f5eeb 100644 --- a/sc/source/ui/app/client.cxx +++ b/sc/source/ui/app/client.cxx @@ -212,10 +212,8 @@ void ScClient::ViewChanged() if (pDrawObj) { tools::Rectangle aLogicRect = pDrawObj->GetLogicRect(); - Fraction aFractX = GetScaleWidth(); - Fraction aFractY = GetScaleHeight(); - aFractX *= aVisSize.Width(); - aFractY *= aVisSize.Height(); + Fraction aFractX = GetScaleWidth() * aVisSize.Width(); + Fraction aFractY = GetScaleHeight() * aVisSize.Height(); aVisSize = Size( (long) aFractX, (long) aFractY ); // Scaled for Draw model // pClientData->SetObjArea before pDrawObj->SetLogicRect, so that we don't diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index 69a8e7e6922b..d957d1706aa8 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -127,7 +127,7 @@ void CopyDlg::Reset() // Set Min/Max values ::tools::Rectangle aRect = mpView->GetAllMarkedRect(); Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSize(); - SetMetricValue( *m_pMtrFldMoveX, Fraction(1000000) / maUIScale, MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldMoveX, long(1000000 / maUIScale), MapUnit::Map100thMM); double fScaleFactor = m_pMtrFldMoveX->GetValue()/1000000.0; long nPageWidth = aPageSize.Width() * fScaleFactor; @@ -156,12 +156,12 @@ void CopyDlg::Reset() long nMoveX = 500; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, true, &pPoolItem ) ) nMoveX = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldMoveX, Fraction(nMoveX) / maUIScale, MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldMoveX, long(nMoveX / maUIScale), MapUnit::Map100thMM); long nMoveY = 500; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, true, &pPoolItem ) ) nMoveY = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldMoveY, Fraction(nMoveY) / maUIScale, MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldMoveY, long(nMoveY / maUIScale), MapUnit::Map100thMM); if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) ) m_pMtrFldAngle->SetValue( static_cast<const SfxInt32Item*>( pPoolItem )->GetValue() ); @@ -171,12 +171,12 @@ void CopyDlg::Reset() long nWidth = 0; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, true, &pPoolItem ) ) nWidth = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldWidth, Fraction(nWidth) / maUIScale, MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldWidth, long(nWidth / maUIScale), MapUnit::Map100thMM); long nHeight = 0; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, true, &pPoolItem ) ) nHeight = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldHeight, Fraction(nHeight) / maUIScale, MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldHeight, long(nHeight / maUIScale), MapUnit::Map100thMM); if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) ) { @@ -227,10 +227,10 @@ void CopyDlg::Reset() */ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) { - long nMoveX = Fraction( GetCoreValue( *m_pMtrFldMoveX, MapUnit::Map100thMM) ) * maUIScale; - long nMoveY = Fraction( GetCoreValue( *m_pMtrFldMoveY, MapUnit::Map100thMM) ) * maUIScale; - long nHeight = Fraction( GetCoreValue( *m_pMtrFldHeight, MapUnit::Map100thMM) ) * maUIScale; - long nWidth = Fraction( GetCoreValue( *m_pMtrFldWidth, MapUnit::Map100thMM) ) * maUIScale; + long nMoveX = long( GetCoreValue( *m_pMtrFldMoveX, MapUnit::Map100thMM) * maUIScale); + long nMoveY = long( GetCoreValue( *m_pMtrFldMoveY, MapUnit::Map100thMM) * maUIScale); + long nHeight = long( GetCoreValue( *m_pMtrFldHeight, MapUnit::Map100thMM) * maUIScale); + long nWidth = long( GetCoreValue( *m_pMtrFldWidth, MapUnit::Map100thMM) * maUIScale); rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, (sal_uInt16) m_pNumFldCopies->GetValue() ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) ); @@ -267,10 +267,10 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData, Button*, void) { ::tools::Rectangle aRect = mpView->GetAllMarkedRect(); - SetMetricValue( *m_pMtrFldMoveX, Fraction( aRect.GetWidth() ) / - maUIScale, MapUnit::Map100thMM); - SetMetricValue( *m_pMtrFldMoveY, Fraction( aRect.GetHeight() ) / - maUIScale, MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldMoveX, long( aRect.GetWidth() / + maUIScale ), MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldMoveY, long( aRect.GetHeight() / + maUIScale ), MapUnit::Map100thMM); // sets color attribute const SfxPoolItem* pPoolItem = nullptr; @@ -289,13 +289,13 @@ IMPL_LINK_NOARG(CopyDlg, SetDefault, Button*, void) m_pNumFldCopies->SetValue( 1 ); long nValue = 500; - SetMetricValue( *m_pMtrFldMoveX, Fraction(nValue) / maUIScale, MapUnit::Map100thMM); - SetMetricValue( *m_pMtrFldMoveY, Fraction(nValue) / maUIScale, MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldMoveX, long(nValue / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldMoveY, long(nValue / maUIScale), MapUnit::Map100thMM); nValue = 0; m_pMtrFldAngle->SetValue( nValue ); - SetMetricValue( *m_pMtrFldWidth, Fraction(nValue) / maUIScale, MapUnit::Map100thMM); - SetMetricValue( *m_pMtrFldHeight, Fraction(nValue) / maUIScale, MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldWidth, long(nValue / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_pMtrFldHeight, long(nValue / maUIScale), MapUnit::Map100thMM); // set color attribute const SfxPoolItem* pPoolItem = nullptr; diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx index a46a1f040c11..231a654df18f 100644 --- a/sd/source/ui/dlg/dlgsnap.cxx +++ b/sd/source/ui/dlg/dlgsnap.cxx @@ -78,33 +78,33 @@ SdSnapLineDlg::SdSnapLineDlg( SetMetricValue( *m_pMtrFldX, aLeftTop.X(), ePoolUnit ); long nValue = static_cast<long>(m_pMtrFldX->GetValue()); - nValue = Fraction( nValue ) / aUIScale; + nValue = long( nValue / aUIScale); m_pMtrFldX->SetMin( nValue ); m_pMtrFldX->SetFirst( nValue ); SetMetricValue( *m_pMtrFldX, aRightBottom.X(), ePoolUnit ); nValue = static_cast<long>(m_pMtrFldX->GetValue()); - nValue = Fraction( nValue ) / aUIScale; + nValue = long( nValue / aUIScale); m_pMtrFldX->SetMax( nValue ); m_pMtrFldX->SetLast( nValue ); SetMetricValue( *m_pMtrFldY, aLeftTop.Y(), ePoolUnit ); nValue = static_cast<long>(m_pMtrFldY->GetValue()); - nValue = Fraction( nValue ) / aUIScale; + nValue = long( nValue / aUIScale); m_pMtrFldY->SetMin( nValue ); m_pMtrFldY->SetFirst( nValue ); SetMetricValue( *m_pMtrFldY, aRightBottom.Y(), ePoolUnit ); nValue = static_cast<long>(m_pMtrFldY->GetValue()); - nValue = Fraction( nValue ) / aUIScale; + nValue = long( nValue / aUIScale); m_pMtrFldY->SetMax( nValue ); m_pMtrFldY->SetLast( nValue ); // set values nXValue = static_cast<const SfxInt32Item&>( rInAttrs.Get(ATTR_SNAPLINE_X)).GetValue(); nYValue = static_cast<const SfxInt32Item&>( rInAttrs.Get(ATTR_SNAPLINE_Y)).GetValue(); - nXValue = Fraction(nXValue) / aUIScale; - nYValue = Fraction(nYValue) / aUIScale; + nXValue = long(nXValue / aUIScale); + nYValue = long(nYValue / aUIScale); SetMetricValue( *m_pMtrFldX, nXValue, MapUnit::Map100thMM); SetMetricValue( *m_pMtrFldY, nYValue, MapUnit::Map100thMM); @@ -152,8 +152,8 @@ void SdSnapLineDlg::GetAttr(SfxItemSet& rOutAttrs) else if ( m_pRbVert->IsChecked() ) eKind = SK_VERTICAL; else eKind = SK_POINT; - nXValue = Fraction( GetCoreValue( *m_pMtrFldX, MapUnit::Map100thMM) ) * aUIScale; - nYValue = Fraction( GetCoreValue( *m_pMtrFldY, MapUnit::Map100thMM) ) * aUIScale; + nXValue = long( GetCoreValue( *m_pMtrFldX, MapUnit::Map100thMM) * aUIScale); + nYValue = long( GetCoreValue( *m_pMtrFldY, MapUnit::Map100thMM) * aUIScale); rOutAttrs.Put(SfxAllEnumItem(ATTR_SNAPLINE_KIND, (sal_uInt16)eKind)); rOutAttrs.Put(SfxInt32Item(ATTR_SNAPLINE_X, nXValue)); diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index a7e88b811363..63e06f4b79a3 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -374,8 +374,8 @@ void PreviewRenderer::SetupOutputSize ( { // We should never get here. OSL_ASSERT(false); - aMapMode.SetScaleX(1.0); - aMapMode.SetScaleY(1.0); + aMapMode.SetScaleX(Fraction(1.0)); + aMapMode.SetScaleY(Fraction(1.0)); } mpPreviewDevice->SetMapMode (aMapMode); mpPreviewDevice->SetOutputSizePixel(rFramePixelSize); @@ -443,8 +443,8 @@ Image PreviewRenderer::ScaleBitmap ( MapMode aMapMode (mpPreviewDevice->GetMapMode()); aMapMode.SetMapUnit(MapUnit::MapPixel); aMapMode.SetOrigin (Point()); - aMapMode.SetScaleX (1.0); - aMapMode.SetScaleY (1.0); + aMapMode.SetScaleX (Fraction(1.0)); + aMapMode.SetScaleY (Fraction(1.0)); mpPreviewDevice->SetMapMode (aMapMode); mpPreviewDevice->SetOutputSize (aFrameSize); diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 074ad05157b1..06ae7dae72b1 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -597,8 +597,8 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) Point aPos = GetActiveWindow()->PixelToLogic(maMousePos); pPageView->LogicToPagePos(aPos); Fraction aUIScale(GetDoc()->GetUIScale()); - aPos.X() = Fraction(aPos.X()) / aUIScale; - aPos.Y() = Fraction(aPos.Y()) / aUIScale; + aPos.X() = long(aPos.X() / aUIScale); + aPos.Y() = long(aPos.Y() / aUIScale); // position- and size items if ( mpDrawView->IsAction() ) @@ -612,12 +612,12 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) { pPageView->LogicToPagePos(aRect); aPos = aRect.TopLeft(); - aPos.X() = Fraction(aPos.X()) / aUIScale; - aPos.Y() = Fraction(aPos.Y()) / aUIScale; + aPos.X() = long(aPos.X() / aUIScale); + aPos.Y() = long(aPos.Y() / aUIScale); rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) ); Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ); - aSize.Height() = Fraction(aSize.Height()) / aUIScale; - aSize.Width() = Fraction(aSize.Width()) / aUIScale; + aSize.Height() = long(aSize.Height() / aUIScale); + aSize.Width() = long(aSize.Width() / aUIScale); rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) ); } } @@ -630,13 +630,13 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) // Show the position of the selected shape(s) Point aShapePosition (aRect.TopLeft()); - aShapePosition.X() = Fraction(aShapePosition.X()) / aUIScale; - aShapePosition.Y() = Fraction(aShapePosition.Y()) / aUIScale; + aShapePosition.X() = long(aShapePosition.X() / aUIScale); + aShapePosition.Y() = long(aShapePosition.Y() / aUIScale); rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition)); Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ); - aSize.Height() = Fraction(aSize.Height()) / aUIScale; - aSize.Width() = Fraction(aSize.Width()) / aUIScale; + aSize.Height() = long(aSize.Height() / aUIScale); + aSize.Width() = long(aSize.Width() / aUIScale); rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) ); } else 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); diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx index 21018ad7eccf..87cf3e1cdc79 100644 --- a/starmath/source/utility.cxx +++ b/starmath/source/utility.cxx @@ -236,8 +236,8 @@ SmFace & operator *= (SmFace &rFace, const Fraction &rFrac) // It's main use is to make scaling fonts look easier. { const Size &rFaceSize = rFace.GetFontSize(); - rFace.SetSize(Size(Fraction(rFaceSize.Width()) *= rFrac, - Fraction(rFaceSize.Height()) *= rFrac)); + rFace.SetSize(Size(long(rFaceSize.Width() * rFrac), + long(rFaceSize.Height() * rFrac))); return rFace; } diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx index 6c95747ef09d..93b6000029e9 100644 --- a/svtools/source/filter/DocumentToGraphicRenderer.cxx +++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx @@ -150,8 +150,8 @@ Graphic DocumentToGraphicRenderer::renderToGraphic( OutputDevice* pOutputDev = VCLUnoHelper::GetOutputDevice( xDevice ); pOutputDev->SetAntialiasing(pOutputDev->GetAntialiasing() | AntialiasingFlags::EnableB2dDraw); MapMode mm = pOutputDev->GetMapMode(); - mm.SetScaleX( fScaleX ); - mm.SetScaleY( fScaleY ); + mm.SetScaleX( Fraction(fScaleX) ); + mm.SetScaleY( Fraction(fScaleY) ); pOutputDev->SetMapMode( mm ); aMtf.Record( pOutputDev ); diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index 41e606535600..a77fbd2b5cc6 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -623,8 +623,8 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal if ( aMtfSize.Width() && aMtfSize.Height() ) { MapMode aNewMapMode( MapUnit::Map100thMM ); - aNewMapMode.SetScaleX( static_cast< double >( aLogicalSize.Width ) / static_cast< double >( aMtfSize.Width() ) ); - aNewMapMode.SetScaleY( static_cast< double >( aLogicalSize.Height ) / static_cast< double >( aMtfSize.Height() ) ); + aNewMapMode.SetScaleX( Fraction( aLogicalSize.Width, aMtfSize.Width() ) ); + aNewMapMode.SetScaleY( Fraction( aLogicalSize.Height, aMtfSize.Height() ) ); aDummyVDev->EnableOutput( false ); aDummyVDev->SetMapMode( aNewMapMode ); diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index b7d6d5750271..e6dbcd631a71 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -1478,8 +1478,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( SdrInventor::FmForm, nObjID, nullptr )); - controlSize.Width() = Fraction(controlSize.Width(), 1) * eTargetMode.GetScaleX(); - controlSize.Height() = Fraction(controlSize.Height(), 1) * eTargetMode.GetScaleY(); + controlSize.Width() = long(controlSize.Width() * eTargetMode.GetScaleX()); + controlSize.Height() = long(controlSize.Height() * eTargetMode.GetScaleY()); ::Point controlPos( OutputDevice::LogicToLogic( ::Point( controlSize.Width(), 0 ), eSourceMode, eTargetMode ) ); ::tools::Rectangle controlRect( controlPos, OutputDevice::LogicToLogic( controlSize, eSourceMode, eTargetMode ) ); pControl->SetLogicRect(controlRect); diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 37d132d6ea01..ab27b80cdc68 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -370,7 +370,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, Edit&, void ) Fraction aUIScale = mpView->GetModel()->GetUIScale(); lX += maAnchorPos.X(); - lX = Fraction( lX ) * aUIScale; + lX = long( lX * aUIScale ); SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); @@ -388,7 +388,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, Edit&, void ) Fraction aUIScale = mpView->GetModel()->GetUIScale(); lY += maAnchorPos.Y(); - lY = Fraction( lY ) * aUIScale; + lY = long( lY * aUIScale ); SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); @@ -530,12 +530,10 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pWidthItem) { - long mlOldWidth1 = pWidthItem->GetValue(); - - mlOldWidth1 = Fraction( mlOldWidth1 ) / maUIScale; + long lOldWidth1 = long( pWidthItem->GetValue() / maUIScale ); SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); - SetMetricValue( *mpMtrWidth, mlOldWidth1, mePoolUnit ); - mlOldWidth = mlOldWidth1; + SetMetricValue( *mpMtrWidth, lOldWidth1, mePoolUnit ); + mlOldWidth = lOldWidth1; break; } } @@ -550,12 +548,10 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pHeightItem) { - long mlOldHeight1 = pHeightItem->GetValue(); - - mlOldHeight1 = Fraction( mlOldHeight1 ) / maUIScale; + long nTmp = long( pHeightItem->GetValue() / maUIScale); SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); - SetMetricValue( *mpMtrHeight, mlOldHeight1, mePoolUnit ); - mlOldHeight = mlOldHeight1; + SetMetricValue( *mpMtrHeight, nTmp, mePoolUnit ); + mlOldHeight = nTmp; break; } } @@ -570,8 +566,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pItem) { - long nTmp = pItem->GetValue(); - nTmp = Fraction( nTmp ) / maUIScale; + long nTmp = long(pItem->GetValue() / maUIScale); SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); SetMetricValue( *mpMtrPosX, nTmp, mePoolUnit ); break; @@ -588,8 +583,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pItem) { - long nTmp = pItem->GetValue(); - nTmp = Fraction( nTmp ) / maUIScale; + long nTmp = long(pItem->GetValue() / maUIScale); SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); SetMetricValue( *mpMtrPosY, nTmp, mePoolUnit ); break; @@ -607,7 +601,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pItem) { mlRotX = pItem->GetValue(); - mlRotX = Fraction( mlRotX ) / maUIScale; + mlRotX = long( mlRotX / maUIScale ); } } break; @@ -620,7 +614,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( if(pItem) { mlRotY = pItem->GetValue(); - mlRotY = Fraction( mlRotY ) / maUIScale; + mlRotY = long( mlRotY / maUIScale ); } } break; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 6fbc665a76b4..ecb7800273f3 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -1835,7 +1835,7 @@ basegfx::B2DHomMatrix SdrDragResize::getCurrentTransformation() { basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix( -DragStat().Ref1().X(), -DragStat().Ref1().Y())); - aRetval.scale(aXFact, aYFact); + aRetval.scale(double(aXFact), double(aYFact)); aRetval.translate(DragStat().Ref1().X(), DragStat().Ref1().Y()); return aRetval; @@ -2268,12 +2268,12 @@ basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation() { if (bVertical) { - aRetval.scale(aFact, 1.0); + aRetval.scale(double(aFact), 1.0); aRetval.shearY(-nTan); } else { - aRetval.scale(1.0, aFact); + aRetval.scale(1.0, double(aFact)); aRetval.shearX(-nTan); } } @@ -2371,8 +2371,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt) if (bUpSideDown) nNewAngle-=18000; if (bNeg) nTmpAngle=-nTmpAngle; bResize=true; - double nCos=cos(nTmpAngle*nPi180); - aNeuFact=nCos; + aNeuFact = cos(nTmpAngle*nPi180); aFact.ReduceInaccurate(10); // three decimals should be enough } diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 2150d636f922..625f9ea1fd9a 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -176,8 +176,8 @@ tools::Rectangle SdrLightEmbeddedClient_Impl::impl_getScaledRect_nothrow() const { tools::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( long( aLogicRect.GetWidth() * m_aScaleWidth), + long( aLogicRect.GetHeight() * m_aScaleHeight) ) ); return aLogicRect; } @@ -497,8 +497,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( 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 ); diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx index 97b96ace2b6d..7a3113e88ea0 100644 --- a/svx/source/svdraw/svdsnpv.cxx +++ b/svx/source/svdraw/svdsnpv.cxx @@ -369,7 +369,7 @@ SdrSnap SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const } if(bGridSnap) { - double fSnapWidth = aSnapWdtX; + double fSnapWidth(aSnapWdtX); if(dx == NOT_SNAPPED && fSnapWidth != 0.0) { double fx = (double)x; @@ -384,7 +384,7 @@ SdrSnap SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const x = (long)((double)x * fSnapWidth + (double)pPV->GetPageOrigin().X()); dx = 0; } - fSnapWidth = aSnapWdtY; + fSnapWidth = double(aSnapWdtY); if(dy == NOT_SNAPPED && fSnapWidth) { double fy = (double)y; diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index d6c55f7d5ca1..2f5f50dc19f6 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -893,10 +893,10 @@ DECLARE_OOXMLIMPORT_TEST(testFdo76803, "fdo76803.docx") CPPUNIT_ASSERT_EQUAL(double(-163), aPolygon.getB2DPoint(1).getX()); CPPUNIT_ASSERT_EQUAL(double(3661), aPolygon.getB2DPoint(1).getY()); - CPPUNIT_ASSERT_EQUAL(double(16988), aPolygon.getB2DPoint(2).getX()); + CPPUNIT_ASSERT_EQUAL(double(16987), aPolygon.getB2DPoint(2).getX()); CPPUNIT_ASSERT_EQUAL(double(3661), aPolygon.getB2DPoint(2).getY()); - CPPUNIT_ASSERT_EQUAL(double(16988), aPolygon.getB2DPoint(3).getX()); + CPPUNIT_ASSERT_EQUAL(double(16987), aPolygon.getB2DPoint(3).getX()); CPPUNIT_ASSERT_EQUAL(double(0), aPolygon.getB2DPoint(3).getY()); } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 45c0e9d1de0e..b03fd33f4f49 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -3913,7 +3913,7 @@ void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewHeight, Fraction aTmp( nMyOldH ); aTmp *= Fraction( nNewHeight, nOldHeight ); aTmp += Fraction( 1, 2 ); // round up if needed - nMyNewH = aTmp; + nMyNewH = long(aTmp); } SwFrameSize eSize = ATT_MIN_SIZE; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index f88d84a6a6f0..fc1aed273e67 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -393,8 +393,8 @@ void SwCalcPixStatics( vcl::RenderContext const *pOut ) gProp.nSMinDistPixelH = gProp.nSPixelSzH * 2 + 1; const MapMode &rMap = pOut->GetMapMode(); - gProp.aSScaleX = rMap.GetScaleX(); - gProp.aSScaleY = rMap.GetScaleY(); + gProp.aSScaleX = double(rMap.GetScaleX()); + gProp.aSScaleY = double(rMap.GetScaleY()); } /** @@ -2926,13 +2926,13 @@ void SwTabFramePainter::Insert( const SwFrame& rFrame, const SvxBoxItem& rBoxIte const Fraction& rFracY = rMapMode.GetScaleY(); svx::frame::Style aL(rBoxItem.GetLeft()); - aL.SetPatternScale(rFracY); + aL.SetPatternScale(double(rFracY)); svx::frame::Style aR(rBoxItem.GetRight()); - aR.SetPatternScale(rFracY); + aR.SetPatternScale(double(rFracY)); svx::frame::Style aT(rBoxItem.GetTop()); - aT.SetPatternScale(rFracX); + aT.SetPatternScale(double(rFracX)); svx::frame::Style aB(rBoxItem.GetBottom()); - aB.SetPatternScale(rFracX); + aB.SetPatternScale(double(rFracX)); aR.MirrorSelf(); aB.MirrorSelf(); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 434dca8e90d6..24f506a185fb 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1889,7 +1889,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex sal_uInt16 nOldZoomValue = 0; if (GetWin() && GetWin()->GetMapMode().GetScaleX() != scaleX) { - double fScale = scaleX; + double fScale = double(scaleX); SwViewOption aOption(*GetViewOptions()); nOldZoomValue = aOption.GetZoom(); aOption.SetZoom(fScale * 100); diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index 127f5263f60b..6258e0ee34b3 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -673,7 +673,7 @@ namespace sw const Size &rOrigSize = pNd->GetGraphic().GetPrefSize(); Fraction aMapPolyX(ww::nWrap100Percent, rOrigSize.Width()); Fraction aMapPolyY(ww::nWrap100Percent, rOrigSize.Height()); - aPoly.Scale(aMapPolyX, aMapPolyY); + aPoly.Scale(double(aMapPolyX), double(aMapPolyY)); /* a) stretch right bound by 15twips @@ -691,7 +691,7 @@ namespace sw ww::nWrap100Percent); Fraction aHackY(ww::nWrap100Percent - nMove, ww::nWrap100Percent); - aPoly.Scale(aHackX, aHackY); + aPoly.Scale(double(aHackX), double(aHackY)); aPoly.Move(-nMove, 0); return aPoly; diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index fcc10d5b54b0..d8ccf427accc 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2007,13 +2007,13 @@ void SwWW8ImplReader::MapWrapIntoFlyFormat(SvxMSDffImportRec* pRecord, Fraction aHackX(ww::nWrap100Percent, ww::nWrap100Percent + nMove); Fraction aHackY(ww::nWrap100Percent, ww::nWrap100Percent - nMove); - aPoly.Scale(aHackX, aHackY); + aPoly.Scale(double(aHackX), double(aHackY)); // Turn polygon back into units that match the graphic's const Size &rOrigSize = pNd->GetGraphic().GetPrefSize(); Fraction aMapPolyX(rOrigSize.Width(), ww::nWrap100Percent); Fraction aMapPolyY(rOrigSize.Height(), ww::nWrap100Percent); - aPoly.Scale(aMapPolyX, aMapPolyY); + aPoly.Scale(double(aMapPolyX), double(aMapPolyY)); // #i47277# - contour is already in unit of the // graphic preferred unit. Thus, call method <SetContour(..)> diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index d7d835b35c18..a9dc8b89a920 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -2015,7 +2015,7 @@ unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const if (comphelper::LibreOfficeKit::isActive() && !bEnableMapMode) { // The output device is the tile and contains the real wanted scale factor. - double fScaleX = mpWrtShell->GetOut()->GetMapMode().GetScaleX(); + double fScaleX = double(mpWrtShell->GetOut()->GetMapMode().GetScaleX()); nZoom = fScaleX * 100; } unsigned long aWidth = (unsigned long)(nZoom * 1.8); diff --git a/sw/source/uibase/uiview/swcli.cxx b/sw/source/uibase/uiview/swcli.cxx index e5dabeb42605..6d1f08d7e296 100644 --- a/sw/source/uibase/uiview/swcli.cxx +++ b/sw/source/uibase/uiview/swcli.cxx @@ -68,8 +68,8 @@ void SwOleClient::RequestNewObjectArea( tools::Rectangle& aLogRect ) MapMode aObjectMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( GetObject()->getMapUnit( GetAspect() ) ) ); MapMode aClientMap( GetEditWin()->GetMapMode().GetMapUnit() ); - Size aNewObjSize( Fraction( aLogRect.GetWidth() ) / GetScaleWidth(), - Fraction( aLogRect.GetHeight() ) / GetScaleHeight() ); + Size aNewObjSize( long( aLogRect.GetWidth() / GetScaleWidth() ), + long( aLogRect.GetHeight() / GetScaleHeight() ) ); // convert to logical coordinates of the embedded object Size aNewSize = GetEditWin()->LogicToLogic( aNewObjSize, &aClientMap, &aObjectMap ); @@ -142,8 +142,8 @@ void SwOleClient::ViewChanged() const MapMode aObjMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( GetObject()->getMapUnit( GetAspect() ) ) ); aVisSize = OutputDevice::LogicToLogic( aVisSize, aObjMap, aMyMap ); - aVisSize.Width() = Fraction( aVisSize.Width() ) * GetScaleWidth(); - aVisSize.Height()= Fraction( aVisSize.Height() ) * GetScaleHeight(); + aVisSize.Width() = long(aVisSize.Width() * GetScaleWidth()); + aVisSize.Height() = long(aVisSize.Height() * GetScaleHeight()); SwRect aRect( Point( LONG_MIN, LONG_MIN ), aVisSize ); rSh.LockView( true ); // Prevent scrolling in the EndAction diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 639b8eb9e174..28e6fbe79f04 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -813,8 +813,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, } else { - aArea.Width ( Fraction( aArea.Width() ) / pCli->GetScaleWidth() ); - aArea.Height( Fraction( aArea.Height() ) / pCli->GetScaleHeight()); + aArea.Width ( long( aArea.Width() / pCli->GetScaleWidth() ) ); + aArea.Height( long( aArea.Height() / pCli->GetScaleHeight() ) ); } pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight ); diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.cxx b/writerfilter/source/dmapper/WrapPolygonHandler.cxx index 5d41154e9a9f..010cf2e195a6 100644 --- a/writerfilter/source/dmapper/WrapPolygonHandler.cxx +++ b/writerfilter/source/dmapper/WrapPolygonHandler.cxx @@ -100,8 +100,8 @@ WrapPolygon::Pointer_t WrapPolygon::correctWordWrapPolygon(const awt::Size & rSr awt::Point aMovePoint(aMove.operator long(), 0); pResult = move(aMovePoint); - Fraction aScaleX(nWrap100Percent, Fraction(nWrap100Percent) + aMove); - Fraction aScaleY(nWrap100Percent, Fraction(nWrap100Percent) - aMove); + Fraction aScaleX = nWrap100Percent / (nWrap100Percent + aMove); + Fraction aScaleY = nWrap100Percent / (nWrap100Percent - aMove); pResult = pResult->scale(aScaleX, aScaleY); Fraction aScaleSrcX(rSrcSize.Width, nWrap100Percent); |