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