Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _PARALIST_HXX
21 : #define _PARALIST_HXX
22 :
23 : #include <vector>
24 :
25 : #include <tools/link.hxx>
26 :
27 : class Paragraph;
28 :
29 6107 : class ParagraphList
30 : {
31 : public:
32 : void Clear( sal_Bool bDestroyParagraphs );
33 :
34 151201 : sal_uInt32 GetParagraphCount() const
35 : {
36 151201 : return maEntries.size();
37 : }
38 :
39 639439 : Paragraph* GetParagraph( sal_uLong nPos ) const
40 : {
41 639439 : return nPos < maEntries.size() ? maEntries[nPos] : NULL;
42 : }
43 :
44 : sal_uLong GetAbsPos( Paragraph* pParent ) const;
45 :
46 : void Append( Paragraph *pPara);
47 : void Insert( Paragraph* pPara, sal_uLong nAbsPos);
48 : void Remove( sal_uLong nPara );
49 : void MoveParagraphs( sal_uLong nStart, sal_uLong nDest, sal_uLong nCount );
50 :
51 : Paragraph* GetParent( Paragraph* pParagraph /*, sal_uInt16& rRelPos */ ) const;
52 : sal_Bool HasChildren( Paragraph* pParagraph ) const;
53 : sal_Bool HasHiddenChildren( Paragraph* pParagraph ) const;
54 : sal_Bool HasVisibleChildren( Paragraph* pParagraph ) const;
55 : sal_uLong GetChildCount( Paragraph* pParagraph ) const;
56 :
57 : void Expand( Paragraph* pParent );
58 : void Collapse( Paragraph* pParent );
59 :
60 3250 : void SetVisibleStateChangedHdl( const Link& rLink ) { aVisibleStateChangedHdl = rLink; }
61 : Link GetVisibleStateChangedHdl() const { return aVisibleStateChangedHdl; }
62 :
63 : private:
64 :
65 : Link aVisibleStateChangedHdl;
66 : std::vector<Paragraph*> maEntries;
67 : };
68 :
69 : #endif
70 :
71 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|