[Libreoffice-commits] core.git: Branch 'feature/droid_calcimpress' - 46 commits - include/tools sc/inc sc/source
Andrzej Hunt
andrzej.hunt at collabora.com
Thu Sep 25 02:24:29 PDT 2014
include/tools/mapunit.hxx | 26 +
sc/inc/editutil.hxx | 7
sc/source/core/data/fillinfo.cxx | 12
sc/source/core/tool/editutil.cxx | 57 ++--
sc/source/ui/docshell/docsh.cxx | 7
sc/source/ui/docshell/docsh3.cxx | 10
sc/source/ui/docshell/docsh4.cxx | 24 -
sc/source/ui/docshell/sizedev.cxx | 2
sc/source/ui/inc/docsh.hxx | 4
sc/source/ui/inc/gridwin.hxx | 13
sc/source/ui/inc/output.hxx | 80 +++++
sc/source/ui/inc/viewdata.hxx | 32 +-
sc/source/ui/unoobj/docuno.cxx | 13
sc/source/ui/view/colrowba.cxx | 25 +
sc/source/ui/view/drawvie4.cxx | 2
sc/source/ui/view/gridwin.cxx | 2
sc/source/ui/view/gridwin3.cxx | 24 -
sc/source/ui/view/gridwin4.cxx | 288 ++++++++++++++++----
sc/source/ui/view/output.cxx | 182 +++++++------
sc/source/ui/view/output2.cxx | 530 ++++++++++++++++++++++----------------
sc/source/ui/view/preview.cxx | 27 +
sc/source/ui/view/printfun.cxx | 6
sc/source/ui/view/tabview2.cxx | 6
sc/source/ui/view/viewdata.cxx | 380 ++++++++++++++-------------
sc/source/ui/view/viewfunc.cxx | 4
25 files changed, 1119 insertions(+), 644 deletions(-)
New commits:
commit 262e1773c4ba1294c3d9744249048931e31f6d14
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Fri Aug 29 11:47:55 2014 +0200
TEMPORARY: more twips in ScOutputData.
Some parts are working, some aren't.
Change-Id: I69b63a585e971a4a56514a66ab318e48507ca5be
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 989728d..d34de7d 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -3198,9 +3198,11 @@ bool ScOutputData::Clip( DrawEditParam& rParam, const Size& aCellSize,
aAreaParam.maClipRect.Left() = nScrX;
aAreaParam.mbLeftClip = true;
}
- if ( aAreaParam.maClipRect.Right() > nScrX + nScrW )
+ if ( aAreaParam.maClipRect.Right() >
+ nScrX + LogicToPixelHorizontal(nScrWTwips ) )
{
- aAreaParam.maClipRect.Right() = nScrX + nScrW; //! minus one?
+ aAreaParam.maClipRect.Right() = nScrX +
+ LogicToPixelHorizontal( nScrWTwips ); //! minus one?
aAreaParam.mbRightClip = true;
}
@@ -3218,9 +3220,11 @@ bool ScOutputData::Clip( DrawEditParam& rParam, const Size& aCellSize,
aAreaParam.maClipRect.Top() = nScrY;
bClip = true;
}
- if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrH )
+ if ( aAreaParam.maClipRect.Bottom() >
+ nScrY + LogicToPixelVertical( nScrHTwips ) )
{
- aAreaParam.maClipRect.Bottom() = nScrY + nScrH; //! minus one?
+ aAreaParam.maClipRect.Bottom() = nScrY +
+ LogicToPixelVertical( nScrHTwips ); //! minus one?
bClip = true;
}
@@ -3282,7 +3286,7 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam)
//! mirror margin values for RTL?
//! move margin down to after final GetOutputArea call
long nTopM, nLeftM, nBottomM, nRightM;
- rParam.calcMargins(nTopM, nLeftM, nBottomM, nRightM, mnPPTX, mnPPTY);
+ rParam.calcMargins( nTopM, nLeftM, nBottomM, nRightM );
SCCOL nXForPos = rParam.mnX;
if ( nXForPos < nX1 )
@@ -3312,7 +3316,7 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam)
rParam.mbCellIsValue, true, false, aAreaParam );
//! special ScEditUtil handling if formatting for printer
- rParam.calcPaperSize(aPaperSize, aAreaParam.maAlignRect, mnPPTX, mnPPTY);
+ rParam.calcPaperSize( aPaperSize, aAreaParam.maAlignRect );
}
if (rParam.mbPixelToLogic)
{
@@ -3444,7 +3448,7 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam)
nStartX += nLeftM;
}
- const bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW);
+ const bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrWTwips);
if (bOutside)
return;
@@ -3542,7 +3546,7 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam)
//! mirror margin values for RTL?
//! move margin down to after final GetOutputArea call
long nTopM, nLeftM, nBottomM, nRightM;
- rParam.calcMargins(nTopM, nLeftM, nBottomM, nRightM, mnPPTX, mnPPTY);
+ rParam.calcMargins( nTopM, nLeftM, nBottomM, nRightM );
SCCOL nXForPos = rParam.mnX;
if ( nXForPos < nX1 )
@@ -3572,7 +3576,7 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam)
rParam.mbCellIsValue, true, false, aAreaParam );
//! special ScEditUtil handling if formatting for printer
- rParam.calcPaperSize(aPaperSize, aAreaParam.maAlignRect, mnPPTX, mnPPTY);
+ rParam.calcPaperSize( aPaperSize, aAreaParam.maAlignRect );
}
if (rParam.mbPixelToLogic)
{
@@ -3706,7 +3710,7 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam)
nStartX += nLeftM;
}
- const bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW);
+ const bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrWTwips);
if (bOutside)
return;
@@ -3809,7 +3813,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
//! mirror margin values for RTL?
//! move margin down to after final GetOutputArea call
long nTopM, nLeftM, nBottomM, nRightM;
- rParam.calcMargins(nTopM, nLeftM, nBottomM, nRightM, mnPPTX, mnPPTY);
+ rParam.calcMargins( nTopM, nLeftM, nBottomM, nRightM );
SCCOL nXForPos = rParam.mnX;
if ( nXForPos < nX1 )
@@ -3837,7 +3841,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
rParam.mbCellIsValue, true, false, aAreaParam );
//! special ScEditUtil handling if formatting for printer
- rParam.calcPaperSize(aPaperSize, aAreaParam.maAlignRect, mnPPTX, mnPPTY);
+ rParam.calcPaperSize( aPaperSize, aAreaParam.maAlignRect );
if (rParam.mbPixelToLogic)
{
@@ -3948,7 +3952,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
nStartX += nLeftM;
}
- bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW);
+ bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrWTwips);
if (bOutside)
return;
@@ -3957,9 +3961,9 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
aAreaParam.maClipRect.Left() = nScrX;
aAreaParam.mbLeftClip = true;
}
- if ( aAreaParam.maClipRect.Right() > nScrX + nScrW )
+ if ( aAreaParam.maClipRect.Right() > nScrX + nScrWTwips )
{
- aAreaParam.maClipRect.Right() = nScrX + nScrW; //! minus one?
+ aAreaParam.maClipRect.Right() = nScrX + nScrWTwips; //! minus one?
aAreaParam.mbRightClip = true;
}
@@ -3977,9 +3981,9 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
aAreaParam.maClipRect.Top() = nScrY;
bClip = true;
}
- if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrH )
+ if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrHTwips )
{
- aAreaParam.maClipRect.Bottom() = nScrY + nScrH; //! minus one?
+ aAreaParam.maClipRect.Bottom() = nScrY + nScrHTwips; //! minus one?
bClip = true;
}
@@ -4097,9 +4101,9 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
Point aURLStart = aLogicStart; // copy before modifying for orientation
- Size aPaperLogic = rParam.mpEngine->GetPaperSize();
- aPaperLogic.Width() = nEngineWidth;
- rParam.mpEngine->SetPaperSize(aPaperLogic);
+ Size aPaperTwips = rParam.mpEngine->GetPaperSize();
+ aPaperTwips.Width() = nEngineWidth;
+ rParam.mpEngine->SetPaperSize(aPaperTwips);
rParam.adjustForRTL();
@@ -4167,7 +4171,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
//! mirror margin values for RTL?
//! move margin down to after final GetOutputArea call
long nTopM, nLeftM, nBottomM, nRightM;
- rParam.calcMargins(nTopM, nLeftM, nBottomM, nRightM, mnPPTX, mnPPTY);
+ rParam.calcMargins( nTopM, nLeftM, nBottomM, nRightM );
SCCOL nXForPos = rParam.mnX;
if ( nXForPos < nX1 )
@@ -4195,7 +4199,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
rParam.mbCellIsValue, true, false, aAreaParam );
//! special ScEditUtil handling if formatting for printer
- rParam.calcPaperSize(aPaperSize, aAreaParam.maAlignRect, mnPPTX, mnPPTY);
+ rParam.calcPaperSize( aPaperSize, aAreaParam.maAlignRect );
if (rParam.mbPixelToLogic)
{
@@ -4298,7 +4302,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
nStartX += nLeftM;
- bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW);
+ bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrWTwips);
if (bOutside)
return;
@@ -4307,9 +4311,9 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
aAreaParam.maClipRect.Left() = nScrX;
aAreaParam.mbLeftClip = true;
}
- if ( aAreaParam.maClipRect.Right() > nScrX + nScrW )
+ if ( aAreaParam.maClipRect.Right() > nScrX + nScrWTwips )
{
- aAreaParam.maClipRect.Right() = nScrX + nScrW; //! minus one?
+ aAreaParam.maClipRect.Right() = nScrX + nScrWTwips; //! minus one?
aAreaParam.mbRightClip = true;
}
@@ -4327,9 +4331,9 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
aAreaParam.maClipRect.Top() = nScrY;
bClip = true;
}
- if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrH )
+ if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrHTwips )
{
- aAreaParam.maClipRect.Bottom() = nScrY + nScrH; //! minus one?
+ aAreaParam.maClipRect.Bottom() = nScrY + nScrHTwips; //! minus one?
bClip = true;
}
@@ -4466,10 +4470,10 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
const SfxItemSet* pOldPreviewFontSet = NULL;
ScRefCellValue aCell;
- long nInitPosX = nScrX;
+ long nInitPosXTwips = PixelToLogicHorizontal( nScrX );
if ( bLayoutRTL )
{
- nInitPosX += nMirrorW - 1;
+ nInitPosXTwips += nMirrorWTwips - 1;
}
long nLayoutSign = bLayoutRTL ? -1 : 1;
@@ -4479,20 +4483,24 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
nLastContentCol = sal::static_int_cast<SCCOL>(
nLastContentCol - mpDoc->GetEmptyLinesInBlock( nX2+1, nY1, nTab, MAXCOL, nY2, nTab, DIR_RIGHT ) );
- long nRowPosY = nScrY;
+ long nRowPosYTwips = PixelToLogicVertical( nScrY );
for (SCSIZE nArrY=0; nArrY+1<nArrCount; nArrY++) // 0 fuer Reste von zusammengefassten
{
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
- if (nArrY==1) nRowPosY = nScrY; // vorher wird einzeln berechnet
+ if ( nArrY==1 )
+ {
+ nRowPosYTwips = PixelToLogicVertical( nScrY ); // vorher wird einzeln berechnet
+ }
if ( pThisRowInfo->bChanged || nArrY==0 )
{
- long nPosX = 0;
+ long nPosXTwips = 0;
for (SCCOL nX=0; nX<=nX2; nX++) // wegen Ueberhaengen
{
boost::scoped_ptr< ScPatternAttr > pPreviewPattr;
- if (nX==nX1) nPosX = nInitPosX; // positions before nX1 are calculated individually
+ if (nX==nX1)
+ nPosXTwips = nInitPosXTwips; // positions before nX1 are calculated individually
CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
if (pInfo->bEditEngine)
@@ -4503,10 +4511,10 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
SCROW nCellY = nY;
bool bDoCell = false;
- long nPosY = nRowPosY;
+ long nPosYTwips = nRowPosYTwips;
if ( nArrY == 0 )
{
- nPosY = nScrY;
+ nPosYTwips = PixelToLogicVertical( nScrY );
nY = pRowInfo[1].nRowNo;
SCCOL nOverX; // start of the merged cells
SCROW nOverY;
@@ -4597,9 +4605,9 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
aParam.mnCellX = nCellX;
aParam.mnCellY = nCellY;
aParam.mnTab = nTab;
- aParam.mnPosX = nPosX;
- aParam.mnPosY = nPosY;
- aParam.mnInitPosX = nInitPosX;
+ aParam.mnPosX = LogicToPixelHorizontal( nPosXTwips );
+ aParam.mnPosY = LogicToPixelVertical( nPosYTwips );
+ aParam.mnInitPosX = LogicToPixelHorizontal( nInitPosXTwips );
aParam.mpPreviewFontSet = pPreviewFontSet;
aParam.mpPreviewFontSet = pPreviewFontSet;
aParam.mpOldPattern = pOldPattern;
@@ -4637,10 +4645,10 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
bHyphenatorSet = aParam.mbHyphenatorSet;
}
}
- nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
+ nPosXTwips += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
}
}
- nRowPosY += pRowInfo[nArrY].nHeight;
+ nRowPosYTwips += pRowInfo[nArrY].nHeight;
}
pEngine.reset();
@@ -4670,26 +4678,29 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
const SfxItemSet* pOldCondSet = NULL;
ScRefCellValue aCell;
- long nInitPosX = nScrX;
+ long nInitPosXTwips = PixelToLogicHorizontal( nScrX );
if ( bLayoutRTL )
{
- nInitPosX += nMirrorW - 1;
+ nInitPosXTwips += nMirrorWTwips - 1;
}
long nLayoutSign = bLayoutRTL ? -1 : 1;
- long nRowPosY = nScrY;
+ long nRowPosYTwips = PixelToLogicVertical( nScrY );
for (SCSIZE nArrY=0; nArrY+1<nArrCount; nArrY++) // 0 fuer Reste von zusammengefassten
{
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
- long nCellHeight = (long) pThisRowInfo->nHeight;
- if (nArrY==1) nRowPosY = nScrY; // vorher wird einzeln berechnet
+ long nCellHeightTwips = (long) pThisRowInfo->nHeight;
+ if (nArrY==1)
+ nRowPosYTwips = PixelToLogicVertical( nScrY );
if ( ( pThisRowInfo->bChanged || nArrY==0 ) && pThisRowInfo->nRotMaxCol != SC_ROTMAX_NONE )
{
- long nPosX = 0;
+ long nPosXTwips = 0;
for (SCCOL nX=0; nX<=nRotMax; nX++)
{
- if (nX==nX1) nPosX = nInitPosX; // positions before nX1 are calculated individually
+ // We calculate positions before nX1 individually (?)
+ if (nX==nX1)
+ nPosXTwips = nInitPosXTwips;
CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
if ( pInfo->nRotateDir != SC_ROTDIR_NONE )
@@ -4708,7 +4719,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
else
lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(sal_False)
- long nPosY = nRowPosY;
+ long nPosYTwips = nRowPosYTwips;
bool bVisChanged = false;
//! Rest von zusammengefasster Zelle weiter oben funktioniert nicht!
@@ -4731,7 +4742,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
if (aCell.isEmpty() || IsEmptyCellText(pThisRowInfo, nX, nY))
bHidden = true; // nRotateDir is also set without a cell
- long nCellWidth = (long) pRowInfo[0].pCellInfo[nX+1].nWidth;
+ long nCellWidthTwips = (long) pRowInfo[0].pCellInfo[nX+1].nWidth;
SvxCellHorJustify eHorJust = (SvxCellHorJustify)((const SvxHorJustifyItem&)
pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet)).GetValue();
@@ -4746,39 +4757,44 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
(ScMergeAttr*)&pPattern->GetItem(ATTR_MERGE);
bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1;
- long nStartX = nPosX;
- long nStartY = nPosY;
+ long nStartXTwips = nPosXTwips;
+ long nStartYTwips = nPosYTwips;
if (nX<nX1)
{
if ((bBreak || eOrient!=SVX_ORIENTATION_STANDARD) && !bMerged)
bHidden = true;
else
{
- nStartX = nInitPosX;
+ nStartXTwips = nInitPosXTwips;
SCCOL nCol = nX1;
while (nCol > nX)
{
--nCol;
- nStartX -= nLayoutSign * (long) pRowInfo[0].pCellInfo[nCol+1].nWidth;
+ nStartXTwips -= nLayoutSign *
+ (long) pRowInfo[0].pCellInfo[nCol+1].nWidth;
}
}
}
- long nCellStartX = nStartX;
+ long nCellStartXTwips = nStartXTwips;
// Ersatzdarstellung fuer zu kleinen Text weggelassen
if (!bHidden)
{
- long nOutWidth = nCellWidth - 1;
- long nOutHeight = nCellHeight;
+ long nOutWidthTwips = nCellWidthTwips - PixelToLogicHorizontal( 1 );
+ long nOutHeightTwips = nCellHeightTwips;
if ( bMerged ) // Zusammengefasst
{
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=1; i<nCountX; i++)
- nOutWidth += (long) ( mpDoc->GetColWidth(nX+i,nTab) * mnPPTX );
+ nOutWidthTwips += (long) mpDoc->GetColWidth(nX+i,nTab);
SCROW nCountY = pMerge->GetRowMerge();
- nOutHeight += (long) mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY);
+ // TODO: sum the rows?
+ for ( SCROW i = nY + 1; i <= nY + nCountY - 1; i++ )
+ {
+ nOutHeightTwips += mpDoc->GetRowHeight( i, nTab );
+ }
}
SvxCellVerJustify eVerJust = (SvxCellVerJustify)((const SvxVerJustifyItem&)
@@ -4836,18 +4852,21 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
nIndent = ((const SfxUInt16Item&)pPattern->
GetItem(ATTR_INDENT, pCondSet)).GetValue();
- long nTotalHeight = nOutHeight; // ohne Rand abzuziehen
+ // Without subtracting the margins
+ long nTotalHeightPixel = LogicToPixelVertical(
+ nOutHeightTwips );
if ( bPixelToLogic )
- nTotalHeight = mpRefDevice->PixelToLogic(Size(0,nTotalHeight)).Height();
-
- long nLeftM = (long) ( (pMargin->GetLeftMargin() + nIndent) * mnPPTX );
- long nTopM = (long) ( pMargin->GetTopMargin() * mnPPTY );
- long nRightM = (long) ( pMargin->GetRightMargin() * mnPPTX );
- long nBottomM = (long) ( pMargin->GetBottomMargin() * mnPPTY );
- nStartX += nLeftM;
- nStartY += nTopM;
- nOutWidth -= nLeftM + nRightM;
- nOutHeight -= nTopM + nBottomM;
+ nTotalHeightPixel =
+ mpRefDevice->PixelToLogic(Size(0,nTotalHeightPixel)).Height();
+
+ long nLeftMTwips = (long) (pMargin->GetLeftMargin() + nIndent);
+ long nTopMTwips = (long) pMargin->GetTopMargin();
+ long nRightMTwips = (long) pMargin->GetRightMargin();
+ long nBottomMTwips = (long) pMargin->GetBottomMargin();
+ nStartXTwips += nLeftMTwips;
+ nStartYTwips += nTopMTwips;
+ nOutWidthTwips -= nLeftMTwips + nRightMTwips;
+ nOutHeightTwips -= nTopMTwips + nBottomMTwips;
// Rotation schon hier, um bei Umbruch auch PaperSize anzupassen
long nAttrRotate = 0;
@@ -4877,7 +4896,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
Size aPaperSize = Size( 1000000, 1000000 );
if (eOrient==SVX_ORIENTATION_STACKED)
- aPaperSize.Width() = nOutWidth; // zum Zentrieren
+ // In order to center it
+ aPaperSize.Width() = LogicToPixelHorizontal( nOutWidthTwips );
else if (bBreak)
{
if (nAttrRotate)
@@ -4886,12 +4906,13 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
//! ab, solange die Zeilen nicht einzeln versetzt ausgegeben
//! werden koennen -> darum unbegrenzt, also kein Umbruch.
//! Mit versetzten Zeilen waere das folgende richtig:
- aPaperSize.Width() = (long)(nOutHeight / fabs(nSin));
+ aPaperSize.Width() = (long) (
+ LogicToPixelHorizontal( nOutHeightTwips ) / fabs(nSin) );
}
else if (eOrient == SVX_ORIENTATION_STANDARD)
- aPaperSize.Width() = nOutWidth;
+ aPaperSize.Width() = LogicToPixelHorizontal( nOutWidthTwips );
else
- aPaperSize.Width() = nOutHeight - 1;
+ aPaperSize.Width() = LogicToPixelHorizontal( nOutHeightTwips - 1 );
}
if (bPixelToLogic)
pEngine->SetPaperSize(mpRefDevice->PixelToLogic(aPaperSize));
@@ -4952,25 +4973,29 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
// everything is in pixels
long nEnginePixel = mpRefDevice->LogicToPixel(
Size(0,nEngineHeight)).Height();
- long nEffHeight = nOutHeight - (long)(nEnginePixel * nAbsCos) + 2;
- long nNewWidth = (long)(nEffHeight / nAbsSin) + 2;
- bool bFits = ( nNewWidth >= aPaperSize.Width() );
+ // TODO: continue conversion here...
+ long nEffHeightTwips = nOutHeightTwips -
+ PixelToLogicVertical( (long)(nEnginePixel * nAbsCos) + 2 );
+ long nNewWidthTwips = (long)(nEffHeightTwips / nAbsSin) + 2;
+ bool bFits =
+ ( LogicToPixelHorizontal( nNewWidthTwips ) >=
+ aPaperSize.Width() );
if ( bFits )
nSteps = 0;
else
{
- if ( nNewWidth < 4 )
+ if ( LogicToPixelHorizontal( nNewWidthTwips ) < 4 )
{
// can't fit -> fall back to using half height
- nEffHeight = nOutHeight / 2;
- nNewWidth = (long)(nEffHeight / nAbsSin) + 2;
+ nEffHeightTwips = nOutHeightTwips / 2;
+ nNewWidthTwips = (long)(nEffHeightTwips / nAbsSin) + 2;
nSteps = 0;
}
else
--nSteps;
// set paper width and get new text height
- aPaperSize.Width() = nNewWidth;
+ aPaperSize.Width() = LogicToPixelHorizontal( nNewWidthTwips );
if (bPixelToLogic)
pEngine->SetPaperSize(mpRefDevice->PixelToLogic(aPaperSize));
else
@@ -5010,15 +5035,31 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
if (!bHidden)
{
bool bClip = false;
- Size aClipSize = Size( nScrX+nScrW-nStartX, nScrY+nScrH-nStartY );
+ Size aClipSize = Size(
+ nScrX + LogicToPixelHorizontal( nScrWTwips - nStartXTwips ),
+ nScrY + LogicToPixelVertical( nScrHTwips - nStartYTwips ) );
// weiterschreiben
Size aCellSize;
- if (bPixelToLogic)
- aCellSize = mpRefDevice->PixelToLogic( Size( nOutWidth, nOutHeight ) );
- else
- aCellSize = Size( nOutWidth, nOutHeight ); // Scale ist 1
+
+ // Yes, we really need this conversion:
+ // our Twips units here are all using ViewData's PaintMapMode,
+ // whereas the window/output-device could be using an arbitrary
+ // map-mode which is not necessarily related to the PaintMapMode
+ {
+ long nOutWidth = LogicToPixelHorizontal( nOutWidthTwips );
+ long nOutHeight = LogicToPixelVertical( nOutHeightTwips );
+ if (bPixelToLogic)
+ {
+ aCellSize = mpRefDevice->PixelToLogic(
+ Size( nOutWidth, nOutHeight ) );
+ }
+ else
+ {
+ aCellSize = Size( nOutWidth, nOutHeight ); // Scale ist 1
+ }
+ }
long nGridWidth = nEngineWidth;
bool bNegative = false;
@@ -5044,20 +5085,34 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
if ( bPixelToLogic )
nNeededWidth = mpRefDevice->LogicToPixel(Size(nNeededWidth,0)).Width();
- GetOutputArea( nX, nArrY, nCellStartX, nPosY, nCellX, nCellY, nNeededWidth,
+ GetOutputArea( nX, nArrY,
+ nCellStartXTwips, nPosYTwips,
+ nCellX, nCellY, nNeededWidth,
*pPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
false, false, true, aAreaParam );
+ // TODO: duplication much?
+ long nLeftM = LogicToPixelHorizontal( nLeftMTwips );
+ long nRightM = LogicToPixelHorizontal( nRightMTwips );
+ long nTopM = LogicToPixelVertical( nTopMTwips );
+ long nBottomM = LogicToPixelVertical( nBottomMTwips );
+
if ( bShrink )
{
long nPixelWidth = bPixelToLogic ?
mpRefDevice->LogicToPixel(Size(nEngineWidth,0)).Width() : nEngineWidth;
+ // TODO: these margins are in pixels
+ // TODO: continue here
long nNeededPixel = nPixelWidth + nLeftM + nRightM;
aAreaParam.mbLeftClip = aAreaParam.mbRightClip = true;
// always do height
- ShrinkEditEngine( *pEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM,
+ // TODO: reimplement ShrinkEditEngine
+ ShrinkEditEngine( *pEngine,
+ aAreaParam.maAlignRect,
+ nLeftM, nTopM,
+ nRightM, nBottomM,
false, sal::static_int_cast<sal_uInt16>(eOrient), nAttrRotate, bPixelToLogic,
nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip );
@@ -5078,6 +5133,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
nEngineWidth = (long) ( nRealHeight / fabs( nSin ) );
}
+ const long nStartX = LogicToPixelHorizontal( nStartXTwips );
long nClipStartX = nStartX;
if (nX<nX1)
{
@@ -5092,6 +5148,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
}
}
+ const long nStartY = LogicToPixelVertical( nStartYTwips );
+ const long nRowPosY = LogicToPixelVertical( nRowPosYTwips );
long nClipStartY = nStartY;
if (nArrY==0 || bVisChanged)
{
@@ -5114,7 +5172,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
// gedrehten, ausgerichteten Text nur an den
// Seitengrenzen clippen
nClipStartX = nScrX;
- aClipSize.Width() = nScrW;
+ aClipSize.Width() = nScrWTwips;
}
if (bPixelToLogic)
@@ -5169,7 +5227,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
pEngine->SetDefaultItem(
SvxAdjustItem( eSvxAdjust, EE_PARA_JUST ) );
- aPaperSize.Width() = nOutWidth;
+ aPaperSize.Width() = LogicToPixelHorizontal( nOutWidthTwips );
if (bPixelToLogic)
pEngine->SetPaperSize(mpRefDevice->PixelToLogic(aPaperSize));
else
@@ -5191,6 +5249,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
if ( bLayoutRTL )
{
+ const long nCellWidth = LogicToPixelHorizontal( nCellWidthTwips );
if (bPixelToLogic)
aLogicStart.X() -= mpRefDevice->PixelToLogic(
Size( nCellWidth, 0 ) ).Width();
@@ -5255,7 +5314,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
if ( eRotMode != SVX_ROTATE_MODE_STANDARD )
{
//! begrenzen !!!
- double nSkew = nTotalHeight * nCos / fabs(nSin);
+ double nSkew = nTotalHeightPixel *
+ nCos / fabs(nSin);
if ( eRotMode == SVX_ROTATE_MODE_CENTER )
nAddX -= nSkew * 0.5;
if ( ( eRotMode == SVX_ROTATE_MODE_TOP && nSin > 0.0 ) ||
@@ -5311,10 +5371,10 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
}
}
}
- nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
+ nPosXTwips += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
}
}
- nRowPosY += pRowInfo[nArrY].nHeight;
+ nRowPosYTwips += pRowInfo[nArrY].nHeight;
}
}
commit aab13b4bf4b9209c0e1596b391f1e58ab5951652
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Fri Aug 29 10:36:26 2014 +0200
TEMPORARY: ViewData SetPosX/Y.
Is this just unnecessary data duplication?
(Would've been necessary with the old scaling I guess, but we
don't have these inaccuracies any more?)
Change-Id: I955345668d0d85a30e37316dd9a12f64d6bcbb03
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index eecfdcf..bd1dbe5 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1895,20 +1895,28 @@ void ScViewData::SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX )
long nTPosX = pThisTab->nTPosX[eWhich];
long nPixPosX = pThisTab->nPixPosX[eWhich];
SCCOL i;
+
+ // Really not sure what we should do -- is nPixPosX
+ // just a pix version of nTPosX, in which case we should
+ // completely remove nPixPosX and provide it dynamically?
if ( nNewPosX > nOldPosX )
+ {
for ( i=nOldPosX; i<nNewPosX; i++ )
{
long nThis = pDoc->GetColWidth( i,nTabNo );
nTPosX -= nThis;
- nPixPosX -= ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTX);
+ nPixPosX -= LogicToPixelHorizontal( nThis );
}
+ }
else
+ {
for ( i=nNewPosX; i<nOldPosX; i++ )
{
long nThis = pDoc->GetColWidth( i,nTabNo );
nTPosX += nThis;
- nPixPosX += ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTX);
+ nPixPosX += LogicToPixelHorizontal( nThis );
}
+ }
pThisTab->nPosX[eWhich] = nNewPosX;
pThisTab->nTPosX[eWhich] = nTPosX;
@@ -1931,23 +1939,27 @@ void ScViewData::SetPosY( ScVSplitPos eWhich, SCROW nNewPosY )
long nPixPosY = pThisTab->nPixPosY[eWhich];
SCROW i, nHeightEndRow;
if ( nNewPosY > nOldPosY )
+ {
for ( i=nOldPosY; i<nNewPosY; i++ )
{
long nThis = pDoc->GetRowHeight( i, nTabNo, NULL, &nHeightEndRow );
SCROW nRows = std::min( nNewPosY, nHeightEndRow + 1) - i;
i = nHeightEndRow;
nTPosY -= nThis * nRows;
- nPixPosY -= ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTY) * nRows;
+ nPixPosY -= LogicToPixelVertical( nThis ) * nRows;
}
+ }
else
+ {
for ( i=nNewPosY; i<nOldPosY; i++ )
{
long nThis = pDoc->GetRowHeight( i, nTabNo, NULL, &nHeightEndRow );
SCROW nRows = std::min( nOldPosY, nHeightEndRow + 1) - i;
i = nHeightEndRow;
nTPosY += nThis * nRows;
- nPixPosY += ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTY) * nRows;
+ nPixPosY += LogicToPixelVertical( nThis ) * nRows;
}
+ }
pThisTab->nPosY[eWhich] = nNewPosY;
pThisTab->nTPosY[eWhich] = nTPosY;
commit 191ca27f7488ed5eb0e0853636f77e399db439aa
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Fri Aug 29 10:31:40 2014 +0200
ViewData: further twips updates.
Change-Id: I88b45057ce6feb121f14ecda65a23f2631349ef8
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 2885f0e..eecfdcf 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1729,11 +1729,11 @@ bool ScViewData::GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& r
const ScMergeAttr* pMerge = (const ScMergeAttr*) pDoc->GetAttr( nX,nY,nTabNo, ATTR_MERGE );
if ( pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1 )
{
- long nOutWidth = 0;
- long nOutHeight = 0;
+ long nOutWidthTwips = 0;
+ long nOutHeightTwips = 0;
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=0; i<nCountX; i++)
- nOutWidth += ToPixel( pDoc->GetColWidth(nX+i,nTabNo), nPPTX );
+ nOutWidthTwips += pDoc->GetColWidth(nX+i,nTabNo);
SCROW nCountY = pMerge->GetRowMerge();
for (SCROW nRow = nY; nRow <= nY+nCountY-1; ++nRow)
@@ -1781,24 +1781,27 @@ bool ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
SCsROW nStartPosY = GetPosY(eVWhich);
rPosX = nStartPosX;
rPosY = nStartPosY;
- long nScrX = 0;
- long nScrY = 0;
+
+ Point aScrPosTwips = Point( 0, 0 );
+
+ Point aClickLogic = GetActiveWin()->PixelToLogic( Point( nClickX, nClickY ),
+ maPaintMapMode );
if (nClickX > 0)
{
- while ( rPosX<=MAXCOL && nClickX >= nScrX )
+ while ( ( rPosX <= MAXCOL ) && ( aClickLogic.getX() >= aScrPosTwips.getX() ) )
{
- nScrX += ToPixel( pDoc->GetColWidth( rPosX, nTabNo ), nPPTX );
+ aScrPosTwips.X() += pDoc->GetColWidth( rPosX, nTabNo );
++rPosX;
}
--rPosX;
}
else
{
- while ( rPosX>0 && nClickX < nScrX )
+ while ( ( rPosX > 0 ) && ( aClickLogic.getX() < aScrPosTwips.getX() ) )
{
--rPosX;
- nScrX -= ToPixel( pDoc->GetColWidth( rPosX, nTabNo ), nPPTX );
+ aScrPosTwips.X() -= pDoc->GetColWidth( rPosX, nTabNo );
}
}
@@ -1809,10 +1812,10 @@ bool ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
else
{
/* TODO: could need some "SubPixelsWhileBackward" method */
- while ( rPosY>0 && nClickY < nScrY )
+ while ( ( rPosY > 0 ) && ( nClickY < aScrPosTwips.getY() ) )
{
--rPosY;
- nScrY -= ToPixel( pDoc->GetRowHeight( rPosY, nTabNo ), nPPTY );
+ aScrPosTwips.Y() -= pDoc->GetRowHeight( rPosY, nTabNo );
}
}
@@ -1962,17 +1965,21 @@ void ScViewData::RecalcPixPos() // after zoom changes
{
for (sal_uInt16 eWhich=0; eWhich<2; eWhich++)
{
- long nPixPosX = 0;
+ long nPosXTwips = 0;
SCCOL nPosX = pThisTab->nPosX[eWhich];
for (SCCOL i=0; i<nPosX; i++)
- nPixPosX -= ToPixel(pDoc->GetColWidth(i,nTabNo), nPPTX);
- pThisTab->nPixPosX[eWhich] = nPixPosX;
+ {
+ nPosXTwips -= pDoc->GetColWidth( i, nTabNo );
+ }
+ pThisTab->nPixPosX[eWhich] = LogicToPixelHorizontal( nPosXTwips );
- long nPixPosY = 0;
+ long nPosYTwips = 0;
SCROW nPosY = pThisTab->nPosY[eWhich];
for (SCROW j=0; j<nPosY; j++)
- nPixPosY -= ToPixel(pDoc->GetRowHeight(j,nTabNo), nPPTY);
- pThisTab->nPixPosY[eWhich] = nPixPosY;
+ {
+ nPosYTwips -= pDoc->GetRowHeight( j, nTabNo );
+ }
+ pThisTab->nPixPosY[eWhich] = LogicToPixelVertical( nPosYTwips );
}
}
@@ -1993,10 +2000,8 @@ void ScViewData::SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
{
SCCOL nCol;
SCROW nRow;
- sal_uInt16 nTSize;
- long nSizePix;
- long nScrPosX = 0;
- long nScrPosY = 0;
+ long nScrPosXTwips = 0;
+ long nScrPosYTwips = 0;
SetActivePart( SC_SPLIT_BOTTOMLEFT );
SetPosX( SC_SPLIT_LEFT, nCol1 );
@@ -2004,25 +2009,16 @@ void ScViewData::SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
for (nCol=nCol1; nCol<=nCol2; nCol++)
{
- nTSize = pDoc->GetColWidth( nCol, nTabNo );
- if (nTSize)
- {
- nSizePix = ToPixel( nTSize, nPPTX );
- nScrPosX += (sal_uInt16) nSizePix;
- }
+ nScrPosXTwips += pDoc->GetColWidth( nCol, nTabNo );
}
for (nRow=nRow1; nRow<=nRow2; nRow++)
{
- nTSize = pDoc->GetRowHeight( nRow, nTabNo );
- if (nTSize)
- {
- nSizePix = ToPixel( nTSize, nPPTY );
- nScrPosY += (sal_uInt16) nSizePix;
- }
+ nScrPosYTwips += pDoc->GetRowHeight( nRow, nTabNo );
}
- aScrSize = Size( nScrPosX, nScrPosY );
+ aScrSize = Size( LogicToPixelHorizontal( nScrPosXTwips ),
+ LogicToPixelVertical( nScrPosYTwips ) );
}
void ScViewData::SetScreenPos( const Point& rVisAreaStart )
commit 39704512df72fecb9a707c3b38e57242477d3dc5
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Fri Aug 29 10:23:40 2014 +0200
TEMPORARY: Use PaintMapMode scaling for DrawMapMode too.
Otherwise we end up with invalid scalings once PPTX/Y doesn't
exist.
We can't use the DrawView yet as that gives us invalid scales
for now (due to the PPTX/Y removal/disablement).
Change-Id: I59279cb007bace1237384f58b345079d23aee92e
diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx
index e9ac6ca..568ed96 100644
--- a/sc/source/ui/view/gridwin3.cxx
+++ b/sc/source/ui/view/gridwin3.cxx
@@ -249,20 +249,16 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce )
{
Fraction aScaleX;
Fraction aScaleY;
- if (pDrView)
- pDrView->GetScale( aScaleX, aScaleY );
- else
- {
- SCCOL nEndCol = 0;
- SCROW nEndRow = 0;
- pDoc->GetTableArea( nTab, nEndCol, nEndRow );
- if (nEndCol<20) nEndCol = 20;
- if (nEndRow<20) nEndRow = 1000;
- ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, this,
- pViewData->GetZoomX(),pViewData->GetZoomY(),
- pViewData->GetPPTX(),pViewData->GetPPTY(),
- aScaleX,aScaleY );
- }
+ // if (pDrView)
+ // {
+ // pDrView->GetScale( aScaleX, aScaleY );
+ // }
+ // else
+ // {
+ const MapMode& aPaintMapMode = pViewData->GetPaintMapMode();
+ aScaleX = aPaintMapMode.GetScaleX();
+ aScaleY = aPaintMapMode.GetScaleY();
+ // }
aDrawMode.SetScaleX(aScaleX);
aDrawMode.SetScaleY(aScaleY);
}
commit 49dcb45a3b6b03a27fe7f9047bd702d0f65d0bdd
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Fri Aug 29 10:06:57 2014 +0200
Use Twips in DrawEditStandard too.
This is used e.g. for cells which have been marked by the spellchecker.
Change-Id: I8e0f85c1ff6f3104520b986eb89b03c6d457bf78
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 3d1f280..989728d 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2800,7 +2800,10 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
// call GetOutputArea with nNeeded=0, to get only the cell width
//! handle nArrY == 0
- GetOutputArea( nXForPos, nArrYForPos, rParam.mnPosX, rParam.mnPosY, rParam.mnCellX, rParam.mnCellY, 0,
+ GetOutputArea( nXForPos, nArrYForPos,
+ PixelToLogicHorizontal( rParam.mnPosX ),
+ PixelToLogicVertical( rParam.mnPosY ),
+ rParam.mnCellX, rParam.mnCellY, 0,
*rParam.mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
rParam.mbCellIsValue, true, false, aAreaParam );
@@ -2863,7 +2866,10 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
if (!rParam.mbBreak || bShrink)
{
// for break, the first GetOutputArea call is sufficient
- GetOutputArea( nXForPos, nArrYForPos, rParam.mnPosX, rParam.mnPosY, rParam.mnCellX, rParam.mnCellY, nNeededPixel,
+ GetOutputArea( nXForPos, nArrYForPos,
+ PixelToLogicHorizontal( rParam.mnPosX ),
+ PixelToLogicVertical( rParam.mnPosY ),
+ rParam.mnCellX, rParam.mnCellY, nNeededPixel,
*rParam.mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
rParam.mbCellIsValue || bRepeat || bShrink, false, false, aAreaParam );
@@ -2962,7 +2968,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
nStartX += nLeftM;
}
- bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW);
+ bool bOutside = (aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrWTwips);
if (bOutside)
return;
@@ -2971,9 +2977,9 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
aAreaParam.maClipRect.Left() = nScrX;
aAreaParam.mbLeftClip = true;
}
- if ( aAreaParam.maClipRect.Right() > nScrX + nScrW )
+ if ( aAreaParam.maClipRect.Right() > nScrX + LogicToPixelHorizontal( nScrWTwips ) )
{
- aAreaParam.maClipRect.Right() = nScrX + nScrW; //! minus one?
+ aAreaParam.maClipRect.Right() = nScrX + LogicToPixelHorizontal( nScrWTwips ); //! minus one?
aAreaParam.mbRightClip = true;
}
@@ -2991,9 +2997,11 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
aAreaParam.maClipRect.Top() = nScrY;
bClip = true;
}
- if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrH )
+ if ( aAreaParam.maClipRect.Bottom() >
+ nScrY + PixelToLogicVertical( nScrHTwips ) )
{
- aAreaParam.maClipRect.Bottom() = nScrY + nScrH; //! minus one?
+ aAreaParam.maClipRect.Bottom() =
+ nScrY + PixelToLogicVertical( nScrHTwips ); //! minus one?
bClip = true;
}
@@ -3175,7 +3183,7 @@ void ScOutputData::ShowClipMarks( DrawEditParam& rParam, long nEngineHeight, con
pClipMarkCell->nClipMark |= SC_CLIPMARK_RIGHT; //! also allow left?
bAnyClipped = true;
- const long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX );
+ const long nMarkPixel = PixelToLogicHorizontal( SC_CLIPMARK_SIZE );
if ( aAreaParam.maClipRect.Right() - nMarkPixel > aAreaParam.maClipRect.Left() )
aAreaParam.maClipRect.Right() -= nMarkPixel;
}
commit ec7cf905858a59c6fd08cbb5b4bb6f4c38a3b810
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Aug 28 23:41:14 2014 +0200
Update DrawStrings to Twips.
Change-Id: I8df207056e5aab198a2d81b5a4a7cc4d85aa07e6
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index ed016cb..3d1f280 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1437,9 +1437,9 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
bool bProgress = false;
- long nInitPosX = nScrX;
+ long nInitPosXTwips = PixelToLogicHorizontal( nScrX );
if ( bLayoutRTL )
- nInitPosX += nMirrorW - 1; // pixels
+ nInitPosXTwips += nMirrorWTwips - PixelToLogicHorizontal( 1 ); // pixels
long nLayoutSign = bLayoutRTL ? -1 : 1;
SCCOL nLastContentCol = MAXCOL;
@@ -1453,7 +1453,7 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
// variables for GetOutputArea
OutputAreaParam aAreaParam;
bool bCellIsValue = false;
- long nNeededWidth = 0;
+ long nNeededWidthPix = 0;
const ScPatternAttr* pPattern = NULL;
const SfxItemSet* pCondSet = NULL;
const ScPatternAttr* pOldPattern = NULL;
@@ -1465,16 +1465,16 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
::boost::ptr_vector<ScPatternAttr> aAltPatterns;
std::vector<long> aDX;
- long nPosY = nScrY;
+ long nPosYTwips = PixelToLogicVertical( nScrY );
for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
{
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
if ( pThisRowInfo->bChanged )
{
SCROW nY = pThisRowInfo->nRowNo;
- long nPosX = nInitPosX;
+ long nPosXTwips = nInitPosXTwips;
if ( nLoopStartX < nX1 )
- nPosX -= pRowInfo[0].pCellInfo[nLoopStartX+1].nWidth * nLayoutSign;
+ nPosXTwips -= pRowInfo[0].pCellInfo[nLoopStartX+1].nWidth * nLayoutSign;
for (SCCOL nX=nLoopStartX; nX<=nX2; nX++)
{
bool bMergeEmpty = false;
@@ -1673,7 +1673,7 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
pOldPattern = NULL;
bNeedEdit = aVars.HasEditCharacters() || (bFormulaCell && aCell.mpFormula->IsMultilineResult());
}
- long nTotalMargin = 0;
+ long nTotalMarginPix = 0;
SvxCellHorJustify eOutHorJust = SVX_HOR_JUSTIFY_STANDARD;
if (bDoCell && !bNeedEdit)
{
@@ -1696,19 +1696,22 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
bool bRepeat = aVars.IsRepeat() && !bBreak;
bool bShrink = aVars.IsShrink() && !bBreak && !bRepeat;
- nTotalMargin =
- static_cast<long>(aVars.GetLeftTotal() * mnPPTX) +
- static_cast<long>(aVars.GetMargin()->GetRightMargin() * mnPPTX);
+ nTotalMarginPix = LogicToPixelHorizontal(
+ aVars.GetLeftTotal() + aVars.GetMargin()->GetRightMargin() );
- nNeededWidth = aVars.GetTextSize().Width() + nTotalMargin;
+ nNeededWidthPix = aVars.GetTextSize().Width() + nTotalMarginPix;
// GetOutputArea gives justfied rectangles
- GetOutputArea( nX, nArrY, nPosX, nPosY, nCellX, nCellY, nNeededWidth,
+ GetOutputArea( nX, nArrY,
+ nPosXTwips,
+ nPosYTwips,
+ nCellX, nCellY,
+ nNeededWidthPix, // Pixels
*pPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
bCellIsValue || bRepeat || bShrink, bBreak, false,
aAreaParam );
- aVars.RepeatToFill( aAreaParam.mnColWidth - nTotalMargin );
+ aVars.RepeatToFill( aAreaParam.mnColWidth - nTotalMarginPix );
if ( bShrink )
{
if ( aVars.GetOrient() != SVX_ORIENTATION_STANDARD )
@@ -1719,7 +1722,7 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
}
else if ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip ) // horizontal
{
- long nAvailable = aAreaParam.maAlignRect.GetWidth() - nTotalMargin;
+ long nAvailable = aAreaParam.maAlignRect.GetWidth() - nTotalMarginPix;
long nScaleSize = aVars.GetTextSize().Width(); // without margin
if ( nScaleSize > 0 ) // 0 if the text is empty (formulas, number formats)
@@ -1752,7 +1755,7 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
if ( bRepeat && !aAreaParam.mbLeftClip && !aAreaParam.mbRightClip )
{
- long nAvailable = aAreaParam.maAlignRect.GetWidth() - nTotalMargin;
+ long nAvailable = aAreaParam.maAlignRect.GetWidth() - nTotalMarginPix;
long nRepeatSize = aVars.GetTextSize().Width(); // without margin
// When formatting for the printer, the text sizes don't always add up.
// Round down (too few repetitions) rather than exceeding the cell size then:
@@ -1779,10 +1782,10 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
bNeedEdit = ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip );
else
{
- long nHeight = aVars.GetTextSize().Height() +
- (long)(aVars.GetMargin()->GetTopMargin()*mnPPTY) +
- (long)(aVars.GetMargin()->GetBottomMargin()*mnPPTY);
- bNeedEdit = ( nHeight > aAreaParam.maClipRect.GetHeight() );
+ long nHeightPix = aVars.GetTextSize().Height() +
+ LogicToPixelVertical( aVars.GetMargin()->GetTopMargin() ) +
+ LogicToPixelVertical( aVars.GetMargin()->GetBottomMargin() );
+ bNeedEdit = ( nHeightPix > aAreaParam.maClipRect.GetHeight() );
}
}
if (!bNeedEdit)
@@ -1810,12 +1813,12 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
aVars.SetHashText();
else
// Adjust the decimals to fit the available column width.
- aVars.SetTextToWidthOrHash(aCell, aAreaParam.mnColWidth - nTotalMargin);
+ aVars.SetTextToWidthOrHash( aCell, aAreaParam.mnColWidth - nTotalMarginPix );
- nNeededWidth = aVars.GetTextSize().Width() +
- (long) ( aVars.GetLeftTotal() * mnPPTX ) +
- (long) ( aVars.GetMargin()->GetRightMargin() * mnPPTX );
- if ( nNeededWidth <= aAreaParam.maClipRect.GetWidth() )
+ nNeededWidthPix = aVars.GetTextSize().Width() +
+ LogicToPixelHorizontal(
+ aVars.GetLeftTotal() + aVars.GetMargin()->GetRightMargin() );
+ if ( nNeededWidthPix <= aAreaParam.maClipRect.GetWidth() )
{
// Cell value is no longer clipped. Reset relevant parameters.
aAreaParam.mbLeftClip = aAreaParam.mbRightClip = false;
@@ -1832,15 +1835,17 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
long nAvailWidth = aAreaParam.maAlignRect.GetWidth();
long nOutHeight = aAreaParam.maAlignRect.GetHeight();
- bool bOutside = ( aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW );
+ bool bOutside = ( aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrWTwips );
if ( aAreaParam.maClipRect.Left() < nScrX )
{
aAreaParam.maClipRect.Left() = nScrX;
aAreaParam.mbLeftClip = true;
}
- if ( aAreaParam.maClipRect.Right() > nScrX + nScrW )
+ if ( aAreaParam.maClipRect.Right() >
+ nScrX + LogicToPixelHorizontal( nScrWTwips ) )
{
- aAreaParam.maClipRect.Right() = nScrX + nScrW; //! minus one?
+ aAreaParam.maClipRect.Right() =
+ nScrX + LogicToPixelHorizontal( nScrWTwips ); //! minus one?
aAreaParam.mbRightClip = true;
}
@@ -1852,9 +1857,11 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
aAreaParam.maClipRect.Top() = nScrY;
bVClip = true;
}
- if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrH )
+ if ( aAreaParam.maClipRect.Bottom() >
+ nScrY + LogicToPixelVertical( nScrHTwips ) )
{
- aAreaParam.maClipRect.Bottom() = nScrY + nScrH; //! minus one?
+ aAreaParam.maClipRect.Bottom() =
+ nScrY + LogicToPixelVertical( nScrHTwips ); //! minus one?
bVClip = true;
}
@@ -1867,17 +1874,19 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
switch (eOutHorJust)
{
case SVX_HOR_JUSTIFY_LEFT:
- nJustPosX += (long) ( aVars.GetLeftTotal() * mnPPTX );
+ nJustPosX += LogicToPixelHorizontal(
+ aVars.GetLeftTotal() );
break;
case SVX_HOR_JUSTIFY_RIGHT:
nJustPosX += nAvailWidth - aVars.GetTextSize().Width() -
- (long) ( aVars.GetRightTotal() * mnPPTX );
+ LogicToPixelHorizontal( aVars.GetRightTotal() );
bRightAdjusted = true;
break;
case SVX_HOR_JUSTIFY_CENTER:
nJustPosX += ( nAvailWidth - aVars.GetTextSize().Width() +
- (long) ( aVars.GetLeftTotal() * mnPPTX ) -
- (long) ( aVars.GetMargin()->GetRightMargin() * mnPPTX ) ) / 2;
+ LogicToPixelHorizontal(
+ aVars.GetLeftTotal() -
+ aVars.GetMargin()->GetRightMargin() ) ) / 2;
break;
default:
{
@@ -1891,22 +1900,26 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
case SVX_VER_JUSTIFY_TOP:
case SVX_VER_JUSTIFY_BLOCK:
{
- long nTop = (long)( aVars.GetMargin()->GetTopMargin() * mnPPTY );
+ long nTop = LogicToPixelVertical(
+ aVars.GetMargin()->GetTopMargin() );
nJustPosY += nTop;
nTestClipHeight += nTop;
}
break;
case SVX_VER_JUSTIFY_BOTTOM:
{
- long nBot = (long)( aVars.GetMargin()->GetBottomMargin() * mnPPTY );
+ long nBot = LogicToPixelVertical(
+ aVars.GetMargin()->GetBottomMargin() );
nJustPosY += nOutHeight - aVars.GetTextSize().Height() - nBot;
nTestClipHeight += nBot;
}
break;
case SVX_VER_JUSTIFY_CENTER:
{
- long nTop = (long)( aVars.GetMargin()->GetTopMargin() * mnPPTY );
- long nBot = (long)( aVars.GetMargin()->GetBottomMargin() * mnPPTY );
+ long nTop = LogicToPixelVertical(
+ aVars.GetMargin()->GetTopMargin() );
+ long nBot = LogicToPixelVertical(
+ aVars.GetMargin()->GetBottomMargin() );
nJustPosY += ( nOutHeight + nTop -
aVars.GetTextSize().Height() - nBot ) / 2;
nTestClipHeight += std::abs( nTop - nBot );
@@ -1937,12 +1950,14 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
if (!bHClip)
{
aAreaParam.maClipRect.Left() = nScrX;
- aAreaParam.maClipRect.Right() = nScrX+nScrW;
+ aAreaParam.maClipRect.Right() =
+ nScrX + LogicToPixelHorizontal( nScrWTwips );
}
if (!bVClip)
{
aAreaParam.maClipRect.Top() = nScrY;
- aAreaParam.maClipRect.Bottom() = nScrY+nScrH;
+ aAreaParam.maClipRect.Bottom() =
+ nScrY + LogicToPixelHorizontal( nScrHTwips );
}
// aClipRect is not used after SetClipRegion/IntersectClipRegion,
@@ -2076,10 +2091,10 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
}
}
}
- nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
+ nPosXTwips += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
}
}
- nPosY += pRowInfo[nArrY].nHeight;
+ nPosYTwips += pRowInfo[nArrY].nHeight;
}
if ( bProgress )
ScProgress::DeleteInterpretProgress();
commit 1c45761f2dda67ababf7a0b1f8b809710c5c58b2
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Aug 28 23:35:52 2014 +0200
Upgrade GetOutputArea to Twips too.
Change-Id: Ie8f4f004fb73c1042616aaa475ab1d12c33f1181
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index b5cb414..ed016cb 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1144,7 +1144,7 @@ bool ScOutputData::IsAvailable( SCCOL nX, SCROW nY )
// rParam output: various area parameters.
void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY,
- SCCOL nCellX, SCROW nCellY, long nNeeded,
+ SCCOL nCellX, SCROW nCellY, long nNeededPix,
const ScPatternAttr& rPattern,
sal_uInt16 nHorJustify, bool bCellIsValue,
bool bBreak, bool bOverwrite,
@@ -1155,46 +1155,45 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
long nLayoutSign = bLayoutRTL ? -1 : 1;
- long nCellPosX = nPosX; // find nCellX position, starting at nX/nPosX
+ long nCellPosXTwips = nPosX; // find nCellX position, starting at nX/nPosX
SCCOL nCompCol = nX;
while ( nCellX > nCompCol )
{
//! extra member function for width?
long nColWidth = ( nCompCol <= nX2 ) ?
- pRowInfo[0].pCellInfo[nCompCol+1].nWidth :
- (long) ( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX );
- nCellPosX += nColWidth * nLayoutSign;
+ pRowInfo[0].pCellInfo[nCompCol+1].nWidth :
+ mpDoc->GetColWidth( nCompCol, nTab );
+ nCellPosXTwips += nColWidth * nLayoutSign;
++nCompCol;
}
while ( nCellX < nCompCol )
{
--nCompCol;
long nColWidth = ( nCompCol <= nX2 ) ?
- pRowInfo[0].pCellInfo[nCompCol+1].nWidth :
- (long) ( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX );
- nCellPosX -= nColWidth * nLayoutSign;
+ pRowInfo[0].pCellInfo[nCompCol+1].nWidth :
+ mpDoc->GetColWidth( nCompCol, nTab );
+ nCellPosXTwips -= nColWidth * nLayoutSign;
}
- long nCellPosY = nPosY; // find nCellY position, starting at nArrY/nPosY
+ long nCellPosYTwips = nPosY; // find nCellY position, starting at nArrY/nPosY
SCSIZE nCompArr = nArrY;
SCROW nCompRow = pRowInfo[nCompArr].nRowNo;
while ( nCellY > nCompRow )
{
if ( nCompArr + 1 < nArrCount )
{
- nCellPosY += pRowInfo[nCompArr].nHeight;
+ nCellPosYTwips += pRowInfo[nCompArr].nHeight;
++nCompArr;
nCompRow = pRowInfo[nCompArr].nRowNo;
}
else
{
- sal_uInt16 nDocHeight = mpDoc->GetRowHeight( nCompRow, nTab );
- if ( nDocHeight )
- nCellPosY += (long) ( nDocHeight * mnPPTY );
+ nCellPosYTwips += mpDoc->GetRowHeight( nCompRow, nTab );
++nCompRow;
}
}
- nCellPosY -= (long) mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, mnPPTY );
+
+ nCellPosYTwips -= (long) mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, 1.0 );
const ScMergeAttr* pMerge = (const ScMergeAttr*)&rPattern.GetItem( ATTR_MERGE );
bool bMerged = pMerge->IsMerged();
@@ -1205,61 +1204,62 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
if ( nMergeRows == 0 )
nMergeRows = 1;
- long nMergeSizeX = 0;
+ long nMergeSizeXTwips = 0;
for ( long i=0; i<nMergeCols; i++ )
{
long nColWidth = ( nCellX+i <= nX2 ) ?
- pRowInfo[0].pCellInfo[nCellX+i+1].nWidth :
- (long) ( mpDoc->GetColWidth( sal::static_int_cast<SCCOL>(nCellX+i), nTab ) * mnPPTX );
- nMergeSizeX += nColWidth;
+ pRowInfo[0].pCellInfo[nCellX+i+1].nWidth :
+ mpDoc->GetColWidth( sal::static_int_cast<SCCOL>(nCellX+i), nTab );
+ nMergeSizeXTwips += nColWidth;
}
- long nMergeSizeY = 0;
+ long nMergeSizeYTwips = 0;
short nDirect = 0;
if ( rThisRowInfo.nRowNo == nCellY )
{
// take first row's height from row info
- nMergeSizeY += rThisRowInfo.nHeight;
+ nMergeSizeYTwips += rThisRowInfo.nHeight;
nDirect = 1; // skip in loop
}
// following rows always from document
- nMergeSizeY += (long) mpDoc->GetScaledRowHeight( nCellY+nDirect, nCellY+nMergeRows-1, nTab, mnPPTY);
+ nMergeSizeYTwips += mpDoc->GetScaledRowHeight( nCellY + nDirect, nCellY + nMergeRows - 1, nTab, 1.0 );
- --nMergeSizeX; // leave out the grid horizontally, also for alignment (align between grid lines)
+ nMergeSizeXTwips -= PixelToLogicHorizontal( 1 ); // leave out the grid horizontally, also for alignment (align between grid lines)
- rParam.mnColWidth = nMergeSizeX; // store the actual column width.
+ rParam.mnColWidth = LogicToPixelHorizontal( nMergeSizeXTwips ); // store the actual column width.
rParam.mnLeftClipLength = rParam.mnRightClipLength = 0;
// construct the rectangles using logical left/right values (justify is called at the end)
// rAlignRect is the single cell or merged area, used for alignment.
- rParam.maAlignRect.Left() = nCellPosX;
- rParam.maAlignRect.Right() = nCellPosX + ( nMergeSizeX - 1 ) * nLayoutSign;
- rParam.maAlignRect.Top() = nCellPosY;
- rParam.maAlignRect.Bottom() = nCellPosY + nMergeSizeY - 1;
+ rParam.maAlignRect.Left() = LogicToPixelHorizontal( nCellPosXTwips );
+ rParam.maAlignRect.Right() = LogicToPixelHorizontal(
+ nCellPosXTwips + ( nMergeSizeXTwips ) * nLayoutSign ) - 1 * nLayoutSign;
+ rParam.maAlignRect.Top() = LogicToPixelVertical( nCellPosYTwips );
+ rParam.maAlignRect.Bottom() = LogicToPixelVertical( nCellPosYTwips + nMergeSizeYTwips ) - 1;
// rClipRect is all cells that are used for output.
// For merged cells this is the same as rAlignRect, otherwise neighboring cells can also be used.
rParam.maClipRect = rParam.maAlignRect;
- if ( nNeeded > nMergeSizeX )
+ if ( PixelToLogicHorizontal( nNeededPix ) > nMergeSizeXTwips )
{
SvxCellHorJustify eHorJust = (SvxCellHorJustify)nHorJustify;
- long nMissing = nNeeded - nMergeSizeX;
- long nLeftMissing = 0;
- long nRightMissing = 0;
+ long nMissingTwips = PixelToLogicHorizontal( nNeededPix ) - nMergeSizeXTwips;
+ long nLeftMissingTwips = 0;
+ long nRightMissingTwips = 0;
switch ( eHorJust )
{
case SVX_HOR_JUSTIFY_LEFT:
- nRightMissing = nMissing;
+ nRightMissingTwips = nMissingTwips;
break;
case SVX_HOR_JUSTIFY_RIGHT:
- nLeftMissing = nMissing;
+ nLeftMissingTwips = nMissingTwips;
break;
case SVX_HOR_JUSTIFY_CENTER:
- nLeftMissing = nMissing / 2;
- nRightMissing = nMissing - nLeftMissing;
+ nLeftMissingTwips = nMissingTwips / 2;
+ nRightMissingTwips = nMissingTwips - nLeftMissingTwips;
break;
default:
{
@@ -1269,7 +1269,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
// nLeftMissing, nRightMissing are logical, eHorJust values are visual
if ( bLayoutRTL )
- ::std::swap( nLeftMissing, nRightMissing );
+ ::std::swap( nLeftMissingTwips, nRightMissingTwips );
SCCOL nRightX = nCellX;
SCCOL nLeftX = nCellX;
@@ -1277,50 +1277,48 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
{
// look for empty cells into which the text can be extended
- while ( nRightMissing > 0 && nRightX < MAXCOL && ( bOverwrite || IsAvailable( nRightX+1, nCellY ) ) )
+ while ( nRightMissingTwips > 0 && nRightX < MAXCOL && ( bOverwrite || IsAvailable( nRightX+1, nCellY ) ) )
{
++nRightX;
- long nAdd = (long) ( mpDoc->GetColWidth( nRightX, nTab ) * mnPPTX );
- nRightMissing -= nAdd;
- rParam.maClipRect.Right() += nAdd * nLayoutSign;
+ long nAdd = mpDoc->GetColWidth( nRightX, nTab );
+ nRightMissingTwips -= nAdd;
+ rParam.maClipRect.Right() += LogicToPixelHorizontal( nAdd * nLayoutSign );
if ( rThisRowInfo.nRowNo == nCellY && nRightX >= nX1 && nRightX <= nX2 )
rThisRowInfo.pCellInfo[nRightX].bHideGrid = true;
}
- while ( nLeftMissing > 0 && nLeftX > 0 && ( bOverwrite || IsAvailable( nLeftX-1, nCellY ) ) )
+ while ( nLeftMissingTwips > 0 && nLeftX > 0 && ( bOverwrite || IsAvailable( nLeftX-1, nCellY ) ) )
{
if ( rThisRowInfo.nRowNo == nCellY && nLeftX >= nX1 && nLeftX <= nX2 )
rThisRowInfo.pCellInfo[nLeftX].bHideGrid = true;
--nLeftX;
- long nAdd = (long) ( mpDoc->GetColWidth( nLeftX, nTab ) * mnPPTX );
- nLeftMissing -= nAdd;
- rParam.maClipRect.Left() -= nAdd * nLayoutSign;
+ long nAdd = mpDoc->GetColWidth( nLeftX, nTab );
+ nLeftMissingTwips -= nAdd;
+ rParam.maClipRect.Left() -= LogicToPixelHorizontal( nAdd ) * nLayoutSign;
}
}
// Set flag and reserve space for clipping mark triangle,
// even if rThisRowInfo isn't for nCellY (merged cells).
- if ( nRightMissing > 0 && bMarkClipped && nRightX >= nX1 && nRightX <= nX2 && !bBreak && !bCellIsValue )
+ if ( nRightMissingTwips > 0 && bMarkClipped && nRightX >= nX1 && nRightX <= nX2 && !bBreak && !bCellIsValue )
{
rThisRowInfo.pCellInfo[nRightX+1].nClipMark |= SC_CLIPMARK_RIGHT;
bAnyClipped = true;
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
- rParam.maClipRect.Right() -= nMarkPixel * nLayoutSign;
+ rParam.maClipRect.Right() -= LogicToPixelHorizontal( SC_CLIPMARK_SIZE ) * nLayoutSign;
}
- if ( nLeftMissing > 0 && bMarkClipped && nLeftX >= nX1 && nLeftX <= nX2 && !bBreak && !bCellIsValue )
+ if ( nLeftMissingTwips > 0 && bMarkClipped && nLeftX >= nX1 && nLeftX <= nX2 && !bBreak && !bCellIsValue )
{
rThisRowInfo.pCellInfo[nLeftX+1].nClipMark |= SC_CLIPMARK_LEFT;
bAnyClipped = true;
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
- rParam.maClipRect.Left() += nMarkPixel * nLayoutSign;
+ rParam.maClipRect.Left() += LogicToPixelHorizontal( SC_CLIPMARK_SIZE ) * nLayoutSign;
}
- rParam.mbLeftClip = ( nLeftMissing > 0 );
- rParam.mbRightClip = ( nRightMissing > 0 );
- rParam.mnLeftClipLength = nLeftMissing;
- rParam.mnRightClipLength = nRightMissing;
+ rParam.mbLeftClip = ( nLeftMissingTwips > 0 );
+ rParam.mbRightClip = ( nRightMissingTwips > 0 );
+ rParam.mnLeftClipLength = LogicToPixelHorizontal( nLeftMissingTwips );
+ rParam.mnRightClipLength = LogicToPixelHorizontal( nRightMissingTwips );
}
else
{
@@ -1335,7 +1333,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
{
// filter drop-down width is now independent from row height
const long nFilter = DROPDOWN_BITMAP_SIZE;
- bool bFit = ( nNeeded + nFilter <= nMergeSizeX );
+ bool bFit = ( PixelToLogicHorizontal( nNeededPix + nFilter ) <= nMergeSizeXTwips );
if ( bFit || bCellIsValue )
{
// content fits even in the remaining area without the filter button
commit dcd7063ce617aa79226070be60337fe500fb832b
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Aug 28 23:32:38 2014 +0200
TEMPORARY: don't predraw for calc.
Since we don't have ViewData (yet), the scaling in OutputData is wrong,
making this output ugly. This only seems to affect what appeasrs on screen
directly after startup, and there appears to be no negative effect from
this, so maybe we can jus tkill this pre-painting?
Change-Id: Ie4178ed39263e07fa11a139b20811799b7253601
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 8027dc8..0b32380 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1865,21 +1865,21 @@ void ScDocShell::Draw( OutputDevice* pDev, const JobSetup & /* rSetup */, sal_uI
if ( nAspect == ASPECT_THUMBNAIL )
{
- Rectangle aBoundRect = GetVisArea( ASPECT_THUMBNAIL );
- ScViewData aTmpData( this, NULL );
- aTmpData.SetTabNo(nVisTab);
- SnapVisArea( aBoundRect );
- aTmpData.SetScreen( aBoundRect );
- ScPrintFunc::DrawToDev( &aDocument, pDev, 1.0, aBoundRect, &aTmpData, true );
+// Rectangle aBoundRect = GetVisArea( ASPECT_THUMBNAIL );
+// ScViewData aTmpData( this, NULL );
+// aTmpData.SetTabNo(nVisTab);
+// SnapVisArea( aBoundRect );
+// aTmpData.SetScreen( aBoundRect );
+// // ScPrintFunc::DrawToDev( &aDocument, pDev, 1.0, aBoundRect, &aTmpData, true );
}
else
{
- Rectangle aBoundRect = SfxObjectShell::GetVisArea();
- ScViewData aTmpData( this, NULL );
- aTmpData.SetTabNo(nVisTab);
- SnapVisArea( aBoundRect );
- aTmpData.SetScreen( aBoundRect );
- ScPrintFunc::DrawToDev( &aDocument, pDev, 1.0, aBoundRect, &aTmpData, true );
+ // Rectangle aBoundRect = SfxObjectShell::GetVisArea();
+ // ScViewData aTmpData( this, NULL );
+ // aTmpData.SetTabNo(nVisTab);
+ // SnapVisArea( aBoundRect );
+ // aTmpData.SetScreen( aBoundRect );
+ // ScPrintFunc::DrawToDev( &aDocument, pDev, 1.0, aBoundRect, &aTmpData, true );
}
pDev->SetLayoutMode( nOldLayoutMode );
commit 5bd555419d831d4d854b2fd0c06c13f7627b5f7d
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Aug 28 23:23:09 2014 +0200
TEMPORARY: variable renamed, but usage not yet adapted.
Change-Id: Ica80137ab67f7687db03cc0f6c0f7eb10d574a69
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 9d5c6f2..196c347 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1997,8 +1997,8 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
{
long nMinX = nScrX;
long nMinY = nScrY;
- long nMaxX = nScrX + nScrW - 1;
- long nMaxY = nScrY + nScrH - 1;
+ long nMaxX = nScrX + nScrWTwips - 1;
+ long nMaxY = nScrY + nScrHTwips - 1;
if ( bLayoutRTL )
{
long nTemp = nMinX;
@@ -2041,7 +2041,7 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
long nPosX = nScrX;
if ( bLayoutRTL )
- nPosX += nMirrorW - 1; // always in pixels
+ nPosX += nMirrorWTwips - 1; // always in pixels
for (SCCOL nX=nX1; nX<=nX2; nX++)
{
@@ -2125,8 +2125,8 @@ void ScOutputData::DrawOneChange( SCCOL nRefStartX, SCROW nRefStartY,
{
long nMinX = nScrX;
long nMinY = nScrY;
- long nMaxX = nScrX+nScrW-1;
- long nMaxY = nScrY+nScrH-1;
+ long nMaxX = nScrX+nScrWTwips-1;
+ long nMaxY = nScrY+nScrHTwips-1;
if ( bLayoutRTL )
{
long nTemp = nMinX;
@@ -2169,7 +2169,7 @@ void ScOutputData::DrawOneChange( SCCOL nRefStartX, SCROW nRefStartY,
long nPosX = nScrX;
if ( bLayoutRTL )
- nPosX += nMirrorW - 1; // always in pixels
+ nPosX += nMirrorWTwips - 1; // always in pixels
for (SCCOL nX=nX1; nX<=nX2+1; nX++)
{
@@ -2302,7 +2302,7 @@ void ScOutputData::DrawNoteMarks()
long nInitPosX = nScrX;
if ( bLayoutRTL )
- nInitPosX += nMirrorW - 1; // always in pixels
+ nInitPosX += nMirrorWTwips - 1; // always in pixels
long nLayoutSign = bLayoutRTL ? -1 : 1;
long nPosY = nScrY;
@@ -2355,7 +2355,7 @@ void ScOutputData::DrawNoteMarks()
++nNextX;
}
}
- if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrW ) )
+ if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrWTwips ) )
mpDev->DrawRect( Rectangle( nMarkX-5*nLayoutSign,nPosY,nMarkX+1*nLayoutSign,nPosY+6 ) );
}
@@ -2377,7 +2377,7 @@ void ScOutputData::AddPDFNotes()
{
Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
long nOneX = aOnePixel.Width();
- nInitPosX += nMirrorW - nOneX;
+ nInitPosX += nMirrorWTwips - nOneX;
}
long nLayoutSign = bLayoutRTL ? -1 : 1;
@@ -2421,7 +2421,7 @@ void ScOutputData::AddPDFNotes()
++nNextX;
}
}
- if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrW ) )
+ if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrWTwips ) )
{
Rectangle aNoteRect( nMarkX, nPosY, nMarkX+nNoteWidth*nLayoutSign, nPosY+nNoteHeight );
const ScPostIt* pNote = mpDoc->GetNote(nMergeX, nMergeY, nTab);
commit 318a571741d8ced9647cc2dabdaa6c1c8a1a90ed
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Aug 28 23:22:15 2014 +0200
Logic coordinates for clip marks too.
Change-Id: I214064a1c060af2078dc5cd3f1fb4990ea374f0b
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index f4a22ac..9d5c6f2 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2467,7 +2467,7 @@ void ScOutputData::DrawClipMarks()
long nInitPosX = nScrX;
if ( bLayoutRTL )
- nInitPosX += nMirrorW - 1; // always in pixels
+ nInitPosX += LogicToPixelHorizontal( nMirrorWTwips ) - 1; // always in pixels
long nLayoutSign = bLayoutRTL ? -1 : 1;
Rectangle aCellRect;
@@ -2497,26 +2497,34 @@ void ScOutputData::DrawClipMarks()
nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & SC_MF_HOR ) )
{
--nOverX;
- nStartPosX -= nLayoutSign * (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX );
+ nStartPosX -= nLayoutSign *
+ LogicToPixelHorizontal( mpDoc->GetColWidth(nOverX,nTab) );
}
while ( nOverY > 0 && ( ((const ScMergeFlagAttr*)mpDoc->GetAttr(
nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & SC_MF_VER ) )
{
--nOverY;
- nStartPosY -= nLayoutSign * (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY );
+ nStartPosY -= nLayoutSign *
+ LogicToPixelVertical( mpDoc->GetRowHeight(nOverY,nTab) );
}
- long nOutWidth = (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX );
- long nOutHeight = (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY );
+ long nOutWidth = LogicToPixelHorizontal(
+ mpDoc->GetColWidth(nOverX,nTab) );
+ long nOutHeight = LogicToPixelVertical(
+ mpDoc->GetRowHeight(nOverY,nTab) );
const ScMergeAttr* pMerge = (const ScMergeAttr*)
mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE );
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=1; i<nCountX; i++)
- nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
+ {
+ nOutWidth += LogicToPixelHorizontal(
+ mpDoc->GetColWidth(nOverX+i,nTab) );
+ }
SCROW nCountY = pMerge->GetRowMerge();
- nOutHeight += (long) mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY);
+ nOutHeight += LogicToPixelVertical(
+ mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, 1.0 ) );
if ( bLayoutRTL )
nStartPosX -= nOutWidth - 1;
@@ -2524,8 +2532,8 @@ void ScOutputData::DrawClipMarks()
}
else
{
- long nOutWidth = pRowInfo[0].pCellInfo[nX+1].nWidth;
- long nOutHeight = pThisRowInfo->nHeight;
+ long nOutWidth = LogicToPixelHorizontal( pRowInfo[0].pCellInfo[nX+1].nWidth );
+ long nOutHeight = LogicToPixelVertical( pThisRowInfo->nHeight );
if ( pInfo->bMerged && pInfo->pPatternAttr )
{
@@ -2535,9 +2543,12 @@ void ScOutputData::DrawClipMarks()
(ScMergeAttr*)&pInfo->pPatternAttr->GetItem(ATTR_MERGE);
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=1; i<nCountX; i++)
- nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
+ {
+ nOutWidth += LogicToPixelHorizontal( mpDoc->GetColWidth(nOverX+i,nTab) );
+ }
SCROW nCountY = pMerge->GetRowMerge();
- nOutHeight += (long) mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY);
+ nOutHeight += LogicToPixelVertical(
+ mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, 1.0) );
}
long nStartPosX = nPosX;
@@ -2554,7 +2565,7 @@ void ScOutputData::DrawClipMarks()
else
aCellRect.Right() -= 1;
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX );
+ long nMarkPixel = LogicToPixelHorizontal( SC_CLIPMARK_SIZE );
Size aMarkSize( nMarkPixel, (nMarkPixel-1)*2 );
if ( pInfo->nClipMark & ( bLayoutRTL ? SC_CLIPMARK_RIGHT : SC_CLIPMARK_LEFT ) )
commit 24729f86bbee099c6455f9ac25a60a2af34740ce
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Aug 28 23:17:06 2014 +0200
Use Twips for OutputData as much as possible too.
Change-Id: I4eaa1db83861d325beae2f5eea4b623331a56879
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index e925b2e..22c72f8 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -199,9 +199,9 @@ private:
SCTAB nTab; // sheet
long nScrX; // Output Startpos. (Pixel)
long nScrY;
- long nScrW; // Output size (Pixel)
- long nScrH;
- long nMirrorW; // Visible output width for mirroring (default: nScrW)
+ long nScrWTwips;
+ long nScrHTwips;
+ long nMirrorWTwips; // Visible output width for mirroring (default: nScrW)
SCCOL nX1; // Start-/End coordinates
SCROW nY1; // ( incl. hidden )
SCCOL nX2;
@@ -341,8 +341,22 @@ public:
void SetShowFormulas ( bool bSet = true );
void SetShowSpellErrors( bool bSet = true );
void SetMirrorWidth( long nNew );
- long GetScrW() const { return nScrW; }
- long GetScrH() const { return nScrH; }
+
+ long GetScrW() const
+ {
+ if ( mpViewData )
+ return mpViewData->LogicToPixelHorizontal( nScrWTwips );
+ else
+ return nScrWTwips;
+ }
+
+ long GetScrH() const
+ {
+ if ( mpViewData )
+ return mpViewData->LogicToPixelVertical( nScrHTwips );
+ else
+ return nScrHTwips;
+ }
void SetSnapPixel( bool bSet = true );
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 16c5a0b..f4a22ac 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -207,15 +207,15 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType,
nVisY2 = nY2;
mpDoc->StripHidden( nVisX1, nVisY1, nVisX2, nVisY2, nTab );
- nScrW = 0;
+ nScrWTwips = 0;
for (SCCOL nX=nVisX1; nX<=nVisX2; nX++)
- nScrW += pRowInfo[0].pCellInfo[nX+1].nWidth;
+ nScrWTwips += pRowInfo[0].pCellInfo[nX+1].nWidth;
- nMirrorW = nScrW;
+ nMirrorWTwips = nScrWTwips;
- nScrH = 0;
+ nScrHTwips = 0;
for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
- nScrH += pRowInfo[nArrY].nHeight;
+ nScrHTwips += pRowInfo[nArrY].nHeight;
bTabProtected = mpDoc->IsTabProtected( nTab );
nTabTextDirection = mpDoc->GetEditTextDirection( nTab );
@@ -247,7 +247,7 @@ void ScOutputData::SetContentDevice( OutputDevice* pContentDev )
void ScOutputData::SetMirrorWidth( long nNew )
{
- nMirrorW = nNew;
+ nMirrorWTwips = PixelToLogicHorizontal( nNew );
}
void ScOutputData::SetGridColor( const Color& rColor )
@@ -313,8 +313,8 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage )
{
SCCOL nX;
SCROW nY;
- long nPosX;
- long nPosY;
+ long nPosXTwips;
+ long nPosYTwips;
SCSIZE nArrY;
ScBreakType nBreak = BREAK_NONE;
ScBreakType nBreakOld = BREAK_NONE;
@@ -355,9 +355,9 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage )
// vertical lines
- nPosX = nScrX;
+ nPosXTwips = PixelToLogicHorizontal( nScrX );
if ( bLayoutRTL )
- nPosX += nMirrorW - nOneX;
+ nPosXTwips += nMirrorWTwips - nOneX;
for (nX=nX1; nX<=nX2; nX++)
{
@@ -366,7 +366,7 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage )
sal_uInt16 nWidth = pRowInfo[0].pCellInfo[nXplus1].nWidth;
if (nWidth)
{
- nPosX += nWidth * nLayoutSign;
+ nPosXTwips += nWidth * nLayoutSign;
if ( bPage )
{
@@ -415,12 +415,12 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage )
while ( nVisX < MAXCOL && !mpDoc->GetColWidth(nVisX,nTab) )
++nVisX;
- nPosY = nScrY;
+ nPosYTwips = nScrY;
long nNextY;
for (nArrY=1; nArrY+1<nArrCount; nArrY++)
{
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
- nNextY = nPosY + pThisRowInfo->nHeight;
+ nNextY = nPosYTwips + pThisRowInfo->nHeight;
bool bHOver = pThisRowInfo->pCellInfo[nXplus1].bHideGrid;
if (!bHOver)
@@ -444,37 +444,18 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage )
if (pThisRowInfo->bChanged && !bHOver)
{
- if ( mpViewData )
- {
- aGrid.AddVerLine( mpViewData->LogicToPixelHorizontal( nPosX - nSignedOneX ),
- mpViewData->LogicToPixelVertical( nPosY ),
- mpViewData->LogicToPixelVertical( nNextY - nOneY ) );
- }
- else
- {
- aGrid.AddVerLine( nPosX - nSignedOneX,
- nPosY,
- nNextY - nOneY );
- }
+ aGrid.AddVerLine( LogicToPixelHorizontal( nPosXTwips ) - nSignedOneX,
+ LogicToPixelVertical( nPosYTwips ),
+ LogicToPixelVertical( nNextY - nOneY ) );
}
- nPosY = nNextY;
+ nPosYTwips = nNextY;
}
}
else
{
- if ( mpViewData )
- {
- aGrid.AddVerLine( mpViewData->LogicToPixelHorizontal( nPosX - nSignedOneX ),
- mpViewData->LogicToPixelVertical( nScrY ),
- mpViewData->LogicToPixelVertical( nScrY + nScrH - nOneY ) );
- }
- else
- {
- aGrid.AddVerLine( nPosX - nSignedOneX,
- nScrY,
- nScrY + nScrH - nOneY );
-
- }
+ aGrid.AddVerLine( LogicToPixelHorizontal( nPosXTwips ) - nSignedOneX,
+ nScrY,
+ nScrY + LogicToPixelVertical( nScrHTwips ) - nOneY );
}
}
}
@@ -484,13 +465,13 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage )
bool bHiddenRow = true;
SCROW nHiddenEndRow = -1;
- nPosY = nScrY;
+ nPosYTwips = PixelToLogicVertical( nScrY );
for (nArrY=1; nArrY+1<nArrCount; nArrY++)
{
SCSIZE nArrYplus1 = nArrY+1;
nY = pRowInfo[nArrY].nRowNo;
SCROW nYplus1 = nY+1;
- nPosY += pRowInfo[nArrY].nHeight;
+ nPosYTwips += pRowInfo[nArrY].nHeight;
if (pRowInfo[nArrY].bChanged)
{
@@ -537,15 +518,15 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage )
{
SCROW nVisY = pRowInfo[nArrYplus1].nRowNo;
- nPosX = nScrX;
+ nPosXTwips = PixelToLogicHorizontal( nScrX );
if ( bLayoutRTL )
- nPosX += nMirrorW - nOneX;
+ nPosXTwips += PixelToLogicHorizontal( nMirrorWTwips - nOneX );
- long nNextX;
+ long nNextXTwips;
for (SCCOL i=nX1; i<=nX2; i++)
{
- nNextX = nPosX + pRowInfo[0].pCellInfo[i+1].nWidth * nLayoutSign;
- if (nNextX != nPosX) // visible
+ nNextXTwips = nPosXTwips + pRowInfo[0].pCellInfo[i+1].nWidth * nLayoutSign;
+ if (nNextXTwips != nPosXTwips) // visible
{
bool bVOver;
if ( bNextYisNextRow )
@@ -562,15 +543,19 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage )
}
if (!bVOver)
{
- aGrid.AddHorLine( nPosX, nNextX-nSignedOneX, nPosY-nOneY );
+ aGrid.AddHorLine( LogicToPixelHorizontal( nPosXTwips ),
+ LogicToPixelHorizontal( nNextXTwips ) - nSignedOneX,
+ LogicToPixelVertical( nPosYTwips ) - nOneY );
}
}
- nPosX = nNextX;
+ nPosXTwips = nNextXTwips;
}
}
else
{
- aGrid.AddHorLine( nScrX, nScrX+nScrW-nOneX, nPosY-nOneY );
+ aGrid.AddHorLine( nScrX,
+ nScrX + LogicToPixelHorizontal( nScrWTwips ) - nSignedOneX,
+ LogicToPixelVertical( nPosYTwips ) - nOneY );
}
}
}
@@ -797,7 +782,10 @@ void ScOutputData::DrawDocumentBackground()
Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
long nOneX = aOnePixel.Width();
long nOneY = aOnePixel.Height();
- Rectangle aRect(nScrX - nOneX, nScrY - nOneY, nScrX + nScrW, nScrY + nScrH);
+ Rectangle aRect(nScrX - nOneX,
+ nScrY - nOneY,
+ nScrX + nScrWTwips,
+ nScrY + nScrHTwips);
Color aBgColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor );
mpDev->SetFillColor(aBgColor);
mpDev->DrawRect(aRect);
@@ -993,7 +981,7 @@ void ScOutputData::DrawBackground()
bool bCellContrast = mbUseStyleColor &&
Application::GetSettings().GetStyleSettings().GetHighContrastMode();
- long nPosY = nScrY;
+ long nPosYTwips = PixelToLogicVertical( nScrY );
for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
{
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
@@ -1017,10 +1005,13 @@ void ScOutputData::DrawBackground()
nRowHeight += pRowInfo[nArrY+nSkip].nHeight; // after incrementing
}
- long nPosX = nScrX;
+ long nPosXTwips = PixelToLogicHorizontal( nScrX );
if ( bLayoutRTL )
- nPosX += nMirrorW - nOneX;
- aRect = Rectangle( nPosX, nPosY-nOneY, nPosX, nPosY+nRowHeight-nOneY );
+ nPosXTwips += nMirrorWTwips - PixelToLogicHorizontal( nOneX );
+ aRect = Rectangle( LogicToPixelHorizontal( nPosXTwips ),
+ LogicToPixelVertical( nPosYTwips ) - nOneY,
+ LogicToPixelHorizontal( nPosXTwips ),
+ LogicToPixelVertical( nPosYTwips + nRowHeight ) - nOneY );
const SvxBrushItem* pOldBackground = NULL;
const SvxBrushItem* pBackground;
@@ -1069,16 +1060,21 @@ void ScOutputData::DrawBackground()
pColor = pInfo->pColorScale;
const ScDataBarInfo* pDataBarInfo = pInfo->pDataBar;
const ScIconSetInfo* pIconSetInfo = pInfo->pIconSet;
- drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo );
+ drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect,
+ LogicToPixelHorizontal( nPosXTwips ),
+ nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo,
+ pIconSetInfo, pOldIconSetInfo );
- nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
+ nPosXTwips += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
}
- drawCells( NULL, NULL, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, NULL, pOldDataBarInfo, NULL, pOldIconSetInfo );
+ drawCells( NULL, NULL, pOldColor, pOldBackground, aRect,
+ LogicToPixelHorizontal( nPosXTwips ),
+ nSignedOneX, mpDev, NULL, pOldDataBarInfo, NULL, pOldIconSetInfo );
nArrY += nSkip;
}
}
- nPosY += nRowHeight;
+ nPosYTwips += nRowHeight;
}
}
@@ -1089,6 +1085,8 @@ void ScOutputData::DrawShadow()
void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBottom)
{
+ // TODO: all of me
+
mpDev->SetLineColor();
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
@@ -1102,11 +1100,11 @@ void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBot
{
Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
long nOneX = aOnePixel.Width();
- nInitPosX += nMirrorW - nOneX;
+ nInitPosX += nMirrorWTwips - nOneX;
}
long nLayoutSign = bLayoutRTL ? -1 : 1;
- long nPosY = nScrY - pRowInfo[0].nHeight;
+ long nPosY = LogicToPixelVertical( nScrY ) - pRowInfo[0].nHeight;
for (SCSIZE nArrY=0; nArrY<nArrCount; nArrY++)
{
bool bCornerY = ( nArrY == 0 ) || ( nArrY+1 == nArrCount );
@@ -1262,7 +1260,7 @@ void ScOutputData::DrawClear()
}
aRect = Rectangle( Point( nScrX, nPosY ),
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list