Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SD_NAVIGATOR_HXX
21 : #define SD_NAVIGATOR_HXX
22 :
23 : #include <vcl/window.hxx>
24 : #include <vcl/lstbox.hxx>
25 : #include <vcl/toolbox.hxx>
26 : #include <sfx2/ctrlitem.hxx>
27 : #include "sdtreelb.hxx"
28 : #include "pres.hxx"
29 :
30 : #define NAVSTATE_NONE 0x00000000
31 :
32 : #define NAVBTN_PEN_ENABLED 0x00000010
33 : #define NAVBTN_PEN_DISABLED 0x00000020
34 : #define NAVBTN_PEN_CHECKED 0x00000040
35 : #define NAVBTN_PEN_UNCHECKED 0x00000080
36 :
37 : #define NAVTLB_UPDATE 0x00000100
38 :
39 : #define NAVBTN_FIRST_ENABLED 0x00001000
40 : #define NAVBTN_FIRST_DISABLED 0x00002000
41 : #define NAVBTN_PREV_ENABLED 0x00004000
42 : #define NAVBTN_PREV_DISABLED 0x00008000
43 :
44 : #define NAVBTN_LAST_ENABLED 0x00010000
45 : #define NAVBTN_LAST_DISABLED 0x00020000
46 : #define NAVBTN_NEXT_ENABLED 0x00040000
47 : #define NAVBTN_NEXT_DISABLED 0x00080000
48 :
49 : // forward
50 : namespace sd {
51 : class DrawDocShell;
52 : class NavigatorChildWindow;
53 : }
54 : class Menu;
55 : class SdNavigatorControllerItem;
56 : class SdPageNameControllerItem;
57 :
58 : //------------------------------------------------------------------------
59 :
60 : class NavDocInfo
61 : {
62 : public:
63 0 : NavDocInfo() { mpDocShell = NULL; }
64 :
65 0 : sal_Bool HasName() { return( (sal_Bool) bName ); }
66 0 : sal_Bool IsActive() { return( (sal_Bool) bActive ); }
67 :
68 0 : void SetName( sal_Bool bOn = sal_True ) { bName = bOn; }
69 0 : void SetActive( sal_Bool bOn = sal_True ) { bActive = bOn; }
70 :
71 : private:
72 : friend class SdNavigatorWin;
73 : sal_Bool bName : 1;
74 : sal_Bool bActive : 1;
75 : ::sd::DrawDocShell* mpDocShell;
76 : };
77 :
78 : //------------------------------------------------------------------------
79 :
80 : class SdNavigatorWin
81 : : public Window
82 : {
83 : public:
84 : typedef ::boost::function<void(void)> UpdateRequestFunctor;
85 :
86 : /** Create a new instance of the navigator.
87 : @param bUseActiveUpdate
88 : When <TRUE/>, the default, then the SdNavigatorWin object
89 : will make a SID_NAVIGATOR_INIT call whenever it thinks an
90 : update is necessary. When <FALSE/> the navigator will
91 : rely on others to trigger updates.
92 : */
93 : SdNavigatorWin(
94 : ::Window* pParent,
95 : ::sd::NavigatorChildWindow* pChildWinContext,
96 : const SdResId& rSdResId,
97 : SfxBindings* pBindings,
98 : const UpdateRequestFunctor& rUpdateRequest);
99 : virtual ~SdNavigatorWin();
100 :
101 : virtual void KeyInput( const KeyEvent& rKEvt );
102 :
103 : void InitTreeLB( const SdDrawDocument* pDoc );
104 : void RefreshDocumentLB( const String* pDocName = NULL );
105 :
106 : sal_Bool InsertFile(const String& rFileName);
107 :
108 : NavigatorDragType GetNavigatorDragType();
109 : void SetNavigatorDragType(NavigatorDragType eType) { meDragType = eType; }
110 :
111 : protected:
112 : virtual void Resize();
113 : virtual long Notify(NotifyEvent& rNEvt);
114 :
115 :
116 : private:
117 : friend class ::sd::NavigatorChildWindow;
118 : friend class SdNavigatorControllerItem;
119 : friend class SdPageNameControllerItem;
120 :
121 : ToolBox maToolbox;
122 : SdPageObjsTLB maTlbObjects;
123 : ListBox maLbDocs;
124 :
125 : ::sd::NavigatorChildWindow* mpChildWinContext;
126 : Size maSize;
127 : Size maMinSize;
128 : sal_Bool mbDocImported;
129 : String maDropFileName;
130 : NavigatorDragType meDragType;
131 : std::vector<NavDocInfo> maDocList;
132 : SfxBindings* mpBindings;
133 : SdNavigatorControllerItem* mpNavigatorCtrlItem;
134 : SdPageNameControllerItem* mpPageNameCtrlItem;
135 :
136 : ImageList maImageList;
137 :
138 : /** This flag controls whether all shapes or only the named shapes are
139 : shown.
140 : */
141 : // bool mbShowAllShapes;
142 :
143 : sal_uInt16 GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False );
144 : NavDocInfo* GetDocInfo();
145 :
146 : DECL_LINK( GetFocusObjectsHdl, void * );
147 : DECL_LINK( SelectToolboxHdl, void * );
148 : DECL_LINK(ClickToolboxHdl, void *);
149 : DECL_LINK( DropdownClickToolBoxHdl, ToolBox * );
150 : DECL_LINK( ClickPageHdl, void * );
151 : DECL_LINK( ClickObjectHdl, void * );
152 : DECL_LINK( SelectDocumentHdl, void * );
153 : DECL_LINK( MenuSelectHdl, Menu * );
154 : DECL_LINK( ShapeFilterCallback, Menu * );
155 :
156 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
157 : void SetDragImage();
158 : void ApplyImageList();
159 : };
160 :
161 :
162 :
163 :
164 : /**
165 : * ControllerItem for Navigator
166 : */
167 0 : class SdNavigatorControllerItem : public SfxControllerItem
168 : {
169 : public:
170 : SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*,
171 : const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest);
172 :
173 : protected:
174 : virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
175 : const SfxPoolItem* pState );
176 :
177 : private:
178 : SdNavigatorWin* pNavigatorWin;
179 : const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest;
180 : };
181 :
182 :
183 :
184 : /**
185 : * ControllerItem for Navigator to show the page in the TreeLB
186 : */
187 0 : class SdPageNameControllerItem : public SfxControllerItem
188 : {
189 : public:
190 : SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*,
191 : const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest);
192 :
193 : protected:
194 : virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
195 : const SfxPoolItem* pState );
196 :
197 : private:
198 : SdNavigatorWin* pNavigatorWin;
199 : const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest;
200 : };
201 :
202 : #endif
203 :
204 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|