update dev300-m57
[ooovba.git] / svtools / inc / roadmap.hxx
blob036061d6f46f20c025d585f16385743f6bdfca2d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: roadmap.hxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVTOOLS_ROADMAP_HXX
31 #define _SVTOOLS_ROADMAP_HXX
33 #include "svtools/svtdllapi.h"
34 #include <vcl/ctrl.hxx>
35 #include <vcl/imgctrl.hxx>
37 #ifndef _SVTOOLS_HYPERLABEL_HXX
38 #include "svtools/hyperlabel.hxx"
39 #endif
44 class Bitmap;
45 //.........................................................................
46 namespace svt
48 //.........................................................................
50 struct RoadmapTypes
52 public:
53 typedef sal_Int16 ItemId;
54 typedef sal_Int32 ItemIndex;
58 class RoadmapImpl;
61 class ORoadmapIDHyperLabel : public FixedText
63 public:
64 ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId );
65 ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 );
66 ~ORoadmapIDHyperLabel( );
67 virtual void DataChanged( const DataChangedEvent& rDCEvt );
70 class ORoadmapHyperLabel : public RoadmapTypes
72 private:
73 ORoadmapIDHyperLabel* mpIDLabel;
74 HyperLabel* mpDescHyperLabel;
77 public:
79 ORoadmapHyperLabel( Window* _pParent, const ResId& _rId );
80 ORoadmapHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 );
81 ~ORoadmapHyperLabel( );
83 void SetID( sal_Int16 _ID );
84 sal_Int16 GetID() const;
86 void SetIndex( sal_Int32 _Index );
87 sal_Int32 GetIndex() const;
89 void SetLabel( ::rtl::OUString _rText );
90 ::rtl::OUString GetLabel( );
92 void SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& rNewSize);
94 void SetPosition( ORoadmapHyperLabel* OldHyperLabel );
95 Point GetLogicalPosition();
97 void ToggleBackgroundColor( const Color& _rGBColor );
98 void SetInteractive( sal_Bool _bInteractive );
100 void SetClickHdl( const Link& rLink );
101 const Link& GetClickHdl() const;
102 void SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags );
103 void Enable( BOOL bEnable = TRUE);
104 BOOL IsEnabled() const;
105 void GrabFocus();
107 void SetIDLabel(ORoadmapIDHyperLabel* _pIDLabel){mpIDLabel = _pIDLabel;};
108 ORoadmapIDHyperLabel* GetIDLabel() const { return mpIDLabel;};
110 HyperLabel* GetDescriptionHyperLabel() const { return mpDescHyperLabel;};
111 void SetDescriptionHyperLabel(HyperLabel* _pDescriptionHyperLabel){mpDescHyperLabel = _pDescriptionHyperLabel;};
116 //=====================================================================
117 //= Roadmap
118 //=====================================================================
119 class SVT_DLLPUBLIC ORoadmap : public Control, public RoadmapTypes
121 protected:
122 RoadmapImpl* m_pImpl;
123 // Window overridables
124 void Paint( const Rectangle& _rRect );
125 void implInit();
127 public:
128 ORoadmap( Window* _pParent, const ResId& _rId );
129 ORoadmap( Window* _pParent, WinBits _nWinStyle = 0 );
130 ~ORoadmap( );
132 void SetRoadmapBitmap( const BitmapEx& maBitmap, sal_Bool _bInvalidate = sal_True );
133 const BitmapEx& GetRoadmapBitmap( ) const;
135 void EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex = 0 );
136 sal_Bool IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex = 0 ) const;
138 void ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString sLabel, ItemIndex _nStartIndex = 0 );
139 ::rtl::OUString GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex = 0 );
140 void ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex = 0 );
142 void SetRoadmapInteractive( sal_Bool _bInteractive );
143 sal_Bool IsRoadmapInteractive();
145 void SetRoadmapComplete( sal_Bool _bComplete );
146 sal_Bool IsRoadmapComplete() const;
148 ItemIndex GetItemCount() const;
149 ItemId GetItemID( ItemIndex _nIndex ) const;
150 ItemIndex GetItemIndex( ItemId _nID ) const;
152 void InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True );
153 void ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled );
154 void DeleteRoadmapItem( ItemIndex _nIndex );
156 ItemId GetCurrentRoadmapItemID() const;
157 sal_Bool SelectRoadmapItemByID( ItemId _nItemID );
159 void SetItemSelectHdl( const Link& _rHdl );
160 Link GetItemSelectHdl( ) const;
161 virtual void DataChanged( const DataChangedEvent& rDCEvt );
162 virtual void GetFocus();
165 protected:
166 long PreNotify( NotifyEvent& rNEvt );
168 protected:
169 /// called when an item has been selected by any means
170 virtual void Select();
172 private:
173 DECL_LINK(ImplClickHdl, HyperLabel*);
175 ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex );
176 const ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex ) const;
178 ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 );
179 const ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const;
180 ORoadmapHyperLabel* GetPreviousHyperLabel( ItemIndex _Index);
182 void DrawHeadline();
183 void DeselectOldRoadmapItems();
184 ItemId GetNextAvailableItemId( ItemIndex _NewIndex );
185 ItemId GetPreviousAvailableItemId( ItemIndex _NewIndex );
186 ORoadmapHyperLabel* GetByPointer(Window* pWindow);
187 void InitializeHyperLabelSize();
188 ORoadmapHyperLabel* InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True );
189 void UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 _nadd = 1);
190 void SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription);
193 //.........................................................................
194 } // namespace svt
195 //.........................................................................
197 #endif