28 #include <document.hxx>
32 #include <globstr.hrc>
36 #include <progress.hxx>
64 if (nTotalCount < 1000)
73 return pOuterProgress;
82 void GetOptimalHeightsInColumn(
86 assert(nStartRow <= nEndRow);
98 sal_uInt16 nMinHeight = rHeights.
GetValue(nEndRow);
103 if (aRangeData.maValue < nMinHeight)
105 nPos = std::max<SCSIZE>(0, aRangeData.mnRow1);
108 const SCROW nMinStart = nPos;
112 for (
SCCOL nCol=0; nCol<maxCol; nCol++)
114 rCol[nCol].GetOptimalHeight(rCxt, nStartRow, nEndRow, nMinHeight, nMinStart);
118 nWeightedCount += rCol[nCol].GetWeightedCount(nStartRow, nEndRow);
119 pProgress->
SetState( nWeightedCount );
124 struct OptimalHeightsFuncObjBase
126 virtual ~OptimalHeightsFuncObjBase() {}
127 virtual bool operator() (
SCROW nStartRow,
SCROW nEndRow, sal_uInt16 nHeight) = 0;
130 struct SetRowHeightOnlyFunc :
public OptimalHeightsFuncObjBase
133 explicit SetRowHeightOnlyFunc(
ScTable* pTab) :
137 virtual bool operator() (
SCROW nStartRow,
SCROW nEndRow, sal_uInt16 nHeight)
override
144 struct SetRowHeightRangeFunc :
public OptimalHeightsFuncObjBase
154 virtual bool operator() (
SCROW nStartRow,
SCROW nEndRow, sal_uInt16 nHeight)
override
160 bool SetOptimalHeightsToRows(
162 OptimalHeightsFuncObjBase& rFuncObj,
165 bool bChanged =
false;
168 sal_uInt16 nLast = 0;
175 if ( nRegionEndRow > nEndRow )
176 nRegionEndRow = nEndRow;
177 SCSIZE nMoreRows = nRegionEndRow -
i;
190 for (
SCSIZE nInner = i; nInner <= i + nMoreRows; ++nInner)
197 if (nRangeValue + nExtraHeight == nLast)
199 nRngEnd = std::min<SCSIZE>(i + nMoreRows, nRangeRowEnd);
200 nInner = nRangeRowEnd;
204 bChanged |= rFuncObj(nRngStart, nRngEnd, nLast);
219 bChanged |= rFuncObj(nRngStart, nRngEnd, nLast);
225 bChanged |= rFuncObj(nRngStart, nRngEnd, nLast);
233 bool bColInfo,
bool bRowInfo ) :
236 aCodeName( rNewName ),
237 nLinkRefreshDelay( 0 ),
239 aPageStyle(
ScResId(STR_STYLENAME_STANDARD) ),
253 pSortCollator( nullptr ),
259 maLOKFreezeCell(-1, -1, nNewTab),
263 bPageSizeValid(false),
264 bTableAreaValid(false),
267 bPendingRowHeights(false),
268 bCalcNotification(false),
269 bGlobalKeepQuery(false),
270 bPrintEntireSheet(true),
271 bActiveScenario(false),
272 mbPageBreaksValid(false),
273 mbForceBreaks(false),
274 aDefaultColAttrArray(static_cast<
SCCOL>(-1), nNewTab, rDoc, nullptr)
317 aCol[nCol].FreeNotes();
342 return sal::static_int_cast<sal_Int64>(
reinterpret_cast<sal_IntPtr
>(
this));
407 const OUString& rDoc,
const OUString& rFlt,
const OUString& rOpt,
408 const OUString& rTab,
sal_uLong nRefreshDelay )
429 return aCol[nCol].GetOptimalColWidth( pDev, nPPTX, nPPTY, rZoomX, rZoomY,
437 bool bWidth,
bool bTotalSize,
bool bInPrintTwips )
446 return aCol[nCol].GetNeededSize
447 ( nRow, pDev, nPPTX, nPPTY, rZoomX, rZoomY, bWidth, aOptions,
nullptr, bInPrintTwips );
454 assert(nStartRow <= nEndRow);
457 "automatic OptimalHeight with Extra" );
464 SCSIZE nCount =
static_cast<SCSIZE>(nEndRow-nStartRow+1);
470 GetOptimalHeightsInColumn(rCxt,
aCol, nStartRow, nEndRow, pProgress, nProgressStart);
472 SetRowHeightRangeFunc aFunc(
this, rCxt.
getPPTY());
473 bool bChanged = SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), nStartRow, nEndRow);
475 if ( pProgress != pOuterProgress )
488 "automatic OptimalHeight with Extra" );
493 SCSIZE nCount =
static_cast<SCSIZE>(nEndRow-nStartRow+1);
497 GetOptimalHeightsInColumn(rCxt,
aCol, nStartRow, nEndRow, pProgress, nProgressStart);
499 SetRowHeightOnlyFunc aFunc(
this);
501 SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), nStartRow, nEndRow);
503 if ( pProgress != pOuterProgress )
514 if (!
aCol[i].IsEmptyData())
522 if (
aCol[i].HasCellNotes() )
524 SCROW maxNoteRow =
aCol[i].GetCellNotesMaxRow();
525 if (maxNoteRow >= nMaxY)
567 if (!
aCol[i].IsEmptyData())
576 if (bNotes &&
aCol[i].HasCellNotes() )
578 SCROW maxNoteRow =
aCol[i].GetCellNotesMaxRow();
579 if (maxNoteRow >= nMaxY)
592 SCCOL nMaxDataX = nMaxX;
597 if (
aCol[i].GetLastVisibleAttr( nLastRow ))
601 if (nLastRow > nMaxY)
609 while ( nMaxX>0 &&
aCol[nMaxX].IsVisibleAttrEqual(
aCol[nMaxX+1]) )
613 if ( nMaxX < nMaxDataX )
617 else if ( nMaxX > nMaxDataX )
619 SCCOL nAttrStartX = nMaxDataX + 1;
620 while ( nAttrStartX < (
aCol.
size()-1) )
622 SCCOL nAttrEndX = nAttrStartX;
623 while ( nAttrEndX < (
aCol.
size()-1) &&
aCol[nAttrStartX].IsVisibleAttrEqual(
aCol[nAttrEndX+1]) )
625 if ( nAttrEndX + 1 - nAttrStartX >= SC_COLUMNS_STOP )
628 nMaxX = nAttrStartX - 1;
632 while ( nMaxX > nMaxDataX && !
aCol[nMaxX].GetLastVisibleAttr( nDummyRow ) )
636 nAttrStartX = nAttrEndX + 1;
646 SCCOL& rEndCol )
const
654 if (
aCol[i].HasVisibleAttrIn( nStartRow, nEndRow ))
664 while ( nMaxX>0 &&
aCol[nMaxX].IsVisibleAttrEqual(
aCol[nMaxX+1], nStartRow, nEndRow) )
670 if (!
aCol[i].IsEmptyBlock( nStartRow, nEndRow ))
683 SCROW& rEndRow,
bool bNotes )
const
685 nStartCol = std::min<SCCOL>( nStartCol,
aCol.
size()-1 );
686 nEndCol = std::min<SCCOL>( nEndCol,
aCol.
size()-1 );
691 for (i=nStartCol; i<=nEndCol; i++)
694 if (
aCol[i].GetLastVisibleAttr( nLastRow ))
697 if (nLastRow > nMaxY)
702 for (i=nStartCol; i<=nEndCol; i++)
704 if (!
aCol[i].IsEmptyData())
711 if (bNotes &&
aCol[i].HasCellNotes() )
713 SCROW maxNoteRow =
aCol[i].GetCellNotesMaxRow();
714 if (maxNoteRow > nMaxY)
736 if (
aCol[i].GetFirstVisibleAttr( nFirstRow ))
741 if (nFirstRow < nMinY)
751 while ( nMinX<(
aCol.
size()-1) &&
aCol[nMinX].IsVisibleAttrEqual(
aCol[nMinX-1]) )
756 bool bDatFound =
false;
759 if (!
aCol[i].IsEmptyData())
761 if (!bDatFound && i<nMinX)
763 bFound = bDatFound =
true;
768 if (
aCol[i].HasCellNotes() )
770 SCROW minNoteRow =
aCol[i].GetCellNotesMinRow();
771 if (minNoteRow <= nMinY)
789 bool bIncludeOld,
bool bOnlyDown )
const
799 rStartCol = std::min<SCCOL>( rStartCol,
aCol.
size()-1 );
800 rEndCol = std::min<SCCOL>( rEndCol,
aCol.
size()-1 );
805 bool bBottom =
false;
806 bool bChanged =
false;
809 std::vector< sc::ColumnBlockConstPosition > blockPos( rEndCol + 1 );
810 for(
SCCOL i = 0; i <= rEndCol; ++i )
811 aCol[ i ].InitBlockPosition( blockPos[ i ] );
819 SCROW nStart = rStartRow;
820 SCROW nEnd = rEndRow;
821 if (nStart>0) --nStart;
825 if (!
aCol[rEndCol+1].IsEmptyBlock(nStart,nEnd))
827 assert(
int( blockPos.size()) == rEndCol + 1 );
829 blockPos.resize( blockPos.size() + 1 );
830 aCol[ rEndCol ].InitBlockPosition( blockPos[ rEndCol ] );
836 if (!
aCol[rStartCol-1].IsEmptyBlock(nStart,nEnd))
845 SCROW nTest = rStartRow-1;
846 bool needExtend =
false;
847 for (
SCCOL i = rStartCol; i<=rEndCol && !needExtend; i++)
848 if (
aCol[i].HasDataAt(blockPos[i], nTest))
861 SCROW nTest = rEndRow+1;
862 bool needExtend =
false;
863 for (
SCCOL i = rStartCol; i<=rEndCol && !needExtend; i++)
864 if (
aCol[i].HasDataAt(blockPos[ i ], nTest))
876 if ( !bIncludeOld && !bOnlyDown )
879 while ( rStartCol < rEndCol && rStartCol < (
aCol.
size()-1) &&
aCol[rStartCol].IsEmptyBlock(rStartRow,rEndRow) )
883 while ( rEndCol > 0 && rStartCol < rEndCol &&
aCol[rEndCol].IsEmptyBlock(rStartRow,rEndRow) )
891 for (
SCCOL i = rStartCol; i<=rEndCol && bShrink; i++)
892 if (
aCol[i].HasDataAt(rStartRow))
896 }
while (bShrink && rStartRow <
rDocument.
MaxRow() && rStartRow < rEndRow);
902 if ( !bBottom && rEndRow > 0 && rStartRow < rEndRow )
905 if (nLastDataRow < rEndRow)
906 rEndRow = std::max( rStartRow, nLastDataRow);
918 nCol2 = std::min<SCCOL>( nCol2,
aCol.
size()-1 );
922 SCCOL nFirstNonEmptyCol = -1, nLastNonEmptyCol = -1;
923 SCROW nRowStart = nRow2, nRowEnd = nRow1;
925 for (
SCCOL nCol = nCol1; nCol <= nCol2; ++nCol )
927 SCROW nRowStartThis = nRow1, nRowEndThis = nRow2;
928 bool bTrimmed =
aCol[nCol].TrimEmptyBlocks(nRowStartThis, nRowEndThis);
931 if ( nFirstNonEmptyCol == -1 )
932 nFirstNonEmptyCol = nCol;
933 nLastNonEmptyCol = nCol;
935 nRowStart = std::min<SCROW>(nRowStart, nRowStartThis);
936 nRowEnd = std::max<SCROW>(nRowEnd, nRowEndThis);
940 if ( nFirstNonEmptyCol == -1 )
943 assert(nFirstNonEmptyCol <= nLastNonEmptyCol);
944 assert(nRowStart <= nRowEnd);
953 SCCOL& rEndCol,
SCROW& rEndRow,
bool bColumnsOnly,
bool bStickyTopRow,
bool bStickyLeftCol,
954 bool bConsiderCellNotes,
bool bConsiderCellDrawObjects )
const
956 rStartCol = std::min<SCCOL>( rStartCol,
aCol.
size()-1 );
984 while (rStartCol < rEndCol)
986 if (
aCol[rEndCol].IsEmptyBlock( rStartRow, rEndRow))
988 if (bConsiderCellNotes && !
aCol[rEndCol].IsNotesEmptyBlock( rStartRow, rEndRow ))
991 if (bConsiderCellDrawObjects && !
aCol[rEndCol].IsDrawObjectsEmptyBlock( rStartRow, rEndRow ))
1001 if (!bStickyLeftCol)
1003 while (rStartCol < rEndCol)
1005 if (
aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow))
1007 if (bConsiderCellNotes && !
aCol[rStartCol].IsNotesEmptyBlock( rStartRow, rEndRow ))
1010 if (bConsiderCellDrawObjects && !
aCol[rStartCol].IsDrawObjectsEmptyBlock( rStartRow, rEndRow ))
1025 while (rStartRow < rEndRow)
1027 bool bFound =
false;
1028 for (
SCCOL i=rStartCol; i<=rEndCol && !bFound; i++)
1030 if (
aCol[i].HasDataAt( rStartRow, bConsiderCellNotes, bConsiderCellDrawObjects))
1043 while (rStartRow < rEndRow)
1046 bConsiderCellNotes, bConsiderCellDrawObjects);
1047 if (0 <= nLastDataRow && nLastDataRow < rEndRow)
1049 rEndRow = std::max( rStartRow, nLastDataRow);
1057 return rStartCol != rEndCol || (bColumnsOnly ?
1058 !
aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow) :
1059 (rStartRow != rEndRow ||
1060 aCol[rStartCol].HasDataAt( rStartRow, bConsiderCellNotes, bConsiderCellDrawObjects)));
1064 bool bConsiderCellNotes,
bool bConsiderCellDrawObjects )
const
1069 nCol2 = std::min<SCCOL>( nCol2,
aCol.
size() - 1 );
1071 SCROW nNewLastRow = 0;
1072 for (
SCCOL i = nCol1; i <= nCol2; ++i)
1074 SCROW nThis =
aCol[i].GetLastDataPos(nLastRow, bConsiderCellNotes, bConsiderCellDrawObjects);
1075 if (nNewLastRow < nThis)
1076 nNewLastRow = nThis;
1085 SCCOL nStartColOrig = nStartCol;
1086 SCCOL nEndColOrig = nEndCol;
1087 nStartCol = std::min<SCCOL>( nStartCol,
aCol.
size()-1 );
1088 nEndCol = std::min<SCCOL>( nEndCol,
aCol.
size()-1 );
1091 if ( nStartColOrig != nStartCol )
1093 static_cast<SCSIZE>(nEndRow - nStartRow + 1) :
1094 static_cast<SCSIZE>(nEndColOrig - nStartColOrig + 1) );
1096 SCSIZE nGapRight =
static_cast<SCSIZE>(nEndColOrig - nEndCol);
1101 nCount =
static_cast<SCSIZE>(nEndRow - nStartRow + 1);
1102 for (nCol = nStartCol; nCol <= nEndCol; nCol++)
1108 while ((nCol >= nStartCol) &&
1109 aCol[nCol].IsEmptyBlock(nStartRow, nEndRow))
1114 nCount += nGapRight;
1119 while ((nCol <= nEndCol) &&
aCol[nCol].IsEmptyBlock(nStartRow, nEndRow))
1127 if ( nCol > nEndCol )
1128 nCount += nGapRight;
1139 nEndCol = std::min<SCCOL>( nEndCol,
aCol.
size()-1 );
1141 bool bFound =
false;
1142 for (
SCCOL i=nStartCol; i<=nEndCol && !bFound; i++)
1143 if (
aCol[i].HasDataAt(nRow))
1150 rStartCol = std::min<SCCOL>( rStartCol,
aCol.
size()-1 );
1151 rEndCol = std::min<SCCOL>( rEndCol,
aCol.
size()-1 );
1153 while ( rStartCol<rEndCol &&
aCol[rStartCol].IsEmptyBlock(rStartRow,rEndRow) )
1156 while ( rStartCol<rEndCol &&
aCol[rEndCol].IsEmptyBlock(rStartRow,rEndRow) )
1159 while ( rStartRow<rEndRow &&
IsEmptyLine(rStartRow, rStartCol, rEndCol) )
1164 SCROW lastDataPos = 0;
1165 for (
SCCOL i=rStartCol; i<=rEndCol; i++)
1168 rEndRow = std::min(rEndRow, lastDataPos);
1170 rEndRow = std::max(rStartRow, rEndRow);
1193 return std::max<SCCOL>(0, nCol);
1204 if(nCol >= nLastCol)
1221 if(
aCol[nCol].HasVisibleDataAt(nRow))
1224 while(nCol < nLastCol);
1233 if ( nCol > nLastCol )
1246 nCol = nStartCol -1;
1251 if(
aCol[nCol].HasVisibleDataAt(nRow))
1266 SCCOL nNewCol = rCol;
1267 bool bThere = ( nNewCol <= nLastCol ) &&
aCol[nNewCol].HasVisibleDataAt(rRow);
1278 if( nNextCol <= nLastCol &&
aCol[nNextCol].HasVisibleDataAt(rRow) )
1280 bool bFound =
false;
1285 if( nNextCol <= nLastCol &&
aCol[nNextCol].HasVisibleDataAt(rRow) )
1310 if ( rCol <= nLastCol )
1323 bool bMarked,
bool bUnprotected )
const
1341 if (bMarked || bUnprotected)
1360 const bool bMarked,
const bool bSheetProtected )
const
1367 if ( rRow > nUsedY )
1382 if ( bRowHidden || bOverlapped )
1396 bool bMarked,
bool bUnprotected,
const ScMarkData& rMark,
SCCOL nTabStartCol )
const
1403 if ( bUnprotected && !bSheetProtected )
1404 bUnprotected =
false;
1406 SCCOL nCol = rCol + nMovX;
1407 SCROW nRow = rRow + nMovY;
1409 SCCOL nStartCol, nEndCol;
1410 SCROW nStartRow, nEndRow;
1433 else if (bUnprotected)
1461 rCol = nTabStartCol;
1466 if ( nMovY && (bMarked || bUnprotected))
1470 const bool bUp = (nMovY < 0);
1471 const SCCOL nColAdd = (bUp ? -1 : 1);
1492 nCol = nTabStartCol;
1496 while (
SkipRow( nCol, nRow, nMovY, rMark, bUp, nEndRow, bMarked, bSheetProtected ))
1499 sal_uInt16 nWrap = 0;
1500 while ( nRow < nStartRow || nRow > nEndRow )
1504 while (nStartCol <= nCol && nCol <= nEndCol &&
ValidCol(nCol) &&
ColHidden(nCol))
1507 if (nCol < nStartCol)
1514 else if (nCol > nEndCol)
1521 if (nRow < nStartRow)
1523 else if (nRow > nEndRow)
1529 while (
SkipRow( nCol, nRow, nMovY, rMark, bUp, nEndRow, bMarked, bSheetProtected ))
1535 if ( nMovX && ( bMarked || bUnprotected ) )
1538 if (nCol < nStartCol)
1542 if (nRow < nStartRow)
1553 if ( !
ValidNextPos(nCol, nRow, rMark, bMarked, bUnprotected) )
1556 std::unique_ptr<SCROW[]> pNextRows(
new SCROW[nColCount]);
1558 const bool bUp = (nMovX < 0);
1559 const SCROW nRowAdd = (bUp ? -1 : 1);
1560 sal_uInt16 nWrap = 0;
1564 for (
SCCOL i = 0; i < nColCount; ++i)
1565 pNextRows[i] = (i + nStartCol > nCol) ? (nRow + nRowAdd) : nRow;
1569 for (
SCCOL i = 0; i < nColCount; ++i)
1570 pNextRows[i] = (i + nStartCol < nCol) ? (nRow + nRowAdd) : nRow;
1574 SCROW nNextRow = pNextRows[nCol - nStartCol] + nRowAdd;
1578 nNextRow = ( nCol <= nLastCol ) ?
aCol[nCol].GetNextUnprotected( nNextRow, bUp ) :
1580 pNextRows[nCol - nStartCol] = nNextRow;
1584 SCROW nMaxRow = nStartRow - 1;
1585 for (
SCCOL i = 0; i < nColCount; ++i)
1587 if (pNextRows[i] >= nMaxRow)
1589 nMaxRow = pNextRows[i];
1590 nCol = i + nStartCol;
1595 if ( nRow < nStartRow )
1601 for (
SCCOL i = 0; i < nColCount; ++i)
1602 pNextRows[i] = nEndRow;
1607 SCROW nMinRow = nEndRow + 1;
1608 for (
SCCOL i = 0; i < nColCount; ++i)
1610 if (pNextRows[i] < nMinRow)
1612 nMinRow = pNextRows[i];
1613 nCol = i + nStartCol;
1618 if ( nRow > nEndRow )
1624 for (
SCCOL i = 0; i < nColCount; ++i)
1625 pNextRows[i] = nStartRow;
1629 while ( !
ValidNextPos(nCol, nRow, rMark, bMarked, bUnprotected) );
1652 SCROW nEnd = aArray.GetMarkEnd( nStart,
false );
1655 std::pair<sc::CellStoreType::const_iterator,size_t> aPos = rCells.position(nStart);
1656 sc::CellStoreType::const_iterator it = aPos.first;
1657 SCROW nTestRow = nStart;
1661 nTestRow += it->
size - aPos.second;
1663 if (it == rCells.end())
1671 if (nTestRow <= nEnd)
1696 if ( !(
nTab >= nTab1 &&
nTab <= nTab2 && nDz == 0) )
1700 if ( eUpdateRefMode !=
URM_COPY && pDrawLayer )
1704 nCol1 = sal::static_int_cast<
SCCOL>( nCol1 - nDx );
1705 nRow1 = sal::static_int_cast<
SCROW>( nRow1 - nDy );
1706 nCol2 = sal::static_int_cast<
SCCOL>( nCol2 - nDx );
1707 nRow2 = sal::static_int_cast<
SCROW>( nRow2 - nDy );
1709 pDrawLayer->
MoveArea(
nTab, nCol1,nRow1, nCol2,nRow2, nDx,nDy,
1710 (eUpdateRefMode ==
URM_INSDEL), bUpdateNoteCaptionPos );
1717 bool bUpdated =
false;
1743 for ( ; i<=iMax; i++)
1747 UpdateDrawRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz, bUpdateNoteCaptionPos );
1749 if (
nTab >= nTab1 &&
nTab <= nTab2 && nDz == 0 )
1757 bool bRecalcPages =
false;
1761 nSCol = rPrintRange.aStart.Col();
1762 nSRow = rPrintRange.aStart.Row();
1763 nECol = rPrintRange.aEnd.Col();
1764 nERow = rPrintRange.aEnd.Row();
1768 nCol1,nRow1,
nTab, nCol2,nRow2,
nTab,
1770 nSCol,nSRow,nSTab, nECol,nERow,nETab ) )
1772 rPrintRange =
ScRange( nSCol, nSRow, 0, nECol, nERow, 0 );
1773 bRecalcPages =
true;
1786 nCol1,nRow1,
nTab, nCol2,nRow2,
nTab,
1788 nSCol,nSRow,nSTab, nECol,nERow,nETab ) )
1791 bRecalcPages =
true;
1806 nCol1,nRow1,
nTab, nCol2,nRow2,
nTab,
1808 nSCol,nSRow,nSTab, nECol,nERow,nETab ) )
1811 bRecalcPages =
true;
1839 for (
auto const & rpCol :
aCol)
1840 rpCol->UpdateTranspose( rSource, rDest, pUndoDoc );
1845 for (
auto const & rpCol :
aCol)
1846 rpCol->UpdateGrow( rArea, nGrowX, nGrowY );
1927 aCol[i].UpdateMoveTab(rCxt, nTabNo);
1939 aCol[i].UpdateCompile( bForceIfNameInUse );
1962 OSL_FAIL(
"ExtendPrintArea: No ColInfo or RowInfo");
1967 double nPPTX = aPix1000.X() / 1000.0;
1968 double nPPTY = aPix1000.Y() / 1000.0;
1980 aSkipCols.setTrue(i, nLastCol);
1985 for (
SCCOL j = i; j <= nLastCol; ++j)
1994 aSkipCols.setTrue(j,j);
2001 for (
SCCOL nCol = rEndCol; nCol >= 0; --nCol)
2003 if (!aSkipCols.getRangeData(nCol, aColData))
2015 for (
SCCOL nDataCol = nCol; 0 <= nDataCol && nDataCol >= aColData.
mnCol1; --nDataCol)
2017 SCCOL nPrintCol = nDataCol;
2026 SCCOL nNewCol = nDataCol;
2033 if (nNewCol > nPrintCol)
2034 nPrintCol = nNewCol;
2035 aCell = aIter.
next();
2038 if (nPrintCol > rEndCol)
2040 rEndCol = nPrintCol;
2077 nRow, pDev, nPPTX, nPPTY, aZoom, aZoom,
true, aOptions,
nullptr );
2079 rColumn.
SetTextWidth(nRow, static_cast<sal_uInt16>(nPixel));
2095 if ( eHorJust == SvxCellHorJustify::Center )
2100 bool bRight = ( eHorJust == SvxCellHorJustify::Right );
2108 SCCOL nNewCol = rCol;
2111 auto nNextCol = nNewCol + 1;
2112 bool bNextEmpty =
true;
2116 bNextEmpty = aNextCell.
isEmpty();
2135 explicit SetTableIndex(
SCTAB nTab) : mnTab(nTab) {}
2137 void operator() (
ScRange& rRange)
const
2247 mrRowSegs(rRowSegs),
2249 mnCurRow(ROW_NOT_FOUND),
2250 mnUBound(ROW_NOT_FOUND)
2260 if (nRow > mrDocument.MaxRow())
2262 mnCurRow = ROW_NOT_FOUND;
2267 if (!mrRowSegs.getRangeData(nRow, aData))
2269 mnCurRow = ROW_NOT_FOUND;
2283 mnCurRow = aData.
mnRow2 + 1;
2284 mnUBound = mnCurRow;
2285 if (mnCurRow > mrDocument.MaxRow())
2288 mnCurRow = ROW_NOT_FOUND;
2293 maCell = mrColumn.GetCellValue(mnCurRow);
2294 if (!maCell.isEmpty())
2304 if (mnCurRow == ROW_NOT_FOUND)
2307 while (mrColumn.GetNextDataPos(mnCurRow))
2309 if (mnCurRow > mnUBound)
2313 if (!mrRowSegs.getRangeData(mnCurRow, aData))
2315 mnCurRow = ROW_NOT_FOUND;
2323 mnCurRow = mnUBound = aData.
mnRow2;
2331 maCell = mrColumn.GetCellValue(mnCurRow);
2332 if (!maCell.isEmpty())
2336 mnCurRow = ROW_NOT_FOUND;
2352 pNew->SetKey(nMax+1);
2361 return SvtScriptType::NONE;
2363 return aCol[nCol].GetScriptType(nRow);
2371 aCol[nCol].SetScriptType(nRow, nType);
2378 return SvtScriptType::NONE;
2380 sc::CellStoreType::iterator itr =
aCol[nCol].maCells.
begin();
2389 return aCol[nCol].GetFormulaHash(nRow);
2397 return aCol[nCol].GetFormulaVectorState(nRow);
2407 return aCol[nCol].ResolveStaticReference(nRow);
2412 if (nCol2 < nCol1 || nRow2 < nRow1)
2425 for (
SCCOL nCol = nCol1; nCol <= nMaxCol; ++nCol)
2443 return aCol[nCol].FetchVectorRefArray(nRow1, nRow2);
2449 assert( nRow2 >= nRow1 );
2451 return aCol[nCol].AssertNoInterpretNeeded(nRow1, nRow2);
2463 return aCol[nCol].HandleRefArrayForParallelism(nRow1, nRow2, mxGroup);
2471 return aCol[nCol].GetCellValue(nRow);
2479 return aCol[nCol].GetCellValue(rBlockPos, nRow);
2487 return aCol[nCol].GetBroadcaster(nRow);
2496 aCol[nCol].DeleteBroadcasters(rBlockPos, nRow1, nRow2);
2502 for (
SCCOL nCol = nCol1; nCol <= nCol2; ++nCol, ++nMatCol)
2509 for (
SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
2518 aCol[nCol].SetFormulaResults(nRow, pResults, nLen);
2524 unsigned nThisThread,
unsigned nThreadsTotal)
2529 size_t nLen = nRowEnd - nRowStart + 1;
2531 for (
SCCOL nCurrCol = nColStart; nCurrCol <= nColEnd; ++nCurrCol)
2533 aCol[nCurrCol].CalculateInThread( rContext, nRowStart, nLen, nOffset, nThisThread, nThreadsTotal );
2543 for (
SCCOL nCurrCol = nColStart; nCurrCol <= nColEnd; ++nCurrCol)
2547 #if DUMP_COLUMN_STORAGE
2553 aCol[nCol].DumpColumnStorage();
2562 return aCol[nCol].GetBroadcaster(nRow);
2590 ScColContainer::ScColumnVector::const_iterator beginIter;
2591 ScColContainer::ScColumnVector::const_iterator endIter;
2594 if (nColEnd < nColBegin)
2624 for (
SCCOL i = aOldColSize; i <= nScCol; i++)
formula::FormulaTokenRef ResolveStaticReference(SCCOL nCol, SCROW nRow)
static bool IsSystemRTL()
SC_DLLPUBLIC bool GetPrintArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow, bool bNotes=true) const
Matrix data type that can store values of mixed types.
SCROW GetNextMarked(SCCOL nCol, SCROW nRow, bool bUp) const
May return -1.
SCROW mnRowDelta
Amount and direction of movement in the row direction.
const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow) const
void UpdatePageBreaks(const ScRange *pUserArea)
sal_Int64 GetHashCode() const
sal_uLong GetWeightedCount() const
::boost::intrusive_ptr< ScFormulaCellGroup > ScFormulaCellGroupRef
static ScRefUpdateRes Update(const ScDocument *pDoc, UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCCOL nDx, SCROW nDy, SCTAB nDz, SCCOL &theCol1, SCROW &theRow1, SCTAB &theTab1, SCCOL &theCol2, SCROW &theRow2, SCTAB &theTab2)
void SetTextWidth(SCROW nRow, sal_uInt16 nWidth)
bool isForceAutoSize() const
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
sal_uLong GetWeightedCount() const
~ScTable() COVERITY_NOEXCEPT_FALSE
void SetLink(ScLinkMode nMode, const OUString &rDoc, const OUString &rFlt, const OUString &rOpt, const OUString &rTab, sal_uLong nRefreshDelay)
void DeleteConditionalFormat(sal_uLong nOldIndex)
void DestroySortCollator()
std::unique_ptr< ScFlatUInt16RowSegments > mpRowHeights
const ScRange * GetPrintRange(sal_uInt16 nPos) const
void UpdateGrow(const ScRange &rArea, SCCOL nGrowX, SCROW nGrowY)
SCCOL FindNextVisibleColWithContent(SCCOL nCol, bool bRight, SCROW nRow) const
void SetName(const OUString &rNewName)
CellTextAttrStoreType::iterator miCellTextAttrPos
void SetRowHeightOnly(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight)
Set specified row height to specified ranges.
void SetScenario(bool bFlag)
sal_uInt16 getExtraHeight() const
void InterpretDirtyCells(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
void SetScriptType(SCCOL nCol, SCROW nRow, SvtScriptType nType)
sal_uInt16 GetPrintRangeCount() const
void SetPrintEntireSheet()
Marks the specified sheet to be printed completely.
Context for reference update during shifting, moving or copying of cell ranges.
SvtScriptType GetScriptType(SCCOL nCol, SCROW nRow) const
SCCOL FindNextVisibleCol(SCCOL nCol, bool bRight) const
bool GetPrintAreaVer(SCCOL nStartCol, SCCOL nEndCol, SCROW &rEndRow, bool bNotes) const
ScColumnVector::const_iterator end() const
ScRefCellValue reset(SCROW nRow)
Set the start row position.
SCROW getRow() const
Get the current row position.
void SetFormulaResults(SCCOL nCol, SCROW nRow, const double *pResults, size_t nLen)
Store position data for column array storage.
ScFormulaVectorState GetFormulaVectorState(SCCOL nCol, SCROW nRow) const
This is very similar to ScCellValue, except that it references the original value instead of copying ...
void UpdateReference(sc::RefUpdateContext &rCxt, ScDocument *pUndoDoc=nullptr, bool bIncludeDraw=true, bool bUpdateNoteCaptionPos=true)
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
RowHeightsArray & getHeightArray()
void SetLoadingRTL(bool bSet)
mdds::multi_type_vector< CellFunc, CellStoreEvent > CellStoreType
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
void LimitChartArea(SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow) const
std::unique_ptr< ScRangeName > mpRangeName
bool IsAdjustHeightLocked() const
void MoveArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nDx, SCROW nDy, bool bInsDel, bool bUpdateNoteCaptionPos)
void MaybeAddExtraColumn(SCCOL &rCol, SCROW nRow, OutputDevice *pDev, double nPPTX, double nPPTY)
In case the cell text goes beyond the column width, move the max column position to the right...
void SetRepeatColRange(std::unique_ptr< ScRange > pNew)
bool IsCellMarked(SCCOL nCol, SCROW nRow, bool bNoSimple=false) const
void FillPrintSaver(ScPrintSaverTab &rSaveTab) const
bool ValidRow(SCROW nRow) const
void GetMarkArea(ScRange &rRange) const
void SetStreamValid(bool bSet, bool bIgnoreLock=false)
ScColumn & CreateColumnIfNotExists(const SCCOL nScCol) const
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
void CalculateInColumnInThread(ScInterpreterContext &rContext, SCCOL nColStart, SCCOL nColEnd, SCROW nRowStart, SCROW nRowEnd, unsigned nThisThread, unsigned nThreadsTotal)
void RepaintRange(const ScRange &rRange)
void UpdateDrawRef(UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCCOL nDx, SCROW nDy, SCTAB nDz, bool bUpdateNoteCaptionPos=true)
ScRefCellValue GetCellValue(SCROW nRow) const
bool ValidNextPos(SCCOL nCol, SCROW nRow, const ScMarkData &rMark, bool bMarked, bool bUnprotected) const
SC_DLLPUBLIC SCROW MaxRow() const
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
void SetAnonymousDBData(std::unique_ptr< ScDBData > pDBData)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
This is a rather odd datastructure.
void FillMatrix(ScMatrix &rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, svl::SharedStringPool *pPool) const
bool IsMultiMarked() const
void ClearPrintRanges()
Removes all print ranges.
SC_DLLPUBLIC bool IsDocVisible() const
const ScRange * GetRepeatRow() const
bool setFalse(SCCOL nCol1, SCCOL nCol2)
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
void HandleStuffAfterParallelCalculation(SCCOL nColStart, SCCOL nColEnd, SCROW nRow, size_t nLen, ScInterpreter *pInterpreter)
ScRefCellValue next()
Find the next visible data cell position.
ScColumnVector::const_iterator begin() const
void SetPendingRowHeights(bool bSet)
void FindAreaPos(SCCOL &rCol, SCROW &rRow, ScMoveDirection eDirection) const
std::unique_ptr< ScOutlineTable > pOutlineTable
sal_uInt16 GetOptimalColWidth(SCCOL nCol, OutputDevice *pDev, double nPPTX, double nPPTY, const Fraction &rZoomX, const Fraction &rZoomY, bool bFormula, const ScMarkData *pMarkData, const ScColWidthParam *pParam)
bool SkipRow(const SCCOL rCol, SCROW &rRow, const SCROW nMovY, const ScMarkData &rMark, const bool bUp, const SCROW nUsedY, const bool bMarked, const bool bSheetProtected) const
std::unique_ptr< ScBitMaskCompressedArray< SCCOL, CRFlags > > mpColFlags
void SetRepeatRowRange(std::unique_ptr< ScRange > pNew)
VisibleDataCellIterator(const ScDocument &rDoc, ScFlatBoolRowSegments &rRowSegs, ScColumn &rColumn)
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
void PutInOrder(T &nStart, T &nEnd)
std::unique_ptr< utl::TextSearch > pSearchText
bool IsColValid(const SCCOL nScCol) const
constexpr OUStringLiteral aData
bool SetRowHeightRange(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight, double nPPTY)
void SetRepeat(const ScRange *pCol, const ScRange *pRow)
bool UpdateReference(sc::RefUpdateContext &rCxt, ScDocument *pUndoDoc)
Update reference addresses in formula cell in response to mass cell movement.
static SC_DLLPUBLIC sal_uInt16 nStdRowHeight
SCROW GetLastDataRow(SCCOL nCol1, SCCOL nCol2, SCROW nLastRow, bool bConsiderCellNotes=false, bool bConsiderCellDrawObjects=false) const
SCSIZE GetEmptyLinesInBlock(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScDirection eDir) const
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
void SetPageSize(sal_uInt16 nPageNo, const Size &rSize, bool bUpdateNoteCaptionPos)
SC_DLLPUBLIC SCCOL MaxCol() const
bool ColHidden(SCCOL nCol, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
bool ValidCol(SCCOL nCol) const
Keep track of all named expressions that have been updated during reference update.
void AssertNoInterpretNeeded(SCCOL nCol, SCROW nRow1, SCROW nRow2)
void FillMatrix(ScMatrix &rMat, size_t nMatCol, SCROW nRow1, SCROW nRow2, svl::SharedStringPool *pPool) const
void SetOptimalHeightOnly(sc::RowHeightContext &rCxt, SCROW nStartRow, SCROW nEndRow, ScProgress *pOuterProgress=nullptr, sal_uLong nProgressStart=0)
bool ShrinkToUsedDataArea(bool &o_bShrunk, SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow, bool bColumnsOnly, bool bStickyTopRow, bool bStickyLeftCol, bool bConsiderCellNotes, bool bConsiderCellDrawObjects) const
void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sc::UpdatedRangeNames &rIndexes) const
std::unique_ptr< ScRange > pRepeatColRange
UpdateRefMode meMode
update mode - insert/delete, copy, or move.
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
void RestorePrintRanges(const ScPrintSaverTab &rSaveTab)
void UpdateInsertTab(sc::RefUpdateInsertTabContext &rCxt)
sal_uInt16 GetColWidth(SCCOL nCol, bool bHiddenAsZero=true) const
bool GetPrintAreaHor(SCROW nStartRow, SCROW nEndRow, SCCOL &rEndCol) const
std::unique_ptr< ScDBData > pDBDataNoName
void CreateColumnIfNotExistsImpl(const SCCOL nScCol) const
ScSheetLimits & GetSheetLimits() const
void UpdateCompile(bool bForceIfNameInUse=false)
void AddPrintRange(const ScRange &rNew)
Adds a new print ranges.
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
const mdds::mtv::element_t element_type_empty
std::unique_ptr< ScTableProtection > pTabProtection
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
bool ScAddPage(SCTAB nTab)
ScMarkArray GetMarkArray(SCCOL nCol) const
ScRefCellValue GetRefCellValue(SCCOL nCol, SCROW nRow)
void GetLastDataPos(SCCOL &rCol, SCROW &rRow) const
OUString ScResId(const char *pId)
~VisibleDataCellIterator()
const ScRangeVec & GetPrintRanges() const
bool GetNextMarkedCell(SCCOL &rCol, SCROW &rRow, const ScMarkData &rMark) const
sal_uLong GetState() const
size_t GetFormulaHash(SCCOL nCol, SCROW nRow) const
std::unique_ptr< ScConditionalFormatList > mpCondFormatList
tools::Long GetNeededSize(SCROW nRow, OutputDevice *pDev, double nPPTX, double nPPTY, const Fraction &rZoomX, const Fraction &rZoomY, bool bWidth, const ScNeededSizeOptions &rOptions, const ScPatternAttr **pPatternChange, bool bInPrintTwips=false) const
SvtScriptType GetRangeScriptType(sc::ColumnBlockPosition &rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2)
void UpdateTranspose(const ScRange &rSource, const ScAddress &rDest, ScDocument *pUndoDoc)
const SCCOL SC_COLUMNS_STOP
void SetValue(A nPos, const D &rValue)
const ScRange * GetRepeatCol() const
SC_DLLPUBLIC const SfxItemSet * GetCondResult(SCCOL nCol, SCROW nRow, SCTAB nTab, ScRefCellValue *pCell=nullptr) const
void SetTabNo(SCTAB nNewTab)
ScTable(ScDocument &rDoc, SCTAB nNewTab, const OUString &rNewName, bool bColInfo=true, bool bRowInfo=true)
ScRange maRange
Range of cells that are about to be moved for insert/delete/move modes.
const SCROW SCROW_REPEAT_NONE
bool IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol) const
void SetCondFormList(ScConditionalFormatList *pList)
void UpdateMoveTab(sc::RefUpdateMoveTabContext &rCxt, SCTAB nTabNo, ScProgress *pProgress)
Point LogicToPixel(const Point &rLogicPt) const
bool GetDataAreaSubrange(ScRange &rRange) const
void UpdateDeleteTab(sc::RefUpdateDeleteTabContext &rCxt)
const D & GetValue(A nPos) const
void InvalidatePageBreaks()
void GetOptimalHeight(sc::RowHeightContext &rCxt, SCROW nStartRow, SCROW nEndRow, sal_uInt16 nMinHeight, SCROW nMinStart)
bool IsInDtorClear() const
void SetState(sal_uLong nVal, sal_uLong nNewRange=0)
bool RowHidden(SCROW nRow, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
tools::Long GetNeededSize(SCCOL nCol, SCROW nRow, OutputDevice *pDev, double nPPTX, double nPPTY, const Fraction &rZoomX, const Fraction &rZoomY, bool bWidth, bool bTotalSize, bool bInPrintTwips=false)
void SetTabBgColor(const Color &rColor)
bool IsColRowValid(const SCCOL nScCol, const SCROW nScRow) const
bool IsPrintEntireSheet() const
Returns true, if the sheet is always printed.
void ScRenamePage(SCTAB nTab, const OUString &rNewName)
const SCCOL INITIALCOLCOUNT
bool IsEntireSheet() const
void GetDataArea(SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow, bool bIncludeOld, bool bOnlyDown) const
bool ValidColRow(SCCOL nCol, SCROW nRow) const
SCTAB mnTabDelta
Amount and direction of movement in the sheet direction.
void SetLayoutRTL(bool bSet)
RangeData GetRangeData(A nPos) const
Get range data for a row, i.e.
sal_uLong GetCellCount() const
void DumpColumnStorage(SCCOL nCol) const
ScColumnsRange GetColumnsRange(SCCOL begin, SCCOL end) const
bool GetCellArea(SCCOL &rEndCol, SCROW &rEndRow) const
void DeleteBroadcasters(sc::ColumnBlockPosition &rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2)
void SetVisible(bool bVis)
formula::VectorRefArray FetchVectorRefArray(SCCOL nCol, SCROW nRow1, SCROW nRow2)
std::unique_ptr< ScCompressedArray< SCCOL, sal_uInt16 > > mpColWidth
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
bool HandleRefArrayForParallelism(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScFormulaCellGroupRef &mxGroup)
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
SvtBroadcaster * GetBroadcaster(SCCOL nCol, SCROW nRow)
bool GetTableArea(SCCOL &rEndCol, SCROW &rEndRow) const
bool GetPrintArea(SCCOL &rEndCol, SCROW &rEndRow, bool bNotes) const
SCROW GetNextUnprotected(SCROW nRow, bool bUp) const
Including current, may return -1.
const ScColumn & back() const
void CopyPrintRange(const ScTable &rTable)
std::unique_ptr< ScRange > pRepeatRowRange
std::unique_ptr< ScRangeList > pScenarioRanges
SfxObjectShell * GetDocumentShell() const
The data type represents bits, manageable by bitwise operations.
ScFormulaVectorState
When vectorization is enabled, we could potentially mass-calculate a series of formula token arrays i...
const SCCOL SC_TABSTART_NONE
void GetMultiMarkArea(ScRange &rRange) const
SCCOL ClampToAllocatedColumns(SCCOL nCol) const
void resize(ScSheetLimits const &, const size_t aNewSize)
sal_uLong AddCondFormat(std::unique_ptr< ScConditionalFormat > pNew)
void GetNextPos(SCCOL &rCol, SCROW &rRow, SCCOL nMovX, SCROW nMovY, bool bMarked, bool bUnprotected, const ScMarkData &rMark, SCCOL nTabStartCol) const
SCCOL mnColDelta
Amount and direction of movement in the column direction.
std::unique_ptr< ScFlatBoolRowSegments > mpHiddenRows
sal_uInt16 GetTextWidth(SCROW nRow) const
SCCOL GetAllocatedColumnsCount() const
const OUString & GetUpperName() const
std::unique_ptr< ScSheetEvents > pSheetEvents
void ExtendPrintArea(OutputDevice *pDev, SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW nEndRow)
void ScRemovePage(SCTAB nTab)
ScAttrArray aDefaultColAttrArray
SCROW GetNextMarked(SCROW nRow, bool bUp) const
Including current row, may return -1 if bUp and not found.
bool IsStreamValidLocked() const
sal_uLong nLinkRefreshDelay
const SCCOL SCCOL_REPEAT_NONE
Use this to iterate through non-empty visible cells in a single column.
bool SetOptimalHeight(sc::RowHeightContext &rCxt, SCROW nStartRow, SCROW nEndRow, ScProgress *pOuterProgress=nullptr, sal_uLong nProgressStart=0)
void SetAreas(const ScRangeVec &rRanges, bool bEntireSheet)
bool GetDataStart(SCCOL &rStartCol, SCROW &rStartRow) const
ScConditionalFormatList * GetCondFormList()