merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / inc / TaskPaneViewShell.hxx
blob7251b279bcf513d22f88ce0088e8939e15e5fdeb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TaskPaneViewShell.hxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
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.
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).
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.
29 ************************************************************************/
31 #ifndef SD_TOOLPANEL_TASK_PANE_VIEW_SHELL_HXX
32 #define SD_TOOLPANEL_TASK_PANE_VIEW_SHELL_HXX
34 #include "ViewShell.hxx"
35 #include "glob.hxx"
36 #include "framework/FrameworkHelper.hxx"
37 #include <vcl/button.hxx>
38 #include <sfx2/shell.hxx>
39 #include <sfx2/viewfac.hxx>
40 #include <sfx2/dockwin.hxx>
42 #include <memory>
43 #include <boost/shared_ptr.hpp>
45 class PopupMenu;
47 namespace sd { namespace toolpanel {
49 class TaskPaneShellManager;
50 class TitleToolBox;
51 class TitleBar;
52 class TitledControl;
53 class ToolPanel;
55 /** The tool panel is a view shell for some very specific reasons:
56 - It fits better into the concept of panes being docking windows whose
57 content, a view shell, can be exchanged on runtime.
58 - A control in the tool panel that wants to show a context menu has to
59 do that over the dispatcher of a shell. These shells, usually
60 implemented by the controls themselves, have to be managed by someone.
61 If interpreted as object bars this can be handled by the
62 ObjectBarManager of the ViewShell.
64 class TaskPaneViewShell
65 : public ViewShell
67 public:
68 TYPEINFO();
69 SFX_DECL_INTERFACE(SD_IF_SDTASKPANEVIEWSHELL)
71 /** List of top level panels that can be shown in the task pane.
73 enum PanelId
75 PID__START = 0,
76 PID_UNKNOWN = PID__START,
77 PID_MASTER_PAGES,
78 PID_LAYOUT,
79 PID_TABLE_DESIGN,
80 PID_ANIMATION_SCHEMES,
81 PID_CUSTOM_ANIMATION,
82 PID_SLIDE_TRANSITION,
83 PID__END = PID_SLIDE_TRANSITION
86 TaskPaneViewShell (
87 SfxViewFrame* pFrame,
88 ViewShellBase& rViewShellBase,
89 ::Window* pParentWindow,
90 FrameView* pFrameView);
91 virtual ~TaskPaneViewShell (void);
93 /** Register the SFX interfaces so that (some of) the controls can be
94 pushed as SFX shells on the shell stack and process slot calls and
95 so on.
97 static void RegisterControls (void);
99 virtual void GetFocus (void);
100 virtual void LoseFocus (void);
101 virtual void KeyInput (const KeyEvent& rEvent);
102 using sd::ViewShell::KeyInput;
104 virtual SdPage* GetActualPage (void);
105 virtual SdPage* getCurrentPage (void) const;
107 void Execute (SfxRequest& rRequest);
108 void GetState (SfxItemSet& rItemSet);
110 virtual void ArrangeGUIElements (void);
112 TaskPaneShellManager& GetSubShellManager (void) const;
114 /** Called when a mouse button has been pressed but not yet
115 released, this handler is used to show the popup menu of the
116 title bar.
118 DECL_LINK(ToolboxClickHandler, ToolBox*);
119 DECL_LINK(MenuSelectHandler, Menu*);
121 /** Make the specified panel visible and expand it.
122 @param nId
123 The id of the panel that is to be made visible.
125 void ShowPanel (const PanelId nId);
127 /** Hide and collapse the specified panel.
128 @param nId
129 The id of the panel that is to hide.
131 void HidePanel (const PanelId nId);
133 /** Expand the specified panel. Its visibility state is not modified.
134 @param nId
135 The id of the panel that is to expand.
137 void ExpandPanel (const PanelId nId);
139 /** Collapse the specified panel. Its visibility state is not
140 modified.
141 @param nId
142 The id of the panel that is to collapse.
144 void CollapsePanel (const PanelId nId);
146 virtual ::com::sun::star::uno::Reference<
147 ::com::sun::star::accessibility::XAccessible>
148 CreateAccessibleDocumentView (::sd::Window* pWindow);
150 virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
152 /** Relocate all toplevel controls to the given parent window.
154 virtual bool RelocateToParentWindow (::Window* pParentWindow);
156 private:
157 class Implementation;
158 ::std::auto_ptr<Implementation> mpImpl;
160 ::std::auto_ptr<ToolPanel> mpTaskPane;
162 bool mbIsInitialized;
164 ::boost::shared_ptr<TaskPaneShellManager> mpSubShellManager;
166 /** The id of the menu in the menu bar/tool box of the parent docking
167 window.
169 USHORT mnMenuId;
171 /** Create a popup menu. it contains three sections, one for
172 docking or un-docking the tool panel, one for toggling the
173 visibility state of the tool panel items, and one for bringing
174 up a customization dialog.
175 @param bIsDocking
176 According to this flag one of the lock/unlock entries is
177 made disabled.
179 ::std::auto_ptr<PopupMenu> CreatePopupMenu (bool bIsDocking);
182 /** Make sure that as long as there is at least one visible
183 control there is exactly one expanded control.
184 If the currently expanded control is being hidden then try to
185 expand the control after the hidden one or if that does not
186 exist expand the one before.
188 void EnsureExpandedControl (TitledControl* pHiddenControl);
190 /** Return a pointer to the docking window that is the parent or a
191 predecessor of the content window.
192 @return
193 When the view shell is not placed in a docking window, e.g. when
194 shown in the center pane, then <NULL?> is returned.
196 DockingWindow* GetDockingWindow (void);
198 /** Initialize the task pane view shell if that has not yet been done
199 before. If mbIsInitialized is already set to <TRUE/> then this
200 method returns immediately.
202 void Initialize (void);
208 /** This functor makes visible a panel in the task pane. It can be used
209 with the FrameworkHelper to make a panel visible after an asynchonous
210 update of the configuration, e.g. after switching to another view.
212 class PanelActivation
214 public:
215 /** Create a new object that, when its operator() method is called, will
216 make the specified panel visible in the task pane that belongs to
217 the application window specified by the given ViewShellBase.
219 PanelActivation (ViewShellBase& rBase, TaskPaneViewShell::PanelId nPanelId);
220 void operator() (bool);
221 private:
222 ViewShellBase& mrBase;
223 TaskPaneViewShell::PanelId mnPanelId;
227 } } // end of namespace ::sd::toolpanel
229 #endif