1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include "olinetab.hxx"
24 #include "rechead.hxx"
25 #include "address.hxx"
28 //------------------------------------------------------------------------
30 ScOutlineEntry::ScOutlineEntry( SCCOLROW nNewStart
, SCCOLROW nNewSize
, bool bNewHidden
) :
33 bHidden ( bNewHidden
),
38 ScOutlineEntry::ScOutlineEntry( const ScOutlineEntry
& rEntry
) :
39 nStart ( rEntry
.nStart
),
40 nSize ( rEntry
.nSize
),
41 bHidden ( rEntry
.bHidden
),
42 bVisible( rEntry
.bVisible
)
46 SCCOLROW
ScOutlineEntry::GetStart() const
51 SCSIZE
ScOutlineEntry::GetSize() const
56 SCCOLROW
ScOutlineEntry::GetEnd() const
58 return nStart
+nSize
-1;
60 bool ScOutlineEntry::IsHidden() const
65 bool ScOutlineEntry::IsVisible() const
70 void ScOutlineEntry::Move( SCsCOLROW nDelta
)
72 SCCOLROW nNewPos
= nStart
+ nDelta
;
75 OSL_FAIL("OutlineEntry < 0");
81 void ScOutlineEntry::SetSize( SCSIZE nNewSize
)
87 OSL_FAIL("ScOutlineEntry Size == 0");
91 void ScOutlineEntry::SetPosSize( SCCOLROW nNewPos
, SCSIZE nNewSize
)
97 void ScOutlineEntry::SetHidden( bool bNewHidden
)
102 void ScOutlineEntry::SetVisible( bool bNewVisible
)
104 bVisible
= bNewVisible
;
107 //------------------------------------------------------------------------
109 ScOutlineCollection::ScOutlineCollection() {}
111 size_t ScOutlineCollection::size() const
113 return maEntries
.size();
116 void ScOutlineCollection::clear()
121 void ScOutlineCollection::insert(ScOutlineEntry
* pEntry
)
123 SCCOLROW nStart
= pEntry
->GetStart();
124 maEntries
.insert(nStart
, pEntry
);
127 ScOutlineCollection::iterator
ScOutlineCollection::begin()
129 return maEntries
.begin();
132 ScOutlineCollection::iterator
ScOutlineCollection::end()
134 return maEntries
.end();
137 ScOutlineCollection::const_iterator
ScOutlineCollection::begin() const
139 return maEntries
.begin();
142 ScOutlineCollection::const_iterator
ScOutlineCollection::end() const
144 return maEntries
.end();
147 void ScOutlineCollection::erase(iterator pos
)
149 maEntries
.erase(pos
);
152 bool ScOutlineCollection::empty() const
154 return maEntries
.empty();
157 ScOutlineCollection::iterator
ScOutlineCollection::FindStart(SCCOLROW nMinStart
)
159 return maEntries
.lower_bound(nMinStart
);
162 //------------------------------------------------------------------------
164 ScOutlineArray::ScOutlineArray() :
167 ScOutlineArray::ScOutlineArray( const ScOutlineArray
& rArray
) :
168 nDepth( rArray
.nDepth
)
170 for (size_t nLevel
= 0; nLevel
< nDepth
; ++nLevel
)
172 const ScOutlineCollection
& rColl
= rArray
.aCollections
[nLevel
];
173 ScOutlineCollection::const_iterator it
= rColl
.begin(), itEnd
= rColl
.end();
174 for (; it
!= itEnd
; ++it
)
176 const ScOutlineEntry
* pEntry
= it
->second
;
177 aCollections
[nLevel
].insert(new ScOutlineEntry(*pEntry
));
182 void ScOutlineArray::FindEntry(
183 SCCOLROW nSearchPos
, size_t& rFindLevel
, size_t& rFindIndex
,
186 rFindLevel
= rFindIndex
= 0;
188 if (nMaxLevel
> nDepth
)
191 for (size_t nLevel
= 0; nLevel
< nMaxLevel
; ++nLevel
) //! rueckwaerts suchen ?
193 ScOutlineCollection
* pCollect
= &aCollections
[nLevel
];
194 ScOutlineCollection::iterator it
= pCollect
->begin(), itEnd
= pCollect
->end();
195 for (; it
!= itEnd
; ++it
)
197 ScOutlineEntry
* pEntry
= it
->second
;
198 if (pEntry
->GetStart() <= nSearchPos
&& pEntry
->GetEnd() >= nSearchPos
)
200 rFindLevel
= nLevel
+ 1; // naechster Level (zum Einfuegen)
201 rFindIndex
= std::distance(pCollect
->begin(), it
);
207 bool ScOutlineArray::Insert(
208 SCCOLROW nStartCol
, SCCOLROW nEndCol
, bool& rSizeChanged
, bool bHidden
, bool bVisible
)
210 rSizeChanged
= false;
212 size_t nStartLevel
, nEndLevel
, nStartIndex
, nEndIndex
;
217 FindEntry( nStartCol
, nStartLevel
, nStartIndex
); // nLevel = neuer Level (alter+1) !!!
218 FindEntry( nEndCol
, nEndLevel
, nEndIndex
);
219 nFindMax
= std::max(nStartLevel
,nEndLevel
);
224 if (nStartLevel
== nEndLevel
&& nStartIndex
== nEndIndex
&& nStartLevel
< SC_OL_MAXDEPTH
)
234 ScOutlineCollection::const_iterator it
= aCollections
[nStartLevel
-1].begin();
235 std::advance(it
, nStartIndex
);
236 if (it
->second
->GetStart() == nStartCol
)
237 FindEntry(nStartCol
, nStartLevel
, nStartIndex
, nFindMax
);
242 ScOutlineCollection::const_iterator it
= aCollections
[nEndLevel
-1].begin();
243 std::advance(it
, nEndIndex
);
244 if (it
->second
->GetEnd() == nEndCol
)
245 FindEntry(nEndCol
, nEndLevel
, nEndIndex
, nFindMax
);
251 while ( !bFound
&& bCont
);
256 size_t nLevel
= nStartLevel
;
258 // untere verschieben
260 bool bNeedSize
= false;
263 for (size_t nMoveLevel
= nDepth
-1; nMoveLevel
>= nLevel
; --nMoveLevel
)
265 ScOutlineCollection
& rColl
= aCollections
[nMoveLevel
];
266 ScOutlineCollection::iterator it
= rColl
.begin(), itEnd
= rColl
.end();
269 ScOutlineEntry
* pEntry
= it
->second
;
270 SCCOLROW nEntryStart
= pEntry
->GetStart();
271 if (nEntryStart
>= nStartCol
&& nEntryStart
<= nEndCol
)
273 if (nMoveLevel
>= SC_OL_MAXDEPTH
- 1)
275 rSizeChanged
= false; // kein Platz
278 aCollections
[nMoveLevel
+1].insert(new ScOutlineEntry(*pEntry
));
279 size_t nPos
= std::distance(rColl
.begin(), it
);
282 std::advance(it
, nPos
);
284 if (nMoveLevel
== nDepth
- 1)
301 if (nDepth
<= nLevel
)
307 ScOutlineEntry
* pNewEntry
= new ScOutlineEntry( nStartCol
, nEndCol
+1-nStartCol
, bHidden
);
308 pNewEntry
->SetVisible( bVisible
);
309 aCollections
[nLevel
].insert(pNewEntry
);
314 size_t ScOutlineArray::GetDepth() const
319 bool ScOutlineArray::FindTouchedLevel(
320 SCCOLROW nBlockStart
, SCCOLROW nBlockEnd
, size_t& rFindLevel
) const
325 for (size_t nLevel
= 0; nLevel
< nDepth
; ++nLevel
)
327 const ScOutlineCollection
* pCollect
= &aCollections
[nLevel
];
328 ScOutlineCollection::const_iterator it
= pCollect
->begin(), itEnd
= pCollect
->end();
329 for (; it
!= itEnd
; ++it
)
331 const ScOutlineEntry
* pEntry
= it
->second
;
332 SCCOLROW nStart
= pEntry
->GetStart();
333 SCCOLROW nEnd
= pEntry
->GetEnd();
335 if ( ( nBlockStart
>=nStart
&& nBlockStart
<=nEnd
) ||
336 ( nBlockEnd
>=nStart
&& nBlockEnd
<=nEnd
) )
338 rFindLevel
= nLevel
; // wirklicher Level
347 void ScOutlineArray::RemoveSub(SCCOLROW nStartPos
, SCCOLROW nEndPos
, size_t nLevel
)
349 if ( nLevel
>= nDepth
)
352 ScOutlineCollection
& rColl
= aCollections
[nLevel
];
354 ScOutlineCollection::iterator it
= rColl
.begin(), itEnd
= rColl
.end();
357 ScOutlineEntry
* pEntry
= it
->second
;
358 SCCOLROW nStart
= pEntry
->GetStart();
359 SCCOLROW nEnd
= pEntry
->GetEnd();
360 if (nStart
>= nStartPos
&& nEnd
<= nEndPos
)
363 RemoveSub( nStart
, nEnd
, nLevel
+1 );
365 // Re-calc iterator positions after the tree gets invalidated.
366 size_t nPos
= std::distance(rColl
.begin(), it
);
369 std::advance(it
, nPos
);
381 ScOutlineEntry
* pEntry
= it
->second
;
382 SCCOLROW nStart
= pEntry
->GetStart();
383 SCCOLROW nEnd
= pEntry
->GetEnd();
385 if (nStart
>= nStartPos
&& nEnd
<= nEndPos
)
387 RemoveSub( nStart
, nEnd
, nLevel
+1 );
389 // Re-calc iterator positions after the tree gets invalidated.
390 size_t nPos
= std::distance(rColl
.begin(), it
);
393 std::advance(it
, nPos
);
401 void ScOutlineArray::PromoteSub(SCCOLROW nStartPos
, SCCOLROW nEndPos
, size_t nStartLevel
)
405 OSL_FAIL("PromoteSub mit Level 0");
409 for (size_t nLevel
= nStartLevel
; nLevel
< nDepth
; ++nLevel
)
411 ScOutlineCollection
& rColl
= aCollections
[nLevel
];
412 ScOutlineCollection::iterator it
= rColl
.begin(), itEnd
= rColl
.end();
415 ScOutlineEntry
* pEntry
= it
->second
;
416 SCCOLROW nStart
= pEntry
->GetStart();
417 SCCOLROW nEnd
= pEntry
->GetEnd();
418 if (nStart
>= nStartPos
&& nEnd
<= nEndPos
)
420 aCollections
[nLevel
-1].insert(new ScOutlineEntry(*pEntry
));
422 // Re-calc iterator positions after the tree gets invalidated.
423 size_t nPos
= std::distance(rColl
.begin(), it
);
426 std::advance(it
, nPos
);
438 ScOutlineEntry
* pEntry
= it
->second
;
439 SCCOLROW nStart
= pEntry
->GetStart();
440 SCCOLROW nEnd
= pEntry
->GetEnd();
441 if (nStart
>= nStartPos
&& nEnd
<= nEndPos
)
443 aCollections
[nLevel
-1].insert(new ScOutlineEntry(*pEntry
));
445 // Re-calc iterator positions after the tree gets invalidated.
446 size_t nPos
= std::distance(rColl
.begin(), it
);
449 std::advance(it
, nPos
);
458 bool ScOutlineArray::DecDepth() // nDepth auf leere Levels anpassen
460 bool bChanged
= false;
467 if (aCollections
[nDepth
-1].empty())
480 bool ScOutlineArray::Remove( SCCOLROW nBlockStart
, SCCOLROW nBlockEnd
, bool& rSizeChanged
)
483 FindTouchedLevel( nBlockStart
, nBlockEnd
, nLevel
);
485 ScOutlineCollection
* pCollect
= &aCollections
[nLevel
];
486 ScOutlineCollection::iterator it
= pCollect
->begin(), itEnd
= pCollect
->end();
490 ScOutlineEntry
* pEntry
= it
->second
;
491 SCCOLROW nStart
= pEntry
->GetStart();
492 SCCOLROW nEnd
= pEntry
->GetEnd();
493 if (nBlockStart
<= nEnd
&& nBlockEnd
>= nStart
)
497 PromoteSub( nStart
, nEnd
, nLevel
+1 );
498 itEnd
= pCollect
->end();
499 it
= pCollect
->FindStart( nEnd
+1 );
506 if (bAny
) // Depth anpassen
513 ScOutlineEntry
* ScOutlineArray::GetEntry(size_t nLevel
, size_t nIndex
)
515 if (nLevel
>= nDepth
)
518 ScOutlineCollection
& rColl
= aCollections
[nLevel
];
519 if (nIndex
>= rColl
.size())
522 ScOutlineCollection::iterator it
= rColl
.begin();
523 std::advance(it
, nIndex
);
527 const ScOutlineEntry
* ScOutlineArray::GetEntry(size_t nLevel
, size_t nIndex
) const
529 if (nLevel
>= nDepth
)
532 const ScOutlineCollection
& rColl
= aCollections
[nLevel
];
533 if (nIndex
>= rColl
.size())
536 ScOutlineCollection::const_iterator it
= rColl
.begin();
537 std::advance(it
, nIndex
);
541 size_t ScOutlineArray::GetCount(size_t nLevel
) const
543 if (nLevel
>= nDepth
)
546 return aCollections
[nLevel
].size();
549 const ScOutlineEntry
* ScOutlineArray::GetEntryByPos(size_t nLevel
, SCCOLROW nPos
) const
551 if (nLevel
>= nDepth
)
554 const ScOutlineCollection
& rColl
= aCollections
[nLevel
];
555 ScOutlineCollection::const_iterator it
= rColl
.begin(), itEnd
= rColl
.end();
556 for (; it
!= itEnd
; ++it
)
558 const ScOutlineEntry
* pEntry
= it
->second
;
559 if (pEntry
->GetStart() <= nPos
&& nPos
<= pEntry
->GetEnd())
566 bool ScOutlineArray::GetEntryIndex(size_t nLevel
, SCCOLROW nPos
, size_t& rnIndex
) const
568 if (nLevel
>= nDepth
)
571 // found entry contains passed position
572 const ScOutlineCollection
& rColl
= aCollections
[nLevel
];
573 ScOutlineCollection::const_iterator it
= rColl
.begin(), itEnd
= rColl
.end();
574 for (; it
!= itEnd
; ++it
)
576 const ScOutlineEntry
* p
= it
->second
;
577 if (p
->GetStart() <= nPos
&& nPos
<= p
->GetEnd())
579 rnIndex
= std::distance(rColl
.begin(), it
);
586 bool ScOutlineArray::GetEntryIndexInRange(
587 size_t nLevel
, SCCOLROW nBlockStart
, SCCOLROW nBlockEnd
, size_t& rnIndex
) const
589 if (nLevel
>= nDepth
)
592 // found entry will be completely inside of passed range
593 const ScOutlineCollection
& rColl
= aCollections
[nLevel
];
594 ScOutlineCollection::const_iterator it
= rColl
.begin(), itEnd
= rColl
.end();
595 for (; it
!= itEnd
; ++it
)
597 const ScOutlineEntry
* p
= it
->second
;
598 if (nBlockStart
<= p
->GetStart() && p
->GetEnd() <= nBlockEnd
)
600 rnIndex
= std::distance(rColl
.begin(), it
);
607 void ScOutlineArray::SetVisibleBelow(
608 size_t nLevel
, size_t nEntry
, bool bValue
, bool bSkipHidden
)
610 const ScOutlineEntry
* pEntry
= GetEntry( nLevel
, nEntry
);
614 SCCOLROW nStart
= pEntry
->GetStart();
615 SCCOLROW nEnd
= pEntry
->GetEnd();
617 for (size_t nSubLevel
= nLevel
+1; nSubLevel
< nDepth
; ++nSubLevel
)
619 ScOutlineCollection
& rColl
= aCollections
[nSubLevel
];
620 ScOutlineCollection::iterator it
= rColl
.begin(), itEnd
= rColl
.end();
621 for (; it
!= itEnd
; ++it
)
623 ScOutlineEntry
* p
= it
->second
;
624 if (p
->GetStart() >= nStart
&& p
->GetEnd() <= nEnd
)
626 p
->SetVisible(bValue
);
627 if (bSkipHidden
&& !p
->IsHidden())
629 size_t nPos
= std::distance(rColl
.begin(), it
);
630 SetVisibleBelow(nSubLevel
, nPos
, bValue
, true);
636 nSubLevel
= nDepth
; // Abbruch
640 void ScOutlineArray::GetRange(SCCOLROW
& rStart
, SCCOLROW
& rEnd
) const
642 const ScOutlineCollection
& rColl
= aCollections
[0];
645 ScOutlineCollection::const_iterator it
= rColl
.begin();
646 rStart
= it
->second
->GetStart();
647 std::advance(it
, rColl
.size()-1);
648 rEnd
= it
->second
->GetEnd();
654 void ScOutlineArray::ExtendBlock(size_t nLevel
, SCCOLROW
& rBlkStart
, SCCOLROW
& rBlkEnd
)
656 if (nLevel
>= nDepth
)
659 const ScOutlineCollection
& rColl
= aCollections
[nLevel
];
660 ScOutlineCollection::const_iterator it
= rColl
.begin(), itEnd
= rColl
.end();
661 for (; it
!= itEnd
; ++it
)
663 const ScOutlineEntry
* pEntry
= it
->second
;
664 SCCOLROW nStart
= pEntry
->GetStart();
665 SCCOLROW nEnd
= pEntry
->GetEnd();
667 if (rBlkStart
<= nEnd
&& rBlkEnd
>= nStart
)
669 if (nStart
< rBlkStart
)
677 bool ScOutlineArray::TestInsertSpace(SCSIZE nSize
, SCCOLROW nMaxVal
) const
679 const ScOutlineCollection
& rColl
= aCollections
[0];
683 ScOutlineCollection::const_iterator it
= rColl
.begin();
684 std::advance(it
, rColl
.size()-1);
685 SCCOLROW nEnd
= it
->second
->GetEnd();
686 return sal::static_int_cast
<SCCOLROW
>(nEnd
+nSize
) <= nMaxVal
;
689 void ScOutlineArray::InsertSpace(SCCOLROW nStartPos
, SCSIZE nSize
)
691 ScSubOutlineIterator
aIter( this );
692 ScOutlineEntry
* pEntry
;
693 while ((pEntry
= aIter
.GetNext()) != NULL
)
695 if ( pEntry
->GetStart() >= nStartPos
)
696 pEntry
->Move(static_cast<SCsCOLROW
>(nSize
));
699 SCCOLROW nEnd
= pEntry
->GetEnd();
700 // immer erweitern, wenn innerhalb der Gruppe eingefuegt
701 // beim Einfuegen am Ende nur, wenn die Gruppe nicht ausgeblendet ist
702 if ( nEnd
>= nStartPos
|| ( nEnd
+1 >= nStartPos
&& !pEntry
->IsHidden() ) )
704 SCSIZE nEntrySize
= pEntry
->GetSize();
706 pEntry
->SetSize( nEntrySize
);
712 bool ScOutlineArray::DeleteSpace(SCCOLROW nStartPos
, SCSIZE nSize
)
714 SCCOLROW nEndPos
= nStartPos
+ nSize
- 1;
715 sal_Bool bNeedSave
= false; // Original fuer Undo benoetigt?
716 sal_Bool bChanged
= false; // fuer Test auf Level
718 ScSubOutlineIterator
aIter( this );
719 ScOutlineEntry
* pEntry
;
720 while((pEntry
=aIter
.GetNext())!=NULL
)
722 SCCOLROW nEntryStart
= pEntry
->GetStart();
723 SCCOLROW nEntryEnd
= pEntry
->GetEnd();
724 SCSIZE nEntrySize
= pEntry
->GetSize();
726 if ( nEntryEnd
>= nStartPos
)
728 if ( nEntryStart
> nEndPos
) // rechts
729 pEntry
->Move(-(static_cast<SCsCOLROW
>(nSize
)));
730 else if ( nEntryStart
< nStartPos
&& nEntryEnd
>= nEndPos
) // aussen
731 pEntry
->SetSize( nEntrySize
-nSize
);
735 if ( nEntryStart
>= nStartPos
&& nEntryEnd
<= nEndPos
) // innen
740 else if ( nEntryStart
>= nStartPos
) // rechts ueber
741 pEntry
->SetPosSize( nStartPos
, static_cast<SCSIZE
>(nEntryEnd
-nEndPos
) );
743 pEntry
->SetSize( static_cast<SCSIZE
>(nStartPos
-nEntryStart
) );
754 bool ScOutlineArray::ManualAction(
755 SCCOLROW nStartPos
, SCCOLROW nEndPos
, bool bShow
, const ScTable
& rTable
, bool bCol
)
757 bool bModified
= false;
758 ScSubOutlineIterator
aIter( this );
759 ScOutlineEntry
* pEntry
;
760 while((pEntry
=aIter
.GetNext())!=NULL
)
762 SCCOLROW nEntryStart
= pEntry
->GetStart();
763 SCCOLROW nEntryEnd
= pEntry
->GetEnd();
765 if (nEntryEnd
>=nStartPos
&& nEntryStart
<=nEndPos
)
767 if ( pEntry
->IsHidden() == bShow
)
769 // #i12341# hide if all columns/rows are hidden, show if at least one
771 SCCOLROW nEnd
= rTable
.LastHiddenColRow(nEntryStart
, bCol
);
772 bool bAllHidden
= (nEntryEnd
<= nEnd
&& nEnd
<
773 ::std::numeric_limits
<SCCOLROW
>::max());
775 bool bToggle
= ( bShow
!= bAllHidden
);
778 pEntry
->SetHidden( !bShow
);
779 SetVisibleBelow( aIter
.LastLevel(), aIter
.LastEntry(), bShow
, bShow
);
788 void ScOutlineArray::RemoveAll()
790 for (size_t nLevel
= 0; nLevel
< nDepth
; ++nLevel
)
791 aCollections
[nLevel
].clear();
796 //------------------------------------------------------------------------
798 ScOutlineTable::ScOutlineTable()
802 ScOutlineTable::ScOutlineTable( const ScOutlineTable
& rOutline
) :
803 aColOutline( rOutline
.aColOutline
),
804 aRowOutline( rOutline
.aRowOutline
)
808 sal_Bool
ScOutlineTable::TestInsertCol( SCSIZE nSize
)
810 return aColOutline
.TestInsertSpace( nSize
, MAXCOL
);
813 void ScOutlineTable::InsertCol( SCCOL nStartCol
, SCSIZE nSize
)
815 aColOutline
.InsertSpace( nStartCol
, nSize
);
818 sal_Bool
ScOutlineTable::DeleteCol( SCCOL nStartCol
, SCSIZE nSize
)
820 return aColOutline
.DeleteSpace( nStartCol
, nSize
);
823 sal_Bool
ScOutlineTable::TestInsertRow( SCSIZE nSize
)
825 return aRowOutline
.TestInsertSpace( nSize
, MAXROW
);
828 void ScOutlineTable::InsertRow( SCROW nStartRow
, SCSIZE nSize
)
830 aRowOutline
.InsertSpace( nStartRow
, nSize
);
833 sal_Bool
ScOutlineTable::DeleteRow( SCROW nStartRow
, SCSIZE nSize
)
835 return aRowOutline
.DeleteSpace( nStartRow
, nSize
);
838 //------------------------------------------------------------------------
840 ScSubOutlineIterator::ScSubOutlineIterator( ScOutlineArray
* pOutlineArray
) :
841 pArray( pOutlineArray
),
843 nEnd( SCCOLROW_MAX
), // alle durchgehen
847 nDepth
= pArray
->nDepth
;
850 ScSubOutlineIterator::ScSubOutlineIterator(
851 ScOutlineArray
* pOutlineArray
, size_t nLevel
, size_t nEntry
) :
852 pArray( pOutlineArray
)
854 const ScOutlineCollection
& rColl
= pArray
->aCollections
[nLevel
];
855 ScOutlineCollection::const_iterator it
= rColl
.begin();
856 std::advance(it
, nEntry
);
857 const ScOutlineEntry
* pEntry
= it
->second
;
858 nStart
= pEntry
->GetStart();
859 nEnd
= pEntry
->GetEnd();
860 nSubLevel
= nLevel
+ 1;
862 nDepth
= pArray
->nDepth
;
865 ScOutlineEntry
* ScSubOutlineIterator::GetNext()
867 ScOutlineEntry
* pEntry
= NULL
;
871 if (nSubLevel
>= nDepth
)
874 ScOutlineCollection
& rColl
= pArray
->aCollections
[nSubLevel
];
875 if (nSubEntry
< rColl
.size())
877 ScOutlineCollection::iterator it
= rColl
.begin();
878 std::advance(it
, nSubEntry
);
881 if (pEntry
->GetStart() >= nStart
&& pEntry
->GetEnd() <= nEnd
)
888 // Go to the next sub-level.
894 return pEntry
; // nSubLevel gueltig, wenn pEntry != 0
897 size_t ScSubOutlineIterator::LastLevel() const
902 size_t ScSubOutlineIterator::LastEntry() const
906 OSL_FAIL("ScSubOutlineIterator::LastEntry before GetNext");
912 void ScSubOutlineIterator::DeleteLast()
914 if (nSubLevel
>= nDepth
)
916 OSL_FAIL("ScSubOutlineIterator::DeleteLast after End");
921 OSL_FAIL("ScSubOutlineIterator::DeleteLast before GetNext");
926 ScOutlineCollection
& rColl
= pArray
->aCollections
[nSubLevel
];
927 OSL_ASSERT(nSubEntry
< rColl
.size());
928 ScOutlineCollection::iterator it
= rColl
.begin();
929 std::advance(it
, nSubEntry
);
934 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */