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: NavDocInfo()70 NavDocInfo() { mpDocShell = NULL; } 71 HasName()72 sal_Bool HasName() { return( (sal_Bool) bName ); } IsActive()73 sal_Bool IsActive() { return( (sal_Bool) bActive ); } 74 SetName(sal_Bool bOn=sal_True)75 void SetName( sal_Bool bOn = sal_True ) { bName = bOn; } SetActive(sal_Bool bOn=sal_True)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 typedef ::boost::function<void(void)> UpdateRequestFunctor; 92 93 /** Create a new instance of the navigator. 94 @param bUseActiveUpdate 95 When <TRUE/>, the default, then the SdNavigatorWin object 96 will make a SID_NAVIGATOR_INIT call whenever it thinks an 97 update is necessary. When <FALSE/> the navigator will 98 rely on others to trigger updates. 99 */ 100 SdNavigatorWin( 101 ::Window* pParent, 102 ::sd::NavigatorChildWindow* pChildWinContext, 103 const SdResId& rSdResId, 104 SfxBindings* pBindings, 105 const UpdateRequestFunctor& rUpdateRequest); 106 virtual ~SdNavigatorWin(); 107 108 virtual void KeyInput( const KeyEvent& rKEvt ); 109 110 void InitTreeLB( const SdDrawDocument* pDoc ); 111 void RefreshDocumentLB( const String* pDocName = NULL ); 112 113 sal_Bool InsertFile(const String& rFileName); 114 115 NavigatorDragType GetNavigatorDragType(); SetNavigatorDragType(NavigatorDragType eType)116 void SetNavigatorDragType(NavigatorDragType eType) { meDragType = eType; } 117 118 protected: 119 virtual void Resize(); 120 virtual long Notify(NotifyEvent& rNEvt); 121 122 123 private: 124 friend class ::sd::NavigatorChildWindow; 125 friend class SdNavigatorControllerItem; 126 friend class SdPageNameControllerItem; 127 128 ToolBox maToolbox; 129 SdPageObjsTLB maTlbObjects; 130 ListBox maLbDocs; 131 132 ::sd::NavigatorChildWindow* mpChildWinContext; 133 Size maSize; 134 Size maMinSize; 135 // Size maFltWinSize; 136 sal_Bool mbDocImported; 137 String maDropFileName; 138 NavigatorDragType meDragType; 139 List* mpDocList; 140 SfxBindings* mpBindings; 141 SdNavigatorControllerItem* mpNavigatorCtrlItem; 142 SdPageNameControllerItem* mpPageNameCtrlItem; 143 144 ImageList maImageList; 145 ImageList maImageListH; 146 147 /** This flag controls whether all shapes or only the named shapes are 148 shown. 149 */ 150 // bool mbShowAllShapes; 151 152 sal_uInt16 GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False ); 153 NavDocInfo* GetDocInfo(); 154 155 DECL_LINK( GetFocusObjectsHdl, void * ); 156 DECL_LINK( SelectToolboxHdl, void * ); 157 DECL_LINK( ClickToolboxHdl, ToolBox * ); 158 DECL_LINK( DropdownClickToolBoxHdl, ToolBox * ); 159 DECL_LINK( ClickPageHdl, void * ); 160 DECL_LINK( ClickObjectHdl, void * ); 161 DECL_LINK( SelectDocumentHdl, void * ); 162 DECL_LINK( MenuSelectHdl, Menu * ); 163 DECL_LINK( ShapeFilterCallback, Menu * ); 164 165 virtual void DataChanged( const DataChangedEvent& rDCEvt ); 166 void SetDragImage(); 167 void ApplyImageList(); 168 public: 169 //Solution: when object is marked , fresh the corresponding entry tree . 170 sd::DrawDocShell* GetDrawDocShell(const SdDrawDocument*); 171 void FreshTree ( const SdDrawDocument* pDoc ); 172 void FreshEntry( ); 173 }; 174 175 176 177 178 /************************************************************************* 179 |* 180 |* ControllerItem fuer Navigator 181 |* 182 \************************************************************************/ 183 184 class SdNavigatorControllerItem : public SfxControllerItem 185 { 186 public: 187 SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*, 188 const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest); 189 190 protected: 191 virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, 192 const SfxPoolItem* pState ); 193 194 private: 195 SdNavigatorWin* pNavigatorWin; 196 const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; 197 }; 198 199 200 201 /************************************************************************* 202 |* 203 |* ControllerItem fuer Navigator zum Anzeigen der Seite in der TreeLB 204 |* 205 \************************************************************************/ 206 207 class SdPageNameControllerItem : public SfxControllerItem 208 { 209 public: 210 SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*, 211 const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest); 212 213 protected: 214 virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, 215 const SfxPoolItem* pState ); 216 217 private: 218 SdNavigatorWin* pNavigatorWin; 219 const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; 220 }; 221 222 #endif 223