1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _PARALIST_HXX 25 #define _PARALIST_HXX 26 27 class Paragraph; 28 29 #include <tools/list.hxx> 30 #include <tools/link.hxx> 31 32 class ParagraphList : private List 33 { 34 private: 35 Link aVisibleStateChangedHdl; 36 37 public: 38 void Clear( sal_Bool bDestroyParagraphs ); 39 GetParagraphCount() const40 sal_uLong GetParagraphCount() const { return List::Count(); } GetParagraph(sal_uLong nPos) const41 Paragraph* GetParagraph( sal_uLong nPos ) const { return (Paragraph*)List::GetObject( nPos ); } 42 GetAbsPos(Paragraph * pParent) const43 sal_uLong GetAbsPos( Paragraph* pParent ) const { return List::GetPos( pParent ); } 44 sal_uLong GetVisPos( Paragraph* pParagraph ); 45 Insert(Paragraph * pPara,sal_uLong nAbsPos=LIST_APPEND)46 void Insert( Paragraph* pPara, sal_uLong nAbsPos = LIST_APPEND ) { List::Insert( pPara, nAbsPos ); } Remove(sal_uLong nPara)47 void Remove( sal_uLong nPara ) { List::Remove( nPara ); } 48 void MoveParagraphs( sal_uLong nStart, sal_uLong nDest, sal_uLong nCount ); 49 50 Paragraph* NextVisible( Paragraph* ) const; 51 Paragraph* PrevVisible( Paragraph* ) const; 52 Paragraph* LastVisible() const; 53 54 Paragraph* GetParent( Paragraph* pParagraph /*, sal_uInt16& rRelPos */ ) const; 55 sal_Bool HasChilds( Paragraph* pParagraph ) const; 56 sal_Bool HasHiddenChilds( Paragraph* pParagraph ) const; 57 sal_Bool HasVisibleChilds( Paragraph* pParagraph ) const; 58 sal_uLong GetChildCount( Paragraph* pParagraph ) const; 59 60 void Expand( Paragraph* pParent ); 61 void Collapse( Paragraph* pParent ); 62 SetVisibleStateChangedHdl(const Link & rLink)63 void SetVisibleStateChangedHdl( const Link& rLink ) { aVisibleStateChangedHdl = rLink; } GetVisibleStateChangedHdl() const64 Link GetVisibleStateChangedHdl() const { return aVisibleStateChangedHdl; } 65 }; 66 67 #endif 68