LibreOffice Module framework (master) 1
addonsoptions.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
20#define INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
21
22#include <config_options.h>
23#include <sal/types.h>
24#include <vcl/bitmapex.hxx>
25#include <com/sun/star/beans/PropertyValue.hpp>
26#include <com/sun/star/uno/Sequence.h>
27#include <framework/fwkdllapi.h>
28#include <memory>
29
30namespace osl { class Mutex; }
31
32/*-************************************************************************************************************
33 @descr The method GetAddonsMenu() returns a list of property values.
34 Use follow defines to separate values by names.
35*//*-*************************************************************************************************************/
36inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_URL = u"URL";
37inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_TITLE = u"Title";
38inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_TARGET = u"Target";
39inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_IMAGEIDENTIFIER = u"ImageIdentifier";
40inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_CONTEXT = u"Context";
41inline constexpr OUStringLiteral ADDONSMENUITEM_STRING_SUBMENU = u"Submenu";
42
43inline constexpr OUStringLiteral ADDONSPOPUPMENU_URL_PREFIX_STR = u"private:menu/Addon";
44
45namespace framework
46{
47
49{
50 OUString aMergePoint;
51 OUString aMergeCommand;
54 OUString aMergeContext;
55 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeMenu;
56};
57typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer;
58
60{
61 OUString aMergeToolbar;
62 OUString aMergePoint;
63 OUString aMergeCommand;
66 OUString aMergeContext;
67 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeToolbarItems;
68};
69
70typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
71
73{
75 OUString aMergePoint;
76 OUString aMergeCommand;
79 OUString aMergeContext;
80 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeNotebookBarItems;
81};
82
83typedef ::std::vector< MergeNotebookBarInstruction > MergeNotebookBarInstructionContainer;
84
86{
87 OUString aMergePoint;
88 OUString aMergeCommand;
90 OUString aMergeContext;
91 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeStatusbarItems;
92};
93
94typedef ::std::vector< MergeStatusbarInstruction > MergeStatusbarInstructionContainer;
95
96/*-************************************************************************************************************
97 @short forward declaration to our private date container implementation
98 @descr We use these class as internal member to support small memory requirements.
99 You can create the container if it is necessary. The class which use these mechanism
100 is faster and smaller then a complete implementation!
101*//*-*************************************************************************************************************/
102
104
105/*-************************************************************************************************************
106 @short collect information about menu features
107 @devstatus ready to use
108*//*-*************************************************************************************************************/
109
110class UNLESS_MERGELIBS(FWK_DLLPUBLIC) AddonsOptions
111{
112 public:
113 AddonsOptions();
114 ~AddonsOptions();
115
116 /*-****************************************************************************************************
117 @short returns if an addons menu is available
118 @descr Call to retrieve if an addons menu is available
119
120 @return true if there is a menu otherwise false
121 *//*-*****************************************************************************************************/
122
123 bool HasAddonsMenu() const;
124
125 /*-****************************************************************************************************
126 @short returns number of addons toolbars
127 @descr Call to retrieve the number of addons toolbars
128
129 @return number of addons toolbars
130 *//*-*****************************************************************************************************/
131 sal_Int32 GetAddonsToolBarCount() const ;
132
133 /*-****************************************************************************************************
134 @short returns number of addons notebookbar
135 @descr Call to retrieve the number of addons notebookbar
136
137 @return number of addons notebookar
138 *//*-*****************************************************************************************************/
139 sal_Int32 GetAddonsNotebookBarCount() const ;
140
141 /*-****************************************************************************************************
142 @short returns the complete addons menu
143 @descr Call it to get all entries of the addon menu.
144 We return a list of all nodes with its names and properties.
145 @return A list of menu items is returned.
146
147 @onerror We return an empty list.
148 *//*-*****************************************************************************************************/
149
150 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsMenu() const;
151
152 /*-****************************************************************************************************
153 @short Gets the menu bar part of all addon components registered
154 @return A complete
155
156 @onerror We return sal_False
157 *//*-*****************************************************************************************************/
158
159 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsMenuBarPart() const;
160
161 /*-****************************************************************************************************
162 @short Gets a toolbar part of a single addon
163 @return A complete
164
165 @onerror We return sal_False
166 *//*-*****************************************************************************************************/
167
168 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const;
169
170 /*-****************************************************************************************************
171 @short Gets a unique toolbar resource name of a single addon
172 @return A complete
173
174 @onerror We return sal_False
175 *//*-*****************************************************************************************************/
176
177 OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
178
179 /*-****************************************************************************************************
180 @short Gets a NotebookBar part of a single addon
181 @return A complete
182
183 @onerror We return sal_False
184 *//*-*****************************************************************************************************/
185
186 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsNotebookBarPart( sal_uInt32 nIndex ) const;
187
188 /*-****************************************************************************************************
189 @short Gets a unique NotebookBar resource name of a single addon
190 @return A complete
191
192 @onerror We return sal_False
193 *//*-*****************************************************************************************************/
194
195 OUString GetAddonsNotebookBarResourceName( sal_uInt32 ) const;
196
197 /*-****************************************************************************************************
198 @short Retrieves all available merge instructions for the Office menu bar
199 @return The filled MergeMenuDefinitionContainer
200
201 @onerror We return sal_False
202 *//*-*****************************************************************************************************/
203
204 const MergeMenuInstructionContainer& GetMergeMenuInstructions() const;
205
206 /*-****************************************************************************************************
207 @short Retrieves all available merge instructions for a single toolbar
208 @return The filled
209
210 @onerror We return sal_False
211 *//*-*****************************************************************************************************/
212 bool GetMergeToolbarInstructions( const OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
213
214 /*-****************************************************************************************************
215 @short Retrieves all available merge instructions for Notebookbar
216 @return The filled
217
218 @onerror We return sal_False
219 *//*-*****************************************************************************************************/
220 bool GetMergeNotebookBarInstructions( const OUString& rNotebookBarName, MergeNotebookBarInstructionContainer& rNotebookBar ) const;
221
222 /*-****************************************************************************************************
223 @short Gets the Add-On help menu part of all addon components registered
224 @return A complete
225
226 @onerror We return sal_False
227 *//*-*****************************************************************************************************/
228 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsHelpMenu() const;
229
230 const MergeStatusbarInstructionContainer& GetMergeStatusbarInstructions() const;
231
232 /*-****************************************************************************************************
233 @short Retrieve an image for a command URL which is defined inside the addon menu configuration
234 @descr Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
235 @return An image which was defined in the configuration for the menu item. The image can be empty
236 no bitmap was defined for the request image properties.
237
238 @onerror An empty image
239 *//*-*****************************************************************************************************/
240
241 BitmapEx GetImageFromURL( const OUString& aURL, bool bBig, bool bNoScale ) const;
242 BitmapEx GetImageFromURL( const OUString& aURL, bool bBig ) const;
243
244 // private methods
245
246 /*-****************************************************************************************************
247 @short return a reference to a static mutex
248 @descr These class is partially threadsafe (for de-/initialization only).
249 All access methods aren't safe!
250 We create a static mutex only for one ime and use at different times.
251 @return A reference to a static mutex member.
252 *//*-*****************************************************************************************************/
253
254 static ::osl::Mutex& GetOwnStaticMutex();
255
256 private:
257 std::shared_ptr<AddonsOptions_Impl> m_pImpl;
258};
259
260}
261
262#endif // INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
263
264/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
constexpr OUStringLiteral ADDONSMENUITEM_STRING_IMAGEIDENTIFIER
constexpr OUStringLiteral ADDONSMENUITEM_STRING_TARGET
constexpr OUStringLiteral ADDONSPOPUPMENU_URL_PREFIX_STR
constexpr OUStringLiteral ADDONSMENUITEM_STRING_URL
constexpr OUStringLiteral ADDONSMENUITEM_STRING_SUBMENU
constexpr OUStringLiteral ADDONSMENUITEM_STRING_CONTEXT
constexpr OUStringLiteral ADDONSMENUITEM_STRING_TITLE
float u
#define FWK_DLLPUBLIC
Definition: fwkdllapi.h:19
::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer
::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer
::std::vector< MergeStatusbarInstruction > MergeStatusbarInstructionContainer
::std::vector< MergeNotebookBarInstruction > MergeNotebookBarInstructionContainer
css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeMenu
css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeNotebookBarItems
css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeStatusbarItems
css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeToolbarItems