1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_OUTLINETAB_HXX 25cdf0e10cSrcweir #define SC_OUTLINETAB_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "collect.hxx" 29cdf0e10cSrcweir #include "scdllapi.h" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #define SC_OL_MAXDEPTH 7 32cdf0e10cSrcweir 33cdf0e10cSrcweir class SvStream; 34cdf0e10cSrcweir class ScTable; 35cdf0e10cSrcweir 36cdf0e10cSrcweir 37cdf0e10cSrcweir class ScOutlineEntry : public ScDataObject 38cdf0e10cSrcweir { 39cdf0e10cSrcweir SCCOLROW nStart; 40cdf0e10cSrcweir SCSIZE nSize; 41cdf0e10cSrcweir bool bHidden; 42cdf0e10cSrcweir bool bVisible; 43cdf0e10cSrcweir 44cdf0e10cSrcweir public: 45cdf0e10cSrcweir ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize, 46cdf0e10cSrcweir bool bNewHidden = sal_False ); 47cdf0e10cSrcweir ScOutlineEntry( const ScOutlineEntry& rEntry ); 48cdf0e10cSrcweir 49cdf0e10cSrcweir virtual ScDataObject* Clone() const; 50cdf0e10cSrcweir GetStart() const51cdf0e10cSrcweir SCCOLROW GetStart() const { return nStart; } GetSize() const52cdf0e10cSrcweir SCSIZE GetSize() const { return nSize; } GetEnd() const53cdf0e10cSrcweir SCCOLROW GetEnd() const { return nStart+nSize-1; } IsHidden() const54cdf0e10cSrcweir bool IsHidden() const { return bHidden; } // Gruppe versteckt IsVisible() const55cdf0e10cSrcweir bool IsVisible() const { return bVisible; } // Control sichtbar? 56cdf0e10cSrcweir 57cdf0e10cSrcweir void Move( SCsCOLROW nDelta ); 58cdf0e10cSrcweir void SetSize( SCSIZE nNewSize ); 59cdf0e10cSrcweir void SetPosSize( SCCOLROW nNewPos, SCSIZE nNewSize ); 60cdf0e10cSrcweir void SetHidden( bool bNewHidden ); 61cdf0e10cSrcweir void SetVisible( bool bNewVisible ); 62cdf0e10cSrcweir }; 63cdf0e10cSrcweir 64cdf0e10cSrcweir 65cdf0e10cSrcweir class ScOutlineCollection : public ScSortedCollection 66cdf0e10cSrcweir { 67cdf0e10cSrcweir public: 68cdf0e10cSrcweir ScOutlineCollection(); 69cdf0e10cSrcweir 70cdf0e10cSrcweir virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; 71cdf0e10cSrcweir 72cdf0e10cSrcweir sal_uInt16 FindStart( SCCOLROW nMinStart ); 73cdf0e10cSrcweir }; 74cdf0e10cSrcweir 75cdf0e10cSrcweir 76cdf0e10cSrcweir class SC_DLLPUBLIC ScOutlineArray 77cdf0e10cSrcweir { 78cdf0e10cSrcweir friend class ScSubOutlineIterator; 79cdf0e10cSrcweir 80cdf0e10cSrcweir private: 81cdf0e10cSrcweir sal_uInt16 nDepth; 82cdf0e10cSrcweir ScOutlineCollection aCollections[SC_OL_MAXDEPTH]; 83cdf0e10cSrcweir 84cdf0e10cSrcweir sal_Bool DecDepth(); 85cdf0e10cSrcweir void FindEntry( SCCOLROW nSearchPos, sal_uInt16& rFindLevel, sal_uInt16& rFindIndex, 86cdf0e10cSrcweir sal_uInt16 nMaxLevel = SC_OL_MAXDEPTH ); 87cdf0e10cSrcweir void RemoveSub( SCCOLROW nStartPos, SCCOLROW nEndPos, sal_uInt16 nLevel ); 88cdf0e10cSrcweir void PromoteSub( SCCOLROW nStartPos, SCCOLROW nEndPos, sal_uInt16 nStartLevel ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir public: 91cdf0e10cSrcweir ScOutlineArray(); 92cdf0e10cSrcweir ScOutlineArray( const ScOutlineArray& rArray ); 93cdf0e10cSrcweir GetDepth() const94cdf0e10cSrcweir sal_uInt16 GetDepth() const { return nDepth; } 95cdf0e10cSrcweir 96cdf0e10cSrcweir sal_Bool FindTouchedLevel( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, 97cdf0e10cSrcweir sal_uInt16& rFindLevel ) const; 98cdf0e10cSrcweir 99cdf0e10cSrcweir sal_Bool Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, sal_Bool& rSizeChanged, 100cdf0e10cSrcweir sal_Bool bHidden = sal_False, sal_Bool bVisible = sal_True ); 101cdf0e10cSrcweir sal_Bool Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, sal_Bool& rSizeChanged ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir ScOutlineEntry* GetEntry( sal_uInt16 nLevel, sal_uInt16 nIndex ) const; 104cdf0e10cSrcweir sal_uInt16 GetCount( sal_uInt16 nLevel ) const; 105cdf0e10cSrcweir ScOutlineEntry* GetEntryByPos( sal_uInt16 nLevel, SCCOLROW nPos ) const; 106cdf0e10cSrcweir 107cdf0e10cSrcweir sal_Bool GetEntryIndex( sal_uInt16 nLevel, SCCOLROW nPos, sal_uInt16& rnIndex ) const; 108cdf0e10cSrcweir sal_Bool GetEntryIndexInRange( 109cdf0e10cSrcweir sal_uInt16 nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, 110cdf0e10cSrcweir sal_uInt16& rnIndex ) const; 111cdf0e10cSrcweir 112cdf0e10cSrcweir void SetVisibleBelow( sal_uInt16 nLevel, sal_uInt16 nEntry, sal_Bool bValue, 113cdf0e10cSrcweir sal_Bool bSkipHidden = sal_False ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir void GetRange( SCCOLROW& rStart, SCCOLROW& rEnd ) const; 116cdf0e10cSrcweir void ExtendBlock( sal_uInt16 nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir sal_Bool TestInsertSpace( SCSIZE nSize, SCCOLROW nMaxVal ) const; 119cdf0e10cSrcweir void InsertSpace( SCCOLROW nStartPos, SCSIZE nSize ); 120cdf0e10cSrcweir sal_Bool DeleteSpace( SCCOLROW nStartPos, SCSIZE nSize ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir bool ManualAction( SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, ScTable& rTable, bool bCol ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir void RemoveAll(); 125cdf0e10cSrcweir }; 126cdf0e10cSrcweir 127cdf0e10cSrcweir 128cdf0e10cSrcweir class ScOutlineTable 129cdf0e10cSrcweir { 130cdf0e10cSrcweir private: 131cdf0e10cSrcweir ScOutlineArray aColOutline; 132cdf0e10cSrcweir ScOutlineArray aRowOutline; 133cdf0e10cSrcweir 134cdf0e10cSrcweir public: 135cdf0e10cSrcweir ScOutlineTable(); 136cdf0e10cSrcweir ScOutlineTable( const ScOutlineTable& rOutline ); 137cdf0e10cSrcweir GetColArray() const138cdf0e10cSrcweir const ScOutlineArray* GetColArray() const { return &aColOutline; } GetColArray()139cdf0e10cSrcweir ScOutlineArray* GetColArray() { return &aColOutline; } GetRowArray() const140cdf0e10cSrcweir const ScOutlineArray* GetRowArray() const { return &aRowOutline; } GetRowArray()141cdf0e10cSrcweir ScOutlineArray* GetRowArray() { return &aRowOutline; } 142cdf0e10cSrcweir 143cdf0e10cSrcweir sal_Bool TestInsertCol( SCSIZE nSize ); 144cdf0e10cSrcweir void InsertCol( SCCOL nStartCol, SCSIZE nSize ); 145cdf0e10cSrcweir sal_Bool DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo nur ueber Original 146cdf0e10cSrcweir sal_Bool TestInsertRow( SCSIZE nSize ); 147cdf0e10cSrcweir void InsertRow( SCROW nStartRow, SCSIZE nSize ); 148cdf0e10cSrcweir sal_Bool DeleteRow( SCROW nStartRow, SCSIZE nSize ); 149cdf0e10cSrcweir }; 150cdf0e10cSrcweir 151cdf0e10cSrcweir 152cdf0e10cSrcweir class ScSubOutlineIterator 153cdf0e10cSrcweir { 154cdf0e10cSrcweir private: 155cdf0e10cSrcweir ScOutlineArray* pArray; 156cdf0e10cSrcweir SCCOLROW nStart; 157cdf0e10cSrcweir SCCOLROW nEnd; 158cdf0e10cSrcweir sal_uInt16 nSubLevel; 159cdf0e10cSrcweir sal_uInt16 nSubEntry; 160cdf0e10cSrcweir sal_uInt16 nCount; 161cdf0e10cSrcweir sal_uInt16 nDepth; 162cdf0e10cSrcweir 163cdf0e10cSrcweir public: 164cdf0e10cSrcweir ScSubOutlineIterator( ScOutlineArray* pOutlineArray ); 165cdf0e10cSrcweir ScSubOutlineIterator( ScOutlineArray* pOutlineArray, 166cdf0e10cSrcweir sal_uInt16 nLevel, sal_uInt16 nEntry ); 167cdf0e10cSrcweir ScOutlineEntry* GetNext(); 168cdf0e10cSrcweir sal_uInt16 LastLevel() const; 169cdf0e10cSrcweir sal_uInt16 LastEntry() const; 170cdf0e10cSrcweir void DeleteLast(); 171cdf0e10cSrcweir }; 172cdf0e10cSrcweir 173cdf0e10cSrcweir #endif 174cdf0e10cSrcweir 175cdf0e10cSrcweir 176