diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-10-23 17:41:47 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-10-23 18:34:39 +0200 |
commit | 31af61ea091cc895b893c849f2130aa35792b7db (patch) | |
tree | 6c7b63c5b538034bd5d356c5a8667b7e95d59b9c /sd/source/ui | |
parent | e92c0d6f9b7a6251e00dc55219a203a7e53c96e2 (diff) |
Fraction: Revert "fdo#81356: convert Fraction to boost::rational<long> - 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
Diffstat (limited to 'sd/source/ui')
34 files changed, 140 insertions, 138 deletions
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index 0899fffcaa8f..3c2951bac935 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -181,7 +181,7 @@ bool PathDragResize::EndSdrDrag(bool /*bCopy*/) { const Point aRef( DragStat().Ref1() ); basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-aRef.X(), -aRef.Y())); - aTrans.scale(boost::rational_cast<double>(aXFact), boost::rational_cast<double>(aYFact)); + aTrans.scale(double(aXFact), double(aYFact)); aTrans.translate(aRef.X(), aRef.Y()); basegfx::B2DPolyPolygon aDragPoly(pPathObj->GetPathPoly()); aDragPoly.transform(aTrans); diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index 19125096c0e1..47063aad5fc8 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -376,7 +376,7 @@ void AnnotationWindow::Rescale() { vcl::Font aFont( mpMeta->GetSettings().GetStyleSettings().GetFieldFont() ); sal_Int32 nHeight = aFont.GetHeight(); - nHeight = nHeight * aMode.GetScaleY().numerator() / aMode.GetScaleY().denominator(); + nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator(); aFont.SetHeight( nHeight ); mpMeta->SetControlFont( aFont ); } diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx index 73db89fa54b9..dca7ba140995 100644 --- a/sd/source/ui/app/optsitem.cxx +++ b/sd/source/ui/app/optsitem.cxx @@ -1126,8 +1126,8 @@ SdOptionsGridItem::SdOptionsGridItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd SetFldDrawY( pView->GetGridCoarse().Height() ); SetFldDivisionX( pView->GetGridFine().Width() ? ( GetFldDrawX() / pView->GetGridFine().Width() - 1 ) : 0 ); SetFldDivisionY( pView->GetGridFine().Height() ? ( GetFldDrawY() / pView->GetGridFine().Height() - 1 ) : 0 ); - SetFldSnapX( boost::rational_cast<long>(pView->GetSnapGridWidthX()) ); - SetFldSnapY( boost::rational_cast<long>(pView->GetSnapGridWidthY()) ); + SetFldSnapX( long(pView->GetSnapGridWidthX()) ); + SetFldSnapY( long(pView->GetSnapGridWidthY()) ); SetUseGridSnap( pView->IsGridSnap() ); SetGridVisible( pView->IsGridVisible() ); } diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 8db6f17d7f52..2c83b2d5102e 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -502,9 +502,9 @@ SfxItemSet* SdModule::CreateItemSet( sal_uInt16 nSlot ) if(pFrameView) { - const boost::rational<long>& rFraction = pDoc->GetUIScale(); - nX=rFraction.numerator(); - nY=rFraction.denominator(); + const Fraction& rFraction = pDoc->GetUIScale(); + nX=rFraction.GetNumerator(); + nY=rFraction.GetDenominator(); } else { @@ -595,7 +595,7 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) // Apply to document only if doc type match if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() ) { - pDoc->SetUIScale( boost::rational<long>( nX, nY ) ); + pDoc->SetUIScale( Fraction( nX, nY ) ); if( pViewShell ) pViewShell->SetRuler( pViewShell->HasRuler() ); } diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index b5f2bf9984d1..407bdda8a84e 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -89,8 +89,8 @@ void SdDisplay::Paint( const Rectangle& ) Point aPt; Size aSize = GetOutputSize(); Size aBmpSize = aBitmapEx.GetBitmap().GetSizePixel(); - aBmpSize.Width() = (long) ( (double) aBmpSize.Width() * boost::rational_cast<double>(this->aScale) ); - aBmpSize.Height() = (long) ( (double) aBmpSize.Height() * boost::rational_cast<double>(this->aScale) ); + aBmpSize.Width() = (long) ( (double) aBmpSize.Width() * (double) aScale ); + aBmpSize.Height() = (long) ( (double) aBmpSize.Height() * (double) aScale ); if( aBmpSize.Width() < aSize.Width() ) aPt.X() = ( aSize.Width() - aBmpSize.Width() ) / 2; @@ -100,7 +100,7 @@ void SdDisplay::Paint( const Rectangle& ) aBitmapEx.Draw( this, aPt, aBmpSize ); } -void SdDisplay::SetScale( const boost::rational<long>& rFrac ) +void SdDisplay::SetScale( const Fraction& rFrac ) { aScale = rFrac; } @@ -468,7 +468,7 @@ IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn ) } // calculate and set zoom for DisplayWin - boost::rational<long> aFrac( GetScale() ); + Fraction aFrac( GetScale() ); aCtlDisplay.SetScale( aFrac ); UpdateControl(); @@ -643,9 +643,9 @@ void AnimationWindow::WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime, } } -boost::rational<long> AnimationWindow::GetScale() +Fraction AnimationWindow::GetScale() { - boost::rational<long> aFrac; + Fraction aFrac; size_t const nCount = m_FrameList.size(); if (nCount > 0) { @@ -662,7 +662,7 @@ boost::rational<long> AnimationWindow::GetScale() aBmpSize.Width() += 10; aBmpSize.Height() += 10; - aFrac = rational_FromDouble( std::min( (double)aDisplaySize.Width() / (double)aBmpSize.Width(), + aFrac = Fraction( std::min( (double)aDisplaySize.Width() / (double)aBmpSize.Width(), (double)aDisplaySize.Height() / (double)aBmpSize.Height() ) ); } return( aFrac ); @@ -733,7 +733,7 @@ void AnimationWindow::Resize() aGrpAnimation.SetPosPixel( aGrpAnimation.GetPosPixel() + aPt ); // calculate and set zoom for DisplayWin - boost::rational<long> aFrac( GetScale() ); + Fraction aFrac( GetScale() ); aCtlDisplay.SetScale( aFrac ); aBtnFirst.Show(); @@ -963,7 +963,7 @@ void AnimationWindow::AddObj (::sd::View& rView ) } // calculate and set zoom for DisplayWin - boost::rational<long> aFrac( GetScale() ); + Fraction aFrac( GetScale() ); aCtlDisplay.SetScale( aFrac ); UpdateControl(); diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index c55915884881..56e865215205 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -128,12 +128,12 @@ void CopyDlg::Reset() long nMoveX = 500L; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, true, &pPoolItem ) ) nMoveX = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); - SetMetricValue( *m_pMtrFldMoveX, boost::rational_cast<long>(nMoveX / maUIScale), SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldMoveX, Fraction(nMoveX) / maUIScale, SFX_MAPUNIT_100TH_MM); long nMoveY = 500L; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, true, &pPoolItem ) ) nMoveY = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); - SetMetricValue( *m_pMtrFldMoveY, boost::rational_cast<long>(nMoveY / maUIScale), SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldMoveY, Fraction(nMoveY) / maUIScale, SFX_MAPUNIT_100TH_MM); if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) ) m_pMtrFldAngle->SetValue( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); @@ -143,12 +143,12 @@ void CopyDlg::Reset() long nWidth = 0L; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, true, &pPoolItem ) ) nWidth = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); - SetMetricValue( *m_pMtrFldWidth, boost::rational_cast<long>(nWidth / maUIScale), SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldWidth, Fraction(nWidth) / maUIScale, SFX_MAPUNIT_100TH_MM); long nHeight = 0L; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, true, &pPoolItem ) ) nHeight = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); - SetMetricValue( *m_pMtrFldHeight, boost::rational_cast<long>(nHeight / maUIScale), SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldHeight, Fraction(nHeight) / maUIScale, SFX_MAPUNIT_100TH_MM); if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) ) { @@ -199,10 +199,10 @@ void CopyDlg::Reset() */ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) { - long nMoveX = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldMoveX, SFX_MAPUNIT_100TH_MM) * maUIScale); - long nMoveY = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldMoveY, SFX_MAPUNIT_100TH_MM) * maUIScale); - long nHeight = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldHeight, SFX_MAPUNIT_100TH_MM) * maUIScale); - long nWidth = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldWidth, SFX_MAPUNIT_100TH_MM) * maUIScale); + long nMoveX = Fraction( GetCoreValue( *m_pMtrFldMoveX, SFX_MAPUNIT_100TH_MM) ) * maUIScale; + long nMoveY = Fraction( GetCoreValue( *m_pMtrFldMoveY, SFX_MAPUNIT_100TH_MM) ) * maUIScale; + long nHeight = Fraction( GetCoreValue( *m_pMtrFldHeight, SFX_MAPUNIT_100TH_MM) ) * maUIScale; + long nWidth = Fraction( GetCoreValue( *m_pMtrFldWidth, SFX_MAPUNIT_100TH_MM) ) * maUIScale; rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, (sal_uInt16) m_pNumFldCopies->GetValue() ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) ); @@ -249,8 +249,10 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData) { Rectangle aRect = mpView->GetAllMarkedRect(); - SetMetricValue( *m_pMtrFldMoveX, boost::rational_cast<long>(aRect.GetWidth() / maUIScale), SFX_MAPUNIT_100TH_MM); - SetMetricValue( *m_pMtrFldMoveY, boost::rational_cast<long>(aRect.GetHeight() / maUIScale), SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldMoveX, Fraction( aRect.GetWidth() ) / + maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldMoveY, Fraction( aRect.GetHeight() ) / + maUIScale, SFX_MAPUNIT_100TH_MM); // sets color attribute const SfxPoolItem* pPoolItem = NULL; @@ -271,13 +273,13 @@ IMPL_LINK_NOARG(CopyDlg, SetDefault) m_pNumFldCopies->SetValue( 1L ); long nValue = 500L; - SetMetricValue( *m_pMtrFldMoveX, boost::rational_cast<long>(nValue / maUIScale), SFX_MAPUNIT_100TH_MM); - SetMetricValue( *m_pMtrFldMoveY, boost::rational_cast<long>(nValue / maUIScale), SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldMoveX, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldMoveY, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); nValue = 0L; m_pMtrFldAngle->SetValue( nValue ); - SetMetricValue( *m_pMtrFldWidth, boost::rational_cast<long>(nValue / maUIScale), SFX_MAPUNIT_100TH_MM); - SetMetricValue( *m_pMtrFldHeight, boost::rational_cast<long>(nValue / maUIScale), SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldWidth, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldHeight, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); // set color attribute const SfxPoolItem* pPoolItem = NULL; diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx index b4565165da7f..ee8548f07c6a 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 = boost::rational_cast<long>(nValue / aUIScale); + nValue = Fraction( nValue ) / aUIScale; m_pMtrFldX->SetMin( nValue ); m_pMtrFldX->SetFirst( nValue ); SetMetricValue( *m_pMtrFldX, aRightBottom.X(), ePoolUnit ); nValue = static_cast<long>(m_pMtrFldX->GetValue()); - nValue = boost::rational_cast<long>(nValue / aUIScale); + nValue = Fraction( nValue ) / aUIScale; m_pMtrFldX->SetMax( nValue ); m_pMtrFldX->SetLast( nValue ); SetMetricValue( *m_pMtrFldY, aLeftTop.Y(), ePoolUnit ); nValue = static_cast<long>(m_pMtrFldY->GetValue()); - nValue = boost::rational_cast<long>(nValue / aUIScale); + nValue = Fraction( nValue ) / aUIScale; m_pMtrFldY->SetMin( nValue ); m_pMtrFldY->SetFirst( nValue ); SetMetricValue( *m_pMtrFldY, aRightBottom.Y(), ePoolUnit ); nValue = static_cast<long>(m_pMtrFldY->GetValue()); - nValue = boost::rational_cast<long>(nValue / aUIScale); + nValue = Fraction( nValue ) / aUIScale; m_pMtrFldY->SetMax( nValue ); m_pMtrFldY->SetLast( nValue ); // set values nXValue = ((const SfxInt32Item&) rInAttrs.Get(ATTR_SNAPLINE_X)).GetValue(); nYValue = ((const SfxInt32Item&) rInAttrs.Get(ATTR_SNAPLINE_Y)).GetValue(); - nXValue = boost::rational_cast<long>(nXValue / aUIScale); - nYValue = boost::rational_cast<long>(nYValue / aUIScale); + nXValue = Fraction(nXValue) / aUIScale; + nYValue = Fraction(nYValue) / aUIScale; SetMetricValue( *m_pMtrFldX, nXValue, SFX_MAPUNIT_100TH_MM); SetMetricValue( *m_pMtrFldY, nYValue, SFX_MAPUNIT_100TH_MM); @@ -135,8 +135,8 @@ void SdSnapLineDlg::GetAttr(SfxItemSet& rOutAttrs) else if ( m_pRbVert->IsChecked() ) eKind = SK_VERTICAL; else eKind = SK_POINT; - nXValue = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldX, SFX_MAPUNIT_100TH_MM) * aUIScale); - nYValue = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldY, SFX_MAPUNIT_100TH_MM) * aUIScale); + nXValue = Fraction( GetCoreValue( *m_pMtrFldX, SFX_MAPUNIT_100TH_MM) ) * aUIScale; + nYValue = Fraction( GetCoreValue( *m_pMtrFldY, SFX_MAPUNIT_100TH_MM) ) * aUIScale; rOutAttrs.Put(SfxAllEnumItem(ATTR_SNAPLINE_KIND, (sal_uInt16)eKind)); rOutAttrs.Put(SfxUInt32Item(ATTR_SNAPLINE_X, nXValue)); diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx index 3bd0669a1723..32516f927aff 100644 --- a/sd/source/ui/dlg/docprev.cxx +++ b/sd/source/ui/dlg/docprev.cxx @@ -237,7 +237,7 @@ void SdDocPreviewWin::updateViewSettings() VirtualDevice aVDev; - const boost::rational<long> aFrac( pDoc->GetScaleFraction() ); + const Fraction aFrac( pDoc->GetScaleFraction() ); const MapMode aMap( pDoc->GetScaleUnit(), Point(), aFrac, aFrac ); aVDev.SetMapMode( aMap ); diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index 37de85865e59..7d7774242449 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -113,7 +113,7 @@ void SdVectorizeDlg::InitPreviewBmp() m_pBmpWin->SetGraphic( aPreviewBmp ); } -Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, boost::rational<long>& rScale ) +Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale ) { Bitmap aNew( rBmp ); const Size aSizePix( aNew.GetSizePixel() ); @@ -121,11 +121,11 @@ Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, boost::rational<long>& r if( aSizePix.Width() > VECTORIZE_MAX_EXTENT || aSizePix.Height() > VECTORIZE_MAX_EXTENT ) { const Rectangle aRect( GetRect( Size( VECTORIZE_MAX_EXTENT, VECTORIZE_MAX_EXTENT ), aSizePix ) ); - rScale = boost::rational<long>( aSizePix.Width(), aRect.GetWidth() ); + rScale = Fraction( aSizePix.Width(), aRect.GetWidth() ); aNew.Scale( aRect.GetSize() ); } else - rScale = boost::rational<long>( 1, 1 ); + rScale = Fraction( 1, 1 ); aNew.ReduceColors( (sal_uInt16) m_pNmLayers->GetValue(), BMP_REDUCE_SIMPLE ); @@ -137,7 +137,7 @@ void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf ) mpDocSh->SetWaitCursor( true ); m_pPrgs->SetValue( 0 ); - boost::rational<long> aScale; + Fraction aScale; Bitmap aTmp( GetPreparedBitmap( rBmp, aScale ) ); if( !!aTmp ) diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx index 0cf004be3498..dbfda6e62fd1 100644 --- a/sd/source/ui/docshell/docshel2.cxx +++ b/sd/source/ui/docshell/docshel2.cxx @@ -199,7 +199,7 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixe const Size aPixSize( aVDev.LogicToPixel( aSize ) ); const sal_uLong nMaxEdgePix = std::max( aPixSize.Width(), aPixSize.Height() ); - boost::rational<long> aFrac( nMaxEdgePixel, nMaxEdgePix ); + Fraction aFrac( nMaxEdgePixel, nMaxEdgePix ); aMapMode.SetScaleX( aFrac ); aMapMode.SetScaleY( aFrac ); @@ -207,7 +207,7 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixe aVDev.SetOutputSize( aSize ); // that we also get the dark lines at the right and bottom page margin - aFrac = boost::rational<long>( nMaxEdgePixel - 1, nMaxEdgePix ); + aFrac = Fraction( nMaxEdgePixel - 1, nMaxEdgePix ); aMapMode.SetScaleX( aFrac ); aMapMode.SetScaleY( aFrac ); aVDev.SetMapMode( aMapMode ); diff --git a/sd/source/ui/docshell/sdclient.cxx b/sd/source/ui/docshell/sdclient.cxx index 6ea9d132495e..fc6887d9e878 100644 --- a/sd/source/ui/docshell/sdclient.cxx +++ b/sd/source/ui/docshell/sdclient.cxx @@ -169,8 +169,8 @@ void Client::ViewChanged() Size aSize = pSdrOle2Obj->GetOrigObjSize( &aMap100 ); aVisArea.SetSize( aSize ); - Size aScaledSize( boost::rational_cast<long>(GetScaleWidth() * aVisArea.GetWidth()), - boost::rational_cast<long>(GetScaleHeight() * aVisArea.GetHeight()) ); + Size aScaledSize( static_cast< long >( GetScaleWidth() * Fraction( aVisArea.GetWidth() ) ), + static_cast< long >( GetScaleHeight() * Fraction( aVisArea.GetHeight() ) ) ); // react to the change if the difference is bigger than one pixel Size aPixelDiff = diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx index e1d0b57f76b2..03477a588620 100644 --- a/sd/source/ui/func/fucopy.cxx +++ b/sd/source/ui/func/fucopy.cxx @@ -235,8 +235,8 @@ void FuCopy::DoExecute( SfxRequest& rReq ) } } - boost::rational<long> aWidth( aRect.Right() - aRect.Left() + lWidth, aRect.Right() - aRect.Left() ); - boost::rational<long> aHeight( aRect.Bottom() - aRect.Top() + lHeight, aRect.Bottom() - aRect.Top() ); + Fraction aWidth( aRect.Right() - aRect.Left() + lWidth, aRect.Right() - aRect.Left() ); + Fraction aHeight( aRect.Bottom() - aRect.Top() + lHeight, aRect.Bottom() - aRect.Top() ); if( mpView->IsResizeAllowed() ) mpView->ResizeAllMarked( aRect.TopLeft(), aWidth, aHeight ); diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 8ffedbdf7569..42fbabe36d6a 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -408,7 +408,7 @@ protected: virtual SvxRuler* CreateVRuler(::sd::Window* pWin) SAL_OVERRIDE; virtual void UpdateHRuler() SAL_OVERRIDE; virtual void UpdateVRuler() SAL_OVERRIDE; - virtual void SetZoomFactor(const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY) SAL_OVERRIDE; + virtual void SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY) SAL_OVERRIDE; void SetupPage( Size &rSize, long nLeft, long nRight, long nUpper, long nLower, bool bSize, bool bMargin, bool bScaleAll ); diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index b5935aa6d169..ff43e50132f5 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -536,8 +536,8 @@ protected: virtual void Activate(bool IsMDIActivate) SAL_OVERRIDE; virtual void Deactivate(bool IsMDIActivate) SAL_OVERRIDE; - virtual void SetZoomFactor( const boost::rational<long>& rZoomX, - const boost::rational<long>& rZoomY ); + virtual void SetZoomFactor( const Fraction &rZoomX, + const Fraction &rZoomY ); /** This must be called after the ctor, but before anything else. diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx index c744a3d3a085..af33977a8e33 100644 --- a/sd/source/ui/inc/ViewShellBase.hxx +++ b/sd/source/ui/inc/ViewShellBase.hxx @@ -161,8 +161,8 @@ public: virtual void Activate (bool IsMDIActivate) SAL_OVERRIDE; virtual void Deactivate (bool IsMDIActivate) SAL_OVERRIDE; virtual void SetZoomFactor ( - const boost::rational<long>& rZoomX, - const boost::rational<long>& rZoomY) SAL_OVERRIDE; + const Fraction &rZoomX, + const Fraction &rZoomY) SAL_OVERRIDE; virtual bool PrepareClose (bool bUI = true) SAL_OVERRIDE; virtual void WriteUserData (OUString&, bool bBrowse = false) SAL_OVERRIDE; virtual void ReadUserData (const OUString&, bool bBrowse = false) SAL_OVERRIDE; diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx index 2178f829108c..9e720ad04260 100644 --- a/sd/source/ui/inc/animobjs.hxx +++ b/sd/source/ui/inc/animobjs.hxx @@ -61,7 +61,7 @@ class SdDisplay : public Control { private: BitmapEx aBitmapEx; - boost::rational<long> aScale; + Fraction aScale; public: SdDisplay( vcl::Window* pWin, SdResId Id ); @@ -70,7 +70,7 @@ public: virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; void SetBitmapEx( BitmapEx* pBmpEx ); - void SetScale( const boost::rational<long>& rFrac ); + void SetScale( const Fraction& rFrac ); virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; }; @@ -155,7 +155,7 @@ private: void ResetAttrs(); void WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime, SfxProgress* pStbMgr ) const; - boost::rational<long> GetScale(); + Fraction GetScale(); }; /** diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx index f62bf44f3b39..7994e0c1c08b 100644 --- a/sd/source/ui/inc/copydlg.hxx +++ b/sd/source/ui/inc/copydlg.hxx @@ -64,7 +64,7 @@ private: const SfxItemSet& mrOutAttrs; XColorListRef mpColorList; - boost::rational<long> maUIScale; + Fraction maUIScale; ::sd::View* mpView; DECL_LINK( SelectColorHdl, void * ); diff --git a/sd/source/ui/inc/dlgsnap.hxx b/sd/source/ui/inc/dlgsnap.hxx index befaa538ceba..ab431c856be3 100644 --- a/sd/source/ui/inc/dlgsnap.hxx +++ b/sd/source/ui/inc/dlgsnap.hxx @@ -25,7 +25,7 @@ #include <vcl/field.hxx> #include <vcl/group.hxx> #include <vcl/layout.hxx> -#include <tools/rational.hxx> +#include <tools/fract.hxx> #include <vcl/dialog.hxx> #include "sdenumdef.hxx" /************************************************************************/ @@ -53,7 +53,7 @@ private: long nXValue; long nYValue; FieldUnit eUIUnit; - boost::rational<long> aUIScale; + Fraction aUIScale; DECL_LINK( ClickHdl, Button * ); diff --git a/sd/source/ui/inc/vectdlg.hxx b/sd/source/ui/inc/vectdlg.hxx index 6107c7ed99a1..153343dae933 100644 --- a/sd/source/ui/inc/vectdlg.hxx +++ b/sd/source/ui/inc/vectdlg.hxx @@ -67,7 +67,7 @@ class SdVectorizeDlg : public ModalDialog void UpdatePreviewMtf(); Rectangle GetRect( const Size& rDispSize, const Size& rBmpSize ) const; - Bitmap GetPreparedBitmap( Bitmap& rBmp, boost::rational<long>& rScale ); + Bitmap GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale ); void Calculate( Bitmap& rBmp, GDIMetaFile& rMtf ); void AddTile( BitmapReadAccess* pRAcc, GDIMetaFile& rMtf, long nPosX, long nPosY, long nWidth, long nHeight ); diff --git a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx index b6555cc5ac89..381bac6868f7 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx @@ -24,7 +24,7 @@ #include "view/SlsPageObjectLayouter.hxx" #include "view/SlsTheme.hxx" #include <sal/types.h> -#include <tools/rational.hxx> +#include <tools/fract.hxx> #include <vcl/mapmod.hxx> #include <vector> #include <utility> @@ -114,7 +114,7 @@ public: /** Return the scale factor that can be set at the map mode of the output window. */ - boost::rational<long> GetScaleFactor (void) const; + Fraction GetScaleFactor (void) const; Size GetPageObjectSize (void) const; diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index 3113433ff3b9..4de09a10c1a6 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -383,9 +383,9 @@ void PreviewRenderer::SetupOutputSize ( { const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0); aMapMode.SetScaleX( - boost::rational<long>(rFramePixelSize.Width()-2*nFrameWidth-1, aPageModelSize.Width())); + Fraction(rFramePixelSize.Width()-2*nFrameWidth-1, aPageModelSize.Width())); aMapMode.SetScaleY( - boost::rational<long>(rFramePixelSize.Height()-2*nFrameWidth-1, aPageModelSize.Height())); + Fraction(rFramePixelSize.Height()-2*nFrameWidth-1, aPageModelSize.Height())); aMapMode.SetOrigin(mpPreviewDevice->PixelToLogic(Point(nFrameWidth,nFrameWidth),aMapMode)); } else diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 3d4703c742e3..280055a2b72a 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -677,7 +677,7 @@ throw (UnknownPropertyException, PropertyVetoException, sal_Int32 nValue = 0; if( *pValues >>= nValue ) { - boost::rational<long> aFract( nValue, pDoc->GetUIScale().denominator() ); + Fraction aFract( nValue, pDoc->GetUIScale().GetDenominator() ); pDoc->SetUIScale( aFract ); bOk = true; bChanged = true; @@ -689,7 +689,7 @@ throw (UnknownPropertyException, PropertyVetoException, sal_Int32 nValue = 0; if( *pValues >>= nValue ) { - boost::rational<long> aFract( pDoc->GetUIScale().numerator(), nValue ); + Fraction aFract( pDoc->GetUIScale().GetNumerator(), nValue ); pDoc->SetUIScale( aFract ); bOk = true; bChanged = true; @@ -1091,10 +1091,10 @@ throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std:: } break; case HANDLE_SCALE_NUM: - *pValue <<= (sal_Int32)pDoc->GetUIScale().numerator(); + *pValue <<= (sal_Int32)pDoc->GetUIScale().GetNumerator(); break; case HANDLE_SCALE_DOM: - *pValue <<= (sal_Int32)pDoc->GetUIScale().denominator(); + *pValue <<= (sal_Int32)pDoc->GetUIScale().GetDenominator(); break; case HANDLE_TABSTOP: *pValue <<= (sal_Int32)pDoc->GetDefaultTabulator(); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 23d9ea3170c1..34becc4195c9 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2226,10 +2226,10 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice, // that VirtualDevices use a DPI of 96. // We specifically calculate these scales first as we're still // in TWIPs, and might as well minimise the number of conversions. - boost::rational<long> scaleX = boost::rational<long>( nOutputWidth, 96 ) * boost::rational<long>(1440L) / - boost::rational<long>( nTileWidth ); - boost::rational<long> scaleY = boost::rational<long>( nOutputHeight, 96 ) * boost::rational<long>(1440L) / - boost::rational<long>( nTileHeight ); + Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) / + Fraction( nTileWidth); + Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) / + Fraction( nTileHeight); // svx seems to be the only component that works natively in // 100th mm rather than TWIP. It makes most sense just to diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 1da275481f44..fe024fc0fc4a 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1607,8 +1607,8 @@ private: { MapMode aMap (rInfo.maMap); Point aPageOfs (rInfo.mpPrinter->GetPageOffset() ); - aMap.SetScaleX(boost::rational<long>(1,2)); - aMap.SetScaleY(boost::rational<long>(1,2)); + aMap.SetScaleX(Fraction(1,2)); + aMap.SetScaleY(Fraction(1,2)); mpPrinter->SetMapMode(aMap); Rectangle aOutRect(aPageOfs, rInfo.mpPrinter->GetOutputSize()); @@ -1802,11 +1802,11 @@ private: const double fHorz = (double) aPrintSize.Width() / aPageSize.Width(); const double fVert = (double) aPrintSize.Height() / aPageSize.Height(); - boost::rational<long> aFract; + Fraction aFract; if ( fHorz < fVert ) - aFract = boost::rational<long>(aPrintSize.Width(), aPageSize.Width()); + aFract = Fraction(aPrintSize.Width(), aPageSize.Width()); else - aFract = boost::rational<long>(aPrintSize.Height(), aPageSize.Height()); + aFract = Fraction(aPrintSize.Height(), aPageSize.Height()); aMap.SetScaleX(aFract); aMap.SetScaleY(aFract); @@ -1930,11 +1930,11 @@ private: const double fHorz ((double) rInfo.maPrintSize.Width() / aPageSize.Width()); const double fVert ((double) rInfo.maPrintSize.Height() / aPageSize.Height()); - boost::rational<long> aFract; + Fraction aFract; if (fHorz < fVert) - aFract = boost::rational<long>(rInfo.maPrintSize.Width(), aPageSize.Width()); + aFract = Fraction(rInfo.maPrintSize.Width(), aPageSize.Width()); else - aFract = boost::rational<long>(rInfo.maPrintSize.Height(), aPageSize.Height()); + aFract = Fraction(rInfo.maPrintSize.Height(), aPageSize.Height()); aMap.SetScaleX(aFract); aMap.SetScaleY(aFract); @@ -2012,8 +2012,8 @@ private: } MapMode aMap (rInfo.maMap); - aMap.SetScaleX( boost::rational<long>( aPageSize_2.Width(), rInfo.maPageSize.Width() ) ); - aMap.SetScaleY( boost::rational<long>( aPageSize_2.Height(), rInfo.maPageSize.Height() ) ); + aMap.SetScaleX( Fraction( aPageSize_2.Width(), rInfo.maPageSize.Width() ) ); + aMap.SetScaleY( Fraction( aPageSize_2.Height(), rInfo.maPageSize.Height() ) ); // calculate adjusted print size const Size aAdjustedPrintSize (OutputDevice::LogicToLogic( diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 63d89849de5a..f2b51b9a9920 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -453,8 +453,8 @@ void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize) aSize.Height() -= (aBorder.Top() + aBorder.Bottom()); Size aObjSizePixel = mpImpl->mpViewWindow->LogicToPixel( aObjSize, MAP_100TH_MM ); SfxViewShell::SetZoomFactor( - boost::rational<long>( aSize.Width(), std::max( aObjSizePixel.Width(), (long int)1 ) ), - boost::rational<long>( aSize.Height(), std::max( aObjSizePixel.Height(), (long int)1) ) ); + Fraction( aSize.Width(), std::max( aObjSizePixel.Width(), (long int)1 ) ), + Fraction( aSize.Height(), std::max( aObjSizePixel.Height(), (long int)1) ) ); } mpImpl->ResizePixel(rOrigin, rSize, false); @@ -735,8 +735,8 @@ void ViewShellBase::Deactivate (bool bIsMDIActivate) } void ViewShellBase::SetZoomFactor ( - const boost::rational<long>& rZoomX, - const boost::rational<long>& rZoomY) + const Fraction &rZoomX, + const Fraction &rZoomY) { SfxViewShell::SetZoomFactor (rZoomX, rZoomY); // Forward call to main sub shell. diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 8dd8d031990a..8bf432bdf44e 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -500,7 +500,7 @@ SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin, bool bIsFirst) // ... and also set DefTab at the ruler pRuler->SetDefTabDist( GetDoc()->GetDefaultTabulator() ); // new - boost::rational<long> aUIScale(pWin->GetMapMode().GetScaleX()); + Fraction aUIScale(pWin->GetMapMode().GetScaleX()); aUIScale *= GetDoc()->GetUIScale(); pRuler->SetZoom(aUIScale); @@ -529,7 +529,7 @@ SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin) pRuler->SetUnit( FieldUnit( nMetric ) ); - boost::rational<long> aUIScale(pWin->GetMapMode().GetScaleY()); + Fraction aUIScale(pWin->GetMapMode().GetScaleY()); aUIScale *= GetDoc()->GetUIScale(); pRuler->SetZoom(aUIScale); diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 9c9a151c08c1..bad2da97c85c 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -440,7 +440,7 @@ void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin) /** * adjust zoom factor for InPlace */ -void DrawViewShell::SetZoomFactor(const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY) +void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY) { ViewShell::SetZoomFactor(rZoomX, rZoomY); mbZoomOnPage = false; diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 4f12613fdd7a..09d43cb373ea 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -644,9 +644,9 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) { Point aPos = GetActiveWindow()->PixelToLogic(maMousePos); pPageView->LogicToPagePos(aPos); - boost::rational<long> aUIScale(GetDoc()->GetUIScale()); - aPos.X() = boost::rational_cast<long>(aPos.X() / aUIScale); - aPos.Y() = boost::rational_cast<long>(aPos.Y() / aUIScale); + Fraction aUIScale(GetDoc()->GetUIScale()); + aPos.X() = Fraction(aPos.X()) / aUIScale; + aPos.Y() = Fraction(aPos.Y()) / aUIScale; // position- and size items if ( mpDrawView->IsAction() ) @@ -660,12 +660,12 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) { pPageView->LogicToPagePos(aRect); aPos = aRect.TopLeft(); - aPos.X() = boost::rational_cast<long>(aPos.X() / aUIScale); - aPos.Y() = boost::rational_cast<long>(aPos.Y() / aUIScale); + aPos.X() = Fraction(aPos.X()) / aUIScale; + aPos.Y() = Fraction(aPos.Y()) / aUIScale; rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) ); Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ); - aSize.Height() = boost::rational_cast<long>(aSize.Height() / aUIScale); - aSize.Width() = boost::rational_cast<long>(aSize.Width() / aUIScale); + aSize.Height() = Fraction(aSize.Height()) / aUIScale; + aSize.Width() = Fraction(aSize.Width()) / aUIScale; rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) ); } } @@ -678,13 +678,13 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) // Show the position of the selected shape(s) Point aShapePosition (aRect.TopLeft()); - aShapePosition.X() = boost::rational_cast<long>(aShapePosition.X() / aUIScale); - aShapePosition.Y() = boost::rational_cast<long>(aShapePosition.Y() / aUIScale); + aShapePosition.X() = Fraction(aShapePosition.X()) / aUIScale; + aShapePosition.Y() = Fraction(aShapePosition.Y()) / aUIScale; rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition)); Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ); - aSize.Height() = boost::rational_cast<long>(aSize.Height() / aUIScale); - aSize.Width() = boost::rational_cast<long>(aSize.Width() / aUIScale); + aSize.Height() = Fraction(aSize.Height()) / aUIScale; + aSize.Width() = Fraction(aSize.Width()) / aUIScale; rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) ); } else diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index 470866dffd38..8ce1f57dad2b 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -202,7 +202,7 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK * maVisibleLayers.SetAll(); maPrintableLayers.SetAll(); SetGridCoarse( Size( 1000, 1000 ) ); - SetSnapGridWidth(boost::rational<long>(1000, 1), boost::rational<long>(1000, 1)); + SetSnapGridWidth(Fraction(1000, 1), Fraction(1000, 1)); SetActiveLayer( SD_RESSTR(STR_LAYER_LAYOUT) ); mbNoColors = true; mbNoAttribs = false; @@ -302,8 +302,8 @@ void FrameView::Update(SdOptions* pOptions) SetGridCoarse( Size( pOptions->GetFldDrawX(), pOptions->GetFldDrawY() ) ); SetGridFine( Size( pOptions->GetFldDivisionX(), pOptions->GetFldDivisionY() ) ); - boost::rational<long> aFractX(pOptions->GetFldDrawX(), pOptions->GetFldDrawX() / ( pOptions->GetFldDivisionX() ? pOptions->GetFldDivisionX() : 1 )); - boost::rational<long> aFractY(pOptions->GetFldDrawY(), pOptions->GetFldDrawY() / ( pOptions->GetFldDivisionY() ? pOptions->GetFldDivisionY() : 1 )); + Fraction aFractX(pOptions->GetFldDrawX(), pOptions->GetFldDrawX() / ( pOptions->GetFldDivisionX() ? pOptions->GetFldDivisionX() : 1 )); + Fraction aFractY(pOptions->GetFldDrawY(), pOptions->GetFldDrawY() / ( pOptions->GetFldDivisionY() ? pOptions->GetFldDivisionY() : 1 )); SetSnapGridWidth(aFractX, aFractY); SetQuickEdit(pOptions->IsQuickEdit()); @@ -464,10 +464,10 @@ void FrameView::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com: aUserData.addValue( sUNO_View_GridCoarseHeight, makeAny( (sal_Int32)GetGridCoarse().Height() ) ); aUserData.addValue( sUNO_View_GridFineWidth, makeAny( (sal_Int32)GetGridFine().Width() ) ); aUserData.addValue( sUNO_View_GridFineHeight, makeAny( (sal_Int32)GetGridFine().Height() ) ); - aUserData.addValue( sUNO_View_GridSnapWidthXNumerator, makeAny( (sal_Int32)GetSnapGridWidthX().numerator() ) ); - aUserData.addValue( sUNO_View_GridSnapWidthXDenominator, makeAny( (sal_Int32)GetSnapGridWidthX().denominator() ) ); - aUserData.addValue( sUNO_View_GridSnapWidthYNumerator, makeAny( (sal_Int32)GetSnapGridWidthY().numerator() ) ); - aUserData.addValue( sUNO_View_GridSnapWidthYDenominator, makeAny( (sal_Int32)GetSnapGridWidthY().denominator() ) ); + aUserData.addValue( sUNO_View_GridSnapWidthXNumerator, makeAny( (sal_Int32)GetSnapGridWidthX().GetNumerator() ) ); + aUserData.addValue( sUNO_View_GridSnapWidthXDenominator, makeAny( (sal_Int32)GetSnapGridWidthX().GetDenominator() ) ); + aUserData.addValue( sUNO_View_GridSnapWidthYNumerator, makeAny( (sal_Int32)GetSnapGridWidthY().GetNumerator() ) ); + aUserData.addValue( sUNO_View_GridSnapWidthYDenominator, makeAny( (sal_Int32)GetSnapGridWidthY().GetDenominator() ) ); aUserData.addValue( sUNO_View_IsAngleSnapEnabled, makeAny( IsAngleSnapEnabled() ) ); aUserData.addValue( sUNO_View_SnapAngle, makeAny( (sal_Int32)GetSnapAngle() ) ); @@ -561,11 +561,11 @@ void FrameView::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < : sal_Int16 nInt16 = 0; OUString aString; - sal_Int32 aSnapGridWidthXNum = GetSnapGridWidthX().numerator(); - sal_Int32 aSnapGridWidthXDom = GetSnapGridWidthX().denominator(); + sal_Int32 aSnapGridWidthXNum = GetSnapGridWidthX().GetNumerator(); + sal_Int32 aSnapGridWidthXDom = GetSnapGridWidthX().GetDenominator(); - sal_Int32 aSnapGridWidthYNum = GetSnapGridWidthY().numerator(); - sal_Int32 aSnapGridWidthYDom = GetSnapGridWidthY().denominator(); + sal_Int32 aSnapGridWidthYNum = GetSnapGridWidthY().GetNumerator(); + sal_Int32 aSnapGridWidthYDom = GetSnapGridWidthY().GetDenominator(); const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray(); for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ ) @@ -916,8 +916,8 @@ void FrameView::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < : default: SetViewShEditModeOnLoad(EM_PAGE); break; } - const boost::rational<long> aSnapGridWidthX( aSnapGridWidthXNum, aSnapGridWidthXDom ); - const boost::rational<long> aSnapGridWidthY( aSnapGridWidthYNum, aSnapGridWidthYDom ); + const Fraction aSnapGridWidthX( aSnapGridWidthXNum, aSnapGridWidthXDom ); + const Fraction aSnapGridWidthY( aSnapGridWidthYNum, aSnapGridWidthYDom ); SetSnapGridWidth( aSnapGridWidthX, aSnapGridWidthY ); } diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index fabc2aa506a8..899506492db4 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -876,8 +876,8 @@ void View::SetMarkedOriginalSize() Rectangle aDrawRect( pObj->GetLogicRect() ); pUndoGroup->AddAction( mrDoc.GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) ); - pObj->Resize( aDrawRect.TopLeft(), boost::rational<long>( aOleSize.Width(), aDrawRect.GetWidth() ), - boost::rational<long>( aOleSize.Height(), aDrawRect.GetHeight() ) ); + pObj->Resize( aDrawRect.TopLeft(), Fraction( aOleSize.Width(), aDrawRect.GetWidth() ), + Fraction( aOleSize.Height(), aDrawRect.GetHeight() ) ); } } } @@ -938,10 +938,10 @@ void View::DoConnect(SdrOle2Obj* pObj) MapMode aMapMode( mrDoc.GetScaleUnit() ); Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode ); - boost::rational<long> aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() ); - boost::rational<long> aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() ); - rational_ReduceInaccurate(aScaleWidth, 10); // compatible to SdrOle2Obj - rational_ReduceInaccurate(aScaleHeight, 10); + Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() ); + Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() ); + aScaleWidth.ReduceInaccurate(10); // compatible to SdrOle2Obj + aScaleHeight.ReduceInaccurate(10); pSdClient->SetSizeScale(aScaleWidth, aScaleHeight); // visible area is only changed in-place! diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 3524a77565d2..c620601d1d0f 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -703,8 +703,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, Rectangle aObjRect( pNewObj->GetCurrentBoundRect() ); Size aObjSize( aObjRect.GetSize() ); - boost::rational<long> aScaleWidth( aPickObjSize.Width(), aObjSize.Width() ); - boost::rational<long> aScaleHeight( aPickObjSize.Height(), aObjSize.Height() ); + Fraction aScaleWidth( aPickObjSize.Width(), aObjSize.Width() ); + Fraction aScaleHeight( aPickObjSize.Height(), aObjSize.Height() ); pNewObj->NbcResize( aObjRect.TopLeft(), aScaleWidth, aScaleHeight ); aVec -= aObjRect.TopLeft(); diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index e0a48d4f1cc2..f139a3695e39 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -228,8 +228,8 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, Rectangle aObjRect(pNewGrafObj->GetCurrentBoundRect()); Size aObjSize(aObjRect.GetSize()); - boost::rational<long> aScaleWidth(aPickObjSize.Width(), aObjSize.Width()); - boost::rational<long> aScaleHeight(aPickObjSize.Height(), aObjSize.Height()); + Fraction aScaleWidth(aPickObjSize.Width(), aObjSize.Width()); + Fraction aScaleHeight(aPickObjSize.Height(), aObjSize.Height()); pNewGrafObj->NbcResize(aObjRect.TopLeft(), aScaleWidth, aScaleHeight); Point aVec = aPickObjRect.TopLeft() - aObjRect.TopLeft(); diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 49149706a986..46bf5e8ddb7b 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -179,10 +179,10 @@ void Window::SetMaxZoom (long int nMax) long Window::GetZoom (void) const { - if( GetMapMode().GetScaleX().denominator() ) + if( GetMapMode().GetScaleX().GetDenominator() ) { - return GetMapMode().GetScaleX().numerator() * 100L - / GetMapMode().GetScaleX().denominator(); + return GetMapMode().GetScaleX().GetNumerator() * 100L + / GetMapMode().GetScaleX().GetDenominator(); } else { @@ -318,8 +318,8 @@ long Window::SetZoomFactor(long nZoom) // Set the zoom factor at the window's map mode. MapMode aMap(GetMapMode()); - aMap.SetScaleX(boost::rational<long>(nZoom, 100)); - aMap.SetScaleY(boost::rational<long>(nZoom, 100)); + aMap.SetScaleX(Fraction(nZoom, 100)); + aMap.SetScaleY(Fraction(nZoom, 100)); SetMapMode(aMap); // invalidate previous size - it was relative to the old scaling diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 2a860c2e683b..ebe69a158524 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -332,7 +332,7 @@ void ViewShell::Scroll(long nScrollX, long nScrollY) */ void ViewShell::SetZoom(long nZoom) { - boost::rational<long> aUIScale(nZoom, 100); + Fraction aUIScale(nZoom, 100); aUIScale *= GetDoc()->GetUIScale(); if (mpHorizontalRuler.get() != NULL) @@ -372,7 +372,7 @@ void ViewShell::SetZoom(long nZoom) void ViewShell::SetZoomRect(const Rectangle& rZoomRect) { long nZoom = GetActiveWindow()->SetZoomRect(rZoomRect); - boost::rational<long> aUIScale(nZoom, 100); + Fraction aUIScale(nZoom, 100); aUIScale *= GetDoc()->GetUIScale(); Point aPos = GetActiveWindow()->GetWinViewPos(); @@ -624,9 +624,9 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize, /** * Set zoom factor for InPlace */ -void ViewShell::SetZoomFactor(const boost::rational<long>& rZoomX, const boost::rational<long>&) +void ViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction&) { - long nZoom = (long)(boost::rational_cast<double>(rZoomX) * 100); + long nZoom = (long)((double) rZoomX * 100); SetZoom(nZoom); } @@ -843,10 +843,10 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) if( pObj->IsChart() ) //charts never should be stretched see #i84323# for example aObjAreaSize = aDrawSize; - boost::rational<long> aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() ); - boost::rational<long> aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() ); - rational_ReduceInaccurate(aScaleWidth, 10); // kompatibel zum SdrOle2Obj - rational_ReduceInaccurate(aScaleHeight, 10); + Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() ); + Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() ); + aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj + aScaleHeight.ReduceInaccurate(10); pSdClient->SetSizeScale(aScaleWidth, aScaleHeight); // visible section is only changed in-place! |