xref: /trunk/main/sd/source/ui/inc/navigatr.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_NAVIGATOR_HXX
29 #define SD_NAVIGATOR_HXX
30 
31 #include <vcl/window.hxx>
32 #include <vcl/lstbox.hxx>
33 #ifndef _TOOLBOX_HXX //autogen
34 #include <vcl/toolbox.hxx>
35 #endif
36 #include <sfx2/ctrlitem.hxx>
37 #include "sdtreelb.hxx"
38 #include "pres.hxx"
39 
40 #define NAVSTATE_NONE           0x00000000
41 
42 #define NAVBTN_PEN_ENABLED      0x00000010
43 #define NAVBTN_PEN_DISABLED     0x00000020
44 #define NAVBTN_PEN_CHECKED      0x00000040
45 #define NAVBTN_PEN_UNCHECKED    0x00000080
46 
47 #define NAVTLB_UPDATE           0x00000100
48 
49 #define NAVBTN_FIRST_ENABLED    0x00001000
50 #define NAVBTN_FIRST_DISABLED   0x00002000
51 #define NAVBTN_PREV_ENABLED     0x00004000
52 #define NAVBTN_PREV_DISABLED    0x00008000
53 
54 #define NAVBTN_LAST_ENABLED     0x00010000
55 #define NAVBTN_LAST_DISABLED    0x00020000
56 #define NAVBTN_NEXT_ENABLED     0x00040000
57 #define NAVBTN_NEXT_DISABLED    0x00080000
58 
59 // forward
60 namespace sd {
61 class DrawDocShell;
62 class NavigatorChildWindow;
63 class View;
64 }
65 class Menu;
66 class SdNavigatorControllerItem;
67 class SdPageNameControllerItem;
68 
69 //------------------------------------------------------------------------
70 
71 class NavDocInfo
72 {
73 public:
74             NavDocInfo() { mpDocShell = NULL; }
75 
76     sal_Bool    HasName() { return( (sal_Bool) bName ); }
77     sal_Bool    IsActive() { return( (sal_Bool) bActive ); }
78 
79     void    SetName( sal_Bool bOn = sal_True ) { bName = bOn; }
80     void    SetActive( sal_Bool bOn = sal_True ) { bActive = bOn; }
81 
82 private:
83     friend class SdNavigatorWin;
84     sal_Bool            bName   : 1;
85     sal_Bool            bActive : 1;
86     ::sd::DrawDocShell* mpDocShell;
87 };
88 
89 //------------------------------------------------------------------------
90 
91 class SdNavigatorWin
92     : public Window
93 {
94 public:
95     SdNavigatorWin(
96         ::Window* pParent,
97         ::sd::NavigatorChildWindow* pChildWinContext,
98         const SdResId& rSdResId,
99         SfxBindings* pBindings );
100     virtual ~SdNavigatorWin();
101 
102     virtual void                KeyInput( const KeyEvent& rKEvt );
103 
104     void                        InitTreeLB( const SdDrawDocument* pDoc );
105     void                        RefreshDocumentLB( const String* pDocName = NULL );
106 
107     sal_Bool                        InsertFile(const String& rFileName);
108 
109     NavigatorDragType           GetNavigatorDragType();
110     void                        SetNavigatorDragType(NavigatorDragType eType) { meDragType = eType; }
111 
112 protected:
113     virtual void                Resize();
114     virtual long                Notify(NotifyEvent& rNEvt);
115 
116 
117 private:
118     friend class ::sd::NavigatorChildWindow;
119     friend class SdNavigatorControllerItem;
120     friend class SdPageNameControllerItem;
121 
122     ToolBox                     maToolbox;
123     SdPageObjsTLB               maTlbObjects;
124     ListBox                     maLbDocs;
125 
126     ::sd::NavigatorChildWindow*     mpChildWinContext;
127     Size                        maSize;
128     Size                        maMinSize;
129 //  Size                        maFltWinSize;
130     sal_Bool                        mbDocImported;
131     String                      maDropFileName;
132     NavigatorDragType           meDragType;
133     List*                       mpDocList;
134     SfxBindings*                mpBindings;
135     SdNavigatorControllerItem*  mpNavigatorCtrlItem;
136     SdPageNameControllerItem*   mpPageNameCtrlItem;
137 
138     ImageList                   maImageList;
139     ImageList                   maImageListH;
140 
141     /** This flag controls whether all shapes or only the named shapes are
142         shown.
143     */
144     bool                        mbShowAllShapes;
145 
146     sal_uInt16                      GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False );
147     NavDocInfo*                 GetDocInfo();
148 
149                                 DECL_LINK( GetFocusObjectsHdl, void * );
150                                 DECL_LINK( SelectToolboxHdl, void * );
151                                 DECL_LINK( ClickToolboxHdl, ToolBox * );
152                                 DECL_LINK( DropdownClickToolBoxHdl, ToolBox * );
153                                 DECL_LINK( ClickPageHdl, void * );
154                                 DECL_LINK( ClickObjectHdl, void * );
155                                 DECL_LINK( SelectDocumentHdl, void * );
156                                 DECL_LINK( MenuSelectHdl, Menu * );
157                                 DECL_LINK( ShapeFilterCallback, Menu * );
158 
159     virtual void                DataChanged( const DataChangedEvent& rDCEvt );
160     void                        SetDragImage();
161     void                        ApplyImageList();
162 };
163 
164 
165 
166 
167 /*************************************************************************
168 |*
169 |* ControllerItem fuer Navigator
170 |*
171 \************************************************************************/
172 
173 class SdNavigatorControllerItem : public SfxControllerItem
174 {
175 public:
176     SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
177 
178 protected:
179     virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
180                                 const SfxPoolItem* pState );
181 
182 private:
183     SdNavigatorWin* pNavigatorWin;
184 };
185 
186 
187 
188 /*************************************************************************
189 |*
190 |* ControllerItem fuer Navigator zum Anzeigen der Seite in der TreeLB
191 |*
192 \************************************************************************/
193 
194 class SdPageNameControllerItem : public SfxControllerItem
195 {
196 public:
197     SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
198 
199 protected:
200     virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
201                                 const SfxPoolItem* pState );
202 
203 private:
204     SdNavigatorWin* pNavigatorWin;
205 };
206 
207 #endif
208