summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-09-30 15:28:03 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-09-30 15:28:03 +0100
commitde11617acda45ec49562f7793e0b7b1dabc0b43c (patch)
tree24f372e0f348eeac290473996c5143475f5075f4
parent50933a27ca77d753d80b1bf47e2adc30b0e655e5 (diff)
Use twips internally for FillInfo too.
Otherwise errors sum up leading to tile-mismatches for tiled rendering. Change-Id: I5328771a2d7c284870bb028b53fe69a61e00ba6d
-rw-r--r--sc/inc/document.hxx5
-rw-r--r--sc/source/core/data/fillinfo.cxx49
-rw-r--r--sc/source/ui/view/gridwin.cxx5
-rw-r--r--sc/source/ui/view/gridwin4.cxx6
4 files changed, 40 insertions, 25 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 9c462d7536dc..8fa9b35a1f8f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -20,6 +20,7 @@
#ifndef INCLUDED_SC_INC_DOCUMENT_HXX
#define INCLUDED_SC_INC_DOCUMENT_HXX
+#include <vcl/mapmod.hxx>
#include <vcl/prntypes.hxx>
#include <vcl/timer.hxx>
#include <com/sun/star/uno/Reference.hxx>
@@ -1668,7 +1669,9 @@ public:
void FillInfo(
ScTableInfo& rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode,
+ SCTAB nTab, double fColScale, double fRowScale,
+ const OutputDevice* pOutDev, const MapMode& rMapMode,
+ bool bPageMode, bool bFormulaMode,
const ScMarkData* pMarkData = NULL );
SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const;
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 3688412da328..b3b0a42998c0 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -195,7 +195,9 @@ public:
void ScDocument::FillInfo(
ScTableInfo& rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode,
+ SCTAB nTab, double fColScale, double fRowScale,
+ const OutputDevice* pOutDev, const MapMode& rMapMode,
+ bool bPageMode, bool bFormulaMode,
const ScMarkData* pMarkData )
{
OSL_ENSURE( maTabs[nTab], "Table does not exist" );
@@ -258,6 +260,7 @@ void ScDocument::FillInfo(
SCROW nYExtra = nRow2+1;
sal_uInt16 nDocHeight = ScGlobal::nStdRowHeight;
SCROW nDocHeightEndRow = -1;
+ long nPosYTwips = 0;
for (nSignedY=((SCsROW)nRow1)-1; nSignedY<=(SCsROW)nYExtra; nSignedY++)
{
if (nSignedY >= 0)
@@ -278,7 +281,14 @@ void ScDocument::FillInfo(
RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
pThisRowInfo->pCellInfo = NULL; // wird unten belegt
- sal_uInt16 nHeight = (sal_uInt16) ( nDocHeight * fRowScale );
+ const long nPosStartTwips = nPosYTwips;
+ nPosYTwips += nDocHeight;
+
+ sal_uInt16 nHeight =
+ pOutDev->LogicToPixel( Point( 0, nPosYTwips ),
+ rMapMode ).getY() -
+ pOutDev->LogicToPixel( Point( 0, nPosStartTwips ),
+ rMapMode ).getY();
if (!nHeight)
nHeight = 1;
@@ -386,27 +396,14 @@ void ScDocument::FillInfo(
}
}
- for (nArrCol=nCol2+3; nArrCol<=nRotMax+2; nArrCol++) // restliche Breiten eintragen
- {
- nX = nArrCol-1;
- if ( ValidCol(nX) )
- {
- if (!ColHidden(nX, nTab))
- {
- sal_uInt16 nThisWidth = (sal_uInt16) (GetColWidth( nX, nTab ) * fColScale);
- if (!nThisWidth)
- nThisWidth = 1;
-
- pRowInfo[0].pCellInfo[nArrCol].nWidth = nThisWidth;
- }
- }
- }
ScConditionalFormatList* pCondFormList = GetCondFormList(nTab);
if(pCondFormList)
pCondFormList->startRendering();
- for (nArrCol=0; nArrCol<=nCol2+2; nArrCol++) // links & rechts + 1
+ long nPosXTwips = 0;
+
+ for (nArrCol=0; nArrCol<=nRotMax+2; nArrCol++) // links & rechts + 1
{
nX = (nArrCol>0) ? nArrCol-1 : MAXCOL+1; // negativ -> ungueltig
@@ -418,11 +415,21 @@ void ScDocument::FillInfo(
// TODO: Optimize this loop.
if (!ColHidden(nX, nTab))
{
- sal_uInt16 nThisWidth = (sal_uInt16) (GetColWidth( nX, nTab ) * fColScale);
- if (!nThisWidth)
+ const long nPosStartTwips = nPosXTwips;
+ nPosXTwips += GetColWidth( nX, nTab );
+
+ sal_uInt16 nThisWidth =
+ pOutDev->LogicToPixel( Point( nPosXTwips, 0 ),
+ rMapMode ).getX() -
+ pOutDev->LogicToPixel( Point( nPosStartTwips, 0 ),
+ rMapMode ).getX();
+ if ( nThisWidth == 0)
nThisWidth = 1;
- pRowInfo[0].pCellInfo[nArrCol].nWidth = nThisWidth; //! dies sollte reichen
+ pRowInfo[0].pCellInfo[nArrCol].nWidth = nThisWidth;
+
+ if (nArrCol > nCol2+2)
+ break; // Remaining information isn't needed
ScColumn* pThisCol = &maTabs[nTab]->aCol[nX]; // Spalten-Daten
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 4d5ad0a30361..275a10d1b794 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4623,7 +4623,10 @@ void ScGridWindow::UpdateFormulas()
double nPPTY = pViewData->GetPPTY();
ScTableInfo aTabInfo;
- rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, nPPTX, nPPTY, false, false );
+ rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab,
+ nPPTX, nPPTY,
+ this, pViewData->GetPaintMapMode(),
+ false, false );
Fraction aZoomX = pViewData->GetZoomX();
Fraction aZoomY = pViewData->GetZoomY();
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index b8d36f9a44f1..302bcee0ca3f 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -553,8 +553,10 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
ScTableInfo aTabInfo;
rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab,
- nPPTX, nPPTY, false, bFormulaMode,
- &pViewData->GetMarkData() );
+ nPPTX, nPPTY,
+ this, pViewData->GetPaintMapMode(),
+ false, bFormulaMode,
+ &pViewData->GetMarkData() );
Fraction aZoomX = pViewData->GetZoomX();
Fraction aZoomY = pViewData->GetZoomY();