xref: /aoo4110/main/svtools/inc/svtools/roadmap.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVTOOLS_ROADMAP_HXX
24 #define _SVTOOLS_ROADMAP_HXX
25 
26 #include "svtools/svtdllapi.h"
27 #include <vcl/ctrl.hxx>
28 #include <vcl/imgctrl.hxx>
29 
30 #ifndef _SVTOOLS_HYPERLABEL_HXX
31 #include "svtools/hyperlabel.hxx"
32 #endif
33 
34 
35 
36 
37 class Bitmap;
38 //.........................................................................
39 namespace svt
40 {
41 //.........................................................................
42 
43     struct RoadmapTypes
44     {
45     public:
46         typedef sal_Int16 ItemId;
47         typedef sal_Int32 ItemIndex;
48     };
49 
50 	class RoadmapImpl;
51     class RoadmapItem;
52 
53 	//=====================================================================
54 	//= Roadmap
55 	//=====================================================================
56 	class SVT_DLLPUBLIC ORoadmap : public Control, public RoadmapTypes
57 	{
58 	protected:
59 		RoadmapImpl*	m_pImpl;
60 		// Window overridables
61 		void			Paint( const Rectangle& _rRect );
62         void            implInit();
63 
64 	public:
65 		ORoadmap( Window* _pParent, const ResId& _rId );
66 		ORoadmap( Window* _pParent, WinBits _nWinStyle = 0 );
67 		~ORoadmap( );
68 
69 		void			SetRoadmapBitmap( const BitmapEx& maBitmap, sal_Bool _bInvalidate = sal_True );
70         const BitmapEx&	GetRoadmapBitmap( ) const;
71 
72         void            EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex = 0  );
73         sal_Bool        IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex = 0 ) const;
74 
75         void            ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& sLabel, ItemIndex _nStartIndex = 0 );
76         ::rtl::OUString GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex = 0 );
77         void            ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex = 0  );
78 
79         void            SetRoadmapInteractive( sal_Bool _bInteractive );
80         sal_Bool        IsRoadmapInteractive();
81 
82         void            SetRoadmapComplete( sal_Bool _bComplete );
83         sal_Bool        IsRoadmapComplete() const;
84 
85         ItemIndex       GetItemCount() const;
86         ItemId          GetItemID( ItemIndex _nIndex ) const;
87         ItemIndex       GetItemIndex( ItemId _nID ) const;
88 
89         void            InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True );
90         void            ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled );
91         void            DeleteRoadmapItem( ItemIndex _nIndex );
92 
93         ItemId          GetCurrentRoadmapItemID() const;
94         sal_Bool        SelectRoadmapItemByID( ItemId _nItemID );
95 
96         void            SetItemSelectHdl( const Link& _rHdl );
97         Link            GetItemSelectHdl( ) const;
98 		virtual void	DataChanged( const DataChangedEvent& rDCEvt );
99         virtual void    GetFocus();
100 
101 
102     protected:
103         long       		PreNotify( NotifyEvent& rNEvt );
104 
105     protected:
106         /// called when an item has been selected by any means
107         virtual void    Select();
108 
109 	private:
110         DECL_LINK(ImplClickHdl, HyperLabel*);
111 
112         RoadmapItem*         GetByIndex( ItemIndex _nItemIndex );
113         const RoadmapItem*   GetByIndex( ItemIndex _nItemIndex ) const;
114 
115         RoadmapItem*         GetByID( ItemId _nID, ItemIndex _nStartIndex = 0  );
116         const RoadmapItem*   GetByID( ItemId _nID, ItemIndex _nStartIndex = 0  ) const;
117 		RoadmapItem*			GetPreviousHyperLabel( ItemIndex _Index);
118 
119         void						DrawHeadline();
120         void						DeselectOldRoadmapItems();
121         ItemId						GetNextAvailableItemId( ItemIndex _NewIndex );
122         ItemId						GetPreviousAvailableItemId( ItemIndex _NewIndex );
123         RoadmapItem*                GetByPointer(Window* pWindow);
124         RoadmapItem*                InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True  );
125         void						UpdatefollowingHyperLabels( ItemIndex _Index );
126 	};
127 
128 //.........................................................................
129 }	// namespace svt
130 //.........................................................................
131 
132 #endif
133 
134