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 : Color maBackColor;
60 :
61 : private:
62 : void ClearChildren();
63 : void SetListPositions();
64 : void InvalidateChildrensListPositions();
65 :
66 : public:
67 : static const size_t ITEM_NOT_FOUND = SAL_MAX_SIZE;
68 :
69 : SvTreeListEntry();
70 : SvTreeListEntry(const SvTreeListEntry& r);
71 : virtual ~SvTreeListEntry();
72 :
73 : bool HasChildren() const;
74 : bool HasChildListPos() const;
75 : sal_uLong GetChildListPos() const;
76 :
77 0 : SvTreeListEntries& GetChildEntries() { return maChildren;}
78 0 : const SvTreeListEntries& GetChildEntries() const { return maChildren;}
79 :
80 : void Clone(SvTreeListEntry* pSource);
81 :
82 : size_t ItemCount() const;
83 :
84 : // DARF NUR GERUFEN WERDEN, WENN DER EINTRAG NOCH NICHT IM MODEL
85 : // EINGEFUEGT IST, DA SONST FUER DAS ITEM KEINE VIEW-ABHAENGIGEN
86 : // DATEN ALLOZIERT WERDEN!
87 : void AddItem( SvLBoxItem* pItem );
88 : void ReplaceItem( SvLBoxItem* pNewItem, size_t nPos );
89 : const SvLBoxItem* GetItem( size_t nPos ) const;
90 : SvLBoxItem* GetItem( size_t nPos );
91 : const SvLBoxItem* GetFirstItem( sal_uInt16 nId ) const;
92 : SvLBoxItem* GetFirstItem( sal_uInt16 nId );
93 : size_t GetPos( const SvLBoxItem* pItem ) const;
94 11712 : void* GetUserData() const { return pUserData;}
95 : void SetUserData( void* pPtr );
96 : void EnableChildrenOnDemand( bool bEnable=true );
97 : bool HasChildrenOnDemand() const;
98 : bool HasInUseEmphasis() const;
99 :
100 3588 : sal_uInt16 GetFlags() const { return nEntryFlags;}
101 : void SetFlags( sal_uInt16 nFlags );
102 :
103 : bool GetIsMarked() const { return bIsMarked; }
104 2 : void SetMarked( bool IsMarked ) { bIsMarked = IsMarked; }
105 :
106 0 : void SetBackColor( const Color& aColor ) { maBackColor = aColor; }
107 0 : Color GetBackColor() const { return maBackColor; }
108 : };
109 :
110 : #endif
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|