xref: /aoo41x/main/sd/source/ui/inc/navigatr.hxx (revision 67e470da)
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 
24 #ifndef SD_NAVIGATOR_HXX
25 #define SD_NAVIGATOR_HXX
26 
27 #include <vcl/window.hxx>
28 #include <vcl/lstbox.hxx>
29 #ifndef _TOOLBOX_HXX //autogen
30 #include <vcl/toolbox.hxx>
31 #endif
32 #include <sfx2/ctrlitem.hxx>
33 #include "sdtreelb.hxx"
34 #include "pres.hxx"
35 
36 #define NAVSTATE_NONE			0x00000000
37 
38 #define NAVBTN_PEN_ENABLED		0x00000010
39 #define NAVBTN_PEN_DISABLED 	0x00000020
40 #define NAVBTN_PEN_CHECKED		0x00000040
41 #define NAVBTN_PEN_UNCHECKED	0x00000080
42 
43 #define NAVTLB_UPDATE			0x00000100
44 
45 #define NAVBTN_FIRST_ENABLED	0x00001000
46 #define NAVBTN_FIRST_DISABLED	0x00002000
47 #define NAVBTN_PREV_ENABLED 	0x00004000
48 #define NAVBTN_PREV_DISABLED	0x00008000
49 
50 #define NAVBTN_LAST_ENABLED 	0x00010000
51 #define NAVBTN_LAST_DISABLED	0x00020000
52 #define NAVBTN_NEXT_ENABLED 	0x00040000
53 #define NAVBTN_NEXT_DISABLED	0x00080000
54 
55 // forward
56 namespace sd {
57 class DrawDocShell;
58 class NavigatorChildWindow;
59 class View;
60 }
61 class Menu;
62 class SdNavigatorControllerItem;
63 class SdPageNameControllerItem;
64 
65 //------------------------------------------------------------------------
66 
67 class NavDocInfo
68 {
69 public:
70 			NavDocInfo() { mpDocShell = NULL; }
71 
72 	sal_Bool	HasName() { return( (sal_Bool) bName ); }
73 	sal_Bool	IsActive() { return( (sal_Bool) bActive ); }
74 
75 	void	SetName( sal_Bool bOn = sal_True ) { bName = bOn; }
76 	void	SetActive( sal_Bool bOn = sal_True ) { bActive = bOn; }
77 
78 private:
79     friend class SdNavigatorWin;
80 	sal_Bool			bName	: 1;
81 	sal_Bool			bActive : 1;
82 	::sd::DrawDocShell* mpDocShell;
83 };
84 
85 //------------------------------------------------------------------------
86 
87 class SdNavigatorWin
88     : public Window
89 {
90 public:
91     SdNavigatorWin(
92         ::Window* pParent,
93         ::sd::NavigatorChildWindow* pChildWinContext,
94         const SdResId& rSdResId,
95         SfxBindings* pBindings );
96     virtual ~SdNavigatorWin();
97 
98 	virtual void				KeyInput( const KeyEvent& rKEvt );
99 
100 	void						InitTreeLB( const SdDrawDocument* pDoc );
101 	void						RefreshDocumentLB( const String* pDocName = NULL );
102 
103 	sal_Bool						InsertFile(const String& rFileName);
104 
105 	NavigatorDragType			GetNavigatorDragType();
106 	void						SetNavigatorDragType(NavigatorDragType eType) { meDragType = eType; }
107 
108 protected:
109 	virtual void				Resize();
110 	virtual long				Notify(NotifyEvent& rNEvt);
111 
112 
113 private:
114     friend class ::sd::NavigatorChildWindow;
115     friend class SdNavigatorControllerItem;
116     friend class SdPageNameControllerItem;
117 
118 	ToolBox						maToolbox;
119 	SdPageObjsTLB				maTlbObjects;
120 	ListBox 					maLbDocs;
121 
122 	::sd::NavigatorChildWindow*		mpChildWinContext;
123 	Size						maSize;
124 	Size						maMinSize;
125 //	Size						maFltWinSize;
126 	sal_Bool						mbDocImported;
127 	String						maDropFileName;
128 	NavigatorDragType			meDragType;
129 	List*						mpDocList;
130 	SfxBindings*				mpBindings;
131 	SdNavigatorControllerItem*	mpNavigatorCtrlItem;
132 	SdPageNameControllerItem*	mpPageNameCtrlItem;
133 
134 	ImageList					maImageList;
135 	ImageList					maImageListH;
136 
137     /** This flag controls whether all shapes or only the named shapes are
138         shown.
139     */
140     bool                        mbShowAllShapes;
141 
142 	sal_uInt16						GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False );
143 	NavDocInfo*					GetDocInfo();
144 
145 								DECL_LINK( GetFocusObjectsHdl, void * );
146 								DECL_LINK( SelectToolboxHdl, void * );
147 								DECL_LINK( ClickToolboxHdl, ToolBox * );
148 								DECL_LINK( DropdownClickToolBoxHdl, ToolBox * );
149 								DECL_LINK( ClickPageHdl, void * );
150 								DECL_LINK( ClickObjectHdl, void * );
151 								DECL_LINK( SelectDocumentHdl, void * );
152 								DECL_LINK( MenuSelectHdl, Menu * );
153 								DECL_LINK( ShapeFilterCallback, Menu * );
154 
155 	virtual void				DataChanged( const DataChangedEvent& rDCEvt );
156 	void						SetDragImage();
157 	void						ApplyImageList();
158 };
159 
160 
161 
162 
163 /*************************************************************************
164 |*
165 |* ControllerItem fuer Navigator
166 |*
167 \************************************************************************/
168 
169 class SdNavigatorControllerItem : public SfxControllerItem
170 {
171 public:
172 	SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
173 
174 protected:
175 	virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
176 								const SfxPoolItem* pState );
177 
178 private:
179 	SdNavigatorWin* pNavigatorWin;
180 };
181 
182 
183 
184 /*************************************************************************
185 |*
186 |* ControllerItem fuer Navigator zum Anzeigen der Seite in der TreeLB
187 |*
188 \************************************************************************/
189 
190 class SdPageNameControllerItem : public SfxControllerItem
191 {
192 public:
193 	SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
194 
195 protected:
196 	virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
197 								const SfxPoolItem* pState );
198 
199 private:
200 	SdNavigatorWin* pNavigatorWin;
201 };
202 
203 #endif
204