diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-08-15 16:48:01 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-12 12:29:28 +0900 |
commit | 950d1de733bb03711b2b31f1bacdae4a4ca1513d (patch) | |
tree | ccf07b7b0009f8965b374e10c207918e027c296e | |
parent | ScOutputData needs ScViewData for scaling. (diff) | |
download | core-950d1de733bb03711b2b31f1bacdae4a4ca1513d.tar.gz core-950d1de733bb03711b2b31f1bacdae4a4ca1513d.zip |
Use MapMode instead of nPPTX/nPPTY.
This is far from complete: we need to replace all uses of
nPPTX/nPPTY for things to work correctly.
Change-Id: I7c8aca62c537d8770903f4a6ae0a164479af3fc1
-rw-r--r-- | sc/source/ui/inc/viewdata.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 40 |
2 files changed, 8 insertions, 33 deletions
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index f71310feb43c..d6cb6b611a3a 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -155,6 +155,7 @@ class SC_DLLPUBLIC ScViewData { private: double nPPTX, nPPTY; // Scaling factors + MapMode maPaintMapMode; ::std::vector<ScViewDataTable*> maTabData; boost::scoped_ptr<ScMarkData> mpMarkData; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 229865e689b8..6fc978cea127 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2151,42 +2151,16 @@ void ScViewData::UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY void ScViewData::CalcPPT() { - nPPTX = ScGlobal::nScreenPPTX * (double) GetZoomX(); - if (pDocShell) - nPPTX = nPPTX / pDocShell->GetOutputFactor(); // Faktor ist Drucker zu Bildschirm - nPPTY = ScGlobal::nScreenPPTY * (double) GetZoomY(); - - // if detective objects are present, - // try to adjust horizontal scale so the most common column width has minimal rounding errors, - // to avoid differences between cell and drawing layer output + maPaintMapMode.SetMapUnit( MAP_TWIP ); - if ( pDoc && pDoc->HasDetectiveObjects(nTabNo) ) + Fraction aScaleX = GetZoomX() * Fraction(0.96); + if ( pDocShell ) { - SCCOL nEndCol = 0; - SCROW nDummy = 0; - pDoc->GetTableArea( nTabNo, nEndCol, nDummy ); - if (nEndCol<20) - nEndCol = 20; // same end position as when determining draw scale - - sal_uInt16 nTwips = pDoc->GetCommonWidth( nEndCol, nTabNo ); - if ( nTwips ) - { - double fOriginal = nTwips * nPPTX; - if ( fOriginal < static_cast<double>(nEndCol) ) - { - // if one column is smaller than the column count, - // rounding errors are likely to add up to a whole column. - - double fRounded = ::rtl::math::approxFloor( fOriginal + 0.5 ); - if ( fRounded > 0.0 ) - { - double fScale = fRounded / fOriginal + 1E-6; - if ( fScale >= 0.9 && fScale <= 1.1 ) - nPPTX *= fScale; - } - } - } + aScaleX /= pDocShell->GetOutputFactor(); } + + maPaintMapMode.SetScaleX( aScaleX ); + maPaintMapMode.SetScaleY( GetZoomY() * Fraction(0.96) ); } #define SC_OLD_TABSEP '/' |