diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/fillinfo.hxx | 62 | ||||
-rw-r--r-- | sc/source/core/data/fillinfo.cxx | 56 | ||||
-rw-r--r-- | sc/source/ui/view/output.cxx | 56 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/view/printfun.cxx | 9 |
5 files changed, 124 insertions, 86 deletions
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx index 0bc72e4e3ed3..d6ab0bd537c6 100644 --- a/sc/inc/fillinfo.hxx +++ b/sc/inc/fillinfo.hxx @@ -96,6 +96,22 @@ struct ScIconSetInfo bool mbShowValue; }; +// FillInfo() computes some info for all cells starting from column 0, +// but most of the info is needed only for cells in the given columns. +// Keeping all the info in CellInfo could lead to allocation and initialization +// of MiB's of memory, so split the info needed for all cells to a smaller structure. +struct BasicCellInfo +{ + BasicCellInfo() + : nWidth(0) + , bEmptyCellText(true) + , bEditEngine(false) // view-internal + {} + sal_uInt16 nWidth; + bool bEmptyCellText : 1; + bool bEditEngine : 1; // output-internal +}; + struct CellInfo { CellInfo() @@ -113,9 +129,7 @@ struct CellInfo , eHShadowPart(SC_SHADOW_HSTART) , eVShadowPart(SC_SHADOW_HSTART) , nClipMark(ScClipMark::NONE) - , nWidth(0) , nRotateDir(ScRotateDir::NONE) - , bEmptyCellText(false) , bMerged(false) , bHOverlapped(false) , bVOverlapped(false) @@ -125,7 +139,6 @@ struct CellInfo , bFilterActive(false) , bPrinted(false) // view-internal , bHideGrid(false) // view-internal - , bEditEngine(false) // view-internal { } @@ -154,10 +167,8 @@ struct CellInfo ScShadowPart eHShadowPart : 4; // shadow effective for drawing ScShadowPart eVShadowPart : 4; ScClipMark nClipMark; - sal_uInt16 nWidth; ScRotateDir nRotateDir; - bool bEmptyCellText : 1; bool bMerged : 1; bool bHOverlapped : 1; bool bVOverlapped : 1; @@ -167,7 +178,6 @@ struct CellInfo bool bFilterActive:1; bool bPrinted : 1; // when required (pagebreak mode) bool bHideGrid : 1; // output-internal - bool bEditEngine : 1; // output-internal }; const SCCOL SC_ROTMAX_NONE = SCCOL_MAX; @@ -180,24 +190,44 @@ struct RowInfo CellInfo& cellInfo(SCCOL nCol) { + assert( nCol >= nStartCol - 1 ); #ifdef DBG_UTIL - assert( nCol >= -1 && nCol <= nCols + 1 ); + assert( nCol <= nEndCol + 1 ); #endif - return pCellInfo[ nCol + 1 ]; + return pCellInfo[ nCol - nStartCol + 1 ]; } const CellInfo& cellInfo(SCCOL nCol) const { return const_cast<RowInfo*>(this)->cellInfo(nCol); } - void allocCellInfo(SCCOL cols) + BasicCellInfo& basicCellInfo(SCCOL nCol) + { + assert( nCol >= -1 ); +#ifdef DBG_UTIL + assert( nCol <= nEndCol + 1 ); +#endif + return pBasicCellInfo[ nCol + 1 ]; + } + const BasicCellInfo& basicCellInfo(SCCOL nCol) const + { + return const_cast<RowInfo*>(this)->basicCellInfo(nCol); + } + + void allocCellInfo(SCCOL startCol, SCCOL endCol) { + nStartCol = startCol; #ifdef DBG_UTIL - nCols = cols; + nEndCol = endCol; #endif - pCellInfo = new CellInfo[ cols + 2 ]; + pCellInfo = new CellInfo[ endCol - nStartCol + 1 + 2 ]; + pBasicCellInfo = new BasicCellInfo[ endCol + 2 ]; + } + void freeCellInfo() + { + delete[] pCellInfo; + delete[] pBasicCellInfo; } - void freeCellInfo() { delete[] pCellInfo; } sal_uInt16 nHeight; SCROW nRowNo; @@ -211,10 +241,14 @@ struct RowInfo private: // This class allocates CellInfo with also one item extra before and after. // To make handling easier, this is private and access functions take care of adjusting - // the array indexes and error-checking. + // the array indexes and error-checking. CellInfo is allocated only for a given + // range of columns plus one on each side, BasicCellInfo is allocated for columns + // starting from column 0 until the last column given, again plus one on each side. CellInfo* pCellInfo; + BasicCellInfo* pBasicCellInfo; + SCCOL nStartCol; #ifdef DBG_UTIL - SCCOL nCols; + SCCOL nEndCol; #endif }; diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index 2dc6fbdb7ebe..3e7931620ba2 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -125,6 +125,7 @@ class RowInfoFiller RowInfo* mpRowInfo; SCCOL mnCol; SCSIZE mnArrY; + SCCOL mnStartCol; SCROW mnHiddenEndRow; bool mbHiddenRow; @@ -147,15 +148,15 @@ class RowInfoFiller alignArray(nRow); RowInfo& rThisRowInfo = mpRowInfo[mnArrY]; - CellInfo& rInfo = rThisRowInfo.cellInfo(mnCol); - rInfo.maCell = rCell; - rInfo.bEmptyCellText = false; + if(mnCol >= mnStartCol-1) + rThisRowInfo.cellInfo(mnCol).maCell = rCell; + rThisRowInfo.basicCellInfo(mnCol).bEmptyCellText = false; ++mnArrY; } public: - RowInfoFiller(ScDocument& rDoc, SCTAB nTab, RowInfo* pRowInfo, SCCOL nCol, SCSIZE nArrY) : - mrDoc(rDoc), mnTab(nTab), mpRowInfo(pRowInfo), mnCol(nCol), mnArrY(nArrY), + RowInfoFiller(ScDocument& rDoc, SCTAB nTab, RowInfo* pRowInfo, SCCOL nCol, SCSIZE nArrY, SCCOL nStartCol) : + mrDoc(rDoc), mnTab(nTab), mpRowInfo(pRowInfo), mnCol(nCol), mnArrY(nArrY), mnStartCol(nStartCol), mnHiddenEndRow(-1), mbHiddenRow(false) {} void operator() (size_t nRow, double fVal) @@ -240,18 +241,24 @@ void initRowInfo(const ScDocument* pDoc, RowInfo* pRowInfo, const SCSIZE nMaxRow } } -void initCellInfo(RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nRotMax, +void initCellInfo(RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nStartCol, SCCOL nRotMax, const SvxShadowItem* pDefShadow) { for (SCSIZE nArrRow = 0; nArrRow < nArrCount; ++nArrRow) { RowInfo& rThisRowInfo = pRowInfo[nArrRow]; - rThisRowInfo.allocCellInfo( nRotMax + 1 ); - - for (SCCOL nCol = -1; nCol <= nRotMax+1; ++nCol) // Preassign cell info + // A lot of memory (and performance allocating and initializing it) can + // be saved if we do not allocate CellInfo for columns before nStartCol. + // But code in ScOutputData::SetCellRotation(), ScOutputData::DrawRotatedFrame() + // and ScOutputData::SetCellRotations() accesses those. That depends on + // nRotMaxCol being set to something else than none, and the value is already + // initialized here. So allocate all those cells starting from column 0 only if needed. + SCCOL nMinCol = rThisRowInfo.nRotMaxCol != SC_ROTMAX_NONE ? 0 : nStartCol; + rThisRowInfo.allocCellInfo( nMinCol, nRotMax + 1 ); + + for (SCCOL nCol = nMinCol-1; nCol <= nRotMax+1; ++nCol) // Preassign cell info { CellInfo& rInfo = rThisRowInfo.cellInfo(nCol); - rInfo.bEmptyCellText = true; rInfo.pShadowAttr = pDefShadow; } } @@ -269,7 +276,7 @@ void initColWidths(RowInfo* pRowInfo, const ScDocument* pDoc, double fColScale, if (!nThisWidth) nThisWidth = 1; - pRowInfo[0].cellInfo(nCol).nWidth = nThisWidth; + pRowInfo[0].basicCellInfo(nCol).nWidth = nThisWidth; } } } @@ -405,7 +412,7 @@ void ScDocument::FillInfo( // Allocate cell information only after the test rotation // to nRotMax due to nRotateDir Flag - initCellInfo(pRowInfo, nArrCount, nRotMax, pDefShadow); + initCellInfo(pRowInfo, nArrCount, nCol1, nRotMax, pDefShadow); initColWidths(pRowInfo, this, fColScale, nTab, nCol2, nRotMax); @@ -415,7 +422,7 @@ void ScDocument::FillInfo( SCCOL nLastHiddenCheckedCol = -2; bool bColHidden = false; - for (SCCOL nCol=-1; nCol<=nCol2+1; nCol++) // left & right + 1 + for (SCCOL nCol=-1; nCol<=nCol2+1; nCol++) // collect basic info also for all previous cols, and left & right + 1 { if (ValidCol(nCol)) { @@ -430,7 +437,7 @@ void ScDocument::FillInfo( sal_uInt16 nColWidth = GetColWidth( nCol, nTab, false ); // false=no need to check for hidden, checked above sal_uInt16 nThisWidth = static_cast<sal_uInt16>(std::clamp(nColWidth * fColScale, 1.0, double(std::numeric_limits<sal_uInt16>::max()))); - pRowInfo[0].cellInfo(nCol).nWidth = nThisWidth; //TODO: this should be enough + pRowInfo[0].basicCellInfo(nCol).nWidth = nThisWidth; //TODO: this should be enough const ScAttrArray* pThisAttrArr; // Attribute if (nCol < maTabs[nTab]->GetAllocatedColumnsCount()) @@ -440,7 +447,7 @@ void ScDocument::FillInfo( nArrRow = 1; // Iterate between rows nY1 and nY2 and pick up non-empty // cells that are not hidden. - RowInfoFiller aFunc(*this, nTab, pRowInfo, nCol, nArrRow); + RowInfoFiller aFunc(*this, nTab, pRowInfo, nCol, nArrRow, nCol1); sc::ParseAllNonEmpty(pThisCol->maCells.begin(), pThisCol->maCells, nRow1, nRow2, aFunc); @@ -536,6 +543,7 @@ void ScDocument::FillInfo( pThisRowInfo->bPivotButton = true; CellInfo* pInfo = &pThisRowInfo->cellInfo(nCol); + BasicCellInfo* pBasicInfo = &pThisRowInfo->basicCellInfo(nCol); pInfo->pBackground = pBackground; pInfo->pPatternAttr = pPattern; pInfo->bMerged = bMerged; @@ -565,7 +573,7 @@ void ScDocument::FillInfo( } if (bHidden || (bFormulaMode && bHideFormula && pInfo->maCell.meType == CELLTYPE_FORMULA)) - pInfo->bEmptyCellText = true; + pBasicInfo->bEmptyCellText = true; ++nArrRow; } @@ -613,17 +621,12 @@ void ScDocument::FillInfo( else // columns in front { for (nArrRow=1; nArrRow+1<nArrCount; nArrRow++) - { - RowInfo* pThisRowInfo = &pRowInfo[nArrRow]; - CellInfo* pInfo = &pThisRowInfo->cellInfo(nCol); - - pInfo->nWidth = nThisWidth; //TODO: or check only 0 ?? - } + pRowInfo[nArrRow].basicCellInfo(nCol).nWidth = nThisWidth; //TODO: or check only 0 ?? } } } else - pRowInfo[0].cellInfo(nCol).nWidth = STD_COL_WIDTH; + pRowInfo[0].basicCellInfo(nCol).nWidth = STD_COL_WIDTH; // STD_COL_WIDTH farthest to the left and right is needed for DrawExtraShadow } @@ -760,9 +763,9 @@ void ScDocument::FillInfo( SCCOL nDxPos = 1; SCCOL nDxNeg = -1; - while ( nCol+nDxPos < nCol2+1 && pRowInfo[0].cellInfo(nCol+nDxPos).nWidth == 0 ) + while ( nCol+nDxPos < nCol2+1 && pRowInfo[0].basicCellInfo(nCol+nDxPos).nWidth == 0 ) ++nDxPos; - while ( nCol+nDxNeg > nCol1-1 && pRowInfo[0].cellInfo(nCol+nDxNeg).nWidth == 0 ) + while ( nCol+nDxNeg > nCol1-1 && pRowInfo[0].basicCellInfo(nCol+nDxNeg).nWidth == 0 ) --nDxNeg; bool bLeftDiff = !bLeft && @@ -884,8 +887,9 @@ void ScDocument::FillInfo( // *** create the frame border array *** - // RowInfo structs are filled in the range [ 0 , nArrCount-1 ] + // RowInfo structs are filled in the range [ 0 , nArrCount-1 ], // each RowInfo contains CellInfo structs in the range [ nCol1-1 , nCol2+1 ] + // and BasicCellInfo structs in the range [ -1, nCol2+1 ] size_t nColCount = nCol2 - nCol1 + 1 + 2; size_t nRowCount = nArrCount; diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index a972bdff4d93..9ee2b3b0cd3b 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -195,7 +195,7 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType, nScrW = 0; for (SCCOL nX=nVisX1; nX<=nVisX2; nX++) - nScrW += pRowInfo[0].cellInfo(nX).nWidth; + nScrW += pRowInfo[0].basicCellInfo(nX).nWidth; nMirrorW = nScrW; @@ -368,7 +368,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool for (nX=nX1; nX<=nX2; nX++) { - sal_uInt16 nWidth = pRowInfo[0].cellInfo(nX).nWidth; + sal_uInt16 nWidth = pRowInfo[0].basicCellInfo(nX).nWidth; if (nWidth) { nPosX += nWidth * nLayoutSign; @@ -409,7 +409,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool bool bDraw = bGrid || nBreakOld != ScBreakType::NONE || bMergeCover; // simple grid only if set that way - sal_uInt16 nWidthXplus1 = pRowInfo[0].cellInfo(nX+1).nWidth; + sal_uInt16 nWidthXplus1 = pRowInfo[0].basicCellInfo(nX+1).nWidth; bSingle = false; //! get into Fillinfo !!!!! if ( nX<mpDoc->MaxCol() && !bSingle ) { @@ -546,7 +546,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool for (SCCOL i=nX1; i<=nX2; i++) { - const tools::Long nNextX = nPosX + pRowInfo[0].cellInfo(i).nWidth * nLayoutSign; + const tools::Long nNextX = nPosX + pRowInfo[0].basicCellInfo(i).nWidth * nLayoutSign; if (nNextX != nPosX) // visible { bool bVOver; @@ -1146,7 +1146,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) SCCOL nCol = nX+nOldMerged+nMerged; if (nCol > nX2+2) break; - nPosX += pRowInfo[0].cellInfo(nCol-1).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nCol-1).nWidth * nLayoutSign; } } @@ -1198,7 +1198,7 @@ void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBot if ( pThisRowInfo->bChanged && !bSkipY ) { - tools::Long nPosX = nInitPosX - pRowInfo[0].cellInfo(nX1-1).nWidth * nLayoutSign; + tools::Long nPosX = nInitPosX - pRowInfo[0].basicCellInfo(nX1-1).nWidth * nLayoutSign; for (SCCOL nCol=nX1-1; nCol<=nX2+1; nCol++) { bool bCornerX = ( nCol==nX1-1 || nCol==nX2+1 ); @@ -1222,15 +1222,15 @@ void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBot if (bDo) { - tools::Long nThisWidth = pRowInfo[0].cellInfo(nCol).nWidth; + tools::Long nThisWidth = pRowInfo[0].basicCellInfo(nCol).nWidth; tools::Long nMaxWidth = nThisWidth; if (!nMaxWidth) { //! direction must depend on shadow location SCCOL nWx = nCol+1; - while (nWx<nX2 && !pRowInfo[0].cellInfo(nWx).nWidth) + while (nWx<nX2 && !pRowInfo[0].basicCellInfo(nWx).nWidth) ++nWx; - nMaxWidth = pRowInfo[0].cellInfo(nWx).nWidth; + nMaxWidth = pRowInfo[0].basicCellInfo(nWx).nWidth; } // rectangle is in logical orientation @@ -1302,7 +1302,7 @@ void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBot } } - nPosX += pRowInfo[0].cellInfo(nCol).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nCol).nWidth * nLayoutSign; } } nPosY += nRowHeight; @@ -1438,7 +1438,7 @@ void ScOutputData::DrawFrame(vcl::RenderContext& rRenderContext) // column nX1-1 is not visible (dummy for borders from left) - subtract its width from initial position // subtract 1 unit more, because position 0 is first *in* cell, grid line is one unit above - tools::Long nOldPosX = nInitPosX - nLayoutSign * (1 + pRowInfo[ 0 ].cellInfo( nX1 - 1 ).nWidth); + tools::Long nOldPosX = nInitPosX - nLayoutSign * (1 + pRowInfo[ 0 ].basicCellInfo( nX1 - 1 ).nWidth); tools::Long nOldSnapX = lclGetSnappedX( rRenderContext, nOldPosX, bSnapPixel ); // set X offset for left-to-right sheets; for right-to-left sheets this is done after for() loop if( !bLayoutRTL ) @@ -1446,7 +1446,7 @@ void ScOutputData::DrawFrame(vcl::RenderContext& rRenderContext) for( SCCOL nCol = nX1 - 1; nCol <= nX2 + 1; ++nCol ) { size_t nArrCol = bLayoutRTL ? nX2 + 1 - nCol : nCol - (nX1 - 1); - tools::Long nNewPosX = nOldPosX + pRowInfo[ 0 ].cellInfo( nCol ).nWidth * nLayoutSign; + tools::Long nNewPosX = nOldPosX + pRowInfo[ 0 ].basicCellInfo( nCol ).nWidth * nLayoutSign; tools::Long nNewSnapX = lclGetSnappedX( rRenderContext, nNewPosX, bSnapPixel ); rArray.SetColWidth( nArrCol, std::abs( nNewSnapX - nOldSnapX ) ); nOldPosX = nNewPosX; @@ -1545,7 +1545,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext) if (nX==nX1) nPosX = nInitPosX; // calculated individually for preceding positions CellInfo* pInfo = &rThisRowInfo.cellInfo(nX); - tools::Long nColWidth = pRowInfo[0].cellInfo(nX).nWidth; + tools::Long nColWidth = pRowInfo[0].basicCellInfo(nX).nWidth; if ( pInfo->nRotateDir > ScRotateDir::Standard && !pInfo->bHOverlapped && !pInfo->bVOverlapped ) { @@ -1574,7 +1574,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext) while (nCol > nX) { --nCol; - nPosX -= nLayoutSign * static_cast<tools::Long>(pRowInfo[0].cellInfo(nCol).nWidth); + nPosX -= nLayoutSign * static_cast<tools::Long>(pRowInfo[0].basicCellInfo(nCol).nWidth); } } @@ -1969,10 +1969,10 @@ ReferenceMark ScOutputData::FillReferenceMark( SCCOL nRefStartX, SCROW nRefStart } if ( nX==nRefEndX ) { - nMaxX = nPosX + ( pRowInfo[0].cellInfo(nX).nWidth - 2 ) * nLayoutSign; + nMaxX = nPosX + ( pRowInfo[0].basicCellInfo(nX).nWidth - 2 ) * nLayoutSign; bRight = true; } - nPosX += pRowInfo[0].cellInfo(nX).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign; } if (bTop && bBottom && bLeft && bRight) @@ -2061,10 +2061,10 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY, } if ( nX==nRefEndX ) { - nMaxX = nPosX + ( pRowInfo[0].cellInfo(nX).nWidth - 2 ) * nLayoutSign; + nMaxX = nPosX + ( pRowInfo[0].basicCellInfo(nX).nWidth - 2 ) * nLayoutSign; bRight = true; } - nPosX += pRowInfo[0].cellInfo(nX).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign; } if ( nMaxX * nLayoutSign < nMinX * nLayoutSign || nMaxY < nMinY ) @@ -2188,10 +2188,10 @@ void ScOutputData::DrawOneChange( SCCOL nRefStartX, SCROW nRefStartY, } if ( nX==nRefEndX ) { - nMaxX = nPosX + ( pRowInfo[0].cellInfo(nX).nWidth - 1 ) * nLayoutSign; + nMaxX = nPosX + ( pRowInfo[0].basicCellInfo(nX).nWidth - 1 ) * nLayoutSign; bRight = true; } - nPosX += pRowInfo[0].cellInfo(nX).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign; } if ( nMaxX * nLayoutSign < nMinX * nLayoutSign || nMaxY < nMinY ) @@ -2348,14 +2348,14 @@ void ScOutputData::DrawNoteMarks(vcl::RenderContext& rRenderContext) bFirst = false; } - tools::Long nMarkX = nPosX + ( pRowInfo[0].cellInfo(nX).nWidth - 4 ) * nLayoutSign; + tools::Long nMarkX = nPosX + ( pRowInfo[0].basicCellInfo(nX).nWidth - 4 ) * nLayoutSign; if ( bIsMerged || pInfo->bMerged ) { // if merged, add widths of all cells SCCOL nNextX = nX + 1; while ( nNextX <= nX2 + 1 && pThisRowInfo->cellInfo(nNextX).bHOverlapped ) { - nMarkX += pRowInfo[0].cellInfo(nNextX).nWidth * nLayoutSign; + nMarkX += pRowInfo[0].basicCellInfo(nNextX).nWidth * nLayoutSign; ++nNextX; } } @@ -2363,7 +2363,7 @@ void ScOutputData::DrawNoteMarks(vcl::RenderContext& rRenderContext) rRenderContext.DrawRect( tools::Rectangle( nMarkX-5*nLayoutSign,nPosY,nMarkX+1*nLayoutSign,nPosY+6 ) ); } - nPosX += pRowInfo[0].cellInfo(nX).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign; } } nPosY += pThisRowInfo->nHeight; @@ -2414,14 +2414,14 @@ void ScOutputData::AddPDFNotes() tools::Long nNoteWidth = static_cast<tools::Long>( SC_CLIPMARK_SIZE * mnPPTX ); tools::Long nNoteHeight = static_cast<tools::Long>( SC_CLIPMARK_SIZE * mnPPTY ); - tools::Long nMarkX = nPosX + ( pRowInfo[0].cellInfo(nX).nWidth - nNoteWidth ) * nLayoutSign; + tools::Long nMarkX = nPosX + ( pRowInfo[0].basicCellInfo(nX).nWidth - nNoteWidth ) * nLayoutSign; if ( bIsMerged || pInfo->bMerged ) { // if merged, add widths of all cells SCCOL nNextX = nX + 1; while ( nNextX <= nX2 + 1 && pThisRowInfo->cellInfo(nNextX).bHOverlapped ) { - nMarkX += pRowInfo[0].cellInfo(nNextX).nWidth * nLayoutSign; + nMarkX += pRowInfo[0].basicCellInfo(nNextX).nWidth * nLayoutSign; ++nNextX; } } @@ -2445,7 +2445,7 @@ void ScOutputData::AddPDFNotes() } } - nPosX += pRowInfo[0].cellInfo(nX).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign; } } nPosY += pThisRowInfo->nHeight; @@ -2527,7 +2527,7 @@ void ScOutputData::DrawClipMarks() } else { - tools::Long nOutWidth = pRowInfo[0].cellInfo(nX).nWidth; + tools::Long nOutWidth = pRowInfo[0].basicCellInfo(nX).nWidth; tools::Long nOutHeight = pThisRowInfo->nHeight; if ( pInfo->bMerged && pInfo->pPatternAttr ) @@ -2598,7 +2598,7 @@ void ScOutputData::DrawClipMarks() } } } - nPosX += pRowInfo[0].cellInfo(nX).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign; } } nPosY += pThisRowInfo->nHeight; diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 7379858334b9..e10349ed6a06 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1159,7 +1159,7 @@ bool ScOutputData::IsEmptyCellText( const RowInfo* pThisRowInfo, SCCOL nX, SCROW bool bEmpty; if ( pThisRowInfo && nX <= nX2 ) - bEmpty = pThisRowInfo->cellInfo(nX).bEmptyCellText; + bEmpty = pThisRowInfo->basicCellInfo(nX).bEmptyCellText; else { ScRefCellValue aCell(*mpDoc, ScAddress(nX, nY, nTab)); @@ -1245,7 +1245,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, tools::Long nPosX, too { //! extra member function for width? tools::Long nColWidth = ( nCompCol <= nX2 ) ? - pRowInfo[0].cellInfo(nCompCol).nWidth : + pRowInfo[0].basicCellInfo(nCompCol).nWidth : static_cast<tools::Long>( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX ); nCellPosX += nColWidth * nLayoutSign; ++nCompCol; @@ -1254,7 +1254,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, tools::Long nPosX, too { --nCompCol; tools::Long nColWidth = ( nCompCol <= nX2 ) ? - pRowInfo[0].cellInfo(nCompCol).nWidth : + pRowInfo[0].basicCellInfo(nCompCol).nWidth : static_cast<tools::Long>( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX ); nCellPosX -= nColWidth * nLayoutSign; } @@ -1293,7 +1293,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, tools::Long nPosX, too for ( tools::Long i=0; i<nMergeCols; i++ ) { tools::Long nColWidth = ( nCellX+i <= nX2 ) ? - pRowInfo[0].cellInfo(nCellX+i).nWidth : + pRowInfo[0].basicCellInfo(nCellX+i).nWidth : static_cast<tools::Long>( mpDoc->GetColWidth( sal::static_int_cast<SCCOL>(nCellX+i), nTab ) * mnPPTX ); nMergeSizeX += nColWidth; } @@ -1566,12 +1566,12 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co { tools::Long nPosX = nInitPosX; if ( nLoopStartX < nX1 ) - nPosX -= pRowInfo[0].cellInfo(nLoopStartX).nWidth * nLayoutSign; + nPosX -= pRowInfo[0].basicCellInfo(nLoopStartX).nWidth * nLayoutSign; for (SCCOL nX=nLoopStartX; nX<=nX2; nX++) { bool bMergeEmpty = false; const CellInfo* pInfo = &pThisRowInfo->cellInfo(nX); - bool bEmpty = nX < nX1 || pInfo->bEmptyCellText; + bool bEmpty = nX < nX1 || pThisRowInfo->basicCellInfo(nX).bEmptyCellText; SCCOL nCellX = nX; // position where the cell really starts SCROW nCellY = nY; @@ -1897,7 +1897,7 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co // right are handled by the flag for nX2 SCCOL nMarkX = ( nCellX <= nX2 ) ? nCellX : nX2; RowInfo* pMarkRowInfo = ( nCellY == nY ) ? pThisRowInfo : &pRowInfo[0]; - pMarkRowInfo->cellInfo(nMarkX).bEditEngine = true; + pMarkRowInfo->basicCellInfo(nMarkX).bEditEngine = true; bDoCell = false; // don't draw here } if ( bDoCell ) @@ -2173,7 +2173,7 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co } } } - nPosX += pRowInfo[0].cellInfo(nX).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign; } } nPosY += pRowInfo[nArrY].nHeight; @@ -4354,8 +4354,7 @@ void ScOutputData::DrawEdit(bool bPixelToLogic) std::unique_ptr< ScPatternAttr > pPreviewPattr; if (nX==nX1) nPosX = nInitPosX; // positions before nX1 are calculated individually - const CellInfo* pInfo = &pThisRowInfo->cellInfo(nX); - if (pInfo->bEditEngine) + if (pThisRowInfo->basicCellInfo(nX).bEditEngine) { SCROW nY = pThisRowInfo->nRowNo; @@ -4495,7 +4494,7 @@ void ScOutputData::DrawEdit(bool bPixelToLogic) bHyphenatorSet = aParam.mbHyphenatorSet; } } - nPosX += pRowInfo[0].cellInfo(nX).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign; } } nRowPosY += pRowInfo[nArrY].nHeight; @@ -4590,7 +4589,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) if (aCell.isEmpty() || IsEmptyCellText(pThisRowInfo, nX, nY)) bHidden = true; // nRotateDir is also set without a cell - tools::Long nCellWidth = static_cast<tools::Long>(pRowInfo[0].cellInfo(nX).nWidth); + tools::Long nCellWidth = static_cast<tools::Long>(pRowInfo[0].basicCellInfo(nX).nWidth); SvxCellHorJustify eHorJust = pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet).GetValue(); @@ -4617,7 +4616,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) while (nCol > nX) { --nCol; - nStartX -= nLayoutSign * static_cast<tools::Long>(pRowInfo[0].cellInfo(nCol).nWidth); + nStartX -= nLayoutSign * static_cast<tools::Long>(pRowInfo[0].basicCellInfo(nCol).nWidth); } } } @@ -5140,7 +5139,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) } } } - nPosX += pRowInfo[0].cellInfo(nX).nWidth * nLayoutSign; + nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign; } } nRowPosY += pRowInfo[nArrY].nHeight; diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index c9d376a1e3e4..cecaa80afa51 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -444,12 +444,13 @@ static void lcl_HidePrint( const ScTableInfo& rTabInfo, SCCOL nX1, SCCOL nX2 ) for (SCCOL nX=nX1; nX<=nX2; nX++) { CellInfo& rCellInfo = pThisRowInfo->cellInfo(nX); - if (!rCellInfo.bEmptyCellText) + BasicCellInfo& rBasicCellInfo = pThisRowInfo->basicCellInfo(nX); + if (!rBasicCellInfo.bEmptyCellText) if (rCellInfo.pPatternAttr-> GetItem(ATTR_PROTECTION, rCellInfo.pConditionSet).GetHidePrint()) { rCellInfo.maCell.clear(); - rCellInfo.bEmptyCellText = true; + rBasicCellInfo.bEmptyCellText = true; } } } @@ -1407,8 +1408,8 @@ void ScPrintFunc::DrawBorder( tools::Long nScrX, tools::Long nScrY, tools::Long OSL_ENSURE(aTabInfo.mnArrCount,"nArrCount == 0"); aTabInfo.mpRowInfo[1].nHeight = static_cast<sal_uInt16>(nEffHeight); - aTabInfo.mpRowInfo[0].cellInfo(0).nWidth = - aTabInfo.mpRowInfo[1].cellInfo(0).nWidth = static_cast<sal_uInt16>(nEffWidth); + aTabInfo.mpRowInfo[0].basicCellInfo(0).nWidth = + aTabInfo.mpRowInfo[1].basicCellInfo(0).nWidth = static_cast<sal_uInt16>(nEffWidth); ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pBorderDoc.get(), 0, nScrX+nLeft, nScrY+nTop, 0,0, 0,0, nScaleX, nScaleY ); |