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