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