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_SVTOOLS_TREELISTENTRY_HXX
21 : #define INCLUDED_SVTOOLS_TREELISTENTRY_HXX
22 :
23 : #include <svtools/svtdllapi.h>
24 : #include <tools/solar.h>
25 : #include <svtools/treelistbox.hxx>
26 : #include <svtools/treelistentries.hxx>
27 :
28 : #include <boost/ptr_container/ptr_vector.hpp>
29 :
30 : // Flags, die am Model haengen
31 : #define SV_ENTRYFLAG_CHILDREN_ON_DEMAND 0x0001
32 : #define SV_ENTRYFLAG_DISABLE_DROP 0x0002
33 : #define SV_ENTRYFLAG_IN_USE 0x0004
34 : // wird gesetzt, wenn RequestingChildren keine Children gestzt hat
35 : #define SV_ENTRYFLAG_NO_NODEBMP 0x0008
36 : // Eintrag hatte oder hat Kinder
37 : #define SV_ENTRYFLAG_HAD_CHILDREN 0x0010
38 :
39 : #define SV_ENTRYFLAG_USER_FLAGS 0xF000
40 : #define SV_ENTRYFLAG_SEMITRANSPARENT 0x8000 // draw semi-transparent entry bitmaps
41 :
42 :
43 : class SVT_DLLPUBLIC SvTreeListEntry
44 : {
45 : friend class SvTreeList;
46 : friend class SvListView;
47 : friend class SvTreeListBox;
48 :
49 : typedef boost::ptr_vector<SvLBoxItem> ItemsType;
50 :
51 : SvTreeListEntry* pParent;
52 : SvTreeListEntries maChildren;
53 : sal_uLong nAbsPos;
54 : sal_uLong nListPos;
55 : ItemsType maItems;
56 : bool bIsMarked;
57 : void* pUserData;
58 : sal_uInt16 nEntryFlags;
59 :
60 : private:
61 : void ClearChildren();
62 : void SetListPositions();
63 : void InvalidateChildrensListPositions();
64 :
65 : public:
66 : static const size_t ITEM_NOT_FOUND = SAL_MAX_SIZE;
67 :
68 : SvTreeListEntry();
69 : SvTreeListEntry(const SvTreeListEntry& r);
70 : virtual ~SvTreeListEntry();
71 :
72 : bool HasChildren() const;
73 : bool HasChildListPos() const;
74 : sal_uLong GetChildListPos() const;
75 :
76 : SvTreeListEntries& GetChildEntries();
77 : const SvTreeListEntries& GetChildEntries() const;
78 :
79 : void Clone(SvTreeListEntry* pSource);
80 :
81 : size_t ItemCount() const;
82 :
83 : // DARF NUR GERUFEN WERDEN, WENN DER EINTRAG NOCH NICHT IM MODEL
84 : // EINGEFUEGT IST, DA SONST FUER DAS ITEM KEINE VIEW-ABHAENGIGEN
85 : // DATEN ALLOZIERT WERDEN!
86 : void AddItem( SvLBoxItem* pItem );
87 : void ReplaceItem( SvLBoxItem* pNewItem, size_t nPos );
88 : const SvLBoxItem* GetItem( size_t nPos ) const;
89 : SvLBoxItem* GetItem( size_t nPos );
90 : const SvLBoxItem* GetFirstItem( sal_uInt16 nId ) const;
91 : SvLBoxItem* GetFirstItem( sal_uInt16 nId );
92 : size_t GetPos( const SvLBoxItem* pItem ) const;
93 : void* GetUserData() const;
94 : void SetUserData( void* pPtr );
95 : void EnableChildrenOnDemand( bool bEnable=true );
96 : bool HasChildrenOnDemand() const;
97 : bool HasInUseEmphasis() const;
98 :
99 : sal_uInt16 GetFlags() const;
100 : void SetFlags( sal_uInt16 nFlags );
101 :
102 : bool GetIsMarked() const { return bIsMarked; }
103 0 : void SetMarked( bool IsMarked ) { bIsMarked = IsMarked; }
104 : };
105 :
106 : #endif
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|