Branch libreoffice-5-0-4
[LibreOffice.git] / include / framework / addonsoptions.hxx
blob25adf1041349998748795410e05accc24e7b5da2
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>
31 /*-************************************************************************************************************
32 @descr The method GetAddonsMenu() returns a list of property values.
33 Use follow defines to separate values by names.
34 *//*-*************************************************************************************************************/
35 #define ADDONSMENUITEM_STRING_URL "URL"
36 #define ADDONSMENUITEM_STRING_TITLE "Title"
37 #define ADDONSMENUITEM_STRING_TARGET "Target"
38 #define ADDONSMENUITEM_STRING_IMAGEIDENTIFIER "ImageIdentifier"
39 #define ADDONSMENUITEM_STRING_CONTEXT "Context"
40 #define ADDONSMENUITEM_STRING_SUBMENU "Submenu"
42 #define ADDONSPOPUPMENU_URL_PREFIX_STR "private:menu/Addon"
44 namespace framework
47 struct FWE_DLLPUBLIC MergeMenuInstruction
49 OUString aMergePoint;
50 OUString aMergeCommand;
51 OUString aMergeCommandParameter;
52 OUString aMergeFallback;
53 OUString aMergeContext;
54 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeMenu;
56 typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer;
58 struct FWE_DLLPUBLIC MergeToolbarInstruction
60 OUString aMergeToolbar;
61 OUString aMergePoint;
62 OUString aMergeCommand;
63 OUString aMergeCommandParameter;
64 OUString aMergeFallback;
65 OUString aMergeContext;
66 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeToolbarItems;
69 typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
71 struct FWE_DLLPUBLIC MergeStatusbarInstruction
73 ::rtl::OUString aMergePoint;
74 ::rtl::OUString aMergeCommand;
75 ::rtl::OUString aMergeCommandParameter;
76 ::rtl::OUString aMergeFallback;
77 ::rtl::OUString aMergeContext;
78 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeStatusbarItems;
81 typedef ::std::vector< MergeStatusbarInstruction > MergeStatusbarInstructionContainer;
83 /*-************************************************************************************************************
84 @short forward declaration to our private date container implementation
85 @descr We use these class as internal member to support small memory requirements.
86 You can create the container if it is necessary. The class which use these mechanism
87 is faster and smaller then a complete implementation!
88 *//*-*************************************************************************************************************/
90 class AddonsOptions_Impl;
92 /*-************************************************************************************************************
93 @short collect information about menu features
94 @devstatus ready to use
95 *//*-*************************************************************************************************************/
97 class FWE_DLLPUBLIC AddonsOptions
99 public:
101 /*-****************************************************************************************************
102 @short standard constructor and destructor
103 @descr This will initialize an instance with default values.
104 We implement these class with a refcount mechanism! Every instance of this class increase it
105 at create and decrease it at delete time - but all instances use the same data container!
106 He is implemented as a static member ...
108 @seealso member m_nRefCount
109 @seealso member m_pDataContainer
110 *//*-*****************************************************************************************************/
112 AddonsOptions();
113 ~AddonsOptions();
115 /*-****************************************************************************************************
116 @short clears completely the addons menu
117 @descr Call this methods to clear the addons menu
118 To fill it again use AppendItem().
119 @param "eMenu" select right menu to clear.
120 *//*-*****************************************************************************************************/
122 void Clear();
124 /*-****************************************************************************************************
125 @short returns if an addons menu is available
126 @descr Call to retrieve if a addons menu is available
129 @return true if there is a menu otherwise false
130 *//*-*****************************************************************************************************/
132 bool HasAddonsMenu() const;
134 /*-****************************************************************************************************
135 @short returns number of addons toolbars
136 @descr Call to retrieve the number of addons toolbars
139 @return number of addons toolbars
140 *//*-*****************************************************************************************************/
141 sal_Int32 GetAddonsToolBarCount() const ;
143 /*-****************************************************************************************************
144 @short returns the complete addons menu
145 @descr Call it to get all entries of the addon menu.
146 We return a list of all nodes with his names and properties.
147 @return A list of menu items is returned.
149 @onerror We return an empty list.
150 *//*-*****************************************************************************************************/
152 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenu() const;
154 /*-****************************************************************************************************
155 @short Gets the menu bar part of all addon components registered
156 @return A complete
158 @onerror We return sal_False
159 *//*-*****************************************************************************************************/
161 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenuBarPart() const;
163 /*-****************************************************************************************************
164 @short Gets a toolbar part of an single addon
165 @return A complete
167 @onerror We return sal_False
168 *//*-*****************************************************************************************************/
170 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const;
172 /*-****************************************************************************************************
173 @short Gets a unique toolbar resource name of an single addon
174 @return A complete
176 @onerror We return sal_False
177 *//*-*****************************************************************************************************/
179 const OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
181 /*-****************************************************************************************************
182 @short Retrieves all available merge instructions for the Office menu bar
183 @return The filled MergeMenuDefinitionContaier
185 @onerror We return sal_False
186 *//*-*****************************************************************************************************/
188 const MergeMenuInstructionContainer& GetMergeMenuInstructions() const;
190 /*-****************************************************************************************************
191 @short Retrieves all available merge instructions for a single toolbar
192 @return The filled
194 @onerror We return sal_False
195 *//*-*****************************************************************************************************/
196 bool GetMergeToolbarInstructions( const OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
198 /*-****************************************************************************************************
199 @short Gets the Add-On help menu part of all addon components registered
200 @return A complete
202 @onerror We return sal_False
203 *//*-*****************************************************************************************************/
204 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsHelpMenu() const;
206 const MergeStatusbarInstructionContainer& GetMergeStatusbarInstructions() const;
208 /*-****************************************************************************************************
209 @short Retrieve an image for a command URL which is defined inside the addon menu configuration
210 @descr Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
211 @return An image which was defined in the configuration for the menu item. The image can be empty
212 no bitmap was defined for the request image properties.
214 @onerror An empty image
215 *//*-*****************************************************************************************************/
217 Image GetImageFromURL( const OUString& aURL, bool bBig, bool bNoScale ) const;
218 Image GetImageFromURL( const OUString& aURL, bool bBig ) const;
221 // private methods
224 /*-****************************************************************************************************
225 @short return a reference to a static mutex
226 @descr These class is partially threadsafe (for de-/initialization only).
227 All access methods are'nt safe!
228 We create a static mutex only for one ime and use at different times.
229 @return A reference to a static mutex member.
230 *//*-*****************************************************************************************************/
232 static ::osl::Mutex& GetOwnStaticMutex();
234 /*-****************************************************************************************************
235 @short return a reference to a static mutex
236 @descr These class is partially threadsafe (for de-/initialization only).
237 All access methods are'nt safe!
238 We create a static mutex only for one ime and use at different times.
239 @return A reference to a static mutex member.
240 *//*-*****************************************************************************************************/
241 DECL_STATIC_LINK( AddonsOptions, Notify, void* );
243 private:
245 /*Attention
247 Don't initialize these static members in these headers!
248 a) Double defined symbols will be detected ...
249 b) and unresolved externals exist at linking time.
250 Do it in your source only.
253 static AddonsOptions_Impl* m_pDataContainer ;
254 static sal_Int32 m_nRefCount ;
260 #endif // INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */