build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / framework / addonsoptions.hxx
blob30a46a9ff84109b4008efa645b4c3e0ace8b8ed3
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 .
19 #ifndef INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
20 #define INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
22 #include <sal/types.h>
23 #include <osl/mutex.hxx>
24 #include <vcl/image.hxx>
25 #include <vcl/bitmap.hxx>
26 #include <vcl/svapp.hxx>
27 #include <com/sun/star/uno/Sequence.h>
28 #include <com/sun/star/beans/PropertyValue.hpp>
29 #include <framework/fwedllapi.h>
30 #include <memory>
32 /*-************************************************************************************************************
33 @descr The method GetAddonsMenu() returns a list of property values.
34 Use follow defines to separate values by names.
35 *//*-*************************************************************************************************************/
36 #define ADDONSMENUITEM_STRING_URL "URL"
37 #define ADDONSMENUITEM_STRING_TITLE "Title"
38 #define ADDONSMENUITEM_STRING_TARGET "Target"
39 #define ADDONSMENUITEM_STRING_IMAGEIDENTIFIER "ImageIdentifier"
40 #define ADDONSMENUITEM_STRING_CONTEXT "Context"
41 #define ADDONSMENUITEM_STRING_SUBMENU "Submenu"
43 #define ADDONSPOPUPMENU_URL_PREFIX_STR "private:menu/Addon"
45 namespace framework
48 struct FWE_DLLPUBLIC MergeMenuInstruction
50 OUString aMergePoint;
51 OUString aMergeCommand;
52 OUString aMergeCommandParameter;
53 OUString aMergeFallback;
54 OUString aMergeContext;
55 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeMenu;
57 typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer;
59 struct FWE_DLLPUBLIC MergeToolbarInstruction
61 OUString aMergeToolbar;
62 OUString aMergePoint;
63 OUString aMergeCommand;
64 OUString aMergeCommandParameter;
65 OUString aMergeFallback;
66 OUString aMergeContext;
67 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeToolbarItems;
70 typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
72 struct FWE_DLLPUBLIC MergeStatusbarInstruction
74 ::rtl::OUString aMergePoint;
75 ::rtl::OUString aMergeCommand;
76 ::rtl::OUString aMergeCommandParameter;
77 ::rtl::OUString aMergeFallback;
78 ::rtl::OUString aMergeContext;
79 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aMergeStatusbarItems;
82 typedef ::std::vector< MergeStatusbarInstruction > MergeStatusbarInstructionContainer;
84 /*-************************************************************************************************************
85 @short forward declaration to our private date container implementation
86 @descr We use these class as internal member to support small memory requirements.
87 You can create the container if it is necessary. The class which use these mechanism
88 is faster and smaller then a complete implementation!
89 *//*-*************************************************************************************************************/
91 class AddonsOptions_Impl;
93 /*-************************************************************************************************************
94 @short collect information about menu features
95 @devstatus ready to use
96 *//*-*************************************************************************************************************/
98 class FWE_DLLPUBLIC AddonsOptions
100 public:
101 AddonsOptions();
102 ~AddonsOptions();
104 /*-****************************************************************************************************
105 @short returns if an addons menu is available
106 @descr Call to retrieve if a addons menu is available
108 @return true if there is a menu otherwise false
109 *//*-*****************************************************************************************************/
111 bool HasAddonsMenu() const;
113 /*-****************************************************************************************************
114 @short returns number of addons toolbars
115 @descr Call to retrieve the number of addons toolbars
117 @return number of addons toolbars
118 *//*-*****************************************************************************************************/
119 sal_Int32 GetAddonsToolBarCount() const ;
121 /*-****************************************************************************************************
122 @short returns the complete addons menu
123 @descr Call it to get all entries of the addon menu.
124 We return a list of all nodes with his names and properties.
125 @return A list of menu items is returned.
127 @onerror We return an empty list.
128 *//*-*****************************************************************************************************/
130 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsMenu() const;
132 /*-****************************************************************************************************
133 @short Gets the menu bar part of all addon components registered
134 @return A complete
136 @onerror We return sal_False
137 *//*-*****************************************************************************************************/
139 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsMenuBarPart() const;
141 /*-****************************************************************************************************
142 @short Gets a toolbar part of an single addon
143 @return A complete
145 @onerror We return sal_False
146 *//*-*****************************************************************************************************/
148 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const;
150 /*-****************************************************************************************************
151 @short Gets a unique toolbar resource name of an single addon
152 @return A complete
154 @onerror We return sal_False
155 *//*-*****************************************************************************************************/
157 const OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
159 /*-****************************************************************************************************
160 @short Retrieves all available merge instructions for the Office menu bar
161 @return The filled MergeMenuDefinitionContaier
163 @onerror We return sal_False
164 *//*-*****************************************************************************************************/
166 const MergeMenuInstructionContainer& GetMergeMenuInstructions() const;
168 /*-****************************************************************************************************
169 @short Retrieves all available merge instructions for a single toolbar
170 @return The filled
172 @onerror We return sal_False
173 *//*-*****************************************************************************************************/
174 bool GetMergeToolbarInstructions( const OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
176 /*-****************************************************************************************************
177 @short Gets the Add-On help menu part of all addon components registered
178 @return A complete
180 @onerror We return sal_False
181 *//*-*****************************************************************************************************/
182 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& GetAddonsHelpMenu() const;
184 const MergeStatusbarInstructionContainer& GetMergeStatusbarInstructions() const;
186 /*-****************************************************************************************************
187 @short Retrieve an image for a command URL which is defined inside the addon menu configuration
188 @descr Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
189 @return An image which was defined in the configuration for the menu item. The image can be empty
190 no bitmap was defined for the request image properties.
192 @onerror An empty image
193 *//*-*****************************************************************************************************/
195 Image GetImageFromURL( const OUString& aURL, bool bBig, bool bNoScale ) const;
196 Image GetImageFromURL( const OUString& aURL, bool bBig ) const;
198 // private methods
200 /*-****************************************************************************************************
201 @short return a reference to a static mutex
202 @descr These class is partially threadsafe (for de-/initialization only).
203 All access methods are'nt safe!
204 We create a static mutex only for one ime and use at different times.
205 @return A reference to a static mutex member.
206 *//*-*****************************************************************************************************/
208 static ::osl::Mutex& GetOwnStaticMutex();
210 private:
211 std::shared_ptr<AddonsOptions_Impl> m_pImpl;
216 #endif // INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */