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;
231 if (rArrRow >= nMaxRow)
233 OSL_FAIL(
"FillInfo: Range too big" );
239 if (nSignedY == rYExtra)
247 for (
SCSIZE nArrRow = 0; nArrRow < nArrCount; ++nArrRow)
249 RowInfo& rThisRowInfo = pRowInfo[nArrRow];
259 for (
SCCOL nCol = nMinCol-1; nCol <= nRotMax+1; ++nCol)
269 for (
SCCOL nCol=nCol2+2; nCol<=nRotMax+1; nCol++)
275 sal_uInt16 nThisWidth =
static_cast<sal_uInt16
>(pDoc->
GetColWidth( nCol, nTab ) * fColScale);
287 const ScAddress& rAddr,
bool& bHidden,
bool& bHideFormula,
bool bTabProtect)
290 bool bAnyCondition =
false;
291 for(
const auto& rCondFormat : rCondFormats)
299 if (!
aData.aStyleName.isEmpty())
302 pStlPool->
Find(
aData.aStyleName, SfxStyleFamily::Para );
307 bAnyCondition =
true;
325 if(
aData.mxColorScale)
349 return bAnyCondition;
356 SCTAB nTab,
double fColScale,
double fRowScale,
bool bPageMode,
bool bFormulaMode,
359 OSL_ENSURE(
maTabs[nTab],
"Table does not exist" );
377 bool bAnyMerged =
false;
378 bool bAnyShadow =
false;
379 bool bAnyCondition =
false;
380 bool bAnyPreview =
false;
387 SCROW nYExtra = nRow2+1;
388 initRowInfo(
this, pRowInfo, rTabInfo.
mnArrCapacity, fRowScale, nRow1,
389 nTab, nYExtra, nArrRow, nRow2);
395 bool bAnyItem = isRotateItemUsed(pPool);
397 SCCOL nRotMax = nCol2;
403 OSL_ENSURE( nArrCount>2,
"nArrCount too small" );
404 FindMaxRotCol( nTab, &pRowInfo[1], nArrCount-1, nCol1, nCol2 );
407 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
408 if (pRowInfo[nArrRow].nRotMaxCol !=
SC_ROTMAX_NONE && pRowInfo[nArrRow].nRotMaxCol > nRotMax)
414 initCellInfo(pRowInfo, nArrCount, nCol1, nRotMax, pDefShadow);
416 initColWidths(pRowInfo,
this, fColScale, nTab, nCol2, nRotMax);
422 SCCOL nLastHiddenCheckedCol = -2;
423 bool bColHidden =
false;
424 for (
SCCOL nCol=-1; nCol<=nCol2+1; nCol++)
431 if (nCol > nLastHiddenCheckedCol)
432 bColHidden =
ColHidden(nCol, nTab,
nullptr, &nLastHiddenCheckedCol);
436 sal_uInt16 nColWidth =
GetColWidth( nCol, nTab,
false );
437 sal_uInt16 nThisWidth =
static_cast<sal_uInt16
>(std::clamp(nColWidth * fColScale, 1.0,
double(std::numeric_limits<sal_uInt16>::max())));
449 RowInfoFiller aFunc(*
this, nTab, pRowInfo, nCol, nArrRow, nCol1);
456 pThisAttrArr = &
maTabs[nTab]->aDefaultColData.AttrArray();
470 if ( pThisAttrArr->
Count() )
478 if ( pThisAttrArr->
Count() )
496 if (pShadowAttr != pDefShadow)
500 bool bMerged = ( pMergeAttr != pDefMerge && *pMergeAttr != *pDefMerge );
510 if (bMerged||bHOverlapped||bVOverlapped)
513 bool bHidden, bHideFormula;
521 bHidden = bHideFormula =
false;
524 bool bContainsCondFormat = !rCondFormats.
empty();
528 SCROW nLastHiddenRow = -1;
529 bool bRowHidden =
RowHidden(nCurRow, nTab,
nullptr, &nLastHiddenRow);
530 if ( nArrRow==0 || !bRowHidden )
534 RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
535 if (pBackground != pDefBackground)
537 if (bContainsCondFormat)
541 if (bPivotButton || bPivotPopupButton)
567 if (bContainsCondFormat && pCondFormList)
569 bAnyCondition |= handleConditionalFormat(*pCondFormList, rCondFormats,
570 pInfo, &rTabInfo, pStlPool,
ScAddress(nCol, nCurRow, nTab),
571 bHidden, bHideFormula, bTabProtect);
579 else if (nLastHiddenRow >= 0)
581 nCurRow = nLastHiddenRow;
582 if (nCurRow > nThisRow)
587 while (nCurRow <= nThisRow && nCurRow <= nYExtra);
590 while ( nIndex < pThisAttrArr->
Count() && nThisRow < nYExtra );
613 while (nCurRow <= nThisRow && nCurRow <= nRow2);
616 while (
nIndex < aThisMarkArr.
mvData.size() && nThisRow < nRow2 );
622 for (nArrRow=1; nArrRow+1<nArrCount; nArrRow++)
623 pRowInfo[nArrRow].basicCellInfo(nCol).nWidth = nThisWidth;
636 std::vector< std::unique_ptr<ScPatternAttr> > aAltPatterns;
638 if (bAnyCondition || bAnyPreview)
640 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
642 for (
SCCOL nCol=nCol1-1; nCol<=nCol2+1; nCol++)
651 aAltPatterns.push_back( std::make_unique<ScPatternAttr>( *pInfo->
pPatternAttr ) );
652 pModifiedPatt = aAltPatterns.back().get();
699 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
701 RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
702 SCROW nSignedY = nArrRow ? pThisRowInfo->
nRowNo : nRow1-1;
704 for (
SCCOL nCol=nCol1-1; nCol<=nCol2+1; nCol++)
715 nStartX,nStartY, nEndX,nEndY );
744 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
746 bool bTop = ( nArrRow == 0 );
747 bool bBottom = ( nArrRow+1 == nArrCount );
749 for (
SCCOL nCol=nCol1-1; nCol<=nCol2+1; nCol++)
751 bool bLeft = ( nCol == nCol1-1 );
752 bool bRight = ( nCol == nCol2+1 );
757 if (eLoc != SvxShadowLocation::NONE)
764 while ( nCol+nDxPos < nCol2+1 && pRowInfo[0].basicCellInfo(nCol+nDxPos).nWidth == 0 )
766 while ( nCol+nDxNeg > nCol1-1 && pRowInfo[0].basicCellInfo(nCol+nDxNeg).nWidth == 0 )
769 bool bLeftDiff = !bLeft &&
771 bool bRightDiff = !bRight &&
773 bool bTopDiff = !bTop &&
775 bool bBottomDiff = !bBottom &&
782 case SvxShadowLocation::BottomRight: eLoc = SvxShadowLocation::BottomLeft;
break;
783 case SvxShadowLocation::BottomLeft: eLoc = SvxShadowLocation::BottomRight;
break;
784 case SvxShadowLocation::TopRight: eLoc = SvxShadowLocation::TopLeft;
break;
785 case SvxShadowLocation::TopLeft: eLoc = SvxShadowLocation::TopRight;
break;
795 case SvxShadowLocation::BottomRight:
808 if (bBottomDiff && bRightDiff)
815 case SvxShadowLocation::BottomLeft:
828 if (bBottomDiff && bLeftDiff)
835 case SvxShadowLocation::TopRight:
848 if (bTopDiff && bRightDiff)
855 case SvxShadowLocation::TopLeft:
868 if (bTopDiff && bLeftDiff)
876 OSL_FAIL(
"wrong Shadow-Enum");
883 rTabInfo.
mnArrCount = sal::static_int_cast<sal_uInt16>(nArrCount);
892 size_t nColCount = nCol2 - nCol1 + 1 + 2;
893 size_t nRowCount = nArrCount;
898 for(
size_t nRow = 0; nRow < nRowCount; ++nRow )
900 sal_uInt16 nCellInfoY =
static_cast< sal_uInt16
>( nRow );
901 RowInfo& rThisRowInfo = pRowInfo[ nCellInfoY ];
903 for(
SCCOL nCol = nCol1 - 1; nCol <= nCol2 + 1; ++nCol )
910 size_t colToIndex = -(nCol1 - 1);
912 size_t nX = nCol + colToIndex;
913 size_t nFirstCol = nX;
914 size_t nFirstRow = nRow;
930 SCCOL nCurrDocCol = nCol;
931 SCROW nCurrDocRow =
static_cast< SCROW >( (nCellInfoY > 0) ? rThisRowInfo.
nRowNo : (nRow1 - 1) );
934 SCCOL nFirstRealDocColS, nLastRealDocColS;
935 SCROW nFirstRealDocRowS, nLastRealDocRowS;
937 nCellInfoY,
this, pRowInfo, nCol1,nRow1,nTab,
938 nFirstRealDocColS, nFirstRealDocRowS, nLastRealDocColS, nLastRealDocRowS );
941 SCCOL nFirstRealDocCol = nFirstRealDocColS;
942 SCROW nFirstRealDocRow = nFirstRealDocRowS;
943 SCCOL nLastRealDocCol = nLastRealDocColS;
944 SCROW nLastRealDocRow = nLastRealDocRowS;
947 SCCOL nFirstDocCol = (nCol1 > 0) ? ::std::max< SCCOL >( nFirstRealDocCol, nCol1 - 1 ) : nFirstRealDocCol;
948 nFirstCol = nFirstDocCol + colToIndex;
951 SCCOL nLastDocCol = (nCol2 < MaxCol()) ? ::std::min< SCCOL >( nLastRealDocCol, nCol2 + 1 ) : nLastRealDocCol;
952 size_t nLastCol = nLastDocCol + colToIndex;
955 sal_uInt16 nFirstCellInfoY = nCellInfoY;
956 while( ((nFirstCellInfoY > 1) && (pRowInfo[ nFirstCellInfoY - 1 ].nRowNo >= nFirstRealDocRow)) ||
957 ((nFirstCellInfoY == 1) && (
static_cast< SCROW >( nRow1 - 1 ) >= nFirstRealDocRow)) )
959 SCROW nFirstDocRow = (nFirstCellInfoY > 0) ? pRowInfo[ nFirstCellInfoY ].nRowNo :
static_cast< SCROW >( nRow1 - 1 );
960 nFirstRow =
static_cast< size_t >( nFirstCellInfoY );
963 sal_uInt16 nLastCellInfoY = nCellInfoY;
964 while( (sal::static_int_cast<SCSIZE>(nLastCellInfoY + 1) < nArrCount) &&
965 (pRowInfo[ nLastCellInfoY + 1 ].nRowNo <= nLastRealDocRow) )
967 SCROW nLastDocRow = (nLastCellInfoY > 0) ? pRowInfo[ nLastCellInfoY ].nRowNo :
static_cast< SCROW >( nRow1 - 1 );
968 size_t nLastRow =
static_cast< size_t >( nLastCellInfoY );
971 rArray.
SetMergedRange( nFirstCol, nFirstRow, nLastCol, nLastRow );
979 for(
SCCOL nDocCol = nFirstRealDocCol; nDocCol < nFirstDocCol; ++nDocCol )
984 if( nLastCol + 1 == nColCount )
987 for(
SCCOL nDocCol = nLastDocCol + 1; nDocCol <= nLastRealDocCol; ++nDocCol )
995 for(
SCROW nDocRow = nFirstRealDocRow; nDocRow < nFirstDocRow; ++nDocRow )
1000 if( nLastRow + 1 == nRowCount )
1003 for(
SCROW nDocRow = nLastDocRow + 1; nDocRow <= nLastRealDocRow; ++nDocRow )
1010 if( (nFirstRealDocCol != nCurrDocCol) || (nFirstRealDocRow != nCurrDocRow) )
1022 pTLBR = pBLTR =
nullptr;
1050 : mpRowInfo(new
RowInfo[capacity])
1052 , 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 ...
@ HiddenMember
dp button with popup arrow
@ Scenario
field button for datapilot
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)
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 SC_DLLPUBLIC sal_uInt16 nStdRowHeight
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) const
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
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