xref: /aoo42x/main/sd/source/ui/inc/navigatr.hxx (revision 4d7c9de0)
1c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c45d927aSAndrew Rist  * distributed with this work for additional information
6c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10c45d927aSAndrew Rist  *
11c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12c45d927aSAndrew Rist  *
13c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17c45d927aSAndrew Rist  * specific language governing permissions and limitations
18c45d927aSAndrew Rist  * under the License.
19c45d927aSAndrew Rist  *
20c45d927aSAndrew Rist  *************************************************************/
21c45d927aSAndrew Rist 
22c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SD_NAVIGATOR_HXX
25cdf0e10cSrcweir #define SD_NAVIGATOR_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/window.hxx>
28cdf0e10cSrcweir #include <vcl/lstbox.hxx>
29cdf0e10cSrcweir #ifndef _TOOLBOX_HXX //autogen
30cdf0e10cSrcweir #include <vcl/toolbox.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <sfx2/ctrlitem.hxx>
33cdf0e10cSrcweir #include "sdtreelb.hxx"
34cdf0e10cSrcweir #include "pres.hxx"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #define NAVSTATE_NONE			0x00000000
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #define NAVBTN_PEN_ENABLED		0x00000010
39cdf0e10cSrcweir #define NAVBTN_PEN_DISABLED 	0x00000020
40cdf0e10cSrcweir #define NAVBTN_PEN_CHECKED		0x00000040
41cdf0e10cSrcweir #define NAVBTN_PEN_UNCHECKED	0x00000080
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #define NAVTLB_UPDATE			0x00000100
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #define NAVBTN_FIRST_ENABLED	0x00001000
46cdf0e10cSrcweir #define NAVBTN_FIRST_DISABLED	0x00002000
47cdf0e10cSrcweir #define NAVBTN_PREV_ENABLED 	0x00004000
48cdf0e10cSrcweir #define NAVBTN_PREV_DISABLED	0x00008000
49cdf0e10cSrcweir 
50cdf0e10cSrcweir #define NAVBTN_LAST_ENABLED 	0x00010000
51cdf0e10cSrcweir #define NAVBTN_LAST_DISABLED	0x00020000
52cdf0e10cSrcweir #define NAVBTN_NEXT_ENABLED 	0x00040000
53cdf0e10cSrcweir #define NAVBTN_NEXT_DISABLED	0x00080000
54cdf0e10cSrcweir 
55cdf0e10cSrcweir // forward
56cdf0e10cSrcweir namespace sd {
57cdf0e10cSrcweir class DrawDocShell;
58cdf0e10cSrcweir class NavigatorChildWindow;
59cdf0e10cSrcweir class View;
60cdf0e10cSrcweir }
61cdf0e10cSrcweir class Menu;
62cdf0e10cSrcweir class SdNavigatorControllerItem;
63cdf0e10cSrcweir class SdPageNameControllerItem;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir //------------------------------------------------------------------------
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class NavDocInfo
68cdf0e10cSrcweir {
69cdf0e10cSrcweir public:
NavDocInfo()70cdf0e10cSrcweir 			NavDocInfo() { mpDocShell = NULL; }
71cdf0e10cSrcweir 
HasName()72cdf0e10cSrcweir 	sal_Bool	HasName() { return( (sal_Bool) bName ); }
IsActive()73cdf0e10cSrcweir 	sal_Bool	IsActive() { return( (sal_Bool) bActive ); }
74cdf0e10cSrcweir 
SetName(sal_Bool bOn=sal_True)75cdf0e10cSrcweir 	void	SetName( sal_Bool bOn = sal_True ) { bName = bOn; }
SetActive(sal_Bool bOn=sal_True)76cdf0e10cSrcweir 	void	SetActive( sal_Bool bOn = sal_True ) { bActive = bOn; }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir private:
79cdf0e10cSrcweir     friend class SdNavigatorWin;
80cdf0e10cSrcweir 	sal_Bool			bName	: 1;
81cdf0e10cSrcweir 	sal_Bool			bActive : 1;
82cdf0e10cSrcweir 	::sd::DrawDocShell* mpDocShell;
83cdf0e10cSrcweir };
84cdf0e10cSrcweir 
85cdf0e10cSrcweir //------------------------------------------------------------------------
86cdf0e10cSrcweir 
87cdf0e10cSrcweir class SdNavigatorWin
88cdf0e10cSrcweir     : public Window
89cdf0e10cSrcweir {
90cdf0e10cSrcweir public:
9162024513SAndre Fischer     typedef ::boost::function<void(void)> UpdateRequestFunctor;
9262024513SAndre Fischer 
9362024513SAndre Fischer     /** Create a new instance of the navigator.
9462024513SAndre Fischer         @param bUseActiveUpdate
9562024513SAndre Fischer             When <TRUE/>, the default, then the SdNavigatorWin object
9662024513SAndre Fischer             will make a SID_NAVIGATOR_INIT call whenever it thinks an
9762024513SAndre Fischer             update is necessary.  When <FALSE/> the navigator will
9862024513SAndre Fischer             rely on others to trigger updates.
9962024513SAndre Fischer     */
100cdf0e10cSrcweir     SdNavigatorWin(
101cdf0e10cSrcweir         ::Window* pParent,
102cdf0e10cSrcweir         ::sd::NavigatorChildWindow* pChildWinContext,
103cdf0e10cSrcweir         const SdResId& rSdResId,
10462024513SAndre Fischer         SfxBindings* pBindings,
10562024513SAndre Fischer         const UpdateRequestFunctor& rUpdateRequest);
106cdf0e10cSrcweir     virtual ~SdNavigatorWin();
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	virtual void				KeyInput( const KeyEvent& rKEvt );
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	void						InitTreeLB( const SdDrawDocument* pDoc );
111cdf0e10cSrcweir 	void						RefreshDocumentLB( const String* pDocName = NULL );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	sal_Bool						InsertFile(const String& rFileName);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	NavigatorDragType			GetNavigatorDragType();
SetNavigatorDragType(NavigatorDragType eType)116cdf0e10cSrcweir 	void						SetNavigatorDragType(NavigatorDragType eType) { meDragType = eType; }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir protected:
119cdf0e10cSrcweir 	virtual void				Resize();
120cdf0e10cSrcweir 	virtual long				Notify(NotifyEvent& rNEvt);
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 
123cdf0e10cSrcweir private:
124cdf0e10cSrcweir     friend class ::sd::NavigatorChildWindow;
125cdf0e10cSrcweir     friend class SdNavigatorControllerItem;
126cdf0e10cSrcweir     friend class SdPageNameControllerItem;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	ToolBox						maToolbox;
129cdf0e10cSrcweir 	SdPageObjsTLB				maTlbObjects;
130cdf0e10cSrcweir 	ListBox 					maLbDocs;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	::sd::NavigatorChildWindow*		mpChildWinContext;
133cdf0e10cSrcweir 	Size						maSize;
134cdf0e10cSrcweir 	Size						maMinSize;
135cdf0e10cSrcweir //	Size						maFltWinSize;
136cdf0e10cSrcweir 	sal_Bool						mbDocImported;
137cdf0e10cSrcweir 	String						maDropFileName;
138cdf0e10cSrcweir 	NavigatorDragType			meDragType;
139cdf0e10cSrcweir 	List*						mpDocList;
140cdf0e10cSrcweir 	SfxBindings*				mpBindings;
141cdf0e10cSrcweir 	SdNavigatorControllerItem*	mpNavigatorCtrlItem;
142cdf0e10cSrcweir 	SdPageNameControllerItem*	mpPageNameCtrlItem;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	ImageList					maImageList;
145cdf0e10cSrcweir 	ImageList					maImageListH;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     /** This flag controls whether all shapes or only the named shapes are
148cdf0e10cSrcweir         shown.
149cdf0e10cSrcweir     */
15062024513SAndre Fischer     //    bool                        mbShowAllShapes;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	sal_uInt16						GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False );
153cdf0e10cSrcweir 	NavDocInfo*					GetDocInfo();
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 								DECL_LINK( GetFocusObjectsHdl, void * );
156cdf0e10cSrcweir 								DECL_LINK( SelectToolboxHdl, void * );
157cdf0e10cSrcweir 								DECL_LINK( ClickToolboxHdl, ToolBox * );
158cdf0e10cSrcweir 								DECL_LINK( DropdownClickToolBoxHdl, ToolBox * );
159cdf0e10cSrcweir 								DECL_LINK( ClickPageHdl, void * );
160cdf0e10cSrcweir 								DECL_LINK( ClickObjectHdl, void * );
161cdf0e10cSrcweir 								DECL_LINK( SelectDocumentHdl, void * );
162cdf0e10cSrcweir 								DECL_LINK( MenuSelectHdl, Menu * );
163cdf0e10cSrcweir 								DECL_LINK( ShapeFilterCallback, Menu * );
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	virtual void				DataChanged( const DataChangedEvent& rDCEvt );
166cdf0e10cSrcweir 	void						SetDragImage();
167cdf0e10cSrcweir 	void						ApplyImageList();
168*0deba7fbSSteve Yin public:
169*0deba7fbSSteve Yin 	//Solution: when object is marked , fresh the corresponding entry tree .
170*0deba7fbSSteve Yin 	sd::DrawDocShell*             GetDrawDocShell(const SdDrawDocument*);
171*0deba7fbSSteve Yin     void                        FreshTree ( const  SdDrawDocument* pDoc );
172*0deba7fbSSteve Yin 	void                        FreshEntry( );
173cdf0e10cSrcweir };
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 
178cdf0e10cSrcweir /*************************************************************************
179cdf0e10cSrcweir |*
180cdf0e10cSrcweir |* ControllerItem fuer Navigator
181cdf0e10cSrcweir |*
182cdf0e10cSrcweir \************************************************************************/
183cdf0e10cSrcweir 
184cdf0e10cSrcweir class SdNavigatorControllerItem : public SfxControllerItem
185cdf0e10cSrcweir {
186cdf0e10cSrcweir public:
18762024513SAndre Fischer 	SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*,
18862024513SAndre Fischer         const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest);
189cdf0e10cSrcweir 
190cdf0e10cSrcweir protected:
191cdf0e10cSrcweir 	virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
192cdf0e10cSrcweir 								const SfxPoolItem* pState );
193cdf0e10cSrcweir 
194cdf0e10cSrcweir private:
195cdf0e10cSrcweir 	SdNavigatorWin* pNavigatorWin;
19662024513SAndre Fischer     const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest;
197cdf0e10cSrcweir };
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 
201cdf0e10cSrcweir /*************************************************************************
202cdf0e10cSrcweir |*
203cdf0e10cSrcweir |* ControllerItem fuer Navigator zum Anzeigen der Seite in der TreeLB
204cdf0e10cSrcweir |*
205cdf0e10cSrcweir \************************************************************************/
206cdf0e10cSrcweir 
207cdf0e10cSrcweir class SdPageNameControllerItem : public SfxControllerItem
208cdf0e10cSrcweir {
209cdf0e10cSrcweir public:
21062024513SAndre Fischer 	SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*,
21162024513SAndre Fischer         const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest);
212cdf0e10cSrcweir 
213cdf0e10cSrcweir protected:
214cdf0e10cSrcweir 	virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
215cdf0e10cSrcweir 								const SfxPoolItem* pState );
216cdf0e10cSrcweir 
217cdf0e10cSrcweir private:
218cdf0e10cSrcweir 	SdNavigatorWin* pNavigatorWin;
21962024513SAndre Fischer     const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest;
220cdf0e10cSrcweir };
221cdf0e10cSrcweir 
222cdf0e10cSrcweir #endif
223