24 #include <osl/diagnose.h>
29 bHidden ( bNewHidden ),
35 nStart ( rEntry.nStart ),
36 nSize ( rEntry.nSize ),
37 bHidden ( rEntry.bHidden ),
52 OSL_FAIL(
"OutlineEntry < 0");
64 OSL_FAIL(
"ScOutlineEntry Size == 0");
86 const char*
const pSep =
":";
87 return OString::number(
nStart) + pSep + OString::number(
nSize) +
106 m_Entries.insert(std::make_pair(nStart, rEntry));
147 const char*
const pGroupEntrySep =
",";
148 for (
const auto& rKeyValuePair :
m_Entries)
149 aOutput += rKeyValuePair.second.dumpAsString() + pGroupEntrySep;
158 nDepth( rArray.nDepth )
160 for (
size_t nLevel = 0; nLevel <
nDepth; ++nLevel)
163 for (
const auto& rEntry : rColl)
172 SCCOLROW nSearchPos,
size_t& rFindLevel,
size_t& rFindIndex,
175 rFindLevel = rFindIndex = 0;
180 for (
size_t nLevel = 0; nLevel < nMaxLevel; ++nLevel)
184 for (
auto& rEntry : *pCollect)
187 if (pEntry->
GetStart() <= nSearchPos && pEntry->
GetEnd() >= nSearchPos)
189 rFindLevel = nLevel + 1;
200 rSizeChanged =
false;
202 size_t nStartLevel, nEndLevel, nStartIndex, nEndIndex;
207 FindEntry( nStartCol, nStartLevel, nStartIndex );
208 FindEntry( nEndCol, nEndLevel, nEndIndex );
209 nFindMax = std::max(nStartLevel,nEndLevel);
214 if (nStartLevel == nEndLevel && nStartIndex == nEndIndex && nStartLevel <
SC_OL_MAXDEPTH)
217 if (!bFound && nFindMax>0)
223 std::advance(it, nStartIndex);
224 if (it->second.GetStart() == nStartCol)
225 FindEntry(nStartCol, nStartLevel, nStartIndex, nFindMax);
231 std::advance(it, nEndIndex);
232 if (it->second.GetEnd() == nEndCol)
233 FindEntry(nEndCol, nEndLevel, nEndIndex, nFindMax);
238 while ( !bFound && bCont );
243 size_t nLevel = nStartLevel;
246 bool bNeedSize =
false;
249 for (
size_t nMoveLevel =
nDepth-1; nMoveLevel >= nLevel; --nMoveLevel)
257 if (nEntryStart >= nStartCol && nEntryStart <= nEndCol)
261 rSizeChanged =
false;
265 size_t nPos = std::distance(rColl.
begin(), it);
268 std::advance(it, nPos);
270 if (nMoveLevel ==
nDepth - 1)
293 ScOutlineEntry aNewEntry(nStartCol, nEndCol+1-nStartCol, bHidden);
306 for (
size_t nLevel = 0; nLevel <
nDepth; ++nLevel)
309 for (
const auto& rEntry : *pCollect)
315 if ( ( nBlockStart>=nStart && nBlockStart<=nEnd ) ||
316 ( nBlockEnd >=nStart && nBlockEnd <=nEnd ) )
331 OSL_FAIL(
"PromoteSub with Level 0");
335 for (
size_t nLevel = nStartLevel; nLevel <
nDepth; ++nLevel)
344 if (nStart >= nStartPos && nEnd <= nEndPos)
349 size_t nPos = std::distance(rColl.
begin(), it);
352 std::advance(it, nPos);
367 if (nStart >= nStartPos && nEnd <= nEndPos)
372 size_t nPos = std::distance(rColl.
begin(), it);
375 std::advance(it, nPos);
389 bool bChanged =
false;
422 if (nBlockStart <= nEnd && nBlockEnd >= nStart)
427 itEnd = pCollect->
end();
448 if (nIndex >= rColl.
size())
452 std::advance(it, nIndex);
462 if (nIndex >= rColl.
size())
466 std::advance(it, nIndex);
485 [&nPos](
const auto& rEntry) {
489 if (it != rColl.
end())
503 [&nPos](
const auto& rEntry) {
507 if (it != rColl.
end())
509 rnIndex = std::distance(rColl.
begin(), it);
516 size_t nLevel,
SCCOLROW nBlockStart,
SCCOLROW nBlockEnd,
size_t& rnIndex)
const
524 [&nBlockStart, &nBlockEnd](
const auto& rEntry) {
528 if (it != rColl.
end())
530 rnIndex = std::distance(rColl.
begin(), it);
537 size_t nLevel,
size_t nEntry,
bool bValue,
bool bSkipHidden)
546 for (
size_t nSubLevel = nLevel+1; nSubLevel <
nDepth; ++nSubLevel)
550 for (
auto& rEntry : rColl)
575 rStart = it->second.GetStart();
576 std::advance(it, rColl.
size()-1);
577 rEnd = it->second.GetEnd();
589 for (
const auto& rEntry : rColl)
595 if (rBlkStart <= nEnd && rBlkEnd >= nStart)
597 if (nStart < rBlkStart)
612 std::advance(it, rColl.
size()-1);
613 SCCOLROW nEnd = it->second.GetEnd();
614 return sal::static_int_cast<
SCCOLROW>(nEnd+nSize) <= nMaxVal;
621 while ((pEntry = aIter.
GetNext()) !=
nullptr)
623 if ( pEntry->
GetStart() >= nStartPos )
624 pEntry->
Move(static_cast<SCCOLROW>(nSize));
630 if ( nEnd >= nStartPos || ( nEnd+1 >= nStartPos && !pEntry->
IsHidden() ) )
642 SCCOLROW nEndPos = nStartPos + nSize - 1;
643 bool bNeedSave =
false;
644 bool bChanged =
false;
648 while((pEntry=aIter.
GetNext())!=
nullptr)
654 if ( nEntryEnd >= nStartPos )
656 if ( nEntryStart > nEndPos )
657 pEntry->
Move(-static_cast<SCCOLROW>(nSize));
658 else if ( nEntryStart < nStartPos && nEntryEnd >= nEndPos )
659 pEntry->
SetSize( nEntrySize-nSize );
663 if ( nEntryStart >= nStartPos && nEntryEnd <= nEndPos )
668 else if ( nEntryStart >= nStartPos )
669 pEntry->
SetPosSize( nStartPos, static_cast<SCSIZE>(nEntryEnd-nEndPos) );
671 pEntry->
SetSize( static_cast<SCSIZE>(nStartPos-nEntryStart) );
685 bool bModified =
false;
688 while((pEntry=aIter.
GetNext())!=
nullptr)
693 if (nEntryEnd>=nStartPos && nEntryStart<=nEndPos)
700 bool bAllHidden = (nEntryEnd <= nEnd && nEnd <
701 ::std::numeric_limits<SCCOLROW>::max());
703 bool bToggle = ( bShow != bAllHidden );
718 for (
size_t nLevel = 0; nLevel <
nDepth; ++nLevel)
728 while((pEntry=aIter.
GetNext())!=
nullptr)
737 bool bAllHidden = (nEntryEnd <= nEnd && nEnd <
738 ::std::numeric_limits<SCCOLROW>::max());
748 const char*
const pLevelSep =
" ";
751 if (rCollection.empty())
753 aOutput += rCollection.dumpAsString() + pLevelSep;
764 aColOutline( rOutline.aColOutline ),
765 aRowOutline( rOutline.aRowOutline )
800 pArray( pOutlineArray ),
811 pArray( pOutlineArray )
815 std::advance(it, nEntry);
838 pEntry = &it->second;
860 OSL_FAIL(
"ScSubOutlineIterator::LastEntry before GetNext");
870 OSL_FAIL(
"ScSubOutlineIterator::DeleteLast after End");
875 OSL_FAIL(
"ScSubOutlineIterator::DeleteLast before GetNext");
void ExtendBlock(size_t nLevel, SCCOLROW &rBlkStart, SCCOLROW &rBlkEnd)
void InsertRow(SCROW nStartRow, SCSIZE nSize)
SC_DLLPUBLIC bool IsHidden() const
void Move(SCCOLROW nDelta)
const SCCOLROW SCCOLROW_MAX
bool TestInsertRow(SCSIZE nSize)
ScOutlineEntry(SCCOLROW nNewStart, SCCOLROW nNewSize, bool bNewHidden)
void FindEntry(SCCOLROW nSearchPos, size_t &rFindLevel, size_t &rFindIndex, size_t nMaxLevel=SC_OL_MAXDEPTH)
SC_DLLPUBLIC SCCOLROW GetEnd() const
OString dumpAsString() const
OString dumpAsString() const
ScOutlineEntry * GetEntry(size_t nLevel, size_t nIndex)
SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const
void SetSize(SCSIZE nNewSize)
void finalizeImport(const ScTable &rTable)
void erase(const iterator &pos)
const ScOutlineEntry * GetEntryByPos(size_t nLevel, SCCOLROW nPos) const
ScOutlineCollection aCollections[SC_OL_MAXDEPTH]
void SetVisible(bool bNewVisible)
bool GetEntryIndex(size_t nLevel, SCCOLROW nPos, size_t &rnIndex) const
bool DeleteSpace(SCCOLROW nStartPos, SCSIZE nSize)
bool TestInsertSpace(SCSIZE nSize, SCCOLROW nMaxVal) const
OString dumpAsString() const
bool GetEntryIndexInRange(size_t nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t &rnIndex) 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 ...
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
void InsertSpace(SCCOLROW nStartPos, SCSIZE nSize)
bool DecDepth()
Adapt nDepth for empty Levels.
void GetRange(SCCOLROW &rStart, SCCOLROW &rEnd) const
MapType::iterator iterator
void PromoteSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nStartLevel)
SC_DLLPUBLIC SCCOLROW GetStart() const
ScOutlineArray aColOutline
ScSubOutlineIterator(ScOutlineArray *pOutlineArray)
size_t GetCount(size_t nLevel) const
ScOutlineArray aRowOutline
void SetHidden(bool bNewHidden)
void SetVisibleBelow(size_t nLevel, size_t nEntry, bool bValue, bool bSkipHidden=false)
bool Remove(SCCOLROW nBlockStart, SCCOLROW nBlockEnd, bool &rSizeChanged)
bool DeleteCol(SCCOL nStartCol, SCSIZE nSize)
iterator FindStart(SCCOLROW nMinStart)
bool DeleteRow(SCROW nStartRow, SCSIZE nSize)
void insert(ScOutlineEntry const &rEntry)
ScOutlineEntry * GetNext()
void InsertCol(SCCOL nStartCol, SCSIZE nSize)
bool TestInsertCol(SCSIZE nSize)
void SetPosSize(SCCOLROW nNewPos, SCSIZE nNewSize)
bool ManualAction(SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, const ScTable &rTable, bool bCol)
MapType::const_iterator const_iterator
bool FindTouchedLevel(SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t &rFindLevel) const
bool Insert(SCCOLROW nStartPos, SCCOLROW nEndPos, bool &rSizeChanged, bool bHidden=false)