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_TOOL_PANEL_VIEW_SHELL_HXX 25 #define SD_TOOL_PANEL_VIEW_SHELL_HXX 26 27 #include "ViewShell.hxx" 28 #include "glob.hxx" 29 #include "taskpane/PanelId.hxx" 30 #include "framework/FrameworkHelper.hxx" 31 #include <vcl/button.hxx> 32 #include <sfx2/shell.hxx> 33 #include <sfx2/viewfac.hxx> 34 #include <sfx2/dockwin.hxx> 35 36 #include <boost/shared_ptr.hpp> 37 #include <boost/scoped_ptr.hpp> 38 39 class PopupMenu; 40 41 namespace com { namespace sun { namespace star { namespace ui { 42 class XUIElement; 43 } } } } 44 45 namespace sd { 46 class PaneDockingWindow; 47 48 namespace toolpanel { 49 class TaskPaneShellManager; 50 class TitleToolBox; 51 class TitleBar; 52 class TitledControl; 53 class ToolPanelViewShell_Impl; 54 /** The tool panel is a view shell for some very specific reasons: 55 - It fits better into the concept of panes being docking windows whose 56 content, a view shell, can be exchanged on runtime. 57 - A control in the tool panel that wants to show a context menu has to 58 do that over the dispatcher of a shell. These shells, usually 59 implemented by the controls themselves, have to be managed by someone. 60 If interpreted as object bars this can be handled by the 61 ObjectBarManager of the ViewShell. 62 */ 63 class ToolPanelViewShell 64 : public ViewShell 65 { 66 public: 67 TYPEINFO(); 68 SFX_DECL_INTERFACE(SD_IF_SDTOOLPANELSHELL) 69 70 ToolPanelViewShell ( 71 SfxViewFrame* pFrame, 72 ViewShellBase& rViewShellBase, 73 ::Window* pParentWindow, 74 FrameView* pFrameView); 75 virtual ~ToolPanelViewShell (void); 76 77 /** Register the SFX interfaces so that (some of) the controls can be 78 pushed as SFX shells on the shell stack and process slot calls and 79 so on. 80 */ 81 static void RegisterControls (void); 82 83 virtual void GetFocus (void); 84 virtual void LoseFocus (void); 85 virtual void KeyInput (const KeyEvent& rEvent); 86 using sd::ViewShell::KeyInput; 87 88 virtual SdPage* GetActualPage (void); 89 virtual SdPage* getCurrentPage (void) const; 90 91 virtual void ArrangeGUIElements (void); 92 93 TaskPaneShellManager& GetSubShellManager (void) const; 94 95 /** deactivates the given panel, bypassing the configuration controller. Only valid for tool panels which are 96 not under the drawing framework's control. 97 */ 98 void ActivatePanel( const ::rtl::OUString& i_rPanelResourceURL ); 99 100 /** deactivates the given panel, bypassing the configuration controller 101 */ 102 void DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL ); 103 104 /** Return a pointer to the docking window that is the parent or a 105 predecessor of the content window. 106 @return 107 When the view shell is not placed in a docking window, e.g. when 108 shown in the center pane, then <NULL?> is returned. 109 */ 110 DockingWindow* GetDockingWindow (void); 111 112 virtual ::com::sun::star::uno::Reference< 113 ::com::sun::star::accessibility::XAccessible> 114 CreateAccessibleDocumentView (::sd::Window* pWindow); 115 116 virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void); 117 118 /** Relocate all toplevel controls to the given parent window. 119 */ 120 virtual bool RelocateToParentWindow (::Window* pParentWindow); 121 122 /// returns <TRUE/> if and only if the given window is the panel anchor window of our ToolPanelDeck 123 bool IsPanelAnchorWindow( const ::Window& i_rWindow ) const; 124 125 /** creates an XUIElement for the given standard panel 126 */ 127 ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > 128 CreatePanelUIElement( 129 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocFrame, 130 const ::rtl::OUString& i_rPanelResourceURL 131 ); 132 133 private: 134 ::boost::scoped_ptr< ToolPanelViewShell_Impl > mpImpl; 135 136 ::boost::shared_ptr<TaskPaneShellManager> mpSubShellManager; 137 138 /** The id of the menu in the menu bar/tool box of the parent docking 139 window. 140 */ 141 sal_uInt16 mnMenuId; 142 143 /** Create a popup menu. it contains two sections, one for 144 docking or un-docking the tool panel, one for toggling the 145 visibility state of the tool panel items. 146 @param bIsDocking 147 According to this flag one of the lock/unlock entries is 148 made disabled. 149 */ 150 ::std::auto_ptr<PopupMenu> CreatePopupMenu (bool bIsDocking); 151 152 153 /** Initialize the task pane view shell if that has not yet been done 154 before. If mbIsInitialized is already set to <TRUE/> then this 155 method returns immediately. 156 */ 157 void Initialize (void); 158 }; 159 160 161 162 163 } } // end of namespace ::sd::toolpanel 164 165 #endif 166