1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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"
48 struct FWE_DLLPUBLIC MergeMenuInstruction
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
;
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 aMergeContext
;
78 css::uno::Sequence
< css::uno::Sequence
< css::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
103 /*-****************************************************************************************************
104 @short returns if an addons menu is available
105 @descr Call to retrieve if a addons menu is available
107 @return true if there is a menu otherwise false
108 *//*-*****************************************************************************************************/
110 bool HasAddonsMenu() const;
112 /*-****************************************************************************************************
113 @short returns number of addons toolbars
114 @descr Call to retrieve the number of addons toolbars
116 @return number of addons toolbars
117 *//*-*****************************************************************************************************/
118 sal_Int32
GetAddonsToolBarCount() const ;
120 /*-****************************************************************************************************
121 @short returns the complete addons menu
122 @descr Call it to get all entries of the addon menu.
123 We return a list of all nodes with his names and properties.
124 @return A list of menu items is returned.
126 @onerror We return an empty list.
127 *//*-*****************************************************************************************************/
129 const css::uno::Sequence
< css::uno::Sequence
< css::beans::PropertyValue
> >& GetAddonsMenu() const;
131 /*-****************************************************************************************************
132 @short Gets the menu bar part of all addon components registered
135 @onerror We return sal_False
136 *//*-*****************************************************************************************************/
138 const css::uno::Sequence
< css::uno::Sequence
< css::beans::PropertyValue
> >& GetAddonsMenuBarPart() const;
140 /*-****************************************************************************************************
141 @short Gets a toolbar part of an single addon
144 @onerror We return sal_False
145 *//*-*****************************************************************************************************/
147 const css::uno::Sequence
< css::uno::Sequence
< css::beans::PropertyValue
> >& GetAddonsToolBarPart( sal_uInt32 nIndex
) const;
149 /*-****************************************************************************************************
150 @short Gets a unique toolbar resource name of an single addon
153 @onerror We return sal_False
154 *//*-*****************************************************************************************************/
156 const OUString
GetAddonsToolbarResourceName( sal_uInt32 nIndex
) const;
158 /*-****************************************************************************************************
159 @short Retrieves all available merge instructions for the Office menu bar
160 @return The filled MergeMenuDefinitionContaier
162 @onerror We return sal_False
163 *//*-*****************************************************************************************************/
165 const MergeMenuInstructionContainer
& GetMergeMenuInstructions() const;
167 /*-****************************************************************************************************
168 @short Retrieves all available merge instructions for a single toolbar
171 @onerror We return sal_False
172 *//*-*****************************************************************************************************/
173 bool GetMergeToolbarInstructions( const OUString
& rToolbarName
, MergeToolbarInstructionContainer
& rToolbar
) const;
175 /*-****************************************************************************************************
176 @short Gets the Add-On help menu part of all addon components registered
179 @onerror We return sal_False
180 *//*-*****************************************************************************************************/
181 const css::uno::Sequence
< css::uno::Sequence
< css::beans::PropertyValue
> >& GetAddonsHelpMenu() const;
183 const MergeStatusbarInstructionContainer
& GetMergeStatusbarInstructions() const;
185 /*-****************************************************************************************************
186 @short Retrieve an image for a command URL which is defined inside the addon menu configuration
187 @descr Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
188 @return An image which was defined in the configuration for the menu item. The image can be empty
189 no bitmap was defined for the request image properties.
191 @onerror An empty image
192 *//*-*****************************************************************************************************/
194 Image
GetImageFromURL( const OUString
& aURL
, bool bBig
, bool bNoScale
) const;
195 Image
GetImageFromURL( const OUString
& aURL
, bool bBig
) const;
199 /*-****************************************************************************************************
200 @short return a reference to a static mutex
201 @descr These class is partially threadsafe (for de-/initialization only).
202 All access methods are'nt safe!
203 We create a static mutex only for one ime and use at different times.
204 @return A reference to a static mutex member.
205 *//*-*****************************************************************************************************/
207 static ::osl::Mutex
& GetOwnStaticMutex();
210 std::shared_ptr
<AddonsOptions_Impl
> m_pImpl
;
215 #endif // INCLUDED_FRAMEWORK_ADDONSOPTIONS_HXX
217 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */