27#include <osl/diagnose.h>
30#include <document.hxx>
68 if (rStartX >= nX1 && !pDoc->
ColHidden(rStartX, nTab,
nullptr, &nLastCol))
88 if (rStartX >= nX1 && rStartY >= nY1 &&
89 !pDoc->
ColHidden(rStartX, nTab,
nullptr, &nLastCol) &&
90 !pDoc->
RowHidden(rStartY, nTab,
nullptr, &nLastRow) &&
91 pRowInfo[nArrY].
nRowNo == rStartY)
104 if (rStartX >= nX1 && rStartY >= nY1 &&
105 !pDoc->
ColHidden(rStartX, nTab,
nullptr, &nLastCol) &&
106 !pDoc->
RowHidden(rStartY, nTab,
nullptr, &nLastRow) &&
107 pRowInfo[nArrY].
nRowNo == rStartY)
129 SCROW mnHiddenEndRow;
132 bool isHidden(
size_t nRow)
135 if (nThisRow > mnHiddenEndRow)
136 mbHiddenRow = mrDoc.
RowHidden(nThisRow, mnTab,
nullptr, &mnHiddenEndRow);
140 void alignArray(
size_t nRow)
142 while (mpRowInfo[mnArrY].nRowNo <
static_cast<SCROW>(nRow))
150 RowInfo& rThisRowInfo = mpRowInfo[mnArrY];
151 if(
mnCol >= mnStartCol-1)
159 mrDoc(rDoc), mnTab(nTab), mpRowInfo(pRowInfo),
mnCol(nCol), mnArrY(nArrY), mnStartCol(nStartCol),
160 mnHiddenEndRow(-1), mbHiddenRow(false) {}
162 void operator() (
size_t nRow,
double fVal)
196 SCROW nDocHeightEndRow = -1;
197 for (
SCROW nSignedY=nRow1-1; nSignedY<=rYExtra; nSignedY++)
205 if (nY > nDocHeightEndRow)
208 nDocHeight = pDoc->
GetRowHeight( nY, nTab,
nullptr, &nDocHeightEndRow );
213 if ( rArrRow==0 || nDocHeight || nY > pDoc->
MaxRow() )
215 RowInfo* pThisRowInfo = &pRowInfo[rArrRow];
218 sal_uInt16 nHeight =
static_cast<sal_uInt16
>(
220 nDocHeight * fRowScale, 1.0,
double(std::numeric_limits<sal_uInt16>::max())));
222 pThisRowInfo->
nRowNo = nY;
223 pThisRowInfo->
nHeight = nHeight;
232 if (rArrRow >= nMaxRow)
234 OSL_FAIL(
"FillInfo: Range too big" );
240 if (nSignedY == rYExtra)
248 for (
SCSIZE nArrRow = 0; nArrRow < nArrCount; ++nArrRow)
250 RowInfo& rThisRowInfo = pRowInfo[nArrRow];
260 for (
SCCOL nCol = nMinCol-1; nCol <= nRotMax+1; ++nCol)
270 for (
SCCOL nCol=nCol2+2; nCol<=nRotMax+1; nCol++)
276 sal_uInt16 nThisWidth =
static_cast<sal_uInt16
>(pDoc->
GetColWidth( nCol, nTab ) * fColScale);
288 const ScAddress& rAddr,
bool& bHidden,
bool& bHideFormula,
bool bTabProtect)
291 bool bAnyCondition =
false;
292 for(
const auto& rCondFormat : rCondFormats)
300 if (!
aData.aStyleName.isEmpty())
303 pStlPool->
Find(
aData.aStyleName, SfxStyleFamily::Para );
308 bAnyCondition =
true;
326 if(
aData.mxColorScale)
350 return bAnyCondition;
357 SCTAB nTab,
double fColScale,
double fRowScale,
bool bPageMode,
bool bFormulaMode,
360 OSL_ENSURE(
maTabs[nTab],
"Table does not exist" );
378 bool bAnyMerged =
false;
379 bool bAnyShadow =
false;
380 bool bAnyCondition =
false;
381 bool bAnyPreview =
false;
388 SCROW nYExtra = nRow2+1;
389 initRowInfo(
this, pRowInfo, rTabInfo.
mnArrCapacity, fRowScale, nRow1,
390 nTab, nYExtra, nArrRow, nRow2);
396 bool bAnyItem = isRotateItemUsed(pPool);
398 SCCOL nRotMax = nCol2;
404 OSL_ENSURE( nArrCount>2,
"nArrCount too small" );
405 FindMaxRotCol( nTab, &pRowInfo[1], nArrCount-1, nCol1, nCol2 );
408 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
409 if (pRowInfo[nArrRow].nRotMaxCol !=
SC_ROTMAX_NONE && pRowInfo[nArrRow].nRotMaxCol > nRotMax)
415 initCellInfo(pRowInfo, nArrCount, nCol1, nRotMax, pDefShadow);
417 initColWidths(pRowInfo,
this, fColScale, nTab, nCol2, nRotMax);
423 SCCOL nLastHiddenCheckedCol = -2;
424 bool bColHidden =
false;
425 for (
SCCOL nCol=-1; nCol<=nCol2+1; nCol++)
432 if (nCol > nLastHiddenCheckedCol)
433 bColHidden =
ColHidden(nCol, nTab,
nullptr, &nLastHiddenCheckedCol);
437 sal_uInt16 nColWidth =
GetColWidth( nCol, nTab,
false );
438 sal_uInt16 nThisWidth =
static_cast<sal_uInt16
>(std::clamp(nColWidth * fColScale, 1.0,
double(std::numeric_limits<sal_uInt16>::max())));
450 RowInfoFiller aFunc(*
this, nTab, pRowInfo, nCol, nArrRow, nCol1);
457 pThisAttrArr = &
maTabs[nTab]->aDefaultColData.AttrArray();
471 if ( pThisAttrArr->
Count() )
479 if ( pThisAttrArr->
Count() )
497 if (pShadowAttr != pDefShadow)
501 bool bMerged = ( pMergeAttr != pDefMerge && *pMergeAttr != *pDefMerge );
514 if (bMerged||bHOverlapped||bVOverlapped)
517 bool bHidden, bHideFormula;
525 bHidden = bHideFormula =
false;
528 bool bContainsCondFormat = !rCondFormats.
empty();
532 SCROW nLastHiddenRow = -1;
533 bool bRowHidden =
RowHidden(nCurRow, nTab,
nullptr, &nLastHiddenRow);
534 if ( nArrRow==0 || !bRowHidden )
538 RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
539 if (pBackground != pDefBackground)
541 if (bContainsCondFormat)
545 if (bPivotButton || bPivotPopupButton || bPivotPopupButtonMulti)
547 if (bPivotCollapseButton || bPivotExpandButton)
576 if (bContainsCondFormat && pCondFormList)
578 bAnyCondition |= handleConditionalFormat(*pCondFormList, rCondFormats,
579 pInfo, &rTabInfo, pStlPool,
ScAddress(nCol, nCurRow, nTab),
580 bHidden, bHideFormula, bTabProtect);
588 else if (nLastHiddenRow >= 0)
590 nCurRow = nLastHiddenRow;
591 if (nCurRow > nThisRow)
596 while (nCurRow <= nThisRow && nCurRow <= nYExtra);
599 while ( nIndex < pThisAttrArr->
Count() && nThisRow < nYExtra );
622 while (nCurRow <= nThisRow && nCurRow <= nRow2);
625 while (
nIndex < aThisMarkArr.
mvData.size() && nThisRow < nRow2 );
631 for (nArrRow=1; nArrRow+1<nArrCount; nArrRow++)
632 pRowInfo[nArrRow].basicCellInfo(nCol).nWidth = nThisWidth;
645 std::vector< std::unique_ptr<ScPatternAttr> > aAltPatterns;
647 if (bAnyCondition || bAnyPreview)
649 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
651 for (
SCCOL nCol=nCol1-1; nCol<=nCol2+1; nCol++)
660 aAltPatterns.push_back( std::make_unique<ScPatternAttr>( *pInfo->
pPatternAttr ) );
661 pModifiedPatt = aAltPatterns.back().get();
708 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
710 RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
711 SCROW nSignedY = nArrRow ? pThisRowInfo->
nRowNo : nRow1-1;
713 for (
SCCOL nCol=nCol1-1; nCol<=nCol2+1; nCol++)
724 nStartX,nStartY, nEndX,nEndY );
750 if (pCondFormList && !pStartCond && !rCondFormatIndex.
empty())
752 for (
const auto& rItem : rCondFormatIndex)
773 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
775 bool bTop = ( nArrRow == 0 );
776 bool bBottom = ( nArrRow+1 == nArrCount );
778 for (
SCCOL nCol=nCol1-1; nCol<=nCol2+1; nCol++)
780 bool bLeft = ( nCol == nCol1-1 );
781 bool bRight = ( nCol == nCol2+1 );
786 if (eLoc != SvxShadowLocation::NONE)
793 while ( nCol+nDxPos < nCol2+1 && pRowInfo[0].basicCellInfo(nCol+nDxPos).nWidth == 0 )
795 while ( nCol+nDxNeg > nCol1-1 && pRowInfo[0].basicCellInfo(nCol+nDxNeg).nWidth == 0 )
798 bool bLeftDiff = !bLeft &&
800 bool bRightDiff = !bRight &&
802 bool bTopDiff = !bTop &&
804 bool bBottomDiff = !bBottom &&
811 case SvxShadowLocation::BottomRight: eLoc = SvxShadowLocation::BottomLeft;
break;
812 case SvxShadowLocation::BottomLeft: eLoc = SvxShadowLocation::BottomRight;
break;
813 case SvxShadowLocation::TopRight: eLoc = SvxShadowLocation::TopLeft;
break;
814 case SvxShadowLocation::TopLeft: eLoc = SvxShadowLocation::TopRight;
break;
824 case SvxShadowLocation::BottomRight:
837 if (bBottomDiff && bRightDiff)
844 case SvxShadowLocation::BottomLeft:
857 if (bBottomDiff && bLeftDiff)
864 case SvxShadowLocation::TopRight:
877 if (bTopDiff && bRightDiff)
884 case SvxShadowLocation::TopLeft:
897 if (bTopDiff && bLeftDiff)
905 OSL_FAIL(
"wrong Shadow-Enum");
912 rTabInfo.
mnArrCount = sal::static_int_cast<sal_uInt16>(nArrCount);
921 size_t nColCount = nCol2 - nCol1 + 1 + 2;
922 size_t nRowCount = nArrCount;
927 for(
size_t nRow = 0; nRow < nRowCount; ++nRow )
929 sal_uInt16 nCellInfoY =
static_cast< sal_uInt16
>( nRow );
930 RowInfo& rThisRowInfo = pRowInfo[ nCellInfoY ];
932 for(
SCCOL nCol = nCol1 - 1; nCol <= nCol2 + 1; ++nCol )
939 size_t colToIndex = -(nCol1 - 1);
941 size_t nX = nCol + colToIndex;
942 size_t nFirstCol = nX;
943 size_t nFirstRow = nRow;
959 SCCOL nCurrDocCol = nCol;
960 SCROW nCurrDocRow =
static_cast< SCROW >( (nCellInfoY > 0) ? rThisRowInfo.
nRowNo : (nRow1 - 1) );
963 SCCOL nFirstRealDocColS, nLastRealDocColS;
964 SCROW nFirstRealDocRowS, nLastRealDocRowS;
966 nCellInfoY,
this, pRowInfo, nCol1,nRow1,nTab,
967 nFirstRealDocColS, nFirstRealDocRowS, nLastRealDocColS, nLastRealDocRowS );
970 SCCOL nFirstRealDocCol = nFirstRealDocColS;
971 SCROW nFirstRealDocRow = nFirstRealDocRowS;
972 SCCOL nLastRealDocCol = nLastRealDocColS;
973 SCROW nLastRealDocRow = nLastRealDocRowS;
976 SCCOL nFirstDocCol = (nCol1 > 0) ? ::std::max< SCCOL >( nFirstRealDocCol, nCol1 - 1 ) : nFirstRealDocCol;
977 nFirstCol = nFirstDocCol + colToIndex;
980 SCCOL nLastDocCol = (nCol2 < MaxCol()) ? ::std::min< SCCOL >( nLastRealDocCol, nCol2 + 1 ) : nLastRealDocCol;
981 size_t nLastCol = nLastDocCol + colToIndex;
984 sal_uInt16 nFirstCellInfoY = nCellInfoY;
985 while( ((nFirstCellInfoY > 1) && (pRowInfo[ nFirstCellInfoY - 1 ].nRowNo >= nFirstRealDocRow)) ||
986 ((nFirstCellInfoY == 1) && (
static_cast< SCROW >( nRow1 - 1 ) >= nFirstRealDocRow)) )
988 SCROW nFirstDocRow = (nFirstCellInfoY > 0) ? pRowInfo[ nFirstCellInfoY ].nRowNo :
static_cast< SCROW >( nRow1 - 1 );
989 nFirstRow =
static_cast< size_t >( nFirstCellInfoY );
992 sal_uInt16 nLastCellInfoY = nCellInfoY;
993 while( (sal::static_int_cast<SCSIZE>(nLastCellInfoY + 1) < nArrCount) &&
994 (pRowInfo[ nLastCellInfoY + 1 ].nRowNo <= nLastRealDocRow) )
996 SCROW nLastDocRow = (nLastCellInfoY > 0) ? pRowInfo[ nLastCellInfoY ].nRowNo :
static_cast< SCROW >( nRow1 - 1 );
997 size_t nLastRow =
static_cast< size_t >( nLastCellInfoY );
1000 rArray.
SetMergedRange( nFirstCol, nFirstRow, nLastCol, nLastRow );
1005 if( nFirstCol == 0 )
1008 for(
SCCOL nDocCol = nFirstRealDocCol; nDocCol < nFirstDocCol; ++nDocCol )
1013 if( nLastCol + 1 == nColCount )
1016 for(
SCCOL nDocCol = nLastDocCol + 1; nDocCol <= nLastRealDocCol; ++nDocCol )
1021 if( nFirstRow == 0 )
1024 for(
SCROW nDocRow = nFirstRealDocRow; nDocRow < nFirstDocRow; ++nDocRow )
1029 if( nLastRow + 1 == nRowCount )
1032 for(
SCROW nDocRow = nLastDocRow + 1; nDocRow <= nLastRealDocRow; ++nDocRow )
1039 if( (nFirstRealDocCol != nCurrDocCol) || (nFirstRealDocRow != nCurrDocRow) )
1051 pTLBR = pBLTR =
nullptr;
1079 : mpRowInfo(new
RowInfo[capacity])
1081 , mnArrCapacity(capacity)
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 ...
@ DpCollapse
dp table output
@ DpExpand
dp compact layout collapse button
@ HiddenMember
dp button with popup arrow
@ Scenario
field button for datapilot
@ ButtonPopup2
dp compact layout expand button
bool Search(SCROW nRow, SCSIZE &nIndex) const
std::vector< ScAttrEntry > mvData
std::unique_ptr< ScAttrArray > pAttrArray
sc::CellStoreType maCells
SC_DLLPUBLIC SCCOL GetAllocatedColumnsCount(SCTAB nTab) const
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
bool ValidRow(SCROW nRow) const
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
SC_DLLPUBLIC SCCOL MaxCol() const
rtl::Reference< ScPoolHelper > mxPoolHelper
SC_DLLPUBLIC SCROW MaxRow() const
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)
sal_uInt16 GetSheetOptimalMinRowHeight(SCTAB nTab) const
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
bool ValidCol(SCCOL nCol) const
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
ScStyleSheet * GetPreviewCellStyle()
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
void FindMaxRotCol(SCTAB nTab, RowInfo *pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2) const
SC_DLLPUBLIC const SfxItemSet * GetCondResult(SCCOL nCol, SCROW nRow, SCTAB nTab, ScRefCellValue *pCell=nullptr) const
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
static SvxBrushItem * GetButtonBrushItem()
This is a rather odd datastructure.
std::vector< ScMarkEntry > mvData
bool Search(SCROW nRow, SCSIZE &nIndex) const
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
bool IsMultiMarked() const
ScMarkArray GetMarkArray(SCCOL nCol) const
SCCOL GetColMerge() const
SCROW GetRowMerge() const
void SetStyleSheet(ScStyleSheet *pNewStyle, bool bClearDirectFormat=true)
SfxItemSet & GetItemSet()
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
bool GetHideFormula() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual SfxItemSet & GetItemSet()
const editeng::SvxBorderLine * GetTop() const
const editeng::SvxBorderLine * GetRight() const
const editeng::SvxBorderLine * GetLeft() const
const editeng::SvxBorderLine * GetBottom() const
const editeng::SvxBorderLine * GetLine() const
SvxShadowLocation GetLocation() const
void SetAddMergedLeftSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
bool IsMerged(sal_Int32 nCol, sal_Int32 nRow) const
void SetMergedRange(sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow)
void SetCellStyleBottom(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetAddMergedBottomSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
void SetCellStyleTLBR(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetCellStyleLeft(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetCellStyleRight(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetAddMergedRightSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
void Initialize(sal_Int32 nWidth, sal_Int32 nHeight)
void SetAddMergedTopSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
void SetCellStyleBLTR(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetCellStyleTop(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
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)
const SCCOL SC_ROTMAX_NONE
constexpr sal_Int32 STD_COL_WIDTH
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
constexpr OUStringLiteral aData
CellStoreType::const_iterator ParseAllNonEmpty(const typename CellStoreType::const_iterator &itPos, const CellStoreType &rCells, SCROW nRow1, SCROW nRow2, Func &rFunc)
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
ScCellInfo & cellInfo(SCCOL nCol)
ScBasicCellInfo & basicCellInfo(SCCOL nCol)
void allocCellInfo(SCCOL startCol, SCCOL endCol)
const SvxShadowItem * pVShadowOrigin
const SfxItemSet * pConditionSet
const SvxShadowItem * pHShadowOrigin
ScShadowPart eVShadowPart
std::optional< Color > mxColorScale
const SvxShadowItem * pShadowAttr
original item from document.
const SvxLineItem * mpBLTRLine
original item from document.
const SvxBoxItem * pLinesAttr
const SvxLineItem * mpTLBRLine
original item from document.
const ScPatternAttr * pPatternAttr
ScShadowPart eHShadowPart
bool bPivotCollapseButton
bool bPivotPopupButtonMulti
const ScDataBarInfo * pDataBar
const SvxBrushItem * pBackground
const ScIconSetInfo * pIconSet
This is very similar to ScCellValue, except that it references the original value instead of copying ...
void addIconSetInfo(std::unique_ptr< const ScIconSetInfo > info)
ScTableInfo(const SCSIZE capacity=1024)
std::unique_ptr< RowInfo[]> mpRowInfo
void addDataBarInfo(std::unique_ptr< const ScDataBarInfo > info)
svx::frame::Array maArray