1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2008 by Sun Microsystems, Inc. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * $RCSfile: ToolPanelViewShell.hxx,v $ 10 * $Revision: 1.12 $ 11 * 12 * This file is part of OpenOffice.org. 13 * 14 * OpenOffice.org is free software: you can redistribute it and/or modify 15 * it under the terms of the GNU Lesser General Public License version 3 16 * only, as published by the Free Software Foundation. 17 * 18 * OpenOffice.org is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU Lesser General Public License version 3 for more details 22 * (a copy is included in the LICENSE file that accompanied this code). 23 * 24 * You should have received a copy of the GNU Lesser General Public License 25 * version 3 along with OpenOffice.org. If not, see 26 * <http://www.openoffice.org/license.html> 27 * for a copy of the LGPLv3 License. 28 * 29 ************************************************************************/ 30 31 #ifndef SD_TOOL_PANEL_VIEW_SHELL_HXX 32 #define SD_TOOL_PANEL_VIEW_SHELL_HXX 33 34 #include "ViewShell.hxx" 35 #include "glob.hxx" 36 #include "taskpane/PanelId.hxx" 37 #include "framework/FrameworkHelper.hxx" 38 #include <vcl/button.hxx> 39 #include <sfx2/shell.hxx> 40 #include <sfx2/viewfac.hxx> 41 #include <sfx2/dockwin.hxx> 42 43 #include <boost/shared_ptr.hpp> 44 #include <boost/scoped_ptr.hpp> 45 46 class PopupMenu; 47 48 namespace com { namespace sun { namespace star { namespace ui { 49 class XUIElement; 50 } } } } 51 52 namespace sd { 53 class PaneDockingWindow; 54 55 namespace toolpanel { 56 class TaskPaneShellManager; 57 class TitleToolBox; 58 class TitleBar; 59 class TitledControl; 60 class ToolPanelViewShell_Impl; 61 /** The tool panel is a view shell for some very specific reasons: 62 - It fits better into the concept of panes being docking windows whose 63 content, a view shell, can be exchanged on runtime. 64 - A control in the tool panel that wants to show a context menu has to 65 do that over the dispatcher of a shell. These shells, usually 66 implemented by the controls themselves, have to be managed by someone. 67 If interpreted as object bars this can be handled by the 68 ObjectBarManager of the ViewShell. 69 */ 70 class ToolPanelViewShell 71 : public ViewShell 72 { 73 public: 74 TYPEINFO(); 75 SFX_DECL_INTERFACE(SD_IF_SDTOOLPANELSHELL) 76 77 ToolPanelViewShell ( 78 SfxViewFrame* pFrame, 79 ViewShellBase& rViewShellBase, 80 ::Window* pParentWindow, 81 FrameView* pFrameView); 82 virtual ~ToolPanelViewShell (void); 83 84 /** Register the SFX interfaces so that (some of) the controls can be 85 pushed as SFX shells on the shell stack and process slot calls and 86 so on. 87 */ 88 static void RegisterControls (void); 89 90 virtual void GetFocus (void); 91 virtual void LoseFocus (void); 92 virtual void KeyInput (const KeyEvent& rEvent); 93 using sd::ViewShell::KeyInput; 94 95 virtual SdPage* GetActualPage (void); 96 virtual SdPage* getCurrentPage (void) const; 97 98 virtual void ArrangeGUIElements (void); 99 100 TaskPaneShellManager& GetSubShellManager (void) const; 101 102 /** deactivates the given panel, bypassing the configuration controller. Only valid for tool panels which are 103 not under the drawing framework's control. 104 */ 105 void ActivatePanel( const ::rtl::OUString& i_rPanelResourceURL ); 106 107 /** deactivates the given panel, bypassing the configuration controller 108 */ 109 void DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL ); 110 111 /** Return a pointer to the docking window that is the parent or a 112 predecessor of the content window. 113 @return 114 When the view shell is not placed in a docking window, e.g. when 115 shown in the center pane, then <NULL?> is returned. 116 */ 117 DockingWindow* GetDockingWindow (void); 118 119 virtual ::com::sun::star::uno::Reference< 120 ::com::sun::star::accessibility::XAccessible> 121 CreateAccessibleDocumentView (::sd::Window* pWindow); 122 123 virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void); 124 125 /** Relocate all toplevel controls to the given parent window. 126 */ 127 virtual bool RelocateToParentWindow (::Window* pParentWindow); 128 129 /// returns <TRUE/> if and only if the given window is the panel anchor window of our ToolPanelDeck 130 bool IsPanelAnchorWindow( const ::Window& i_rWindow ) const; 131 132 /** creates an XUIElement for the given standard panel 133 */ 134 ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > 135 CreatePanelUIElement( 136 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocFrame, 137 const ::rtl::OUString& i_rPanelResourceURL 138 ); 139 140 private: 141 ::boost::scoped_ptr< ToolPanelViewShell_Impl > mpImpl; 142 143 ::boost::shared_ptr<TaskPaneShellManager> mpSubShellManager; 144 145 /** The id of the menu in the menu bar/tool box of the parent docking 146 window. 147 */ 148 sal_uInt16 mnMenuId; 149 150 /** Create a popup menu. it contains two sections, one for 151 docking or un-docking the tool panel, one for toggling the 152 visibility state of the tool panel items. 153 @param bIsDocking 154 According to this flag one of the lock/unlock entries is 155 made disabled. 156 */ 157 ::std::auto_ptr<PopupMenu> CreatePopupMenu (bool bIsDocking); 158 159 160 /** Initialize the task pane view shell if that has not yet been done 161 before. If mbIsInitialized is already set to <TRUE/> then this 162 method returns immediately. 163 */ 164 void Initialize (void); 165 }; 166 167 168 169 170 } } // end of namespace ::sd::toolpanel 171 172 #endif 173