29 #include <document.hxx>
39 #include <stlpool.hxx>
67 if (rStartX >= nX1 && !pDoc->
ColHidden(rStartX, nTab,
nullptr, &nLastCol))
87 if (rStartX >= nX1 && rStartY >= nY1 &&
88 !pDoc->
ColHidden(rStartX, nTab,
nullptr, &nLastCol) &&
89 !pDoc->
RowHidden(rStartY, nTab,
nullptr, &nLastRow) &&
90 pRowInfo[nArrY].
nRowNo == rStartY)
103 if (rStartX >= nX1 && rStartY >= nY1 &&
104 !pDoc->
ColHidden(rStartX, nTab,
nullptr, &nLastCol) &&
105 !pDoc->
RowHidden(rStartY, nTab,
nullptr, &nLastRow) &&
106 pRowInfo[nArrY].
nRowNo == rStartY)
127 SCROW mnHiddenEndRow;
130 bool isHidden(
size_t nRow)
133 if (nThisRow > mnHiddenEndRow)
134 mbHiddenRow = mrDoc.
RowHidden(nThisRow, mnTab,
nullptr, &mnHiddenEndRow);
138 void alignArray(
size_t nRow)
140 while (mpRowInfo[mnArrY].nRowNo < static_cast<SCROW>(nRow))
148 RowInfo& rThisRowInfo = mpRowInfo[mnArrY];
157 mrDoc(rDoc), mnTab(nTab), mpRowInfo(pRowInfo), mnArrX(nArrX), mnArrY(nArrY),
158 mnHiddenEndRow(-1), mbHiddenRow(false) {}
160 void operator() (
size_t nRow,
double fVal)
194 SCROW nDocHeightEndRow = -1;
195 for (
SCROW nSignedY=nRow1-1; nSignedY<=rYExtra; nSignedY++)
203 if (nY > nDocHeightEndRow)
206 nDocHeight = pDoc->
GetRowHeight( nY, nTab,
nullptr, &nDocHeightEndRow );
211 if ( rArrRow==0 || nDocHeight || nY >
MAXROW )
213 RowInfo* pThisRowInfo = &pRowInfo[rArrRow];
216 sal_uInt16 nHeight =
static_cast<sal_uInt16
>(
218 nDocHeight * fRowScale, 1.0,
double(std::numeric_limits<sal_uInt16>::max())));
220 pThisRowInfo->
nRowNo = nY;
221 pThisRowInfo->
nHeight = nHeight;
229 if (rArrRow >= nMaxRow)
231 OSL_FAIL(
"FillInfo: Range too big" );
237 if (nSignedY == rYExtra)
245 for (
SCSIZE nArrRow = 0; nArrRow < nArrCount; ++nArrRow)
247 RowInfo& rThisRowInfo = pRowInfo[nArrRow];
250 for (
SCCOL nArrCol = 0; nArrCol <= nRotMax+2; ++nArrCol)
261 for (
SCCOL nArrCol=nCol2+3; nArrCol<=nRotMax+2; nArrCol++)
263 SCCOL nX = nArrCol-1;
268 sal_uInt16 nThisWidth =
static_cast<sal_uInt16
>(pDoc->
GetColWidth( nX, nTab ) * fColScale);
280 const ScAddress& rAddr,
bool& bHidden,
bool& bHideFormula,
bool bTabProtect)
283 bool bAnyCondition =
false;
284 for(
const auto& rCondFormat : rCondFormats)
300 bAnyCondition =
true;
341 return bAnyCondition;
348 SCTAB nTab,
double fColScale,
double fRowScale,
bool bPageMode,
bool bFormulaMode,
351 OSL_ENSURE(
maTabs[nTab],
"Table does not exist" );
369 bool bAnyMerged =
false;
370 bool bAnyShadow =
false;
371 bool bAnyCondition =
false;
372 bool bAnyPreview =
false;
379 SCROW nYExtra = nRow2+1;
380 initRowInfo(
this, pRowInfo, rTabInfo.
mnArrCapacity, fRowScale, nRow1,
381 nTab, nYExtra, nArrRow, nRow2);
387 bool bAnyItem = isRotateItemUsed(pPool);
389 SCCOL nRotMax = nCol2;
395 OSL_ENSURE( nArrCount>2,
"nArrCount too small" );
396 FindMaxRotCol( nTab, &pRowInfo[1], nArrCount-1, nCol1, nCol2 );
399 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
400 if (pRowInfo[nArrRow].nRotMaxCol !=
SC_ROTMAX_NONE && pRowInfo[nArrRow].nRotMaxCol > nRotMax)
406 initCellInfo(pRowInfo, nArrCount, nRotMax, pDefShadow);
408 initColWidths(pRowInfo,
this, fColScale, nTab, nCol2, nRotMax);
414 for (
SCCOL nArrCol=0; nArrCol<=nCol2+2; nArrCol++)
426 sal_uInt16 nThisWidth =
static_cast<sal_uInt16
>(std::clamp(
GetColWidth( nX, nTab ) * fColScale, 1.0,
double(std::numeric_limits<sal_uInt16>::max())));
438 RowInfoFiller aFunc(*
this, nTab, pRowInfo, nArrCol, nArrRow);
445 pThisAttrArr = &
maTabs[nTab]->aDefaultColAttrArray;
459 if ( pThisAttrArr->
Count() )
460 (
void) pThisAttrArr->
Search( nCurRow, nIndex );
467 if ( pThisAttrArr->
Count() )
469 nThisRow = pThisAttrArr->
mvData[nIndex].nEndRow;
470 pPattern = pThisAttrArr->
mvData[nIndex].pPattern;
485 if (pShadowAttr != pDefShadow)
489 bool bMerged = ( pMergeAttr != pDefMerge && *pMergeAttr != *pDefMerge );
499 if (bMerged||bHOverlapped||bVOverlapped)
502 bool bHidden, bHideFormula;
510 bHidden = bHideFormula =
false;
513 bool bContainsCondFormat = !rCondFormats.
empty();
517 SCROW nLastHiddenRow = -1;
518 bool bRowHidden =
RowHidden(nCurRow, nTab,
nullptr, &nLastHiddenRow);
519 if ( nArrRow==0 || !bRowHidden )
523 RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
524 if (pBackground != pDefBackground)
526 if (bContainsCondFormat)
530 if (bPivotButton || bPivotPopupButton)
555 if (bContainsCondFormat && pCondFormList)
557 bAnyCondition |= handleConditionalFormat(*pCondFormList, rCondFormats, pInfo, pStlPool,
ScAddress(nX, nCurRow, nTab),
558 bHidden, bHideFormula, bTabProtect);
566 else if (nLastHiddenRow >= 0)
568 nCurRow = nLastHiddenRow;
569 if (nCurRow > nThisRow)
574 while (nCurRow <= nThisRow && nCurRow <= nYExtra);
577 while ( nIndex < pThisAttrArr->
Count() && nThisRow < nYExtra );
586 if ( aThisMarkArr.Search( nRow1, nIndex ) )
590 nThisRow=aThisMarkArr.
mvData[nIndex].nRow;
600 while (nCurRow <= nThisRow && nCurRow <= nRow2);
603 while ( nIndex < aThisMarkArr.mvData.size() && nThisRow < nRow2 );
609 for (nArrRow=1; nArrRow+1<nArrCount; nArrRow++)
611 RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
614 pInfo->
nWidth = nThisWidth;
628 std::vector< std::unique_ptr<ScPatternAttr> > aAltPatterns;
630 if (bAnyCondition || bAnyPreview)
632 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
634 for (
SCCOL nArrCol=nCol1; nArrCol<=nCol2+2; nArrCol++)
644 aAltPatterns.push_back( std::make_unique<ScPatternAttr>( *pInfo->
pPatternAttr ) );
645 pModifiedPatt = aAltPatterns.back().get();
665 pInfo->
pLinesAttr = static_cast<const SvxBoxItem*>(pItem);
668 pInfo->
mpTLBRLine = static_cast< const SvxLineItem* >( pItem );
670 pInfo->
mpBLTRLine = static_cast< const SvxLineItem* >( pItem );
694 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
696 RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
697 SCROW nSignedY = nArrRow ? pThisRowInfo->
nRowNo : nRow1-1;
699 for (
SCCOL nArrCol=nCol1; nArrCol<=nCol2+2; nArrCol++)
701 SCCOL nSignedX = nArrCol - 1;
711 nStartX,nStartY, nEndX,nEndY );
718 if ( !pStartCond || pStartCond->
726 if ( !pStartCond || pStartCond->
727 GetItemState(
ATTR_SHADOW,
true,&pItem) != SfxItemState::SET )
739 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
741 bool bTop = ( nArrRow == 0 );
742 bool bBottom = ( nArrRow+1 == nArrCount );
744 for (
SCCOL nArrCol=nCol1; nArrCol<=nCol2+2; nArrCol++)
746 bool bLeft = ( nArrCol == nCol1 );
747 bool bRight = ( nArrCol == nCol2+2 );
752 if (eLoc != SvxShadowLocation::NONE)
759 while ( nArrCol+nDxPos < nCol2+2 && pRowInfo[0].pCellInfo[nArrCol+nDxPos].nWidth == 0 )
761 while ( nArrCol+nDxNeg > nCol1 && pRowInfo[0].pCellInfo[nArrCol+nDxNeg].nWidth == 0 )
764 bool bLeftDiff = !bLeft &&
766 bool bRightDiff = !bRight &&
768 bool bTopDiff = !bTop &&
770 bool bBottomDiff = !bBottom &&
777 case SvxShadowLocation::BottomRight: eLoc = SvxShadowLocation::BottomLeft;
break;
778 case SvxShadowLocation::BottomLeft: eLoc = SvxShadowLocation::BottomRight;
break;
779 case SvxShadowLocation::TopRight: eLoc = SvxShadowLocation::TopLeft;
break;
780 case SvxShadowLocation::TopLeft: eLoc = SvxShadowLocation::TopRight;
break;
790 case SvxShadowLocation::BottomRight:
803 if (bBottomDiff && bRightDiff)
810 case SvxShadowLocation::BottomLeft:
823 if (bBottomDiff && bLeftDiff)
830 case SvxShadowLocation::TopRight:
843 if (bTopDiff && bRightDiff)
850 case SvxShadowLocation::TopLeft:
863 if (bTopDiff && bLeftDiff)
871 OSL_FAIL(
"wrong Shadow-Enum");
878 rTabInfo.
mnArrCount = sal::static_int_cast<sal_uInt16>(nArrCount);
887 size_t nRowCount = nArrCount;
892 for(
size_t nRow = 0; nRow < nRowCount; ++nRow )
894 sal_uInt16 nCellInfoY =
static_cast< sal_uInt16
>( nRow );
895 RowInfo& rThisRowInfo = pRowInfo[ nCellInfoY ];
897 for(
size_t nCol = 0; nCol < nColCount; ++nCol )
899 sal_uInt16 nCellInfoX =
static_cast< sal_uInt16
>( nCol + nCol1 );
906 size_t nFirstCol = nCol;
907 size_t nFirstRow = nRow;
924 SCCOL nCurrDocCol =
static_cast< SCCOL >( nCellInfoX - 1 );
925 SCROW nCurrDocRow =
static_cast< SCROW >( (nCellInfoY > 0) ? rThisRowInfo.
nRowNo : (nRow1 - 1) );
928 SCCOL nFirstRealDocColS, nLastRealDocColS;
929 SCROW nFirstRealDocRowS, nLastRealDocRowS;
931 nCellInfoY,
this, pRowInfo, nCol1,nRow1,nTab,
932 nFirstRealDocColS, nFirstRealDocRowS, nLastRealDocColS, nLastRealDocRowS );
935 SCCOL nFirstRealDocCol = nFirstRealDocColS;
936 SCROW nFirstRealDocRow = nFirstRealDocRowS;
937 SCCOL nLastRealDocCol = nLastRealDocColS;
938 SCROW nLastRealDocRow = nLastRealDocRowS;
941 SCCOL nFirstDocCol = (nCol1 > 0) ? ::std::max< SCCOL >( nFirstRealDocCol, nCol1 - 1 ) : nFirstRealDocCol;
942 sal_uInt16 nFirstCellInfoX =
static_cast< sal_uInt16
>( nFirstDocCol + 1 );
943 nFirstCol =
static_cast< size_t >( nFirstCellInfoX - nCol1 );
946 SCCOL nLastDocCol = (nCol2 < MAXCOL) ? ::std::min< SCCOL >( nLastRealDocCol, nCol2 + 1 ) : nLastRealDocCol;
947 sal_uInt16 nLastCellInfoX =
static_cast< sal_uInt16
>( nLastDocCol + 1 );
948 size_t nLastCol =
static_cast< size_t >( nLastCellInfoX - nCol1 );
951 sal_uInt16 nFirstCellInfoY = nCellInfoY;
952 while( ((nFirstCellInfoY > 1) && (pRowInfo[ nFirstCellInfoY - 1 ].
nRowNo >= nFirstRealDocRow)) ||
953 ((nFirstCellInfoY == 1) && (static_cast< SCROW >( nRow1 - 1 ) >= nFirstRealDocRow)) )
955 SCROW nFirstDocRow = (nFirstCellInfoY > 0) ? pRowInfo[ nFirstCellInfoY ].nRowNo : static_cast< SCROW >( nRow1 - 1 );
956 nFirstRow =
static_cast< size_t >( nFirstCellInfoY );
959 sal_uInt16 nLastCellInfoY = nCellInfoY;
960 while( (sal::static_int_cast<SCSIZE>(nLastCellInfoY + 1) < nArrCount) &&
961 (pRowInfo[ nLastCellInfoY + 1 ].nRowNo <= nLastRealDocRow) )
963 SCROW nLastDocRow = (nLastCellInfoY > 0) ? pRowInfo[ nLastCellInfoY ].nRowNo : static_cast< SCROW >( nRow1 - 1 );
964 size_t nLastRow =
static_cast< size_t >( nLastCellInfoY );
967 rArray.
SetMergedRange( nFirstCol, nFirstRow, nLastCol, nLastRow );
975 for(
SCCOL nDocCol = nFirstRealDocCol; nDocCol < nFirstDocCol; ++nDocCol )
980 if( nLastCol + 1 == nColCount )
983 for(
SCCOL nDocCol = nLastDocCol + 1; nDocCol <= nLastRealDocCol; ++nDocCol )
991 for(
SCROW nDocRow = nFirstRealDocRow; nDocRow < nFirstDocRow; ++nDocRow )
996 if( nLastRow + 1 == nRowCount )
999 for(
SCROW nDocRow = nLastDocRow + 1; nDocRow <= nLastRealDocRow; ++nDocRow )
1006 if( (nFirstRealDocCol != nCurrDocCol) || (nFirstRealDocRow != nCurrDocRow) )
1018 pTLBR = pBLTR =
nullptr;
1046 : mpRowInfo(new
RowInfo[capacity])
1048 , mnArrCapacity(capacity)
1057 delete [] mpRowInfo[ nIdx ].pCellInfo;
std::unique_ptr< RowInfo[]> mpRowInfo
void FillInfo(ScTableInfo &rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode, const ScMarkData *pMarkData=nullptr)
SCCOL GetColMerge() const
const SCCOL SC_ROTMAX_NONE
void SetCellStyleTLBR(size_t nCol, size_t nRow, const Style &rStyle)
const SvxLineItem * mpTLBRLine
original item from document.
std::vector< ScMarkEntry > mvData
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
std::unique_ptr< ScAttrArray > pAttrArray
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
const SfxItemSet & GetItemSet() const
CellStoreType::const_iterator ParseAllNonEmpty(const typename CellStoreType::const_iterator &itPos, const CellStoreType &rCells, SCROW nRow1, SCROW nRow2, Func &rFunc)
static SvxBrushItem * GetButtonBrushItem()
virtual SfxItemSet & GetItemSet()
This is very similar to ScCellValue, except that it references the original value instead of copying ...
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
const editeng::SvxBorderLine * GetRight() const
void SetCellStyleTop(size_t nCol, size_t nRow, const Style &rStyle)
void SetCellStyleBottom(size_t nCol, size_t nRow, const Style &rStyle)
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
const SvxBoxItem * pLinesAttr
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
SvxShadowLocation GetLocation() const
std::unique_ptr< const ScDataBarInfo > pDataBar
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 ...
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
This is a rather odd datastructure.
bool IsMultiMarked() const
const SvxShadowItem * pShadowAttr
original item from document.
sc::CellStoreType maCells
ScTableInfo(const SCSIZE capacity=1024)
bool Search(SCROW nRow, SCSIZE &nIndex) const
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
SC_DLLPUBLIC SCCOL GetAllocatedColumnsCount(SCTAB nTab) const
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
ScStyleSheet * GetPreviewCellStyle()
constexpr OUStringLiteral aData
void SetCellStyleLeft(size_t nCol, size_t nRow, const Style &rStyle)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
std::vector< ScAttrEntry > mvData
static SC_DLLPUBLIC sal_uInt16 nStdRowHeight
void SetAddMergedTopSize(size_t nCol, size_t nRow, tools::Long nAddSize)
const editeng::SvxBorderLine * GetTop() const
std::unique_ptr< const ScIconSetInfo > pIconSet
dp button with popup arrow
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
const ScPatternAttr * pPatternAttr
const editeng::SvxBorderLine * GetLeft() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
bool ValidCol(SCCOL nCol) const
svx::frame::Array maArray
bool GetHideFormula() const
ScMarkArray GetMarkArray(SCCOL nCol) const
void Initialize(size_t nWidth, size_t nHeight)
bool IsMerged(size_t nCol, size_t nRow) const
SC_DLLPUBLIC const SfxItemSet * GetCondResult(SCCOL nCol, SCROW nRow, SCTAB nTab, ScRefCellValue *pCell=nullptr) const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
void SetCellStyleBLTR(size_t nCol, size_t nRow, const Style &rStyle)
const SvxBrushItem * pBackground
void SetStyleSheet(ScStyleSheet *pNewStyle, bool bClearDirectFormat=true)
const SvxShadowItem * pVShadowOrigin
static void lcl_GetMergeRange(SCCOL nX, SCROW nY, SCSIZE nArrY, const ScDocument *pDoc, RowInfo *pRowInfo, SCCOL nX1, SCROW nY1, SCTAB nTab, SCCOL &rStartX, SCROW &rStartY, SCCOL &rEndX, SCROW &rEndY)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
ScShadowPart eHShadowPart
void FindMaxRotCol(SCTAB nTab, RowInfo *pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2) const
std::optional< Color > mxColorScale
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
void SetMergedRange(size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow)
bool ValidRow(SCROW nRow) const
const editeng::SvxBorderLine * GetLine() const
ScShadowPart eVShadowPart
field button for datapilot
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
void SetCellStyleRight(size_t nCol, size_t nRow, const Style &rStyle)
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
void SetAddMergedRightSize(size_t nCol, size_t nRow, tools::Long nAddSize)
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
const SvxLineItem * mpBLTRLine
original item from document.
rtl::Reference< ScPoolHelper > mxPoolHelper
void SetAddMergedLeftSize(size_t nCol, size_t nRow, tools::Long nAddSize)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
SCROW GetRowMerge() const
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
const editeng::SvxBorderLine * GetBottom() const
void SetAddMergedBottomSize(size_t nCol, size_t nRow, tools::Long nAddSize)
const SvxShadowItem * pHShadowOrigin
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
const SfxItemSet * pConditionSet