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