diff options
Diffstat (limited to 'sc/source/ui/view')
24 files changed, 153 insertions, 155 deletions
diff --git a/sc/source/ui/view/drawutil.cxx b/sc/source/ui/view/drawutil.cxx index 668337aac0da..21840f50ffaf 100644 --- a/sc/source/ui/view/drawutil.cxx +++ b/sc/source/ui/view/drawutil.cxx @@ -27,9 +27,9 @@ void ScDrawUtil::CalcScale( ScDocument* pDoc, SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, OutputDevice* pDev, - const Fraction& rZoomX, const Fraction& rZoomY, + const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY, double nPPTX, double nPPTY, - Fraction& rScaleX, Fraction& rScaleY ) + boost::rational<long>& rScaleX, boost::rational<long>& rScaleY ) { long nPixelX = 0; long nTwipsX = 0; @@ -63,27 +63,27 @@ void ScDrawUtil::CalcScale( ScDocument* pDoc, SCTAB nTab, // because ReduceInaccurate is called later anyway. if ( aPixelLog.X() && nTwipsX ) - rScaleX = Fraction( ((double)aPixelLog.X()) * - ((double)rZoomX.GetNumerator()) / + rScaleX = rational_FromDouble( ((double)aPixelLog.X()) * + ((double)rZoomX.numerator()) / ((double)nTwipsX) / ((double)HMM_PER_TWIPS) / - ((double)rZoomX.GetDenominator()) ); + ((double)rZoomX.denominator()) ); else - rScaleX = Fraction( 1, 1 ); + rScaleX = boost::rational<long>( 1, 1 ); if ( aPixelLog.Y() && nTwipsY ) - rScaleY = Fraction( ((double)aPixelLog.Y()) * - ((double)rZoomY.GetNumerator()) / + rScaleY = rational_FromDouble( ((double)aPixelLog.Y()) * + ((double)rZoomY.numerator()) / ((double)nTwipsY) / ((double)HMM_PER_TWIPS) / - ((double)rZoomY.GetDenominator()) ); + ((double)rZoomY.denominator()) ); else - rScaleY = Fraction( 1, 1 ); + rScaleY = boost::rational<long>( 1, 1 ); // 25 bits of accuracy are needed to always hit the right part of // cells in the last rows (was 17 before 1M rows). - rScaleX.ReduceInaccurate( 25 ); - rScaleY.ReduceInaccurate( 25 ); + rational_ReduceInaccurate(rScaleX, 25); + rational_ReduceInaccurate(rScaleY, 25); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 08a3565d28ca..6a8add5ccc4e 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -437,7 +437,7 @@ uno::Reference<datatransfer::XTransferable> ScDrawView::CopyToTransferable() // Korrektur fuer 100% berechnen, unabhaengig von momentanen Einstellungen -void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const +void ScDrawView::CalcNormScale( boost::rational<long>& rFractX, boost::rational<long>& rFractY ) const { double nPPTX = ScGlobal::nScreenPPTX; double nPPTY = ScGlobal::nScreenPPTY; @@ -453,7 +453,7 @@ void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const if (nEndRow<20) nEndRow = 1000; - Fraction aZoom(1,1); + boost::rational<long> aZoom(1,1); ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev, aZoom,aZoom, nPPTX, nPPTY, rFractX,rFractY ); } @@ -513,7 +513,7 @@ void ScDrawView::SetMarkedOriginalSize() { // Pixel-Korrektur beruecksichtigen, damit Bitmap auf dem Bildschirm stimmt - Fraction aNormScaleX, aNormScaleY; + boost::rational<long> aNormScaleX, aNormScaleY; CalcNormScale( aNormScaleX, aNormScaleY ); aDestMap.SetScaleX(aNormScaleX); aDestMap.SetScaleY(aNormScaleY); @@ -535,8 +535,8 @@ void ScDrawView::SetMarkedOriginalSize() Rectangle aDrawRect = pObj->GetLogicRect(); pUndoGroup->AddAction( new SdrUndoGeoObj( *pObj ) ); - pObj->Resize( aDrawRect.TopLeft(), Fraction( aOriginalSize.Width(), aDrawRect.GetWidth() ), - Fraction( aOriginalSize.Height(), aDrawRect.GetHeight() ) ); + pObj->Resize( aDrawRect.TopLeft(), boost::rational<long>( aOriginalSize.Width(), aDrawRect.GetWidth() ), + boost::rational<long>( aOriginalSize.Height(), aDrawRect.GetHeight() ) ); ++nDone; } } diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 718091033af3..00e31a2910d0 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -286,7 +286,7 @@ void ScDrawView::DoCut() EndUndo(); } -void ScDrawView::GetScale( Fraction& rFractX, Fraction& rFractY ) const +void ScDrawView::GetScale( boost::rational<long>& rFractX, boost::rational<long>& rFractY ) const { rFractX = aScaleX; rFractY = aScaleY; @@ -296,8 +296,8 @@ void ScDrawView::RecalcScale() { double nPPTX; double nPPTY; - Fraction aZoomX(1,1); - Fraction aZoomY(1,1); + boost::rational<long> aZoomX(1,1); + boost::rational<long> aZoomY(1,1); if (pViewData) { @@ -614,8 +614,8 @@ void ScDrawView::UpdateUserViewOptions() SetSnapEnabled( rGrid.GetUseGridSnap() ); SetGridSnap( rGrid.GetUseGridSnap() ); - Fraction aFractX( rGrid.GetFldDrawX(), rGrid.GetFldDivisionX() + 1 ); - Fraction aFractY( rGrid.GetFldDrawY(), rGrid.GetFldDivisionY() + 1 ); + boost::rational<long> aFractX( rGrid.GetFldDrawX(), rGrid.GetFldDivisionX() + 1 ); + boost::rational<long> aFractY( rGrid.GetFldDrawY(), rGrid.GetFldDivisionY() + 1 ); SetSnapGridWidth( aFractX, aFractY ); SetGridCoarse( Size( rGrid.GetFldDrawX(), rGrid.GetFldDrawY() ) ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index e0d5b7a604e1..219adb2f3977 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4625,8 +4625,8 @@ void ScGridWindow::UpdateFormulas() ScTableInfo aTabInfo; rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, nPPTX, nPPTY, false, false ); - Fraction aZoomX = pViewData->GetZoomX(); - Fraction aZoomY = pViewData->GetZoomY(); + boost::rational<long> aZoomX = pViewData->GetZoomX(); + boost::rational<long> aZoomY = pViewData->GetZoomY(); ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index e9ac6ca2054a..9cbaa2a9139b 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -247,8 +247,8 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce ) ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); if ( pDrView || bForce ) { - Fraction aScaleX; - Fraction aScaleY; + boost::rational<long> aScaleX; + boost::rational<long> aScaleY; if (pDrView) pDrView->GetScale( aScaleX, aScaleY ); else diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 0991b7e5bed5..56f35ecb4496 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -77,7 +77,7 @@ static void lcl_LimitRect( Rectangle& rRect, const Rectangle& rVisible ) static void lcl_DrawOneFrame( OutputDevice* pDev, const Rectangle& rInnerPixel, const OUString& rTitle, const Color& rColor, bool bTextBelow, - double nPPTX, double nPPTY, const Fraction& rZoomY, + double nPPTX, double nPPTY, const boost::rational<long>& rZoomY, ScDocument* pDoc, ScViewData* pButtonViewData, bool bLayoutRTL ) { // pButtonViewData wird nur benutzt, um die Button-Groesse zu setzen, @@ -132,8 +132,8 @@ static void lcl_DrawOneFrame( OutputDevice* pDev, const Rectangle& rInnerPixel, ScDDComboBoxButton aComboButton((vcl::Window*)pDev); aComboButton.SetOptSizePixel(); - long nBWidth = ( aComboButton.GetSizePixel().Width() * rZoomY.GetNumerator() ) - / rZoomY.GetDenominator(); + long nBWidth = ( aComboButton.GetSizePixel().Width() * rZoomY.numerator() ) + / rZoomY.denominator(); long nBHeight = nVer + aTextSize.Height() + 1; Size aButSize( nBWidth, nBHeight ); long nButtonPos = bLayoutRTL ? aOuter.Left() : aOuter.Right()-nBWidth+1; @@ -470,8 +470,8 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod nPPTX, nPPTY, false, bFormulaMode, &pViewData->GetMarkData() ); - Fraction aZoomX = pViewData->GetZoomX(); - Fraction aZoomY = pViewData->GetZoomY(); + boost::rational<long> aZoomX = pViewData->GetZoomX(); + boost::rational<long> aZoomY = pViewData->GetZoomY(); ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 1e94298dc046..617288e69ef2 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -145,7 +145,7 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType, SCTAB nNewTab, long nNewScrX, long nNewScrY, SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW nNewY2, double nPixelPerTwipsX, double nPixelPerTwipsY, - const Fraction* pZoomX, const Fraction* pZoomY ) : + const boost::rational<long>* pZoomX, const boost::rational<long>* pZoomY ) : mpDev( pNewDev ), mpRefDevice( pNewDev ), // default is output device pFmtDevice( pNewDev ), // default is output device @@ -193,11 +193,11 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType, if (pZoomX) aZoomX = *pZoomX; else - aZoomX = Fraction(1,1); + aZoomX = boost::rational<long>(1,1); if (pZoomY) aZoomY = *pZoomY; else - aZoomY = Fraction(1,1); + aZoomY = boost::rational<long>(1,1); nVisX1 = nX1; nVisY1 = nY1; diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 9f7e48ff2276..a5a9af577aae 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -231,7 +231,7 @@ void ScDrawStringsVars::SetShrinkScale( long nScale, sal_uInt8 nScript ) // call GetFont with a modified fraction, use only the height - Fraction aFraction( nScale, 100 ); + boost::rational<long> aFraction( nScale, 100 ); if ( !bPixelToLogic ) aFraction *= pOutput->aZoomY; vcl::Font aTmpFont; @@ -810,12 +810,12 @@ double ScOutputData::GetStretch() if ( mpRefDevice == pFmtDevice ) { MapMode aOld = mpRefDevice->GetMapMode(); - return ((double)aOld.GetScaleY()) / ((double)aOld.GetScaleX()) * ((double)aZoomY) / ((double)aZoomX); + return boost::rational_cast<double>(aOld.GetScaleY()) / boost::rational_cast<double>(aOld.GetScaleX()) * boost::rational_cast<double>(this->aZoomY) / boost::rational_cast<double>(this->aZoomX); } else { // when formatting for printer, device map mode has already been taken care of - return ((double)aZoomY) / ((double)aZoomX); + return boost::rational_cast<double>(this->aZoomY) / boost::rational_cast<double>(this->aZoomX); } } @@ -2787,7 +2787,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) // #i85342# screen display and formatting for printer, // use same GetEditArea call as in ScViewData::SetEditEngine - Fraction aFract(1,1); + boost::rational<long> aFract(1,1); Rectangle aUtilRect = ScEditUtil( mpDoc, rParam.mnCellX, rParam.mnCellY, nTab, Point(0,0), pFmtDevice, HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( rParam.mpPattern, false ); aLogicSize.Width() = aUtilRect.GetWidth(); @@ -3809,7 +3809,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) // #i85342# screen display and formatting for printer, // use same GetEditArea call as in ScViewData::SetEditEngine - Fraction aFract(1,1); + boost::rational<long> aFract(1,1); Rectangle aUtilRect = ScEditUtil( mpDoc, rParam.mnCellX, rParam.mnCellY, nTab, Point(0,0), pFmtDevice, HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( rParam.mpPattern, false ); aLogicSize.Width() = aUtilRect.GetWidth(); @@ -4165,7 +4165,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) // #i85342# screen display and formatting for printer, // use same GetEditArea call as in ScViewData::SetEditEngine - Fraction aFract(1,1); + boost::rational<long> aFract(1,1); Rectangle aUtilRect = ScEditUtil( mpDoc, rParam.mnCellX, rParam.mnCellY, nTab, Point(0,0), pFmtDevice, HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( rParam.mpPattern, false ); aLogicSize.Width() = aUtilRect.GetWidth(); diff --git a/sc/source/ui/view/overlayobject.cxx b/sc/source/ui/view/overlayobject.cxx index 778e44f0dfe0..1e2fe00972fd 100644 --- a/sc/source/ui/view/overlayobject.cxx +++ b/sc/source/ui/view/overlayobject.cxx @@ -20,7 +20,6 @@ #include "overlayobject.hxx" #include <vcl/outdev.hxx> #include <vcl/lineinfo.hxx> -#include <tools/fract.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index e7cad9911d72..e7b50e8993ee 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -344,8 +344,8 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) UpdateDrawView(); // Spreedsheet eventually changes } - Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + boost::rational<long> aPreviewZoom( nZoom, 100 ); + boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); bool bDoPrint = ( pFillLocation == NULL ); @@ -732,8 +732,8 @@ void ScPreview::SetZoom(sal_uInt16 nNewZoom) // apply new MapMode and call UpdateScrollBars to update aOffset - Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + boost::rational<long> aPreviewZoom( nZoom, 100 ); + boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); @@ -961,8 +961,8 @@ void ScPreview::DataChanged( const DataChangedEvent& rDCEvt ) void ScPreview::MouseButtonDown( const MouseEvent& rMEvt ) { - Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + boost::rational<long> aPreviewZoom( nZoom, 100 ); + boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); aButtonDownChangePoint = PixelToLogic( rMEvt.GetPosPixel(),aMMMode ); @@ -1044,8 +1044,8 @@ void ScPreview::MouseButtonDown( const MouseEvent& rMEvt ) void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) { - Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + boost::rational<long> aPreviewZoom( nZoom, 100 ); + boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); aButtonUpPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode ); @@ -1294,8 +1294,8 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) void ScPreview::MouseMove( const MouseEvent& rMEvt ) { - Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + boost::rational<long> aPreviewZoom( nZoom, 100 ); + boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); Point aMouseMovePoint = PixelToLogic( rMEvt.GetPosPixel(), aMMMode ); @@ -1540,8 +1540,8 @@ void ScPreview::SwitchView() void ScPreview::DragMove( long nDragMovePos, sal_uInt16 nFlags ) { - Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + boost::rational<long> aPreviewZoom( nZoom, 100 ); + boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); long nPos = nDragMovePos; diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index bb379604e695..0e2bda3c4421 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -1593,7 +1593,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, if ( !pPrinter ) { OutputDevice* pRefDev = pDoc->GetPrinter(); // use the printer also for Preview - Fraction aPrintFrac( nZoom, 100 ); // without nManualZoom + boost::rational<long> aPrintFrac( nZoom, 100 ); // without nManualZoom // MapMode, as it would arrive at the printer: pRefDev->SetMapMode( MapMode( MAP_100TH_MM, Point(), aPrintFrac, aPrintFrac ) ); @@ -2543,13 +2543,13 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc. long nEffZoom = nZoom * (long) nManualZoom; nScaleX = nScaleY = HMM_PER_TWIPS; // output in 1/100 mm - Fraction aZoomFract( nEffZoom,10000 ); - Fraction aHorFract = aZoomFract; + boost::rational<long> aZoomFract( nEffZoom,10000 ); + boost::rational<long> aHorFract = aZoomFract; if ( !pPrinter && !bIsRender ) // adjust scale for preview { double nFact = pDocShell->GetOutputFactor(); - aHorFract = Fraction( (long)( nEffZoom / nFact ), 10000 ); + aHorFract = boost::rational<long>( long( nEffZoom / nFact ), 10000 ); } aLogicMode = MapMode( MAP_100TH_MM, Point(), aHorFract, aZoomFract ); @@ -2557,7 +2557,7 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc. Point aLogicOfs( -aOffset.X(), -aOffset.Y() ); aOffsetMode = MapMode( MAP_100TH_MM, aLogicOfs, aHorFract, aZoomFract ); - Point aTwipsOfs( (long) ( -aOffset.X() / nScaleX + 0.5 ), (long) ( -aOffset.Y() / nScaleY + 0.5 ) ); + Point aTwipsOfs( long( -aOffset.X() / nScaleX + 0.5 ), long( -aOffset.Y() / nScaleY + 0.5 ) ); aTwipMode = MapMode( MAP_TWIP, aTwipsOfs, aHorFract, aZoomFract ); } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 9150af64bee9..6802dd0e7bf7 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -697,11 +697,11 @@ void ScTabView::UpdateVarZoom() if ( eZoomType != SVX_ZOOM_PERCENT && !bInZoomUpdate ) { bInZoomUpdate = true; - const Fraction& rOldX = GetViewData().GetZoomX(); - const Fraction& rOldY = GetViewData().GetZoomY(); - long nOldPercent = ( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator(); + const boost::rational<long>& rOldX = GetViewData().GetZoomX(); + const boost::rational<long>& rOldY = GetViewData().GetZoomY(); + long nOldPercent = ( rOldY.numerator() * 100 ) / rOldY.denominator(); sal_uInt16 nNewZoom = CalcZoom( eZoomType, (sal_uInt16)nOldPercent ); - Fraction aNew( nNewZoom, 100 ); + boost::rational<long> aNew( nNewZoom, 100 ); if ( aNew != rOldX || aNew != rOldY ) { @@ -924,8 +924,8 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos ) // for ole inplace editing, the scale is defined by the visarea and client size // and can't be changed directly - const Fraction& rOldY = aViewData.GetZoomY(); - long nOld = (long)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator()); + const boost::rational<long>& rOldY = aViewData.GetZoomY(); + long nOld = long(( rOldY.numerator() * 100 ) / rOldY.denominator()); long nNew = nOld; if ( pData->GetMode() == COMMAND_WHEEL_ZOOM_SCALE ) { @@ -943,7 +943,7 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos ) bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom(); SetZoomType( SVX_ZOOM_PERCENT, bSyncZoom ); - Fraction aFract( nNew, 100 ); + boost::rational<long> aFract( nNew, 100 ); SetZoom( aFract, aFract, bSyncZoom ); PaintGrid(); PaintTop(); diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index c79d356065ae..e19348adeed2 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -1111,7 +1111,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCCOL nFixPosX, SCROW nFixPosY ) { - double fZoomFactor = (double)Fraction(nZoom,100); + double fZoomFactor = boost::rational_cast<double>(boost::rational<long>(nZoom, 100)); fScaleX *= fZoomFactor; fScaleY *= fZoomFactor; diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 028a5ff6cce9..749f542747d4 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2337,8 +2337,8 @@ void ScTabView::RecalcPPT() // call view SetZoom (including draw scale, split update etc) // and paint only if values changed - Fraction aZoomX = aViewData.GetZoomX(); - Fraction aZoomY = aViewData.GetZoomY(); + boost::rational<long> aZoomX = aViewData.GetZoomX(); + boost::rational<long> aZoomY = aViewData.GetZoomY(); SetZoom( aZoomX, aZoomY, false ); PaintGrid(); diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 4f263d61a450..e5acb09e0b92 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -370,7 +370,7 @@ void ScTabView::SetZoomType( SvxZoomType eNew, bool bAll ) aViewData.SetZoomType( eNew, bAll ); } -void ScTabView::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll ) +void ScTabView::SetZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY, bool bAll ) { aViewData.SetZoom( rNewX, rNewY, bAll ); if (pDrawView) diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index d32a366b4880..571532633499 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -627,9 +627,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom(); SvxZoomType eOldZoomType = GetZoomType(); SvxZoomType eNewZoomType = eOldZoomType; - const Fraction& rOldY = GetViewData().GetZoomY(); // Y wird angezeigt - sal_uInt16 nOldZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 ) - / rOldY.GetDenominator()); + const boost::rational<long>& rOldY = GetViewData().GetZoomY(); // Y wird angezeigt + sal_uInt16 nOldZoom = (sal_uInt16)(( rOldY.numerator() * 100 ) + / rOldY.denominator()); sal_uInt16 nZoom = nOldZoom; bool bCancel = false; @@ -720,7 +720,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) aNewOpt.SetZoomType( GetZoomType() ); pScMod->SetAppOptions( aNewOpt ); } - Fraction aFract( nZoom, 100 ); + boost::rational<long> aFract( nZoom, 100 ); SetZoom( aFract, aFract, bSyncZoom ); PaintGrid(); PaintTop(); @@ -749,7 +749,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) aNewOpt.SetZoomType( GetZoomType() ); pScMod->SetAppOptions( aNewOpt ); } - Fraction aFract( nCurrentZoom,100 ); + boost::rational<long> aFract( nCurrentZoom,100 ); SetZoom( aFract, aFract, bSyncZoom ); PaintGrid(); PaintTop(); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index f04e93174755..b3c558d9ece0 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -333,8 +333,8 @@ void ScTabViewShell::UpdateOleZoom() { vcl::Window* pWin = GetActiveWin(); Size aWinHMM = pWin->PixelToLogic( pWin->GetOutputSizePixel(), MAP_100TH_MM ); - SetZoomFactor( Fraction( aWinHMM.Width(),aObjSize.Width() ), - Fraction( aWinHMM.Height(),aObjSize.Height() ) ); + SetZoomFactor( boost::rational<long>( aWinHMM.Width(),aObjSize.Width() ), + boost::rational<long>( aWinHMM.Height(),aObjSize.Height() ) ); } } } @@ -362,8 +362,8 @@ void ScTabViewShell::InnerResizePixel( const Point &rOfs, const Size &rSize ) if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 ) { Size aLogicSize = GetWindow()->PixelToLogic( aSize, MAP_100TH_MM ); - SfxViewShell::SetZoomFactor( Fraction( aLogicSize.Width(),aObjSize.Width() ), - Fraction( aLogicSize.Height(),aObjSize.Height() ) ); + SfxViewShell::SetZoomFactor( boost::rational<long>( aLogicSize.Width(),aObjSize.Width() ), + boost::rational<long>( aLogicSize.Height(),aObjSize.Height() ) ); } Point aPos( rOfs ); @@ -401,19 +401,19 @@ void ScTabViewShell::OuterResizePixel( const Point &rOfs, const Size &rSize ) ForceMove(); } -void ScTabViewShell::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) +void ScTabViewShell::SetZoomFactor( const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY ) { // fuer OLE... - Fraction aFrac20( 1,5 ); - Fraction aFrac400( 4,1 ); + boost::rational<long> aFrac20( 1,5 ); + boost::rational<long> aFrac400( 4,1 ); - Fraction aNewX( rZoomX ); + boost::rational<long> aNewX( rZoomX ); if ( aNewX < aFrac20 ) aNewX = aFrac20; if ( aNewX > aFrac400 ) aNewX = aFrac400; - Fraction aNewY( rZoomY ); + boost::rational<long> aNewY( rZoomY ); if ( aNewY < aFrac20 ) aNewY = aFrac20; if ( aNewY > aFrac400 ) @@ -1727,7 +1727,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, } else { - Fraction aFract( rAppOpt.GetZoom(), 100 ); + boost::rational<long> aFract( rAppOpt.GetZoom(), 100 ); SetZoom( aFract, aFract, true ); SetZoomType( rAppOpt.GetZoomType(), true ); } diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index adde73054bbb..5c2727a50667 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -287,9 +287,8 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) rSet.DisableItem( nWhich ); else { - const Fraction& rOldY = GetViewData().GetZoomY(); - sal_uInt16 nZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 ) - / rOldY.GetDenominator()); + const boost::rational<long>& rOldY = GetViewData().GetZoomY(); + sal_uInt16 nZoom = (sal_uInt16)(( rOldY.numerator() * 100 ) / rOldY.denominator()); rSet.Put( SvxZoomItem( SVX_ZOOM_PERCENT, nZoom, nWhich ) ); } break; @@ -300,8 +299,8 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) rSet.DisableItem( nWhich ); else { - const Fraction& rOldY = GetViewData().GetZoomY(); - sal_uInt16 nCurrentZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator()); + const boost::rational<long>& rOldY = GetViewData().GetZoomY(); + sal_uInt16 nCurrentZoom = (sal_uInt16)(( rOldY.numerator() * 100 ) / rOldY.denominator()); if( nCurrentZoom ) { diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 5e635b01fca9..e010c86f07ac 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -85,10 +85,10 @@ void ScTabViewShell::ConnectObject( SdrOle2Obj* pObj ) Size aOleSize = pObj->GetOrigObjSize(); - Fraction aScaleWidth (aDrawSize.Width(), aOleSize.Width() ); - Fraction aScaleHeight(aDrawSize.Height(), aOleSize.Height() ); - aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj - aScaleHeight.ReduceInaccurate(10); + boost::rational<long> aScaleWidth (aDrawSize.Width(), aOleSize.Width() ); + boost::rational<long> aScaleHeight(aDrawSize.Height(), aOleSize.Height() ); + rational_ReduceInaccurate(aScaleWidth, 10); // kompatibel zum SdrOle2Obj + rational_ReduceInaccurate(aScaleHeight, 10); pClient->SetSizeScale(aScaleWidth,aScaleHeight); // sichtbarer Ausschnitt wird nur inplace veraendert! @@ -145,17 +145,17 @@ bool ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) awt::Size aSz( aOleSize.Width(), aOleSize.Height() ); xObj->setVisualAreaSize( pClient->GetAspect(), aSz ); } - Fraction aOne( 1, 1 ); + boost::rational<long> aOne( 1, 1 ); pClient->SetSizeScale( aOne, aOne ); } else { // calculate scale from client and VisArea size - Fraction aScaleWidth (aDrawSize.Width(), aOleSize.Width() ); - Fraction aScaleHeight(aDrawSize.Height(), aOleSize.Height() ); - aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj - aScaleHeight.ReduceInaccurate(10); + boost::rational<long> aScaleWidth (aDrawSize.Width(), aOleSize.Width() ); + boost::rational<long> aScaleHeight(aDrawSize.Height(), aOleSize.Height() ); + rational_ReduceInaccurate(aScaleWidth, 10); // kompatibel zum SdrOle2Obj + rational_ReduceInaccurate(aScaleHeight, 10); pClient->SetSizeScale(aScaleWidth,aScaleHeight); } diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx index e427e1fae490..46503dae69a7 100644 --- a/sc/source/ui/view/tabvwshh.cxx +++ b/sc/source/ui/view/tabvwshh.cxx @@ -121,12 +121,12 @@ void ScTabViewShell::ExecuteObject( SfxRequest& rReq ) pDrView->MoveMarkedObj( Size( 0, nNewVal - aRect.Top() ) ); else if ( nSlotId == SID_OBJECT_WIDTH ) pDrView->ResizeMarkedObj( aRect.TopLeft(), - Fraction( nNewVal, aRect.GetWidth() ), - Fraction( 1, 1 ) ); + boost::rational<long>( nNewVal, aRect.GetWidth() ), + boost::rational<long>( 1, 1 ) ); else // if ( nSlotId == SID_OBJECT_HEIGHT ) pDrView->ResizeMarkedObj( aRect.TopLeft(), - Fraction( 1, 1 ), - Fraction( nNewVal, aRect.GetHeight() ) ); + boost::rational<long>( 1, 1 ), + boost::rational<long>( nNewVal, aRect.GetHeight() ) ); bDone = true; } } diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index af08c7080b74..1dd2d255a0d7 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -144,8 +144,8 @@ void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue> pSettings[SC_POSITION_BOTTOM].Name = OUString(SC_POSITIONBOTTOM); pSettings[SC_POSITION_BOTTOM].Value <<= sal_Int32(nPosY[SC_SPLIT_BOTTOM]); - sal_Int32 nZoomValue ((aZoomY.GetNumerator() * 100) / aZoomY.GetDenominator()); - sal_Int32 nPageZoomValue ((aPageZoomY.GetNumerator() * 100) / aPageZoomY.GetDenominator()); + sal_Int32 nZoomValue ((aZoomY.numerator() * 100) / aZoomY.denominator()); + sal_Int32 nPageZoomValue ((aPageZoomY.numerator() * 100) / aPageZoomY.denominator()); pSettings[SC_TABLE_ZOOM_TYPE].Name = OUString(SC_ZOOMTYPE); pSettings[SC_TABLE_ZOOM_TYPE].Value <<= sal_Int16(eZoomType); pSettings[SC_TABLE_ZOOM_VALUE].Name = OUString(SC_ZOOMVALUE); @@ -248,14 +248,14 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV else if (sName.equalsAscii(SC_ZOOMVALUE) ) { aSettings[i].Value >>= nTemp32; - Fraction aZoom(nTemp32, 100); + boost::rational<long> aZoom(nTemp32, 100); aZoomX = aZoomY = aZoom; rHasZoom = true; } else if (sName.equalsAscii(SC_PAGEVIEWZOOMVALUE) ) { aSettings[i].Value >>= nTemp32; - Fraction aZoom(nTemp32, 100); + boost::rational<long> aZoom(nTemp32, 100); aPageZoomX = aPageZoomY = aZoom; rHasZoom = true; } @@ -616,21 +616,21 @@ void ScViewData::SetZoomType( SvxZoomType eNew, bool bAll ) SetZoomType( eNew, vTabs ); } -void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs ) +void ScViewData::SetZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY, std::vector< SCTAB >& tabs ) { bool bAll = ( tabs.empty() ); if ( !bAll ) // create associated table data CreateTabData( tabs ); - Fraction aFrac20( 1,5 ); - Fraction aFrac400( 4,1 ); + boost::rational<long> aFrac20( 1,5 ); + boost::rational<long> aFrac400( 4,1 ); - Fraction aValidX = rNewX; + boost::rational<long> aValidX = rNewX; if (aValidX<aFrac20) aValidX = aFrac20; if (aValidX>aFrac400) aValidX = aFrac400; - Fraction aValidY = rNewY; + boost::rational<long> aValidY = rNewY; if (aValidY<aFrac20) aValidY = aFrac20; if (aValidY>aFrac400) @@ -690,7 +690,7 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vec RefreshZoom(); } -void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll ) +void ScViewData::SetZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY, bool bAll ) { std::vector< SCTAB > vTabs; if ( !bAll ) // get selected tabs @@ -1033,7 +1033,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, // if text is formatted for printer, use the exact same paper width // (and same line breaks) as for output. - Fraction aFract(1,1); + boost::rational<long> aFract(1,1); Rectangle aUtilRect = ScEditUtil( pDoc,nNewX,nNewY,nTabNo, Point(0,0), pWin, HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( pPattern, false ); aPaperSize.Width() = aUtilRect.GetWidth(); @@ -2120,31 +2120,31 @@ bool ScViewData::IsMinimized() return pView->IsMinimized(); } -void ScViewData::UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY ) +void ScViewData::UpdateScreenZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY ) { - Fraction aOldX = GetZoomX(); - Fraction aOldY = GetZoomY(); + boost::rational<long> aOldX = GetZoomX(); + boost::rational<long> aOldY = GetZoomY(); SetZoom( rNewX, rNewY, false ); - Fraction aWidth = GetZoomX(); - aWidth *= Fraction( aScrSize.Width(),1 ); + boost::rational<long> aWidth = GetZoomX(); + aWidth *= aScrSize.Width(); aWidth /= aOldX; - Fraction aHeight = GetZoomY(); - aHeight *= Fraction( aScrSize.Height(),1 ); + boost::rational<long> aHeight = GetZoomY(); + aHeight *= aScrSize.Height(); aHeight /= aOldY; - aScrSize.Width() = (long) aWidth; - aScrSize.Height() = (long) aHeight; + aScrSize.Width() = boost::rational_cast<long>(aWidth); + aScrSize.Height() = boost::rational_cast<long>(aHeight); } void ScViewData::CalcPPT() { - nPPTX = ScGlobal::nScreenPPTX * (double) GetZoomX(); + nPPTX = ScGlobal::nScreenPPTX * boost::rational_cast<double>(this->GetZoomX()); if (pDocShell) nPPTX = nPPTX / pDocShell->GetOutputFactor(); // Faktor ist Drucker zu Bildschirm - nPPTY = ScGlobal::nScreenPPTY * (double) GetZoomY(); + nPPTY = ScGlobal::nScreenPPTY * boost::rational_cast<double>(this->GetZoomY()); // if detective objects are present, // try to adjust horizontal scale so the most common column width has minimal rounding errors, @@ -2192,9 +2192,9 @@ void ScViewData::WriteUserData(OUString& rData) // PosX[links]/PosX[rechts]/PosY[oben]/PosY[unten] // wenn Zeilen groesser 8192, "+" statt "/" - sal_uInt16 nZoom = (sal_uInt16)((pThisTab->aZoomY.GetNumerator() * 100) / pThisTab->aZoomY.GetDenominator()); + sal_uInt16 nZoom = (sal_uInt16)((pThisTab->aZoomY.numerator() * 100) / pThisTab->aZoomY.denominator()); rData = OUString::number( nZoom ) + "/"; - nZoom = (sal_uInt16)((pThisTab->aPageZoomY.GetNumerator() * 100) / pThisTab->aPageZoomY.GetDenominator()); + nZoom = (sal_uInt16)((pThisTab->aPageZoomY.numerator() * 100) / pThisTab->aPageZoomY.denominator()); rData += OUString::number( nZoom ) + "/"; if (bPagebreak) rData += "1"; @@ -2259,15 +2259,15 @@ void ScViewData::ReadUserData(const OUString& rData) // nicht pro Tabelle: SCTAB nTabStart = 2; - Fraction aZoomX, aZoomY, aPageZoomX, aPageZoomY; // evaluate (all sheets?) + boost::rational<long> aZoomX, aZoomY, aPageZoomX, aPageZoomY; // evaluate (all sheets?) OUString aZoomStr = rData.getToken(0, ';'); // Zoom/PageZoom/Modus sal_uInt16 nNormZoom = sal::static_int_cast<sal_uInt16>(aZoomStr.getToken(0,'/').toInt32()); if ( nNormZoom >= MINZOOM && nNormZoom <= MAXZOOM ) - aZoomX = aZoomY = Fraction( nNormZoom, 100 ); // "normal" zoom (always) + aZoomX = aZoomY = boost::rational<long>( nNormZoom, 100 ); // "normal" zoom (always) sal_uInt16 nPageZoom = sal::static_int_cast<sal_uInt16>(aZoomStr.getToken(1,'/').toInt32()); if ( nPageZoom >= MINZOOM && nPageZoom <= MAXZOOM ) - aPageZoomX = aPageZoomY = Fraction( nPageZoom, 100 ); // Pagebreak-zoom, if set + aPageZoomX = aPageZoomY = boost::rational<long>( nPageZoom, 100 ); // Pagebreak-zoom, if set sal_Unicode cMode = aZoomStr.getToken(2,'/')[0]; // 0 or "0"/"1" SetPagebreakMode( cMode == '1' ); // SetPagebreakMode muss immer gerufen werden wegen CalcPPT / RecalcPixPos() @@ -2447,8 +2447,8 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const // view mode and zoom rTabSett.mbPageMode = bPagebreak; - rTabSett.mnNormalZoom = static_cast< long >( pViewTab->aZoomY * Fraction( 100.0 ) ); - rTabSett.mnPageZoom = static_cast< long >( pViewTab->aPageZoomY * Fraction( 100.0 ) ); + rTabSett.mnNormalZoom = boost::rational_cast<long>(pViewTab->aZoomY * rational_FromDouble(100.)); + rTabSett.mnPageZoom = boost::rational_cast<long>(pViewTab->aPageZoomY * rational_FromDouble(100.)); } } } @@ -2579,9 +2579,9 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt ) // zoom for each sheet if( rTabSett.mnNormalZoom ) - rViewTab.aZoomX = rViewTab.aZoomY = Fraction( rTabSett.mnNormalZoom, 100L ); + rViewTab.aZoomX = rViewTab.aZoomY = boost::rational<long>( rTabSett.mnNormalZoom, 100L ); if( rTabSett.mnPageZoom ) - rViewTab.aPageZoomX = rViewTab.aPageZoomY = Fraction( rTabSett.mnPageZoom, 100L ); + rViewTab.aPageZoomX = rViewTab.aPageZoomY = boost::rational<long>( rTabSett.mnPageZoom, 100L ); rViewTab.bShowGrid = rTabSett.mbShowGrid; @@ -2599,9 +2599,9 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt ) // view mode and default zoom (for new sheets) from current sheet if( rTabSett.mnNormalZoom ) - aDefZoomX = aDefZoomY = Fraction( rTabSett.mnNormalZoom, 100L ); + aDefZoomX = aDefZoomY = boost::rational<long>( rTabSett.mnNormalZoom, 100L ); if( rTabSett.mnPageZoom ) - aDefPageZoomX = aDefPageZoomY = Fraction( rTabSett.mnPageZoom, 100L ); + aDefPageZoomX = aDefPageZoomY = boost::rational<long>( rTabSett.mnPageZoom, 100L ); /* #i46820# set pagebreak mode via SetPagebreakMode(), this will update map modes that are needed to draw text correctly. */ SetPagebreakMode( rTabSett.mbPageMode ); @@ -2662,8 +2662,8 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe pSettings[SC_ACTIVE_TABLE].Value <<= sName; pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Name = OUString(SC_HORIZONTALSCROLLBARWIDTH); pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Value <<= sal_Int32(pView->GetTabBarWidth()); - sal_Int32 nZoomValue ((pThisTab->aZoomY.GetNumerator() * 100) / pThisTab->aZoomY.GetDenominator()); - sal_Int32 nPageZoomValue ((pThisTab->aPageZoomY.GetNumerator() * 100) / pThisTab->aPageZoomY.GetDenominator()); + sal_Int32 nZoomValue ((pThisTab->aZoomY.numerator() * 100) / pThisTab->aZoomY.denominator()); + sal_Int32 nPageZoomValue ((pThisTab->aPageZoomY.numerator() * 100) / pThisTab->aPageZoomY.denominator()); pSettings[SC_ZOOM_TYPE].Name = OUString(SC_ZOOMTYPE); pSettings[SC_ZOOM_TYPE].Value <<= sal_Int16(pThisTab->eZoomType); pSettings[SC_ZOOM_VALUE].Name = OUString(SC_ZOOMVALUE); @@ -2787,7 +2787,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue> { if (rSettings[i].Value >>= nTemp32) { - Fraction aZoom(nTemp32, 100); + boost::rational<long> aZoom(nTemp32, 100); aDefZoomX = aDefZoomY = aZoom; } } @@ -2795,7 +2795,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue> { if (rSettings[i].Value >>= nTemp32) { - Fraction aZoom(nTemp32, 100); + boost::rational<long> aZoom(nTemp32, 100); aDefPageZoomX = aDefPageZoomY = aZoom; } } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 1f395fc4aad6..4a69e92182b0 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -114,15 +114,15 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData ) double nPPTX = GetViewData().GetPPTX(); double nPPTY = GetViewData().GetPPTY(); - Fraction aZoomX = GetViewData().GetZoomX(); - Fraction aZoomY = GetViewData().GetZoomY(); + boost::rational<long> aZoomX = GetViewData().GetZoomX(); + boost::rational<long> aZoomY = GetViewData().GetZoomY(); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) { nPPTX = aProv.GetPPTX(); nPPTY = aProv.GetPPTY(); - aZoomX = aZoomY = Fraction( 1, 1 ); + aZoomX = aZoomY = boost::rational<long>( 1, 1 ); } sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice()); @@ -163,8 +163,8 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, bool bPaint ) SCTAB nTab = GetViewData().GetTabNo(); double nPPTX = GetViewData().GetPPTX(); double nPPTY = GetViewData().GetPPTY(); - Fraction aZoomX = GetViewData().GetZoomX(); - Fraction aZoomY = GetViewData().GetZoomY(); + boost::rational<long> aZoomX = GetViewData().GetZoomX(); + boost::rational<long> aZoomY = GetViewData().GetZoomY(); sal_uInt16 nOldPixel = 0; if (nStartRow == nEndRow) nOldPixel = (sal_uInt16) (rDoc.GetRowHeight(nStartRow,nTab) * nPPTY); @@ -174,7 +174,7 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, bool bPaint ) { nPPTX = aProv.GetPPTX(); nPPTY = aProv.GetPPTY(); - aZoomX = aZoomY = Fraction( 1, 1 ); + aZoomX = aZoomY = boost::rational<long>( 1, 1 ); } sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice()); bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab); diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index b937eb3bf121..1e27dd1e9be1 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -420,7 +420,7 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic, if (aSourceMap.GetMapUnit() == MAP_PIXEL) { // consider pixel correction, so bitmap fits to screen - Fraction aScaleX, aScaleY; + boost::rational<long> aScaleX, aScaleY; pScDrawView->CalcNormScale( aScaleX, aScaleY ); aDestMap.SetScaleX(aScaleX); aDestMap.SetScaleY(aScaleY); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index f1ab1ebd8dba..3ed06d2db3de 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -228,15 +228,15 @@ sal_uInt16 ScViewFunc::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula double nPPTX = GetViewData().GetPPTX(); double nPPTY = GetViewData().GetPPTY(); - Fraction aZoomX = GetViewData().GetZoomX(); - Fraction aZoomY = GetViewData().GetZoomY(); + boost::rational<long> aZoomX = GetViewData().GetZoomX(); + boost::rational<long> aZoomY = GetViewData().GetZoomY(); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) { nPPTX = aProv.GetPPTX(); nPPTY = aProv.GetPPTY(); - aZoomX = aZoomY = Fraction( 1, 1 ); + aZoomX = aZoomY = boost::rational<long>( 1, 1 ); } sal_uInt16 nTwips = rDoc.GetOptimalColWidth( nCol, nTab, aProv.GetDevice(), @@ -2031,15 +2031,15 @@ void ScViewFunc::SetWidthOrHeight( double nPPTX = GetViewData().GetPPTX(); double nPPTY = GetViewData().GetPPTY(); - Fraction aZoomX = GetViewData().GetZoomX(); - Fraction aZoomY = GetViewData().GetZoomY(); + boost::rational<long> aZoomX = GetViewData().GetZoomX(); + boost::rational<long> aZoomY = GetViewData().GetZoomY(); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) { nPPTX = aProv.GetPPTX(); nPPTY = aProv.GetPPTY(); - aZoomX = aZoomY = Fraction( 1, 1 ); + aZoomX = aZoomY = boost::rational<long>( 1, 1 ); } sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice()); @@ -2265,15 +2265,15 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) { double nPPTX = GetViewData().GetPPTX(); double nPPTY = GetViewData().GetPPTY(); - Fraction aZoomX = GetViewData().GetZoomX(); - Fraction aZoomY = GetViewData().GetZoomY(); + boost::rational<long> aZoomX = GetViewData().GetZoomX(); + boost::rational<long> aZoomY = GetViewData().GetZoomY(); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) { nPPTX = aProv.GetPPTX(); nPPTY = aProv.GetPPTY(); - aZoomX = aZoomY = Fraction( 1, 1 ); + aZoomX = aZoomY = boost::rational<long>( 1, 1 ); } long nPixel = rDoc.GetNeededSize( nCol, nRow, nTab, aProv.GetDevice(), |