fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / sfx2 / taskpane.hxx
blob0d0dd6eea19967dbfdffbefa34bc0218f6765871
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 SFX_TASKPANE_HXX
21 #define SFX_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/scoped_ptr.hpp>
31 #include <boost/optional.hpp>
33 namespace svt
35 class ToolPanelDeck;
38 //......................................................................................................................
39 namespace sfx2
41 //......................................................................................................................
43 //==================================================================================================================
44 //= ITaskPaneToolPanelAccess
45 //==================================================================================================================
46 class SAL_NO_VTABLE ITaskPaneToolPanelAccess
48 public:
49 virtual void ActivateToolPanel( const OUString& i_rPanelURL ) = 0;
51 protected:
52 ~ITaskPaneToolPanelAccess() {}
55 //==================================================================================================================
56 //= TaskPaneWrapper
57 //==================================================================================================================
58 class SFX2_DLLPUBLIC TaskPaneWrapper :public SfxChildWindow
59 ,public ITaskPaneToolPanelAccess
61 public:
62 TaskPaneWrapper(
63 Window* i_pParent,
64 sal_uInt16 i_nId,
65 SfxBindings* i_pBindings,
66 SfxChildWinInfo* i_pInfo
69 SFX_DECL_CHILDWINDOW( TaskPaneWrapper );
71 // ITaskPaneToolPanelAccess
72 virtual void ActivateToolPanel( const OUString& i_rPanelURL );
75 //==================================================================================================================
76 //= IToolPanelCompare
77 //==================================================================================================================
78 class SFX2_DLLPUBLIC SAL_NO_VTABLE IToolPanelCompare
80 public:
81 /** compares to tool panel URLs
82 @return
83 <ul>
84 <li>-1 if the tool panel described by i_rLHS should precede the one described by i_rRHS</li>
85 <li>0 if the two panels have no particular relative order</li>
86 <li>1 if the tool panel described by i_rLHS should succeed the one described by i_rRHS</li>
89 virtual short compareToolPanelsURLs(
90 const OUString& i_rLHS,
91 const OUString& i_rRHS
92 ) const = 0;
94 protected:
95 ~IToolPanelCompare() {}
98 //==================================================================================================================
99 //= ModuleTaskPane
100 //==================================================================================================================
101 class ModuleTaskPane_Impl;
102 /** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective
103 module's configuration
105 class SFX2_DLLPUBLIC ModuleTaskPane : public Window
107 public:
108 /** creates a new instance
109 @param i_rParentWindow
110 the parent window
111 @param i_rDocumentFrame
112 the frame to which the task pane belongs. Will be passed to any custom tool panels created
113 via an XUIElementFactory. Also, it is used to determine the module which the task pane is
114 responsible for, thus controlling which tool panels are actually available.
116 ModuleTaskPane(
117 Window& i_rParentWindow,
118 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame
120 /** creates a new instance
121 @param i_rParentWindow
122 the parent window
123 @param i_rDocumentFrame
124 the frame to which the task pane belongs. Will be passed to any custom tool panels created
125 via an XUIElementFactory. Also, it is used to determine the module which the task pane is
126 responsible for, thus controlling which tool panels are actually available.
127 @param i_rCompare
128 a comparator for tool panel URLs, which allows controlling the order in which the panels are
129 added to the tool panel deck.
131 ModuleTaskPane(
132 Window& i_rParentWindow,
133 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame,
134 const IToolPanelCompare& i_rCompare
136 ~ModuleTaskPane();
138 /** determines whether a given module has any registered tool panels
140 static bool ModuleHasToolPanels( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame );
142 /** provides access to the Window aspect of the PanelDeck
144 Be careful with this method. For instance, you're not allowed to insert arbitrary IToolPanel implementations
145 into the deck, as the ModuleTaskPane has certain assumptions about the panel implementations. However,
146 you're allowed to remove and re-insert panels, which have originally been created by the ModuleTaskPane
147 itself.
149 ::svt::ToolPanelDeck& GetPanelDeck();
150 const ::svt::ToolPanelDeck& GetPanelDeck() const;
152 /** returns the position of the panel with the given resource URL
154 ::boost::optional< size_t >
155 GetPanelPos( const OUString& i_rResourceURL );
157 /** returns the resource URL of the panel at the specified position
159 OUString
160 GetPanelResourceURL( const size_t i_nPanelPos ) const;
162 /// sets the "classical" layout of the tool panel deck, using drawers
163 void SetDrawersLayout();
164 /// sets the new layout of the tool panel deck, using tabs
165 void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent );
167 protected:
168 // Window overridables
169 virtual void Resize();
170 virtual void GetFocus();
172 private:
173 ::boost::scoped_ptr< ModuleTaskPane_Impl > m_pImpl;
176 //==================================================================================================================
177 //= TaskPaneController
178 //==================================================================================================================
179 class TaskPaneController_Impl;
180 /** is a helper class for connecting a ModuleTaskPane and a TitledDockingWindow, for clients of the ModuleTaskPane
181 which do not use the TaskPaneDockingWindow
183 The controller will add a drop down menu to the docking window which contains one item for each panel in the
184 panel deck, and allows toggling their visibility.
186 class SFX2_DLLPUBLIC TaskPaneController
188 public:
189 TaskPaneController(
190 ModuleTaskPane& i_rTaskPane,
191 TitledDockingWindow& i_rDockingWindow
193 ~TaskPaneController();
195 /// activates the panel with the given URL
196 void ActivateToolPanel( const OUString& i_rPanelURL );
198 private:
199 ::boost::scoped_ptr< TaskPaneController_Impl > m_pImpl;
202 //==================================================================================================================
203 //= TaskPaneDockingWindow
204 //==================================================================================================================
205 class TaskPaneDockingWindow :public TitledDockingWindow
206 ,public ITaskPaneToolPanelAccess
208 public:
209 TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper,
210 Window* i_pParent, WinBits i_nBits );
212 // ITaskPaneToolPanelAccess
213 virtual void ActivateToolPanel( const OUString& i_rPanelURL );
215 protected:
216 // Window overridables
217 virtual void GetFocus();
219 // TitledDockingWindow overridables
220 virtual void onLayoutDone();
222 private:
223 ModuleTaskPane m_aTaskPane;
224 TaskPaneController m_aPaneController;
227 //......................................................................................................................
228 } // namespace sfx2
229 //......................................................................................................................
231 #endif // SFX_TASKPANE_HXX
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */