1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _PARALIST_HXX
29 #define _PARALIST_HXX
30 
31 class Paragraph;
32 
33 #include <tools/list.hxx>
34 #include <tools/link.hxx>
35 
36 class ParagraphList : private List
37 {
38 private:
39 	Link			aVisibleStateChangedHdl;
40 
41 public:
42 	void			Clear( sal_Bool bDestroyParagraphs );
43 
44 	sal_uLong			GetParagraphCount() const			{ return List::Count(); }
45 	Paragraph*		GetParagraph( sal_uLong nPos ) const 	{ return (Paragraph*)List::GetObject( nPos ); }
46 
47 	sal_uLong			GetAbsPos( Paragraph* pParent ) const { return List::GetPos( pParent ); }
48 	sal_uLong			GetVisPos( Paragraph* pParagraph );
49 
50 	void			Insert( Paragraph* pPara, sal_uLong nAbsPos = LIST_APPEND ) { List::Insert( pPara, nAbsPos ); }
51 	void			Remove( sal_uLong nPara ) { List::Remove( nPara ); }
52 	void 			MoveParagraphs( sal_uLong nStart, sal_uLong nDest, sal_uLong nCount );
53 
54 	Paragraph*		NextVisible( Paragraph* ) const;
55 	Paragraph*		PrevVisible( Paragraph* ) const;
56 	Paragraph*		LastVisible() const;
57 
58 	Paragraph*		GetParent( Paragraph* pParagraph /*, sal_uInt16& rRelPos */ ) const;
59 	sal_Bool			HasChilds( Paragraph* pParagraph ) const;
60 	sal_Bool			HasHiddenChilds( Paragraph* pParagraph ) const;
61 	sal_Bool			HasVisibleChilds( Paragraph* pParagraph ) const;
62 	sal_uLong			GetChildCount( Paragraph* pParagraph ) const;
63 
64 	void            Expand( Paragraph* pParent );
65 	void            Collapse( Paragraph* pParent );
66 
67 	void			SetVisibleStateChangedHdl( const Link& rLink ) { aVisibleStateChangedHdl = rLink; }
68 	Link			GetVisibleStateChangedHdl() const { return aVisibleStateChangedHdl; }
69 };
70 
71 #endif
72