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-08-30 21:37:09 +0200
commit5a8df7cd86cc8c9c70bfec841893b19d45574ecf (patch)
tree06a89e5a756dfe52038dfee84cb2be6a558d6bfe
parent0a9bd8f7c8a9cb20867e51b67730f1b9923b0cb4 (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 de45a39a2397..21232c22a08b 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 2b396d9ae7a7..55b8c4f07ad3 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 '/'