merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / classes / addonsoptions.hxx
blobea3f05735c96487ad7fade0563cb6e4612dd2ee1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: addonsoptions.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
31 #define __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
33 //_________________________________________________________________________________________________________________
34 // includes
35 //_________________________________________________________________________________________________________________
37 #include <sal/types.h>
38 #include <osl/mutex.hxx>
39 #include <vcl/image.hxx>
40 #include <vcl/bitmap.hxx>
41 #include <vcl/svapp.hxx>
42 #include <com/sun/star/uno/Sequence.h>
43 #include <com/sun/star/beans/PropertyValue.hpp>
45 //_________________________________________________________________________________________________________________
46 // types, enums, ...
47 //_________________________________________________________________________________________________________________
49 /*-************************************************************************************************************//**
50 @descr The method GetAddonsMenu() returns a list of property values.
51 Use follow defines to seperate values by names.
52 *//*-*************************************************************************************************************/
53 #define ADDONSMENUITEM_STRING_URL "URL"
54 #define ADDONSMENUITEM_STRING_TITLE "Title"
55 #define ADDONSMENUITEM_STRING_TARGET "Target"
56 #define ADDONSMENUITEM_STRING_IMAGEIDENTIFIER "ImageIdentifier"
57 #define ADDONSMENUITEM_STRING_CONTEXT "Context"
58 #define ADDONSMENUITEM_STRING_SUBMENU "Submenu"
59 #define ADDONSMENUITEM_STRING_CONTROLTYPE "ControlType"
60 #define ADDONSMENUITEM_STRING_WIDTH "Width"
62 #define ADDONSMENUITEM_URL_LEN 3
63 #define ADDONSMENUITEM_TITLE_LEN 5
64 #define ADDONSMENUITEM_TARGET_LEN 6
65 #define ADDONSMENUITEM_SUBMENU_LEN 7
66 #define ADDONSMENUITEM_CONTEXT_LEN 7
67 #define ADDONSMENUITEM_IMAGEIDENTIFIER_LEN 15
69 #define ADDONSMENUITEM_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_URL ))
70 #define ADDONSMENUITEM_PROPERTYNAME_TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_TITLE ))
71 #define ADDONSMENUITEM_PROPERTYNAME_TARGET ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_TARGET ))
72 #define ADDONSMENUITEM_PROPERTYNAME_IMAGEIDENTIFIER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_IMAGEIDENTIFIER ))
73 #define ADDONSMENUITEM_PROPERTYNAME_CONTEXT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_CONTEXT ))
74 #define ADDONSMENUITEM_PROPERTYNAME_SUBMENU ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_SUBMENU ))
75 #define ADDONSMENUITEM_PROPERTYNAME_CONTROLTYPE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_CONTROLTYPE ))
76 #define ADDONSMENUITEM_PROPERTYNAME_WIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_WIDTH ))
78 #define ADDONSPOPUPMENU_URL_PREFIX_STR "private:menu/Addon"
80 #define ADDONSPOPUPMENU_URL_PREFIX ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ADDONSPOPUPMENU_URL_PREFIX_STR ))
82 namespace framework
85 typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > MergeMenuDefinition;
87 struct MergeMenuInstruction
89 ::rtl::OUString aMergePoint;
90 ::rtl::OUString aMergeCommand;
91 ::rtl::OUString aMergeCommandParameter;
92 ::rtl::OUString aMergeFallback;
93 ::rtl::OUString aMergeContext;
94 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeMenu;
96 typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer;
98 struct MergeToolbarInstruction
100 ::rtl::OUString aMergeToolbar;
101 ::rtl::OUString aMergePoint;
102 ::rtl::OUString aMergeCommand;
103 ::rtl::OUString aMergeCommandParameter;
104 ::rtl::OUString aMergeFallback;
105 ::rtl::OUString aMergeContext;
106 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeToolbarItems;
109 typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
111 //_________________________________________________________________________________________________________________
112 // forward declarations
113 //_________________________________________________________________________________________________________________
115 /*-************************************************************************************************************//**
116 @short forward declaration to our private date container implementation
117 @descr We use these class as internal member to support small memory requirements.
118 You can create the container if it is neccessary. The class which use these mechanism
119 is faster and smaller then a complete implementation!
120 *//*-*************************************************************************************************************/
122 class AddonsOptions_Impl;
124 //_________________________________________________________________________________________________________________
125 // declarations
126 //_________________________________________________________________________________________________________________
128 /*-************************************************************************************************************//**
129 @short collect informations about menu features
130 @descr -
132 @implements -
133 @base -
135 @devstatus ready to use
136 *//*-*************************************************************************************************************/
138 class AddonsOptions
140 //-------------------------------------------------------------------------------------------------------------
141 // public methods
142 //-------------------------------------------------------------------------------------------------------------
144 public:
145 //---------------------------------------------------------------------------------------------------------
146 // constructor / destructor
147 //---------------------------------------------------------------------------------------------------------
149 /*-****************************************************************************************************//**
150 @short standard constructor and destructor
151 @descr This will initialize an instance with default values.
152 We implement these class with a refcount mechanism! Every instance of this class increase it
153 at create and decrease it at delete time - but all instances use the same data container!
154 He is implemented as a static member ...
156 @seealso member m_nRefCount
157 @seealso member m_pDataContainer
159 @param -
160 @return -
162 @onerror -
163 *//*-*****************************************************************************************************/
165 AddonsOptions();
166 ~AddonsOptions();
168 //---------------------------------------------------------------------------------------------------------
169 // interface
170 //---------------------------------------------------------------------------------------------------------
172 /*-****************************************************************************************************//**
173 @short clears completely the addons menu
174 @descr Call this methods to clear the addons menu
175 To fill it again use AppendItem().
177 @seealso -
179 @param "eMenu" select right menu to clear.
180 @return -
182 @onerror -
183 *//*-*****************************************************************************************************/
185 void Clear();
187 /*-****************************************************************************************************//**
188 @short returns if an addons menu is available
189 @descr Call to retrieve if a addons menu is available
192 @return sal_True if there is a menu otherwise sal_False
193 *//*-*****************************************************************************************************/
195 sal_Bool HasAddonsMenu() const;
197 /*-****************************************************************************************************//**
198 @short returns if an addons help menu is available
199 @descr Call to retrieve if a addons menu is available
202 @return sal_True if there is a menu otherwise sal_False
203 *//*-*****************************************************************************************************/
205 sal_Bool HasAddonsHelpMenu() const;
207 /*-****************************************************************************************************//**
208 @short returns number of addons toolbars
209 @descr Call to retrieve the number of addons toolbars
212 @return number of addons toolbars
213 *//*-*****************************************************************************************************/
214 sal_Int32 GetAddonsToolBarCount() const ;
216 /*-****************************************************************************************************//**
217 @short returns the complete addons menu
218 @descr Call it to get all entries of the addon menu.
219 We return a list of all nodes with his names and properties.
221 @seealso -
223 @return A list of menu items is returned.
225 @onerror We return an empty list.
226 *//*-*****************************************************************************************************/
228 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenu() const;
230 /*-****************************************************************************************************//**
231 @short Gets the menu bar part of all addon components registered
232 @descr -
234 @seealso -
236 @return A complete
238 @onerror We return sal_False
239 *//*-*****************************************************************************************************/
241 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenuBarPart() const;
243 /*-****************************************************************************************************//**
244 @short Gets a toolbar part of an single addon
245 @descr -
247 @seealso -
249 @return A complete
251 @onerror We return sal_False
252 *//*-*****************************************************************************************************/
254 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const;
256 /*-****************************************************************************************************//**
257 @short Gets a unique toolbar resource name of an single addon
258 @descr -
260 @seealso -
262 @return A complete
264 @onerror We return sal_False
265 *//*-*****************************************************************************************************/
267 const ::rtl::OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
269 /*-****************************************************************************************************//**
270 @short Retrieves all available merge instructions for the Office menu bar
271 @descr -
273 @seealso -
275 @return The filled MergeMenuDefinitionContaier
277 @onerror We return sal_False
278 *//*-*****************************************************************************************************/
280 const MergeMenuInstructionContainer& GetMergeMenuInstructions() const;
282 /*-****************************************************************************************************//**
283 @short Retrieves all available merge instructions for a single toolbar
284 @descr -
286 @seealso -
288 @return The filled
290 @onerror We return sal_False
291 *//*-*****************************************************************************************************/
292 bool GetMergeToolbarInstructions( const ::rtl::OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
294 /*-****************************************************************************************************//**
295 @short Gets the Add-On help menu part of all addon components registered
296 @descr -
298 @seealso -
300 @return A complete
302 @onerror We return sal_False
303 *//*-*****************************************************************************************************/
304 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsHelpMenu() const;
306 /*-****************************************************************************************************//**
307 @short Retrieve an image for a command URL which is defined inside the addon menu configuration
308 @descr Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
310 @seealso -
312 @return An image which was defined in the configuration for the menu item. The image can be empty
313 no bitmap was defined for the request image properties.
315 @onerror An empty image
316 *//*-*****************************************************************************************************/
318 Image GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast, sal_Bool bNoScale ) const;
320 Image GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast ) const;
321 //-------------------------------------------------------------------------------------------------------------
322 // private methods
323 //-------------------------------------------------------------------------------------------------------------
325 /*-****************************************************************************************************//**
326 @short return a reference to a static mutex
327 @descr These class is partially threadsafe (for de-/initialization only).
328 All access methods are'nt safe!
329 We create a static mutex only for one ime and use at different times.
331 @seealso -
333 @param -
334 @return A reference to a static mutex member.
336 @onerror -
337 *//*-*****************************************************************************************************/
339 static ::osl::Mutex& GetOwnStaticMutex();
341 /*-****************************************************************************************************//**
342 @short return a reference to a static mutex
343 @descr These class is partially threadsafe (for de-/initialization only).
344 All access methods are'nt safe!
345 We create a static mutex only for one ime and use at different times.
347 @seealso -
349 @param -
350 @return A reference to a static mutex member.
352 @onerror -
353 *//*-*****************************************************************************************************/
354 DECL_STATIC_LINK( AddonsOptions, Notify, void* );
356 //-------------------------------------------------------------------------------------------------------------
357 // private member
358 //-------------------------------------------------------------------------------------------------------------
360 private:
362 /*Attention
364 Don't initialize these static member in these header!
365 a) Double dfined symbols will be detected ...
366 b) and unresolved externals exist at linking time.
367 Do it in your source only.
370 static AddonsOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
371 static sal_Int32 m_nRefCount ; /// internal ref count mechanism
373 }; // class SvtMenuOptions
377 #endif // #ifndef __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_