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