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 INCLUDED_EDITENG_SOURCE_OUTLINER_PARALIST_HXX
21 : #define INCLUDED_EDITENG_SOURCE_OUTLINER_PARALIST_HXX
22 :
23 : #include <sal/config.h>
24 : #include <sal/log.hxx>
25 :
26 : #include <vector>
27 :
28 : #include <tools/link.hxx>
29 :
30 : class Paragraph;
31 :
32 68200 : class ParagraphList
33 : {
34 : public:
35 : void Clear( bool bDestroyParagraphs );
36 :
37 2291266 : sal_Int32 GetParagraphCount() const
38 : {
39 2291266 : size_t nSize = maEntries.size();
40 2291266 : if (nSize > SAL_MAX_INT32)
41 : {
42 : SAL_WARN( "editeng", "ParagraphList::GetParagraphCount - overflow " << nSize);
43 0 : return SAL_MAX_INT32;
44 : }
45 2291266 : return nSize;
46 : }
47 :
48 8265691 : Paragraph* GetParagraph( sal_Int32 nPos ) const
49 : {
50 8265691 : return 0 <= nPos && static_cast<size_t>(nPos) < maEntries.size() ? maEntries[nPos] : NULL;
51 : }
52 :
53 : sal_Int32 GetAbsPos( Paragraph* pParent ) const;
54 :
55 : void Append( Paragraph *pPara);
56 : void Insert( Paragraph* pPara, sal_Int32 nAbsPos);
57 : void Remove( sal_Int32 nPara );
58 : void MoveParagraphs( sal_Int32 nStart, sal_Int32 nDest, sal_Int32 nCount );
59 :
60 : Paragraph* GetParent( Paragraph* pParagraph /*, sal_uInt16& rRelPos */ ) const;
61 : bool HasChildren( Paragraph* pParagraph ) const;
62 : bool HasHiddenChildren( Paragraph* pParagraph ) const;
63 : bool HasVisibleChildren( Paragraph* pParagraph ) const;
64 : sal_Int32 GetChildCount( Paragraph* pParagraph ) const;
65 :
66 : void Expand( Paragraph* pParent );
67 : void Collapse( Paragraph* pParent );
68 :
69 34284 : void SetVisibleStateChangedHdl( const Link& rLink ) { aVisibleStateChangedHdl = rLink; }
70 : Link GetVisibleStateChangedHdl() const { return aVisibleStateChangedHdl; }
71 :
72 : private:
73 :
74 : Link aVisibleStateChangedHdl;
75 : std::vector<Paragraph*> maEntries;
76 : };
77 :
78 : #endif
79 :
80 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|