summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-05-18 19:54:20 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-05-18 19:58:01 +0200
commit09a67a5bcec037fd837bb515c6c00a12e68e2ea5 (patch)
treed1e765123f99eb0f4386923e97c667a24df44f73
parentb532d46551489e84d2754c815f5076f47f824117 (diff)
render vertically merged cells together
This helps with databars and color scales in merged cells. Change-Id: Ice2054a03d031012645a1f2537da1ea636cbbaef
-rw-r--r--sc/source/ui/view/output.cxx23
1 files changed, 20 insertions, 3 deletions
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index b195e3437bf8..14298826f7fb 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1000,9 +1000,14 @@ void ScOutputData::DrawBackground()
const Color* pOldColor = NULL;
const ScDataBarInfo* pOldDataBarInfo = NULL;
const ScIconSetInfo* pOldIconSetInfo = NULL;
- for (SCCOL nX=nX1; nX<=nX2; nX++)
+ SCCOL nMergedCells = 1;
+ SCCOL nOldMerged = 0;
+
+ for (SCCOL nX=nX1; nX + nMergedCells <= nX2 + 1; nX += nOldMerged)
{
- CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
+ CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+nMergedCells];
+
+ nOldMerged = nMergedCells;
if (bCellContrast)
{
@@ -1043,7 +1048,19 @@ void ScOutputData::DrawBackground()
const ScIconSetInfo* pIconSetInfo = pInfo->pIconSet.get();
drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo );
- nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
+ // extend for all merged cells
+ nMergedCells = 1;
+ if (pInfo->bMerged && pInfo->pPatternAttr)
+ {
+ const ScMergeAttr* pMerge =
+ static_cast<const ScMergeAttr*>(&pInfo->pPatternAttr->GetItem(ATTR_MERGE));
+ nMergedCells = std::max<SCCOL>(1, pMerge->GetColMerge());
+ }
+
+ for (SCCOL nMerged = 0; nMerged < nMergedCells; ++nMerged)
+ {
+ nPosX += pRowInfo[0].pCellInfo[nX+nOldMerged+nMerged].nWidth * nLayoutSign;
+ }
}
drawCells( NULL, NULL, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, NULL, pOldDataBarInfo, NULL, pOldIconSetInfo );