summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-08-15 16:48:01 +0200
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-09-29 06:30:42 +0100
commit40a1470c8a6947bcbb46116f135462227255421e (patch)
treeef4c3962f05b48d0cbf70f76d982e5895584e2a6
parent332f911c9f04e0497f61d8b59738c6b5d1332599 (diff)
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.hxx1
-rw-r--r--sc/source/ui/view/viewdata.cxx40
2 files changed, 8 insertions, 33 deletions
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 683e985edc2f..4623b24439e8 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -156,6 +156,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 d7c25b2c146a..6db5e5657be3 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 '/'