bump product version to 5.0.4.1
[LibreOffice.git] / include / sfx2 / taskpane.hxx
blob21556961e85faf5248bc3b7fb3d9500520ad0f08
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SFX2_TASKPANE_HXX
21 #define INCLUDED_SFX2_TASKPANE_HXX
23 #include <sfx2/dllapi.h>
24 #include <sfx2/childwin.hxx>
25 #include <sfx2/titledockwin.hxx>
27 #include <svtools/toolpanel/tabalignment.hxx>
28 #include <svtools/toolpanel/tabitemcontent.hxx>
30 #include <boost/optional.hpp>
32 namespace svt
34 class ToolPanelDeck;
38 namespace sfx2
43 //= ITaskPaneToolPanelAccess
45 class SAL_NO_VTABLE ITaskPaneToolPanelAccess
47 public:
48 virtual void ActivateToolPanel( const OUString& i_rPanelURL ) = 0;
50 protected:
51 ~ITaskPaneToolPanelAccess() {}
55 //= TaskPaneWrapper
57 class SFX2_DLLPUBLIC TaskPaneWrapper :public SfxChildWindow
58 ,public ITaskPaneToolPanelAccess
60 public:
61 TaskPaneWrapper(
62 vcl::Window* i_pParent,
63 sal_uInt16 i_nId,
64 SfxBindings* i_pBindings,
65 SfxChildWinInfo* i_pInfo
68 SFX_DECL_CHILDWINDOW( TaskPaneWrapper );
70 // ITaskPaneToolPanelAccess
71 virtual void ActivateToolPanel( const OUString& i_rPanelURL ) SAL_OVERRIDE;
75 //= ModuleTaskPane
77 class ModuleTaskPane_Impl;
78 /** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective
79 module's configuration
81 class SFX2_DLLPUBLIC ModuleTaskPane : public vcl::Window
83 public:
84 /** creates a new instance
85 @param i_rParentWindow
86 the parent window
87 @param i_rDocumentFrame
88 the frame to which the task pane belongs. Will be passed to any custom tool panels created
89 via an XUIElementFactory. Also, it is used to determine the module which the task pane is
90 responsible for, thus controlling which tool panels are actually available.
92 ModuleTaskPane(
93 vcl::Window& i_rParentWindow,
94 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame
96 virtual ~ModuleTaskPane();
98 /** determines whether a given module has any registered tool panels
100 static bool ModuleHasToolPanels( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame );
102 /** provides access to the Window aspect of the PanelDeck
104 Be careful with this method. For instance, you're not allowed to insert arbitrary IToolPanel implementations
105 into the deck, as the ModuleTaskPane has certain assumptions about the panel implementations. However,
106 you're allowed to remove and re-insert panels, which have originally been created by the ModuleTaskPane
107 itself.
109 ::svt::ToolPanelDeck& GetPanelDeck();
110 const ::svt::ToolPanelDeck& GetPanelDeck() const;
112 /** returns the position of the panel with the given resource URL
114 ::boost::optional< size_t >
115 GetPanelPos( const OUString& i_rResourceURL );
117 /// sets the "classical" layout of the tool panel deck, using drawers
118 void SetDrawersLayout();
119 /// sets the new layout of the tool panel deck, using tabs
120 void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent );
122 protected:
123 // Window overridables
124 virtual void Resize() SAL_OVERRIDE;
125 virtual void GetFocus() SAL_OVERRIDE;
127 private:
128 std::unique_ptr<ModuleTaskPane_Impl> m_xImpl;
132 //= TaskPaneController
134 class TaskPaneController_Impl;
135 /** is a helper class for connecting a ModuleTaskPane and a TitledDockingWindow, for clients of the ModuleTaskPane
136 which do not use the TaskPaneDockingWindow
138 The controller will add a drop down menu to the docking window which contains one item for each panel in the
139 panel deck, and allows toggling their visibility.
141 class SFX2_DLLPUBLIC TaskPaneController
143 public:
144 TaskPaneController(
145 ModuleTaskPane& i_rTaskPane,
146 TitledDockingWindow& i_rDockingWindow
148 ~TaskPaneController();
150 /// activates the panel with the given URL
151 void ActivateToolPanel( const OUString& i_rPanelURL );
153 private:
154 std::unique_ptr<TaskPaneController_Impl> m_xImpl;
158 //= TaskPaneDockingWindow
160 class TaskPaneDockingWindow :public TitledDockingWindow
161 ,public ITaskPaneToolPanelAccess
163 public:
164 TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper,
165 vcl::Window* i_pParent, WinBits i_nBits );
166 virtual ~TaskPaneDockingWindow();
167 virtual void dispose() SAL_OVERRIDE;
169 // ITaskPaneToolPanelAccess
170 virtual void ActivateToolPanel( const OUString& i_rPanelURL ) SAL_OVERRIDE;
172 protected:
173 // Window overridables
174 virtual void GetFocus() SAL_OVERRIDE;
176 // TitledDockingWindow overridables
177 virtual void onLayoutDone() SAL_OVERRIDE;
179 private:
180 VclPtr<ModuleTaskPane> m_aTaskPane;
181 TaskPaneController m_aPaneController;
185 } // namespace sfx2
188 #endif // INCLUDED_SFX2_TASKPANE_HXX
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */