diff options
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh3.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/sizedev.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/docsh.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/drawvie4.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/preview.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/view/tabview2.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 4 |
9 files changed, 44 insertions, 23 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 7c4721284eb1..d1848b02896c 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1453,7 +1453,8 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) if ( bRet && (bSetColWidths || bSetRowHeights) ) { // Adjust column width/row height; base 100% zoom Fraction aZoom( 1, 1 ); - double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / GetOutputFactor(); // Factor is printer display ratio + double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / + static_cast< double >( GetOutputFactor() ); // Factor is printer display ratio double nPPTY = ScGlobal::nScreenPPTY * (double) aZoom; VirtualDevice aVirtDev; // all sheets (for Excel import) @@ -2628,7 +2629,7 @@ ScDocShell::ScDocShell( const ScDocShell& rShell ) : SfxListener(), aDocument ( SCDOCMODE_DOCUMENT, this ), aDdeTextFmt(OUString("TEXT")), - nPrtToScreenFactor( 1.0 ), + nPrtToScreenFactor( 1, 1 ), pImpl ( new DocShell_Impl ), bHeaderOn ( true ), bFooterOn ( true ), @@ -2673,7 +2674,7 @@ ScDocShell::ScDocShell( const sal_uInt64 i_nSfxCreationFlags ) : SfxObjectShell( i_nSfxCreationFlags ), aDocument ( SCDOCMODE_DOCUMENT, this ), aDdeTextFmt(OUString("TEXT")), - nPrtToScreenFactor( 1.0 ), + nPrtToScreenFactor( 1, 1 ), pImpl ( new DocShell_Impl ), bHeaderOn ( true ), bFooterOn ( true ), diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 8424ef566172..5421ac196ed4 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -338,14 +338,14 @@ void ScDocShell::CalcOutputFactor() { if (bIsInplace) { - nPrtToScreenFactor = 1.0; // passt sonst nicht zur inaktiven Darstellung + nPrtToScreenFactor = Fraction( 1, 1 ); // passt sonst nicht zur inaktiven Darstellung return; } bool bTextWysiwyg = SC_MOD()->GetInputOptions().GetTextWysiwyg(); if (bTextWysiwyg) { - nPrtToScreenFactor = 1.0; + nPrtToScreenFactor = Fraction( 1, 1 ); return; } @@ -376,11 +376,13 @@ void ScDocShell::CalcOutputFactor() nWindowWidth = (long) ( nWindowWidth / ScGlobal::nScreenPPTX * HMM_PER_TWIPS ); if (nPrinterWidth && nWindowWidth) - nPrtToScreenFactor = nPrinterWidth / (double) nWindowWidth; + { + nPrtToScreenFactor = Fraction( nPrinterWidth, nWindowWidth ); + } else { OSL_FAIL("GetTextSize gibt 0 ??"); - nPrtToScreenFactor = 1.0; + nPrtToScreenFactor = Fraction( 1, 1 ); } } diff --git a/sc/source/ui/docshell/sizedev.cxx b/sc/source/ui/docshell/sizedev.cxx index e0ff33c205c1..99524b6c69cc 100644 --- a/sc/source/ui/docshell/sizedev.cxx +++ b/sc/source/ui/docshell/sizedev.cxx @@ -49,7 +49,7 @@ ScSizeDeviceProvider::ScSizeDeviceProvider( ScDocShell* pDocSh ) nPPTY = aLogic.Y() / 1000.0; if ( !bTextWysiwyg ) - nPPTX /= pDocSh->GetOutputFactor(); + nPPTX /= static_cast< double >( pDocSh->GetOutputFactor() ); } ScSizeDeviceProvider::~ScSizeDeviceProvider() diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index b432f94199b3..75175ada8bbe 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -88,7 +88,7 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener OUString aDdeTextFmt; - double nPrtToScreenFactor; + Fraction nPrtToScreenFactor; DocShell_Impl* pImpl; ScDocFunc* pDocFunc; @@ -370,7 +370,7 @@ public: void SetInUndo(bool bSet); void CalcOutputFactor(); - double GetOutputFactor() const { return nPrtToScreenFactor;} + Fraction GetOutputFactor() const { return nPrtToScreenFactor;} void GetPageOnFromPageStyleSet( const SfxItemSet* pStyleSet, SCTAB nCurTab, bool& rbHeader, diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index d9c0a691ce6d..4171f15c7916 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -443,7 +443,7 @@ void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const double nPPTY = ScGlobal::nScreenPPTY; if (pViewData) - nPPTX /= pViewData->GetDocShell()->GetOutputFactor(); + nPPTX /= static_cast< double >( pViewData->GetDocShell()->GetOutputFactor() ); SCCOL nEndCol = 0; SCROW nEndRow = 0; diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index bd7d984e8d81..09486c954694 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -345,7 +345,9 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) } Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double>( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); bool bDoPrint = ( pFillLocation == NULL ); @@ -733,7 +735,9 @@ 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 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); @@ -802,7 +806,8 @@ static Size lcl_GetDocPageSize( ScDocument* pDoc, SCTAB nTab ) sal_uInt16 ScPreview::GetOptimalZoom(bool bWidthOnly) { - double nWinScaleX = ScGlobal::nScreenPPTX / pDocShell->GetOutputFactor(); + double nWinScaleX = ScGlobal::nScreenPPTX / + static_cast< double >( pDocShell->GetOutputFactor() ); double nWinScaleY = ScGlobal::nScreenPPTY; Size aWinSize = GetOutputSizePixel(); @@ -962,7 +967,9 @@ void ScPreview::DataChanged( const DataChangedEvent& rDCEvt ) void ScPreview::MouseButtonDown( const MouseEvent& rMEvt ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); aButtonDownChangePoint = PixelToLogic( rMEvt.GetPosPixel(),aMMMode ); @@ -1045,7 +1052,9 @@ void ScPreview::MouseButtonDown( const MouseEvent& rMEvt ) void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); aButtonUpPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode ); @@ -1295,7 +1304,9 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) void ScPreview::MouseMove( const MouseEvent& rMEvt ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); Point aMouseMovePoint = PixelToLogic( rMEvt.GetPosPixel(), aMMMode ); @@ -1541,7 +1552,9 @@ void ScPreview::SwitchView() void ScPreview::DragMove( long nDragMovePos, sal_uInt16 nFlags ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); long nPos = nDragMovePos; diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 93452fd1d844..59d50f40cc6d 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -1238,7 +1238,8 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom ) aWinSize.Height() += GetGridHeight( SC_SPLIT_TOP ); ScDocShell* pDocSh = aViewData.GetDocShell(); - double nPPTX = ScGlobal::nScreenPPTX / pDocSh->GetOutputFactor(); + double nPPTX = ScGlobal::nScreenPPTX / + static_cast< double >( pDocSh->GetOutputFactor() ); double nPPTY = ScGlobal::nScreenPPTY; sal_uInt16 nMin = MINZOOM; @@ -1331,7 +1332,8 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom ) aWinSize.Height() = nOtherHeight; } - double nPPTX = ScGlobal::nScreenPPTX / aViewData.GetDocShell()->GetOutputFactor(); + double nPPTX = ScGlobal::nScreenPPTX / + static_cast< double >( aViewData.GetDocShell()->GetOutputFactor() ); double nPPTY = ScGlobal::nScreenPPTY; long nZoomX = (long) ( aWinSize.Width() * 100 / diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index cee08ea7d488..2b396d9ae7a7 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2404,7 +2404,8 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const rSplitPos = Point( bHSplit ? pViewTab->nHSplitPos : 0, bVSplit ? pViewTab->nVSplitPos : 0 ); rSplitPos = Application::GetDefaultDevice()->PixelToLogic( rSplitPos, MapMode( MAP_TWIP ) ); if( pDocShell ) - rSplitPos.X() = (long)((double)rSplitPos.X() / pDocShell->GetOutputFactor()); + rSplitPos.X() = (long)((double)rSplitPos.X() / + static_cast< double >( pDocShell->GetOutputFactor()) ); } else if( bFrozen ) { @@ -2534,7 +2535,7 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt ) // effectively results in the nFactor = 1.0 regardless of the Option setting. if( pDocShell && SC_MOD()->GetInputOptions().GetTextWysiwyg()) { - double nFactor = pDocShell->GetOutputFactor(); + double nFactor = static_cast< double >( pDocShell->GetOutputFactor() ); aPixel.X() = (long)( aPixel.X() * nFactor + 0.5 ); } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index c3359a0e7afd..650f800f29ea 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2308,7 +2308,9 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) nMargin = sal::static_int_cast<sal_uInt16>( nMargin + ((const SfxUInt16Item&)pPattern->GetItem(ATTR_INDENT)).GetValue() ); - nWidth = (sal_uInt16)(nEdit * pDocSh->GetOutputFactor() / HMM_PER_TWIPS) + nWidth = (sal_uInt16)( nEdit * + static_cast< double>( pDocSh->GetOutputFactor() ) / + HMM_PER_TWIPS ) + nMargin + STD_EXTRA_WIDTH; } } |