xref: /AOO41X/main/framework/source/fwe/classes/addonsoptions.cxx (revision bb0b5665bb7e780d37216c70970870c193b44173)
16d739b60SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
36d739b60SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
46d739b60SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
56d739b60SAndrew Rist  * distributed with this work for additional information
66d739b60SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
76d739b60SAndrew Rist  * to you under the Apache License, Version 2.0 (the
86d739b60SAndrew Rist  * "License"); you may not use this file except in compliance
96d739b60SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
116d739b60SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
136d739b60SAndrew Rist  * Unless required by applicable law or agreed to in writing,
146d739b60SAndrew Rist  * software distributed under the License is distributed on an
156d739b60SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
166d739b60SAndrew Rist  * KIND, either express or implied.  See the License for the
176d739b60SAndrew Rist  * specific language governing permissions and limitations
186d739b60SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
206d739b60SAndrew Rist  *************************************************************/
216d739b60SAndrew Rist 
226d739b60SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_framework.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir #include <framework/addonsoptions.hxx>
31cdf0e10cSrcweir #include <unotools/configmgr.hxx>
32cdf0e10cSrcweir #include <unotools/configitem.hxx>
33cdf0e10cSrcweir #include <unotools/ucbstreamhelper.hxx>
34cdf0e10cSrcweir #include <tools/debug.hxx>
35cdf0e10cSrcweir #include <tools/stream.hxx>
36cdf0e10cSrcweir #include <tools/color.hxx>
37cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
38cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
39cdf0e10cSrcweir #include "com/sun/star/util/XMacroExpander.hpp"
40cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp"
41cdf0e10cSrcweir #include "com/sun/star/beans/XPropertySet.hpp"
42cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
43cdf0e10cSrcweir #include <rtl/uri.hxx>
44cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
45cdf0e10cSrcweir #include <vcl/graph.hxx>
46cdf0e10cSrcweir #include <svtools/filter.hxx>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include <hash_map>
49cdf0e10cSrcweir #include <algorithm>
50cdf0e10cSrcweir #include <vector>
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //_________________________________________________________________________________________________________________
53cdf0e10cSrcweir //	namespaces
54cdf0e10cSrcweir //_________________________________________________________________________________________________________________
55cdf0e10cSrcweir 
56cdf0e10cSrcweir using namespace ::std					;
57cdf0e10cSrcweir using namespace ::utl					;
58cdf0e10cSrcweir using namespace ::osl					;
59cdf0e10cSrcweir using namespace ::com::sun::star::uno	;
60cdf0e10cSrcweir using namespace ::com::sun::star::beans	;
61cdf0e10cSrcweir using namespace ::com::sun::star::lang	;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir //_________________________________________________________________________________________________________________
64cdf0e10cSrcweir //	const
65cdf0e10cSrcweir //_________________________________________________________________________________________________________________
66cdf0e10cSrcweir 
67*bb0b5665SAriel Constenla-Haile #define STR_TOOLBARITEMS    "ToolBarItems"
68*bb0b5665SAriel Constenla-Haile 
69cdf0e10cSrcweir #define ROOTNODE_ADDONMENU                              ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Addons"	))
70cdf0e10cSrcweir #define PATHDELIMITER                                   ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"				))
71*bb0b5665SAriel Constenla-Haile #define TOOLBARITEMS									::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(STR_TOOLBARITEMS))
72cdf0e10cSrcweir #define SEPARATOR_URL_STR								"private:separator"
73cdf0e10cSrcweir #define SEPARATOR_URL_LEN								17
74cdf0e10cSrcweir #define SEPARATOR_URL									::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SEPARATOR_URL_STR ))
75cdf0e10cSrcweir 
76cdf0e10cSrcweir #define PROPERTYNAME_URL                                ADDONSMENUITEM_PROPERTYNAME_URL
77cdf0e10cSrcweir #define PROPERTYNAME_TITLE                              ADDONSMENUITEM_PROPERTYNAME_TITLE
78cdf0e10cSrcweir #define PROPERTYNAME_TARGET                             ADDONSMENUITEM_PROPERTYNAME_TARGET
79cdf0e10cSrcweir #define PROPERTYNAME_IMAGEIDENTIFIER                    ADDONSMENUITEM_PROPERTYNAME_IMAGEIDENTIFIER
80cdf0e10cSrcweir #define PROPERTYNAME_CONTEXT							ADDONSMENUITEM_PROPERTYNAME_CONTEXT
81cdf0e10cSrcweir #define PROPERTYNAME_SUBMENU							ADDONSMENUITEM_PROPERTYNAME_SUBMENU
82cdf0e10cSrcweir #define PROPERTYNAME_CONTROLTYPE                        ADDONSMENUITEM_PROPERTYNAME_CONTROLTYPE
83cdf0e10cSrcweir #define PROPERTYNAME_WIDTH                              ADDONSMENUITEM_PROPERTYNAME_WIDTH
84*bb0b5665SAriel Constenla-Haile #define PROPERTYNAME_TOOLBARITEMS                       TOOLBARITEMS
85cdf0e10cSrcweir 
86fdaa53dfSAriel Constenla-Haile #define PROPERTYNAME_ALIGN                              STATUSBARITEM_PROPERTYNAME_ALIGN
87fdaa53dfSAriel Constenla-Haile #define PROPERTYNAME_AUTOSIZE                           STATUSBARITEM_PROPERTYNAME_AUTOSIZE
88fdaa53dfSAriel Constenla-Haile #define PROPERTYNAME_OWNERDRAW                          STATUSBARITEM_PROPERTYNAME_OWNERDRAW
89fdaa53dfSAriel Constenla-Haile 
90cdf0e10cSrcweir #define PROPERTYNAME_IMAGESMALL							::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageSmall" ))
91cdf0e10cSrcweir #define PROPERTYNAME_IMAGEBIG							::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageBig" ))
92cdf0e10cSrcweir #define PROPERTYNAME_IMAGESMALLHC						::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageSmallHC" ))
93cdf0e10cSrcweir #define PROPERTYNAME_IMAGEBIGHC							::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageBigHC" ))
94cdf0e10cSrcweir #define PROPERTYNAME_IMAGESMALL_URL						::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageSmallURL" ))
95cdf0e10cSrcweir #define PROPERTYNAME_IMAGEBIG_URL						::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageBigURL" ))
96cdf0e10cSrcweir #define PROPERTYNAME_IMAGESMALLHC_URL					::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageSmallHCURL" ))
97cdf0e10cSrcweir #define PROPERTYNAME_IMAGEBIGHC_URL						::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageBigHCURL" ))
98cdf0e10cSrcweir 
99cdf0e10cSrcweir #define IMAGES_NODENAME									::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UserDefinedImages" ))
100cdf0e10cSrcweir #define PRIVATE_IMAGE_URL                               ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:image/" ))
101cdf0e10cSrcweir 
102cdf0e10cSrcweir #define PROPERTYNAME_MERGEMENU_MERGEPOINT               ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergePoint" ))
103cdf0e10cSrcweir #define PROPERTYNAME_MERGEMENU_MERGECOMMAND             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeCommand" ))
104cdf0e10cSrcweir #define PROPERTYNAME_MERGEMENU_MERGECOMMANDPARAMETER    ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeCommandParameter" ))
105cdf0e10cSrcweir #define PROPERTYNAME_MERGEMENU_MERGEFALLBACK            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeFallback" ))
106cdf0e10cSrcweir #define PROPERTYNAME_MERGEMENU_MERGECONTEXT             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeContext" ))
107cdf0e10cSrcweir #define PROPERTYNAME_MERGEMENU_MENUITEMS                ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MenuItems" ))
108cdf0e10cSrcweir #define MERGEMENU_MERGEPOINT_SEPARATOR                  '\\'
109cdf0e10cSrcweir 
110cdf0e10cSrcweir #define PROPERTYNAME_MERGETOOLBAR_TOOLBAR               ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeToolBar" ))
111cdf0e10cSrcweir #define PROPERTYNAME_MERGETOOLBAR_MERGEPOINT            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergePoint" ))
112cdf0e10cSrcweir #define PROPERTYNAME_MERGETOOLBAR_MERGECOMMAND          ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeCommand" ))
113cdf0e10cSrcweir #define PROPERTYNAME_MERGETOOLBAR_MERGECOMMANDPARAMETER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeCommandParameter" ))
114cdf0e10cSrcweir #define PROPERTYNAME_MERGETOOLBAR_MERGEFALLBACK         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeFallback" ))
115cdf0e10cSrcweir #define PROPERTYNAME_MERGETOOLBAR_MERGECONTEXT          ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeContext" ))
116*bb0b5665SAriel Constenla-Haile #define PROPERTYNAME_MERGETOOLBAR_TOOLBARITEMS          ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(STR_TOOLBARITEMS ))
117cdf0e10cSrcweir 
118fdaa53dfSAriel Constenla-Haile #define PROPERTYNAME_MERGESTATUSBAR_MERGEPOINT               ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergePoint" ))
119fdaa53dfSAriel Constenla-Haile #define PROPERTYNAME_MERGESTATUSBAR_MERGECOMMAND             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeCommand" ))
120fdaa53dfSAriel Constenla-Haile #define PROPERTYNAME_MERGESTATUSBAR_MERGECOMMANDPARAMETER    ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeCommandParameter" ))
121fdaa53dfSAriel Constenla-Haile #define PROPERTYNAME_MERGESTATUSBAR_MERGEFALLBACK            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeFallback" ))
122fdaa53dfSAriel Constenla-Haile #define PROPERTYNAME_MERGESTATUSBAR_MERGECONTEXT             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MergeContext" ))
123fdaa53dfSAriel Constenla-Haile #define PROPERTYNAME_MERGESTATUSBAR_STATUSBARITEMS           ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StatusBarItems" ))
124fdaa53dfSAriel Constenla-Haile 
125cdf0e10cSrcweir // The following order is mandatory. Please add properties at the end!
126cdf0e10cSrcweir #define INDEX_URL               0
127cdf0e10cSrcweir #define INDEX_TITLE             1
128cdf0e10cSrcweir #define INDEX_IMAGEIDENTIFIER   2
129cdf0e10cSrcweir #define INDEX_TARGET            3
130cdf0e10cSrcweir #define INDEX_CONTEXT           4
131cdf0e10cSrcweir #define INDEX_SUBMENU           5
132cdf0e10cSrcweir #define INDEX_CONTROLTYPE       6
133cdf0e10cSrcweir #define INDEX_WIDTH             7
134fdaa53dfSAriel Constenla-Haile #define INDEX_ALIGN             8
135fdaa53dfSAriel Constenla-Haile #define INDEX_AUTOSIZE          9
136fdaa53dfSAriel Constenla-Haile #define INDEX_OWNERDRAW         10
137*bb0b5665SAriel Constenla-Haile #define INDEX_TOOLBARITEMS      11
138*bb0b5665SAriel Constenla-Haile #define PROPERTYCOUNT_INDEX     12
139cdf0e10cSrcweir 
140cdf0e10cSrcweir // The following order is mandatory. Please add properties at the end!
141cdf0e10cSrcweir #define PROPERTYCOUNT_MENUITEM							6
142cdf0e10cSrcweir #define OFFSET_MENUITEM_URL                             0
143cdf0e10cSrcweir #define OFFSET_MENUITEM_TITLE                           1
144cdf0e10cSrcweir #define OFFSET_MENUITEM_IMAGEIDENTIFIER					2
145cdf0e10cSrcweir #define OFFSET_MENUITEM_TARGET							3
146cdf0e10cSrcweir #define OFFSET_MENUITEM_CONTEXT							4
147cdf0e10cSrcweir #define OFFSET_MENUITEM_SUBMENU							5
148cdf0e10cSrcweir 
149cdf0e10cSrcweir // The following order is mandatory. Please add properties at the end!
150cdf0e10cSrcweir #define PROPERTYCOUNT_POPUPMENU							4
151cdf0e10cSrcweir #define OFFSET_POPUPMENU_TITLE							0
152cdf0e10cSrcweir #define OFFSET_POPUPMENU_CONTEXT						1
153cdf0e10cSrcweir #define OFFSET_POPUPMENU_SUBMENU						2
154cdf0e10cSrcweir #define OFFSET_POPUPMENU_URL							3	// Used for property set
155cdf0e10cSrcweir 
156cdf0e10cSrcweir // The following order is mandatory. Please add properties at the end!
157*bb0b5665SAriel Constenla-Haile #define PROPERTYCOUNT_TOOLBAR                           2
158*bb0b5665SAriel Constenla-Haile #define OFFSET_TOOLBAR_TITLE                            0
159*bb0b5665SAriel Constenla-Haile #define OFFSET_TOOLBAR_TOOLBARITEMS                     1
160*bb0b5665SAriel Constenla-Haile 
161*bb0b5665SAriel Constenla-Haile // The following order is mandatory. Please add properties at the end!
162cdf0e10cSrcweir #define PROPERTYCOUNT_TOOLBARITEM						7
163cdf0e10cSrcweir #define OFFSET_TOOLBARITEM_URL							0
164cdf0e10cSrcweir #define OFFSET_TOOLBARITEM_TITLE						1
165cdf0e10cSrcweir #define OFFSET_TOOLBARITEM_IMAGEIDENTIFIER				2
166cdf0e10cSrcweir #define OFFSET_TOOLBARITEM_TARGET						3
167cdf0e10cSrcweir #define OFFSET_TOOLBARITEM_CONTEXT						4
168cdf0e10cSrcweir #define OFFSET_TOOLBARITEM_CONTROLTYPE                  5
169cdf0e10cSrcweir #define OFFSET_TOOLBARITEM_WIDTH                        6
170cdf0e10cSrcweir 
171cdf0e10cSrcweir // The following order is mandatory. Please add properties at the end!
172fdaa53dfSAriel Constenla-Haile #define PROPERTYCOUNT_STATUSBARITEM                     7
173fdaa53dfSAriel Constenla-Haile #define OFFSET_STATUSBARITEM_URL                        0
174fdaa53dfSAriel Constenla-Haile #define OFFSET_STATUSBARITEM_TITLE                      1
175fdaa53dfSAriel Constenla-Haile #define OFFSET_STATUSBARITEM_CONTEXT                    2
176fdaa53dfSAriel Constenla-Haile #define OFFSET_STATUSBARITEM_ALIGN                      3
177fdaa53dfSAriel Constenla-Haile #define OFFSET_STATUSBARITEM_AUTOSIZE                   4
178fdaa53dfSAriel Constenla-Haile #define OFFSET_STATUSBARITEM_OWNERDRAW                  5
179fdaa53dfSAriel Constenla-Haile #define OFFSET_STATUSBARITEM_WIDTH                      6
180fdaa53dfSAriel Constenla-Haile 
181fdaa53dfSAriel Constenla-Haile 
182fdaa53dfSAriel Constenla-Haile // The following order is mandatory. Please add properties at the end!
183cdf0e10cSrcweir #define PROPERTYCOUNT_IMAGES							8
184cdf0e10cSrcweir #define PROPERTYCOUNT_EMBEDDED_IMAGES                   4
185cdf0e10cSrcweir #define OFFSET_IMAGES_SMALL								0
186cdf0e10cSrcweir #define OFFSET_IMAGES_BIG								1
187cdf0e10cSrcweir #define OFFSET_IMAGES_SMALLHC							2
188cdf0e10cSrcweir #define OFFSET_IMAGES_BIGHC								3
189cdf0e10cSrcweir #define OFFSET_IMAGES_SMALL_URL							4
190cdf0e10cSrcweir #define OFFSET_IMAGES_BIG_URL							5
191cdf0e10cSrcweir #define OFFSET_IMAGES_SMALLHC_URL						6
192cdf0e10cSrcweir #define OFFSET_IMAGES_BIGHC_URL							7
193cdf0e10cSrcweir 
194cdf0e10cSrcweir #define PROPERTYCOUNT_MERGE_MENUBAR                     6
195cdf0e10cSrcweir #define OFFSET_MERGEMENU_MERGEPOINT                     0
196cdf0e10cSrcweir #define OFFSET_MERGEMENU_MERGECOMMAND                   1
197cdf0e10cSrcweir #define OFFSET_MERGEMENU_MERGECOMMANDPARAMETER          2
198cdf0e10cSrcweir #define OFFSET_MERGEMENU_MERGEFALLBACK                  3
199cdf0e10cSrcweir #define OFFSET_MERGEMENU_MERGECONTEXT                   4
200cdf0e10cSrcweir #define OFFSET_MERGEMENU_MENUITEMS                      5
201cdf0e10cSrcweir 
202cdf0e10cSrcweir #define PROPERTYCOUNT_MERGE_TOOLBAR                     7
203cdf0e10cSrcweir #define OFFSET_MERGETOOLBAR_TOOLBAR                     0
204cdf0e10cSrcweir #define OFFSET_MERGETOOLBAR_MERGEPOINT                  1
205cdf0e10cSrcweir #define OFFSET_MERGETOOLBAR_MERGECOMMAND                2
206cdf0e10cSrcweir #define OFFSET_MERGETOOLBAR_MERGECOMMANDPARAMETER       3
207cdf0e10cSrcweir #define OFFSET_MERGETOOLBAR_MERGEFALLBACK               4
208cdf0e10cSrcweir #define OFFSET_MERGETOOLBAR_MERGECONTEXT                5
209cdf0e10cSrcweir #define OFFSET_MERGETOOLBAR_TOOLBARITEMS                6
210cdf0e10cSrcweir 
211fdaa53dfSAriel Constenla-Haile #define PROPERTYCOUNT_MERGE_STATUSBAR                   6
212fdaa53dfSAriel Constenla-Haile #define OFFSET_MERGESTATUSBAR_MERGEPOINT                0
213fdaa53dfSAriel Constenla-Haile #define OFFSET_MERGESTATUSBAR_MERGECOMMAND              1
214fdaa53dfSAriel Constenla-Haile #define OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER     2
215fdaa53dfSAriel Constenla-Haile #define OFFSET_MERGESTATUSBAR_MERGEFALLBACK             3
216fdaa53dfSAriel Constenla-Haile #define OFFSET_MERGESTATUSBAR_MERGECONTEXT              4
217fdaa53dfSAriel Constenla-Haile #define OFFSET_MERGESTATUSBAR_STATUSBARITEMS            5
218fdaa53dfSAriel Constenla-Haile 
219cdf0e10cSrcweir #define EXPAND_PROTOCOL                                 "vnd.sun.star.expand:"
220cdf0e10cSrcweir 
221cdf0e10cSrcweir const Size  aImageSizeSmall( 16, 16 );
222cdf0e10cSrcweir const Size  aImageSizeBig( 26, 26 );
223cdf0e10cSrcweir 
224cdf0e10cSrcweir //_________________________________________________________________________________________________________________
225cdf0e10cSrcweir //	private declarations!
226cdf0e10cSrcweir //_________________________________________________________________________________________________________________
227cdf0e10cSrcweir 
228cdf0e10cSrcweir /*-****************************************************************************************************************
229cdf0e10cSrcweir     @descr  struct to hold information about one menu entry.
230cdf0e10cSrcweir ****************************************************************************************************************-*/
231cdf0e10cSrcweir 
232cdf0e10cSrcweir namespace framework
233cdf0e10cSrcweir {
234cdf0e10cSrcweir 
235cdf0e10cSrcweir class AddonsOptions_Impl : public ConfigItem
236cdf0e10cSrcweir {
237cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
238cdf0e10cSrcweir 	//	public methods
239cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 	public:
242cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
243cdf0e10cSrcweir 		//	constructor / destructor
244cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
245cdf0e10cSrcweir 
246cdf0e10cSrcweir          AddonsOptions_Impl();
247cdf0e10cSrcweir         ~AddonsOptions_Impl();
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
250cdf0e10cSrcweir 		//	overloaded methods of baseclass
251cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 		/*-****************************************************************************************************//**
254cdf0e10cSrcweir 			@short		called for notify of configmanager
255cdf0e10cSrcweir 			@descr		These method is called from the ConfigManager before application ends or from the
256cdf0e10cSrcweir 			 			PropertyChangeListener if the sub tree broadcasts changes. You must update your
257cdf0e10cSrcweir 						internal values.
258cdf0e10cSrcweir 
259cdf0e10cSrcweir 			@seealso	baseclass ConfigItem
260cdf0e10cSrcweir 
261cdf0e10cSrcweir             @param      "lPropertyNames" is the list of properties which should be updated.
262cdf0e10cSrcweir 			@return		-
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 			@onerror	-
265cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
266cdf0e10cSrcweir 
267cdf0e10cSrcweir         virtual void Notify( const Sequence< ::rtl::OUString >& lPropertyNames );
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 		/*-****************************************************************************************************//**
270cdf0e10cSrcweir 			@short		write changes to configuration
271cdf0e10cSrcweir 			@descr		These method writes the changed values into the sub tree
272cdf0e10cSrcweir 						and should always called in our destructor to guarantee consistency of config data.
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 			@seealso	baseclass ConfigItem
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 			@param		-
277cdf0e10cSrcweir 			@return		-
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 			@onerror	-
280cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
281cdf0e10cSrcweir 
282cdf0e10cSrcweir     	virtual void Commit();
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
285cdf0e10cSrcweir 		//	public interface
286cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 		/*-****************************************************************************************************//**
289cdf0e10cSrcweir             @short      base implementation of public interface for "SvtDynamicMenuOptions"!
290cdf0e10cSrcweir             @descr      These class is used as static member of "SvtDynamicMenuOptions" ...
291cdf0e10cSrcweir 						=> The code exist only for one time and isn't duplicated for every instance!
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 			@seealso	-
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 			@param		-
296cdf0e10cSrcweir 			@return		-
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 			@onerror	-
299cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 		sal_Bool										HasAddonsMenu		 () const ;
302cdf0e10cSrcweir 		sal_Bool										HasAddonsHelpMenu	 () const ;
303cdf0e10cSrcweir         sal_Int32                                       GetAddonsToolBarCount() const ;
304cdf0e10cSrcweir         const Sequence< Sequence< PropertyValue > >&	GetAddonsMenu		 () const ;
305cdf0e10cSrcweir 		const Sequence< Sequence< PropertyValue > >&	GetAddonsMenuBarPart () const ;
306cdf0e10cSrcweir         const Sequence< Sequence< PropertyValue > >&	GetAddonsToolBarPart ( sal_uInt32 nIndex ) const ;
307cdf0e10cSrcweir         const ::rtl::OUString                           GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
308*bb0b5665SAriel Constenla-Haile         const ::rtl::OUString                           GetAddonsToolbarUIName( sal_uInt32 nIndex ) const;
309cdf0e10cSrcweir 		const Sequence< Sequence< PropertyValue > >&	GetAddonsHelpMenu	 () const ;
310cdf0e10cSrcweir 		Image											GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast, sal_Bool bNoScale ) const;
311cdf0e10cSrcweir         const MergeMenuInstructionContainer&            GetMergeMenuInstructions() const;
312cdf0e10cSrcweir         bool                                            GetMergeToolbarInstructions( const ::rtl::OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbarInstructions ) const;
313fdaa53dfSAriel Constenla-Haile         const MergeStatusbarInstructionContainer&       GetMergeStatusbarInstructions() const;
314cdf0e10cSrcweir         void                                            ReadConfigurationData();
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
317cdf0e10cSrcweir 	//	private methods
318cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	private:
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 		struct ImageEntry
323cdf0e10cSrcweir 		{
324cdf0e10cSrcweir 			Image	aImageSmall;
325cdf0e10cSrcweir 			Image	aImageBig;
326cdf0e10cSrcweir 			Image	aImageSmallHC;
327cdf0e10cSrcweir 			Image	aImageBigHC;
328cdf0e10cSrcweir 
329cdf0e10cSrcweir             Image   aImageSmallNoScale;
330cdf0e10cSrcweir             Image   aImageBigNoScale;
331cdf0e10cSrcweir             Image   aImageSmallHCNoScale;
332cdf0e10cSrcweir             Image   aImageBigHCNoScale;
333cdf0e10cSrcweir 		};
334cdf0e10cSrcweir 
3355758ad8cSAriel Constenla-Haile 		typedef std::hash_map< ::rtl::OUString, ImageEntry, rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ImageManager;
3365758ad8cSAriel Constenla-Haile         typedef std::hash_map< ::rtl::OUString, sal_uInt32, rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > StringToIndexMap;
337cdf0e10cSrcweir         typedef std::vector< Sequence< Sequence< PropertyValue > > > AddonToolBars;
3385758ad8cSAriel Constenla-Haile         typedef ::std::hash_map< ::rtl::OUString, MergeToolbarInstructionContainer, rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ToolbarMergingInstructions;
339cdf0e10cSrcweir 
340cdf0e10cSrcweir         enum ImageSize
341cdf0e10cSrcweir         {
342cdf0e10cSrcweir             IMGSIZE_SMALL,
343cdf0e10cSrcweir             IMGSIZE_BIG
344cdf0e10cSrcweir         };
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 		/*-****************************************************************************************************//**
347cdf0e10cSrcweir             @short      return list of key names of our configuration management which represent oue module tree
348cdf0e10cSrcweir 			@descr		These methods return the current list of key names! We need it to get needed values from our
349cdf0e10cSrcweir                         configuration management!
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 			@seealso	-
352cdf0e10cSrcweir 
353cdf0e10cSrcweir             @param      "nCount"     ,   returns count of menu entries for "new"
354cdf0e10cSrcweir 			@return		A list of configuration key names is returned.
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 			@onerror	-
357cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 		sal_Bool			 ReadAddonMenuSet( Sequence< Sequence< PropertyValue > >& aAddonMenuSeq );
360cdf0e10cSrcweir 		sal_Bool			 ReadOfficeMenuBarSet( Sequence< Sequence< PropertyValue > >& aAddonOfficeMenuBarSeq );
361*bb0b5665SAriel Constenla-Haile         sal_Bool			 ReadOfficeToolBarSet( AddonToolBars& rAddonOfficeToolBars,
362*bb0b5665SAriel Constenla-Haile                                                    std::vector< rtl::OUString >& rAddonOfficeToolBarResNames,
363*bb0b5665SAriel Constenla-Haile                                                    std::vector< rtl::OUString >& rAddonOfficeToolBarUINames );
364cdf0e10cSrcweir         sal_Bool			 ReadToolBarItemSet( const rtl::OUString rToolBarItemSetNodeName, Sequence< Sequence< PropertyValue > >& aAddonOfficeToolBarSeq );
365cdf0e10cSrcweir 		sal_Bool			 ReadOfficeHelpSet( Sequence< Sequence< PropertyValue > >& aAddonOfficeHelpMenuSeq );
366cdf0e10cSrcweir 		sal_Bool			 ReadImages( ImageManager& aImageManager );
367cdf0e10cSrcweir         sal_Bool             ReadMenuMergeInstructions( MergeMenuInstructionContainer& rContainer );
368cdf0e10cSrcweir         sal_Bool             ReadToolbarMergeInstructions( ToolbarMergingInstructions& rToolbarMergeMap );
369fdaa53dfSAriel Constenla-Haile         sal_Bool             ReadStatusbarMergeInstructions( MergeStatusbarInstructionContainer& rContainer );
370cdf0e10cSrcweir 
371cdf0e10cSrcweir         sal_Bool             ReadMergeMenuData( const ::rtl::OUString& aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeMenu );
372cdf0e10cSrcweir         sal_Bool             ReadMergeToolbarData( const ::rtl::OUString& aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeToolbarItems );
373fdaa53dfSAriel Constenla-Haile         sal_Bool             ReadMergeStatusbarData( const ::rtl::OUString& aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeStatusbar );
374cdf0e10cSrcweir 		sal_Bool			 ReadMenuItem( const ::rtl::OUString& aMenuItemNodeName, Sequence< PropertyValue >& aMenuItem, sal_Bool bIgnoreSubMenu = sal_False );
375cdf0e10cSrcweir 		sal_Bool			 ReadPopupMenu( const ::rtl::OUString& aPopupMenuNodeName, Sequence< PropertyValue >& aPopupMenu );
376cdf0e10cSrcweir         sal_Bool             AppendPopupMenu( Sequence< PropertyValue >& aTargetPopupMenu, const Sequence< PropertyValue >& rSourcePopupMenu );
377cdf0e10cSrcweir 		sal_Bool			 ReadToolBarItem( const ::rtl::OUString& aToolBarItemNodeName, Sequence< PropertyValue >& aToolBarItem );
378fdaa53dfSAriel Constenla-Haile         sal_Bool             ReadStatusBarItem( const ::rtl::OUString& aStatusbarItemNodeName, Sequence< PropertyValue >& aStatusbarItem );
379cdf0e10cSrcweir 		sal_Bool			 ReadImagesItem( const ::rtl::OUString& aImagesItemNodeName, Sequence< PropertyValue >& aImagesItem );
380cdf0e10cSrcweir 		ImageEntry*			 ReadImageData( const ::rtl::OUString& aImagesNodeName );
381cdf0e10cSrcweir 		void                 ReadAndAssociateImages( const ::rtl::OUString& aURL, const ::rtl::OUString& aImageId );
382cdf0e10cSrcweir 		void                 ReadImageFromURL( ImageSize nImageSize, const ::rtl::OUString& aURL, Image& aImage, Image& aNoScaleImage );
383cdf0e10cSrcweir 		sal_Bool             HasAssociatedImages( const ::rtl::OUString& aURL );
384cdf0e10cSrcweir 		void                 SubstituteVariables( ::rtl::OUString& aURL );
385cdf0e10cSrcweir 
386cdf0e10cSrcweir 		sal_Bool			 ReadSubMenuEntries( const Sequence< ::rtl::OUString >& aSubMenuNodeNames, Sequence< Sequence< PropertyValue > >& rSubMenu );
387cdf0e10cSrcweir 		void				 InsertToolBarSeparator( Sequence< Sequence< PropertyValue > >& rAddonOfficeToolBarSeq );
388cdf0e10cSrcweir 		::rtl::OUString			 GeneratePrefixURL();
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 		Sequence< ::rtl::OUString > GetPropertyNamesMergeMenuInstruction( const ::rtl::OUString& aPropertyRootName ) const;
391cdf0e10cSrcweir         Sequence< ::rtl::OUString > GetPropertyNamesMenuItem( const ::rtl::OUString& aPropertyRootNode ) const;
392cdf0e10cSrcweir 		Sequence< ::rtl::OUString > GetPropertyNamesPopupMenu( const ::rtl::OUString& aPropertyRootNode ) const;
393*bb0b5665SAriel Constenla-Haile         Sequence< ::rtl::OUString > GetPropertyNamesToolBar( const ::rtl::OUString& aPropertyRootNode ) const;
394cdf0e10cSrcweir 		Sequence< ::rtl::OUString > GetPropertyNamesToolBarItem( const ::rtl::OUString& aPropertyRootNode ) const;
395fdaa53dfSAriel Constenla-Haile         Sequence< ::rtl::OUString > GetPropertyNamesStatusbarItem( const ::rtl::OUString& aPropertyRootNode ) const;
396cdf0e10cSrcweir 		Sequence< ::rtl::OUString > GetPropertyNamesImages( const ::rtl::OUString& aPropertyRootNode ) const;
397cdf0e10cSrcweir 		sal_Bool			 CreateImageFromSequence( Image& rImage, sal_Bool bBig, Sequence< sal_Int8 >& rBitmapDataSeq ) const;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
400cdf0e10cSrcweir 	//	private member
401cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 	private:
404cdf0e10cSrcweir 		ImageEntry*	ReadOptionalImageData( const ::rtl::OUString& aMenuNodeName );
405cdf0e10cSrcweir 
406cdf0e10cSrcweir 		sal_Int32                                         m_nRootAddonPopupMenuId;
407cdf0e10cSrcweir 		::rtl::OUString                                          m_aPropNames[PROPERTYCOUNT_INDEX];
408cdf0e10cSrcweir 		::rtl::OUString                                          m_aPropImagesNames[PROPERTYCOUNT_IMAGES];
409cdf0e10cSrcweir         ::rtl::OUString                                          m_aPropMergeMenuNames[PROPERTYCOUNT_MERGE_MENUBAR];
410cdf0e10cSrcweir         ::rtl::OUString                                          m_aPropMergeToolbarNames[PROPERTYCOUNT_MERGE_TOOLBAR];
411fdaa53dfSAriel Constenla-Haile         ::rtl::OUString                                          m_aPropMergeStatusbarNames[PROPERTYCOUNT_MERGE_STATUSBAR];
412cdf0e10cSrcweir 		::rtl::OUString                                          m_aEmpty;
413cdf0e10cSrcweir 		::rtl::OUString                                          m_aPathDelimiter;
414cdf0e10cSrcweir 		::rtl::OUString                                          m_aSeparator;
415cdf0e10cSrcweir 		::rtl::OUString                                          m_aRootAddonPopupMenuURLPrexfix;
416cdf0e10cSrcweir 		::rtl::OUString                                          m_aPrivateImageURL;
417cdf0e10cSrcweir 		Sequence< Sequence< PropertyValue > >             m_aCachedMenuProperties;
418cdf0e10cSrcweir 		Sequence< Sequence< PropertyValue > >             m_aCachedMenuBarPartProperties;
419cdf0e10cSrcweir         AddonToolBars                                     m_aCachedToolBarPartProperties;
420cdf0e10cSrcweir         std::vector< rtl::OUString >                      m_aCachedToolBarPartResourceNames;
421*bb0b5665SAriel Constenla-Haile         std::vector< rtl::OUString >                      m_aCachedToolBarPartUINames;
422cdf0e10cSrcweir 		Sequence< Sequence< PropertyValue > >             m_aCachedHelpMenuProperties;
423cdf0e10cSrcweir 		Reference< com::sun::star::util::XMacroExpander > m_xMacroExpander;
424cdf0e10cSrcweir 		ImageManager                                      m_aImageManager;
425cdf0e10cSrcweir         Sequence< Sequence< PropertyValue > >             m_aEmptyAddonToolBar;
426cdf0e10cSrcweir         MergeMenuInstructionContainer                     m_aCachedMergeMenuInsContainer;
427cdf0e10cSrcweir         ToolbarMergingInstructions                        m_aCachedToolbarMergingInstructions;
428fdaa53dfSAriel Constenla-Haile         MergeStatusbarInstructionContainer                m_aCachedStatusbarMergingInstructions;
429cdf0e10cSrcweir };
430cdf0e10cSrcweir 
431cdf0e10cSrcweir //_________________________________________________________________________________________________________________
432cdf0e10cSrcweir //	definitions
433cdf0e10cSrcweir //_________________________________________________________________________________________________________________
434cdf0e10cSrcweir 
435cdf0e10cSrcweir //*****************************************************************************************************************
436cdf0e10cSrcweir //	constructor
437cdf0e10cSrcweir //*****************************************************************************************************************
438cdf0e10cSrcweir AddonsOptions_Impl::AddonsOptions_Impl()
439cdf0e10cSrcweir     // Init baseclasses first
440cdf0e10cSrcweir     : ConfigItem( ROOTNODE_ADDONMENU ),
441cdf0e10cSrcweir 	m_nRootAddonPopupMenuId( 0 ),
442cdf0e10cSrcweir 	m_aPathDelimiter( PATHDELIMITER ),
443cdf0e10cSrcweir 	m_aSeparator( SEPARATOR_URL ),
444cdf0e10cSrcweir 	m_aRootAddonPopupMenuURLPrexfix( ADDONSPOPUPMENU_URL_PREFIX ),
445cdf0e10cSrcweir 	m_aPrivateImageURL( PRIVATE_IMAGE_URL )
446cdf0e10cSrcweir {
447cdf0e10cSrcweir 	// initialize array with fixed property names
448cdf0e10cSrcweir 	m_aPropNames[ INDEX_URL				] = PROPERTYNAME_URL;
449cdf0e10cSrcweir 	m_aPropNames[ INDEX_TITLE			] = PROPERTYNAME_TITLE;
450cdf0e10cSrcweir 	m_aPropNames[ INDEX_TARGET			] = PROPERTYNAME_TARGET;
451cdf0e10cSrcweir 	m_aPropNames[ INDEX_IMAGEIDENTIFIER	] = PROPERTYNAME_IMAGEIDENTIFIER;
452cdf0e10cSrcweir 	m_aPropNames[ INDEX_CONTEXT			] = PROPERTYNAME_CONTEXT;
453cdf0e10cSrcweir 	m_aPropNames[ INDEX_SUBMENU			] = PROPERTYNAME_SUBMENU; // Submenu set!
454cdf0e10cSrcweir     m_aPropNames[ INDEX_CONTROLTYPE     ] = PROPERTYNAME_CONTROLTYPE;
455cdf0e10cSrcweir     m_aPropNames[ INDEX_WIDTH           ] = PROPERTYNAME_WIDTH;
456fdaa53dfSAriel Constenla-Haile     m_aPropNames[ INDEX_ALIGN           ] = PROPERTYNAME_ALIGN;
457fdaa53dfSAriel Constenla-Haile     m_aPropNames[ INDEX_AUTOSIZE        ] = PROPERTYNAME_AUTOSIZE;
458fdaa53dfSAriel Constenla-Haile     m_aPropNames[ INDEX_OWNERDRAW       ] = PROPERTYNAME_OWNERDRAW;
459*bb0b5665SAriel Constenla-Haile     m_aPropNames[ INDEX_TOOLBARITEMS    ] = PROPERTYNAME_TOOLBARITEMS;
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 	// initialize array with fixed images property names
462cdf0e10cSrcweir 	m_aPropImagesNames[ OFFSET_IMAGES_SMALL			] = PROPERTYNAME_IMAGESMALL;
463cdf0e10cSrcweir 	m_aPropImagesNames[ OFFSET_IMAGES_BIG			] = PROPERTYNAME_IMAGEBIG;
464cdf0e10cSrcweir 	m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC		] = PROPERTYNAME_IMAGESMALLHC;
465cdf0e10cSrcweir 	m_aPropImagesNames[ OFFSET_IMAGES_BIGHC			] = PROPERTYNAME_IMAGEBIGHC;
466cdf0e10cSrcweir 	m_aPropImagesNames[ OFFSET_IMAGES_SMALL_URL		] = PROPERTYNAME_IMAGESMALL_URL;
467cdf0e10cSrcweir 	m_aPropImagesNames[ OFFSET_IMAGES_BIG_URL	    ] = PROPERTYNAME_IMAGEBIG_URL;
468cdf0e10cSrcweir 	m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC_URL	] = PROPERTYNAME_IMAGESMALLHC_URL;
469cdf0e10cSrcweir 	m_aPropImagesNames[ OFFSET_IMAGES_BIGHC_URL		] = PROPERTYNAME_IMAGEBIGHC_URL;
470cdf0e10cSrcweir 
471cdf0e10cSrcweir     // initialize array with fixed merge menu property names
472cdf0e10cSrcweir     m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEPOINT    ] = PROPERTYNAME_MERGEMENU_MERGEPOINT;
473cdf0e10cSrcweir     m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMAND  ] = PROPERTYNAME_MERGEMENU_MERGECOMMAND;
474cdf0e10cSrcweir     m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ] = PROPERTYNAME_MERGEMENU_MERGECOMMANDPARAMETER;
475cdf0e10cSrcweir     m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEFALLBACK ] = PROPERTYNAME_MERGEMENU_MERGEFALLBACK;
476cdf0e10cSrcweir     m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECONTEXT  ] = PROPERTYNAME_MERGEMENU_MERGECONTEXT;
477cdf0e10cSrcweir     m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MENUITEMS     ] = PROPERTYNAME_MERGEMENU_MENUITEMS;
478cdf0e10cSrcweir 
479cdf0e10cSrcweir     m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBAR               ] = PROPERTYNAME_MERGETOOLBAR_TOOLBAR;
480cdf0e10cSrcweir     m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEPOINT            ] = PROPERTYNAME_MERGETOOLBAR_MERGEPOINT;
481cdf0e10cSrcweir     m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMAND          ] = PROPERTYNAME_MERGETOOLBAR_MERGECOMMAND;
482cdf0e10cSrcweir     m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMANDPARAMETER ] = PROPERTYNAME_MERGETOOLBAR_MERGECOMMANDPARAMETER;
483cdf0e10cSrcweir     m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEFALLBACK         ] = PROPERTYNAME_MERGETOOLBAR_MERGEFALLBACK;
484cdf0e10cSrcweir     m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT          ] = PROPERTYNAME_MERGETOOLBAR_MERGECONTEXT;
485cdf0e10cSrcweir     m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBARITEMS          ] = PROPERTYNAME_MERGETOOLBAR_TOOLBARITEMS;
486cdf0e10cSrcweir 
487fdaa53dfSAriel Constenla-Haile     m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_MERGEPOINT            ] = PROPERTYNAME_MERGESTATUSBAR_MERGEPOINT;
488fdaa53dfSAriel Constenla-Haile     m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_MERGECOMMAND          ] = PROPERTYNAME_MERGESTATUSBAR_MERGECOMMAND;
489fdaa53dfSAriel Constenla-Haile     m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER ] = PROPERTYNAME_MERGESTATUSBAR_MERGECOMMANDPARAMETER;
490fdaa53dfSAriel Constenla-Haile     m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_MERGEFALLBACK         ] = PROPERTYNAME_MERGESTATUSBAR_MERGEFALLBACK;
491fdaa53dfSAriel Constenla-Haile     m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_MERGECONTEXT          ] = PROPERTYNAME_MERGESTATUSBAR_MERGECONTEXT;
492fdaa53dfSAriel Constenla-Haile     m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_STATUSBARITEMS        ] = PROPERTYNAME_MERGESTATUSBAR_STATUSBARITEMS;
493fdaa53dfSAriel Constenla-Haile 
494cdf0e10cSrcweir     Reference< XComponentContext > xContext;
495cdf0e10cSrcweir     Reference< com::sun::star::beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
496cdf0e10cSrcweir     xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
497cdf0e10cSrcweir     if ( xContext.is() )
498cdf0e10cSrcweir     {
499cdf0e10cSrcweir         m_xMacroExpander =  Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
500cdf0e10cSrcweir                                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
501cdf0e10cSrcweir                                 UNO_QUERY );
502cdf0e10cSrcweir     }
503cdf0e10cSrcweir 
504cdf0e10cSrcweir     ReadConfigurationData();
505cdf0e10cSrcweir 
506cdf0e10cSrcweir     // Enable notification mechanism of ouer baseclass.
507cdf0e10cSrcweir 	// We need it to get information about changes outside these class on ouer used configuration keys!
508cdf0e10cSrcweir     Sequence< rtl::OUString > aNotifySeq( 1 );
509cdf0e10cSrcweir     aNotifySeq[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AddonUI" ));
510cdf0e10cSrcweir     EnableNotification( aNotifySeq );
511cdf0e10cSrcweir }
512cdf0e10cSrcweir 
513cdf0e10cSrcweir //*****************************************************************************************************************
514cdf0e10cSrcweir //	destructor
515cdf0e10cSrcweir //*****************************************************************************************************************
516cdf0e10cSrcweir AddonsOptions_Impl::~AddonsOptions_Impl()
517cdf0e10cSrcweir {
518cdf0e10cSrcweir 	// We must save our current values .. if user forget it!
519cdf0e10cSrcweir 	if( IsModified() == sal_True )
520cdf0e10cSrcweir 	{
521cdf0e10cSrcweir 		Commit();
522cdf0e10cSrcweir 	}
523cdf0e10cSrcweir }
524cdf0e10cSrcweir 
525cdf0e10cSrcweir void AddonsOptions_Impl::ReadConfigurationData()
526cdf0e10cSrcweir {
527cdf0e10cSrcweir     // reset members to be read again from configuration
528cdf0e10cSrcweir     m_aCachedMenuProperties = Sequence< Sequence< PropertyValue > >();
529cdf0e10cSrcweir     m_aCachedMenuBarPartProperties = Sequence< Sequence< PropertyValue > >();
530cdf0e10cSrcweir     m_aCachedToolBarPartProperties = AddonToolBars();
531cdf0e10cSrcweir     m_aCachedHelpMenuProperties = Sequence< Sequence< PropertyValue > >();
532cdf0e10cSrcweir     m_aCachedToolBarPartResourceNames.clear();
533*bb0b5665SAriel Constenla-Haile     m_aCachedToolBarPartUINames.clear();
534cdf0e10cSrcweir     m_aImageManager = ImageManager();
535cdf0e10cSrcweir 
536cdf0e10cSrcweir     ReadAddonMenuSet( m_aCachedMenuProperties );
537cdf0e10cSrcweir 	ReadOfficeMenuBarSet( m_aCachedMenuBarPartProperties );
538*bb0b5665SAriel Constenla-Haile 	ReadOfficeToolBarSet( m_aCachedToolBarPartProperties,
539*bb0b5665SAriel Constenla-Haile                           m_aCachedToolBarPartResourceNames,
540*bb0b5665SAriel Constenla-Haile                           m_aCachedToolBarPartUINames );
541fdaa53dfSAriel Constenla-Haile 
542cdf0e10cSrcweir 	ReadOfficeHelpSet( m_aCachedHelpMenuProperties );
543cdf0e10cSrcweir 	ReadImages( m_aImageManager );
544cdf0e10cSrcweir 
545cdf0e10cSrcweir     m_aCachedMergeMenuInsContainer.clear();
546cdf0e10cSrcweir     m_aCachedToolbarMergingInstructions.clear();
547fdaa53dfSAriel Constenla-Haile     m_aCachedStatusbarMergingInstructions.clear();
548cdf0e10cSrcweir 
549cdf0e10cSrcweir     ReadMenuMergeInstructions( m_aCachedMergeMenuInsContainer );
550cdf0e10cSrcweir     ReadToolbarMergeInstructions( m_aCachedToolbarMergingInstructions );
551fdaa53dfSAriel Constenla-Haile     ReadStatusbarMergeInstructions( m_aCachedStatusbarMergingInstructions );
552cdf0e10cSrcweir }
553cdf0e10cSrcweir 
554cdf0e10cSrcweir //*****************************************************************************************************************
555cdf0e10cSrcweir //	public method
556cdf0e10cSrcweir //*****************************************************************************************************************
557cdf0e10cSrcweir void AddonsOptions_Impl::Notify( const Sequence< ::rtl::OUString >& /*lPropertyNames*/ )
558cdf0e10cSrcweir {
559cdf0e10cSrcweir     Application::PostUserEvent( STATIC_LINK( 0, AddonsOptions, Notify ) );
560cdf0e10cSrcweir }
561cdf0e10cSrcweir 
562cdf0e10cSrcweir //*****************************************************************************************************************
563cdf0e10cSrcweir //	public method
564cdf0e10cSrcweir //*****************************************************************************************************************
565cdf0e10cSrcweir void AddonsOptions_Impl::Commit()
566cdf0e10cSrcweir {
567cdf0e10cSrcweir     DBG_ERROR( "AddonsOptions_Impl::Commit()\nNot implemented yet!\n" );
568cdf0e10cSrcweir }
569cdf0e10cSrcweir 
570cdf0e10cSrcweir //*****************************************************************************************************************
571cdf0e10cSrcweir //	public method
572cdf0e10cSrcweir //*****************************************************************************************************************
573cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::HasAddonsMenu() const
574cdf0e10cSrcweir {
575cdf0e10cSrcweir 	return ( m_aCachedMenuProperties.getLength() > 0 );
576cdf0e10cSrcweir }
577cdf0e10cSrcweir 
578cdf0e10cSrcweir //*****************************************************************************************************************
579cdf0e10cSrcweir //	public method
580cdf0e10cSrcweir //*****************************************************************************************************************
581cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::HasAddonsHelpMenu	() const
582cdf0e10cSrcweir {
583cdf0e10cSrcweir 	return ( m_aCachedHelpMenuProperties.getLength() > 0 );
584cdf0e10cSrcweir }
585cdf0e10cSrcweir 
586cdf0e10cSrcweir //*****************************************************************************************************************
587cdf0e10cSrcweir //	public method
588cdf0e10cSrcweir //*****************************************************************************************************************
589cdf0e10cSrcweir sal_Int32 AddonsOptions_Impl::GetAddonsToolBarCount() const
590cdf0e10cSrcweir {
591cdf0e10cSrcweir     return m_aCachedToolBarPartProperties.size();
592cdf0e10cSrcweir }
593cdf0e10cSrcweir 
594cdf0e10cSrcweir //*****************************************************************************************************************
595cdf0e10cSrcweir //	public method
596cdf0e10cSrcweir //*****************************************************************************************************************
597cdf0e10cSrcweir const Sequence< Sequence< PropertyValue > >& AddonsOptions_Impl::GetAddonsMenu() const
598cdf0e10cSrcweir {
599cdf0e10cSrcweir 	return m_aCachedMenuProperties;
600cdf0e10cSrcweir }
601cdf0e10cSrcweir 
602cdf0e10cSrcweir //*****************************************************************************************************************
603cdf0e10cSrcweir //	public method
604cdf0e10cSrcweir //*****************************************************************************************************************
605cdf0e10cSrcweir const Sequence< Sequence< PropertyValue > >& AddonsOptions_Impl::GetAddonsMenuBarPart() const
606cdf0e10cSrcweir {
607cdf0e10cSrcweir 	return m_aCachedMenuBarPartProperties;
608cdf0e10cSrcweir }
609cdf0e10cSrcweir 
610cdf0e10cSrcweir //*****************************************************************************************************************
611cdf0e10cSrcweir //	public method
612cdf0e10cSrcweir //*****************************************************************************************************************
613cdf0e10cSrcweir const Sequence< Sequence< PropertyValue > >& AddonsOptions_Impl::GetAddonsToolBarPart( sal_uInt32 nIndex ) const
614cdf0e10cSrcweir {
615cdf0e10cSrcweir     if ( /*nIndex >= 0 &&*/ nIndex < m_aCachedToolBarPartProperties.size() )
616cdf0e10cSrcweir         return m_aCachedToolBarPartProperties[nIndex];
617cdf0e10cSrcweir     else
618cdf0e10cSrcweir         return m_aEmptyAddonToolBar;
619cdf0e10cSrcweir }
620cdf0e10cSrcweir 
621cdf0e10cSrcweir //*****************************************************************************************************************
622cdf0e10cSrcweir //	public method
623cdf0e10cSrcweir //*****************************************************************************************************************
624cdf0e10cSrcweir const ::rtl::OUString AddonsOptions_Impl::GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const
625cdf0e10cSrcweir {
626cdf0e10cSrcweir     if ( nIndex < m_aCachedToolBarPartResourceNames.size() )
627cdf0e10cSrcweir         return m_aCachedToolBarPartResourceNames[nIndex];
628cdf0e10cSrcweir     else
629cdf0e10cSrcweir         return rtl::OUString();
630cdf0e10cSrcweir }
631cdf0e10cSrcweir 
632*bb0b5665SAriel Constenla-Haile 
633*bb0b5665SAriel Constenla-Haile const ::rtl::OUString AddonsOptions_Impl::GetAddonsToolbarUIName( sal_uInt32 nIndex ) const
634*bb0b5665SAriel Constenla-Haile {
635*bb0b5665SAriel Constenla-Haile     if ( nIndex < m_aCachedToolBarPartUINames.size() )
636*bb0b5665SAriel Constenla-Haile         return m_aCachedToolBarPartUINames[nIndex];
637*bb0b5665SAriel Constenla-Haile     else
638*bb0b5665SAriel Constenla-Haile         return rtl::OUString();
639*bb0b5665SAriel Constenla-Haile }
640*bb0b5665SAriel Constenla-Haile 
641cdf0e10cSrcweir //*****************************************************************************************************************
642cdf0e10cSrcweir //	public method
643cdf0e10cSrcweir //*****************************************************************************************************************
644cdf0e10cSrcweir const Sequence< Sequence< PropertyValue > >& AddonsOptions_Impl::GetAddonsHelpMenu	() const
645cdf0e10cSrcweir {
646cdf0e10cSrcweir 	return m_aCachedHelpMenuProperties;
647cdf0e10cSrcweir }
648cdf0e10cSrcweir 
649cdf0e10cSrcweir //*****************************************************************************************************************
650cdf0e10cSrcweir //	public method
651cdf0e10cSrcweir //*****************************************************************************************************************
652cdf0e10cSrcweir const MergeMenuInstructionContainer& AddonsOptions_Impl::GetMergeMenuInstructions() const
653cdf0e10cSrcweir {
654cdf0e10cSrcweir     return m_aCachedMergeMenuInsContainer;
655cdf0e10cSrcweir }
656cdf0e10cSrcweir 
657cdf0e10cSrcweir //*****************************************************************************************************************
658cdf0e10cSrcweir //	public method
659cdf0e10cSrcweir //*****************************************************************************************************************
660cdf0e10cSrcweir bool AddonsOptions_Impl::GetMergeToolbarInstructions(
661cdf0e10cSrcweir     const ::rtl::OUString& rToolbarName,
662cdf0e10cSrcweir     MergeToolbarInstructionContainer& rToolbarInstructions ) const
663cdf0e10cSrcweir {
664cdf0e10cSrcweir     ToolbarMergingInstructions::const_iterator pIter = m_aCachedToolbarMergingInstructions.find( rToolbarName );
665cdf0e10cSrcweir     if ( pIter != m_aCachedToolbarMergingInstructions.end() )
666cdf0e10cSrcweir     {
667cdf0e10cSrcweir         rToolbarInstructions = pIter->second;
668cdf0e10cSrcweir         return true;
669cdf0e10cSrcweir     }
670cdf0e10cSrcweir     else
671cdf0e10cSrcweir         return false;
672cdf0e10cSrcweir }
673cdf0e10cSrcweir 
674fdaa53dfSAriel Constenla-Haile const MergeStatusbarInstructionContainer& AddonsOptions_Impl::GetMergeStatusbarInstructions() const
675fdaa53dfSAriel Constenla-Haile {
676fdaa53dfSAriel Constenla-Haile     return m_aCachedStatusbarMergingInstructions;
677fdaa53dfSAriel Constenla-Haile }
678fdaa53dfSAriel Constenla-Haile 
679cdf0e10cSrcweir //*****************************************************************************************************************
680cdf0e10cSrcweir //	public method
681cdf0e10cSrcweir //*****************************************************************************************************************
682cdf0e10cSrcweir Image AddonsOptions_Impl::GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast, sal_Bool bNoScale ) const
683cdf0e10cSrcweir {
684cdf0e10cSrcweir 	Image aImage;
685cdf0e10cSrcweir 
686cdf0e10cSrcweir 	ImageManager::const_iterator pIter = m_aImageManager.find( aURL );
687cdf0e10cSrcweir 	if ( pIter != m_aImageManager.end() )
688cdf0e10cSrcweir 	{
689cdf0e10cSrcweir 		if ( !bHiContrast  )
690cdf0e10cSrcweir         {
691cdf0e10cSrcweir 			if ( bNoScale )
692cdf0e10cSrcweir                 aImage = ( bBig ? pIter->second.aImageBigNoScale : pIter->second.aImageSmallNoScale );
693cdf0e10cSrcweir             if ( !aImage )
694cdf0e10cSrcweir                 aImage = ( bBig ? pIter->second.aImageBig : pIter->second.aImageSmall );
695cdf0e10cSrcweir         }
696cdf0e10cSrcweir 		else
697cdf0e10cSrcweir         {
698cdf0e10cSrcweir 			if ( bNoScale )
699cdf0e10cSrcweir                 aImage = ( bBig ? pIter->second.aImageBigHCNoScale : pIter->second.aImageSmallHCNoScale );
700cdf0e10cSrcweir             if ( !aImage )
701cdf0e10cSrcweir 			    aImage = ( bBig ? pIter->second.aImageBigHC : pIter->second.aImageSmallHC );
702cdf0e10cSrcweir         }
703cdf0e10cSrcweir 	}
704cdf0e10cSrcweir 
705cdf0e10cSrcweir 	return aImage;
706cdf0e10cSrcweir }
707cdf0e10cSrcweir 
708cdf0e10cSrcweir //*****************************************************************************************************************
709cdf0e10cSrcweir //	private method
710cdf0e10cSrcweir //*****************************************************************************************************************
711cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadAddonMenuSet( Sequence< Sequence< PropertyValue > >& rAddonMenuSeq )
712cdf0e10cSrcweir {
713cdf0e10cSrcweir 	// Read the AddonMenu set and fill property sequences
714cdf0e10cSrcweir 	::rtl::OUString				aAddonMenuNodeName( RTL_CONSTASCII_USTRINGPARAM( "AddonUI/AddonMenu" ));
715cdf0e10cSrcweir 	Sequence< ::rtl::OUString >	aAddonMenuNodeSeq = GetNodeNames( aAddonMenuNodeName );
716cdf0e10cSrcweir 	::rtl::OUString				aAddonMenuItemNode( aAddonMenuNodeName + m_aPathDelimiter );
717cdf0e10cSrcweir 
718cdf0e10cSrcweir 	sal_uInt32				nCount = aAddonMenuNodeSeq.getLength();
719cdf0e10cSrcweir 	sal_uInt32				nIndex = 0;
720cdf0e10cSrcweir 	Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM );
721cdf0e10cSrcweir 
722cdf0e10cSrcweir 	// Init the property value sequence
723cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_URL				].Name = m_aPropNames[ INDEX_URL			];
724cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_TITLE			].Name = m_aPropNames[ INDEX_TITLE			];
725cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_TARGET			].Name = m_aPropNames[ INDEX_TARGET			];
726cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER	].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
727cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_CONTEXT			].Name = m_aPropNames[ INDEX_CONTEXT		];
728cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_SUBMENU			].Name = m_aPropNames[ INDEX_SUBMENU		];	// Submenu set!
729cdf0e10cSrcweir 
730cdf0e10cSrcweir 	for ( sal_uInt32 n = 0; n < nCount; n++ )
731cdf0e10cSrcweir 	{
732cdf0e10cSrcweir 		::rtl::OUString aRootMenuItemNode( aAddonMenuItemNode + aAddonMenuNodeSeq[n] );
733cdf0e10cSrcweir 
734cdf0e10cSrcweir 		// Read the MenuItem
735cdf0e10cSrcweir 		if ( ReadMenuItem( aRootMenuItemNode, aMenuItem ) )
736cdf0e10cSrcweir 		{
737cdf0e10cSrcweir 			// Successfully read a menu item, append to our list
738cdf0e10cSrcweir 			sal_uInt32 nMenuItemCount = rAddonMenuSeq.getLength() + 1;
739cdf0e10cSrcweir 			rAddonMenuSeq.realloc( nMenuItemCount );
740cdf0e10cSrcweir 			rAddonMenuSeq[nIndex++] = aMenuItem;
741cdf0e10cSrcweir 		}
742cdf0e10cSrcweir 	}
743cdf0e10cSrcweir 
744cdf0e10cSrcweir 	return ( rAddonMenuSeq.getLength() > 0 );
745cdf0e10cSrcweir }
746cdf0e10cSrcweir 
747cdf0e10cSrcweir //*****************************************************************************************************************
748cdf0e10cSrcweir //	private method
749cdf0e10cSrcweir //*****************************************************************************************************************
750cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadOfficeHelpSet( Sequence< Sequence< PropertyValue > >& rAddonOfficeHelpMenuSeq )
751cdf0e10cSrcweir {
752cdf0e10cSrcweir 	// Read the AddonMenu set and fill property sequences
753cdf0e10cSrcweir 	::rtl::OUString				aAddonHelpMenuNodeName( RTL_CONSTASCII_USTRINGPARAM( "AddonUI/OfficeHelp" ));
754cdf0e10cSrcweir 	Sequence< ::rtl::OUString >	aAddonHelpMenuNodeSeq = GetNodeNames( aAddonHelpMenuNodeName );
755cdf0e10cSrcweir 	::rtl::OUString				aAddonHelpMenuItemNode( aAddonHelpMenuNodeName + m_aPathDelimiter );
756cdf0e10cSrcweir 
757cdf0e10cSrcweir 	sal_uInt32				nCount = aAddonHelpMenuNodeSeq.getLength();
758cdf0e10cSrcweir 	sal_uInt32				nIndex = 0;
759cdf0e10cSrcweir 	Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM );
760cdf0e10cSrcweir 
761cdf0e10cSrcweir 	// Init the property value sequence
762cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_URL				].Name = m_aPropNames[ INDEX_URL			];
763cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_TITLE			].Name = m_aPropNames[ INDEX_TITLE			];
764cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_TARGET			].Name = m_aPropNames[ INDEX_TARGET			];
765cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER	].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
766cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_CONTEXT			].Name = m_aPropNames[ INDEX_CONTEXT		];
767cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_SUBMENU			].Name = m_aPropNames[ INDEX_SUBMENU		];	// Submenu set!
768cdf0e10cSrcweir 
769cdf0e10cSrcweir 	for ( sal_uInt32 n = 0; n < nCount; n++ )
770cdf0e10cSrcweir 	{
771cdf0e10cSrcweir 		::rtl::OUString aRootMenuItemNode( aAddonHelpMenuItemNode + aAddonHelpMenuNodeSeq[n] );
772cdf0e10cSrcweir 
773cdf0e10cSrcweir 		// Read the MenuItem
774cdf0e10cSrcweir 		if ( ReadMenuItem( aRootMenuItemNode, aMenuItem, sal_True ) )
775cdf0e10cSrcweir 		{
776cdf0e10cSrcweir 			// Successfully read a menu item, append to our list
777cdf0e10cSrcweir 			sal_uInt32 nMenuItemCount = rAddonOfficeHelpMenuSeq.getLength() + 1;
778cdf0e10cSrcweir 			rAddonOfficeHelpMenuSeq.realloc( nMenuItemCount );
779cdf0e10cSrcweir 			rAddonOfficeHelpMenuSeq[nIndex++] = aMenuItem;
780cdf0e10cSrcweir 		}
781cdf0e10cSrcweir 	}
782cdf0e10cSrcweir 
783cdf0e10cSrcweir 	return ( rAddonOfficeHelpMenuSeq.getLength() > 0 );
784cdf0e10cSrcweir }
785cdf0e10cSrcweir 
786cdf0e10cSrcweir //*****************************************************************************************************************
787cdf0e10cSrcweir //	private method
788cdf0e10cSrcweir //*****************************************************************************************************************
789cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadOfficeMenuBarSet( Sequence< Sequence< PropertyValue > >& rAddonOfficeMenuBarSeq )
790cdf0e10cSrcweir {
791cdf0e10cSrcweir 	// Read the OfficeMenuBar set and fill property sequences
792cdf0e10cSrcweir 	::rtl::OUString				aAddonMenuBarNodeName( RTL_CONSTASCII_USTRINGPARAM( "AddonUI/OfficeMenuBar" ));
793cdf0e10cSrcweir 	Sequence< ::rtl::OUString >	aAddonMenuBarNodeSeq = GetNodeNames( aAddonMenuBarNodeName );
794cdf0e10cSrcweir 	::rtl::OUString				aAddonMenuBarNode( aAddonMenuBarNodeName + m_aPathDelimiter );
795cdf0e10cSrcweir 
796cdf0e10cSrcweir 	sal_uInt32				nCount = aAddonMenuBarNodeSeq.getLength();
797cdf0e10cSrcweir 	sal_uInt32				nIndex = 0;
798cdf0e10cSrcweir 	Sequence< PropertyValue > aPopupMenu( PROPERTYCOUNT_POPUPMENU );
799cdf0e10cSrcweir 
800cdf0e10cSrcweir 	// Init the property value sequence
801cdf0e10cSrcweir 	aPopupMenu[ OFFSET_POPUPMENU_TITLE		].Name = m_aPropNames[ INDEX_TITLE	];
802cdf0e10cSrcweir 	aPopupMenu[ OFFSET_POPUPMENU_CONTEXT	].Name = m_aPropNames[ INDEX_CONTEXT];
803cdf0e10cSrcweir 	aPopupMenu[ OFFSET_POPUPMENU_SUBMENU	].Name = m_aPropNames[ INDEX_SUBMENU];
804cdf0e10cSrcweir 	aPopupMenu[ OFFSET_POPUPMENU_URL		].Name = m_aPropNames[ INDEX_URL	];
805cdf0e10cSrcweir 
806cdf0e10cSrcweir     StringToIndexMap aTitleToIndexMap;
807cdf0e10cSrcweir 
808cdf0e10cSrcweir     for ( sal_uInt32 n = 0; n < nCount; n++ )
809cdf0e10cSrcweir 	{
810cdf0e10cSrcweir 		::rtl::OUString aPopupMenuNode( aAddonMenuBarNode + aAddonMenuBarNodeSeq[n] );
811cdf0e10cSrcweir 
812cdf0e10cSrcweir 		// Read the MenuItem
813cdf0e10cSrcweir 		if ( ReadPopupMenu( aPopupMenuNode, aPopupMenu ) )
814cdf0e10cSrcweir 		{
815cdf0e10cSrcweir 			// Successfully read a popup menu, append to our list
816cdf0e10cSrcweir             ::rtl::OUString aPopupTitle;
817cdf0e10cSrcweir             if ( aPopupMenu[OFFSET_POPUPMENU_TITLE].Value >>= aPopupTitle )
818cdf0e10cSrcweir             {
819cdf0e10cSrcweir                 StringToIndexMap::const_iterator pIter = aTitleToIndexMap.find( aPopupTitle );
820cdf0e10cSrcweir                 if ( pIter != aTitleToIndexMap.end() )
821cdf0e10cSrcweir                 {
822cdf0e10cSrcweir                     // title already there => concat both popup menus
823cdf0e10cSrcweir                     Sequence< PropertyValue >& rOldPopupMenu = rAddonOfficeMenuBarSeq[pIter->second];
824cdf0e10cSrcweir                     AppendPopupMenu( rOldPopupMenu, aPopupMenu );
825cdf0e10cSrcweir                 }
826cdf0e10cSrcweir                 else
827cdf0e10cSrcweir                 {
828cdf0e10cSrcweir                     // not found
829cdf0e10cSrcweir 			        sal_uInt32 nMenuItemCount = rAddonOfficeMenuBarSeq.getLength() + 1;
830cdf0e10cSrcweir 			        rAddonOfficeMenuBarSeq.realloc( nMenuItemCount );
831cdf0e10cSrcweir 			        rAddonOfficeMenuBarSeq[nIndex] = aPopupMenu;
832cdf0e10cSrcweir                     aTitleToIndexMap.insert( StringToIndexMap::value_type( aPopupTitle, nIndex ));
833cdf0e10cSrcweir                     ++nIndex;
834cdf0e10cSrcweir                 }
835cdf0e10cSrcweir             }
836cdf0e10cSrcweir 		}
837cdf0e10cSrcweir 	}
838cdf0e10cSrcweir 
839cdf0e10cSrcweir 	return ( rAddonOfficeMenuBarSeq.getLength() > 0 );
840cdf0e10cSrcweir }
841cdf0e10cSrcweir 
842cdf0e10cSrcweir //*****************************************************************************************************************
843cdf0e10cSrcweir //	private method
844cdf0e10cSrcweir //*****************************************************************************************************************
845*bb0b5665SAriel Constenla-Haile sal_Bool AddonsOptions_Impl::ReadOfficeToolBarSet(
846*bb0b5665SAriel Constenla-Haile     AddonToolBars& rAddonOfficeToolBars,
847*bb0b5665SAriel Constenla-Haile     std::vector< rtl::OUString >& rAddonOfficeToolBarResNames,
848*bb0b5665SAriel Constenla-Haile     std::vector< rtl::OUString >& rAddonOfficeToolBarUINames )
849cdf0e10cSrcweir {
850cdf0e10cSrcweir 	// Read the OfficeToolBar set and fill property sequences
851cdf0e10cSrcweir 	::rtl::OUString             aAddonToolBarNodeName( RTL_CONSTASCII_USTRINGPARAM( "AddonUI/OfficeToolBar" ));
852cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aAddonToolBarNodeSeq = GetNodeNames( aAddonToolBarNodeName );
853cdf0e10cSrcweir 	::rtl::OUString             aAddonToolBarNode( aAddonToolBarNodeName + m_aPathDelimiter );
854cdf0e10cSrcweir 
855cdf0e10cSrcweir 	sal_uInt32           nCount = aAddonToolBarNodeSeq.getLength();
856cdf0e10cSrcweir 
857cdf0e10cSrcweir 	for ( sal_uInt32 n = 0; n < nCount; n++ )
858cdf0e10cSrcweir 	{
859*bb0b5665SAriel Constenla-Haile         ::rtl::OUString aToolBarNode( aAddonToolBarNode + aAddonToolBarNodeSeq[n] + m_aPathDelimiter );
860cdf0e10cSrcweir         rAddonOfficeToolBarResNames.push_back( aAddonToolBarNodeSeq[n] );
861cdf0e10cSrcweir         rAddonOfficeToolBars.push_back( m_aEmptyAddonToolBar );
862*bb0b5665SAriel Constenla-Haile 
863*bb0b5665SAriel Constenla-Haile         Sequence< Any > aToolBarNodeValues = GetProperties( GetPropertyNamesToolBar( aToolBarNode ) );
864*bb0b5665SAriel Constenla-Haile 
865*bb0b5665SAriel Constenla-Haile         rtl::OUString aUIName;
866*bb0b5665SAriel Constenla-Haile         aToolBarNodeValues[OFFSET_TOOLBAR_TITLE] >>= aUIName;
867*bb0b5665SAriel Constenla-Haile         rAddonOfficeToolBarUINames.push_back( aUIName );
868*bb0b5665SAriel Constenla-Haile 
869*bb0b5665SAriel Constenla-Haile         Reference < XInterface > xToolbarItems;
870*bb0b5665SAriel Constenla-Haile         if ( ( aToolBarNodeValues[OFFSET_TOOLBAR_TOOLBARITEMS] >>= xToolbarItems ) && xToolbarItems.is() )
871*bb0b5665SAriel Constenla-Haile         {
872*bb0b5665SAriel Constenla-Haile             ::rtl::OUStringBuffer aBuffer;
873*bb0b5665SAriel Constenla-Haile             aBuffer.append( aToolBarNode );
874*bb0b5665SAriel Constenla-Haile             aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( STR_TOOLBARITEMS ) );
875*bb0b5665SAriel Constenla-Haile             ReadToolBarItemSet( aBuffer.makeStringAndClear(), rAddonOfficeToolBars[n] );
876*bb0b5665SAriel Constenla-Haile         }
877cdf0e10cSrcweir 	}
878cdf0e10cSrcweir 
879cdf0e10cSrcweir 	return ( !rAddonOfficeToolBars.empty() );
880cdf0e10cSrcweir }
881cdf0e10cSrcweir 
882cdf0e10cSrcweir 
883cdf0e10cSrcweir //*****************************************************************************************************************
884cdf0e10cSrcweir //	private method
885cdf0e10cSrcweir //*****************************************************************************************************************
886cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadToolBarItemSet( const rtl::OUString rToolBarItemSetNodeName, Sequence< Sequence< PropertyValue > >& rAddonOfficeToolBarSeq )
887cdf0e10cSrcweir {
888cdf0e10cSrcweir 	sal_Bool					bInsertSeparator		= sal_False;
889cdf0e10cSrcweir 	sal_uInt32					nToolBarItemCount		= rAddonOfficeToolBarSeq.getLength();
890cdf0e10cSrcweir 	::rtl::OUString					aAddonToolBarItemSetNode( rToolBarItemSetNodeName + m_aPathDelimiter );
891cdf0e10cSrcweir 	Sequence< ::rtl::OUString >		aAddonToolBarItemSetNodeSeq = GetNodeNames( rToolBarItemSetNodeName );
892cdf0e10cSrcweir 	Sequence< PropertyValue >	aToolBarItem( PROPERTYCOUNT_TOOLBARITEM );
893cdf0e10cSrcweir 
894cdf0e10cSrcweir 	// Init the property value sequence
895cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_URL				].Name = m_aPropNames[ INDEX_URL			];
896cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_TITLE				].Name = m_aPropNames[ INDEX_TITLE			];
897cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER	].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
898cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_TARGET				].Name = m_aPropNames[ INDEX_TARGET			];
899cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT			].Name = m_aPropNames[ INDEX_CONTEXT		];
900cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE		].Name = m_aPropNames[ INDEX_CONTROLTYPE	];
901cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_WIDTH			    ].Name = m_aPropNames[ INDEX_WIDTH		    ];
902cdf0e10cSrcweir 
903cdf0e10cSrcweir 	sal_uInt32 nCount = aAddonToolBarItemSetNodeSeq.getLength();
904cdf0e10cSrcweir 	for ( sal_uInt32 n = 0; n < nCount; n++ )
905cdf0e10cSrcweir 	{
906cdf0e10cSrcweir 		::rtl::OUString aToolBarItemNode( aAddonToolBarItemSetNode + aAddonToolBarItemSetNodeSeq[n] );
907cdf0e10cSrcweir 
908cdf0e10cSrcweir 		// Read the ToolBarItem
909cdf0e10cSrcweir 		if ( ReadToolBarItem( aToolBarItemNode, aToolBarItem ) )
910cdf0e10cSrcweir 		{
911cdf0e10cSrcweir 			if ( bInsertSeparator )
912cdf0e10cSrcweir 			{
913cdf0e10cSrcweir 				bInsertSeparator = sal_False;
914cdf0e10cSrcweir 				InsertToolBarSeparator( rAddonOfficeToolBarSeq );
915cdf0e10cSrcweir 			}
916cdf0e10cSrcweir 
917cdf0e10cSrcweir 			// Successfully read a toolbar item, append to our list
918cdf0e10cSrcweir 			sal_uInt32 nAddonCount = rAddonOfficeToolBarSeq.getLength();
919cdf0e10cSrcweir 			rAddonOfficeToolBarSeq.realloc( nAddonCount+1 );
920cdf0e10cSrcweir 			rAddonOfficeToolBarSeq[nAddonCount] = aToolBarItem;
921cdf0e10cSrcweir 		}
922cdf0e10cSrcweir 	}
923cdf0e10cSrcweir 
924cdf0e10cSrcweir 	return ( (sal_uInt32)rAddonOfficeToolBarSeq.getLength() > nToolBarItemCount );
925cdf0e10cSrcweir }
926cdf0e10cSrcweir 
927cdf0e10cSrcweir //*****************************************************************************************************************
928cdf0e10cSrcweir //	private method
929cdf0e10cSrcweir //*****************************************************************************************************************
930cdf0e10cSrcweir void AddonsOptions_Impl::InsertToolBarSeparator( Sequence< Sequence< PropertyValue > >& rAddonOfficeToolBarSeq )
931cdf0e10cSrcweir {
932cdf0e10cSrcweir 	Sequence< PropertyValue >	aToolBarItem( PROPERTYCOUNT_TOOLBARITEM );
933cdf0e10cSrcweir 
934cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_URL				].Name = m_aPropNames[ INDEX_URL			];
935cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_TITLE				].Name = m_aPropNames[ INDEX_TITLE			];
936cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER	].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER];
937cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_TARGET				].Name = m_aPropNames[ INDEX_TARGET			];
938cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT			].Name = m_aPropNames[ INDEX_CONTEXT		];
939cdf0e10cSrcweir 
940cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_URL				].Value <<= SEPARATOR_URL;
941cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_TITLE				].Value <<= m_aEmpty;
942cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_TARGET				].Value <<= m_aEmpty;
943cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER	].Value <<= m_aEmpty;
944cdf0e10cSrcweir 	aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT			].Value <<= m_aEmpty;
945cdf0e10cSrcweir 
946cdf0e10cSrcweir 	sal_uInt32 nToolBarItemCount = rAddonOfficeToolBarSeq.getLength();
947cdf0e10cSrcweir 	rAddonOfficeToolBarSeq.realloc( nToolBarItemCount+1 );
948cdf0e10cSrcweir 	rAddonOfficeToolBarSeq[nToolBarItemCount] = aToolBarItem;
949cdf0e10cSrcweir }
950cdf0e10cSrcweir 
951fdaa53dfSAriel Constenla-Haile 
952cdf0e10cSrcweir //*****************************************************************************************************************
953cdf0e10cSrcweir //	private method
954cdf0e10cSrcweir //*****************************************************************************************************************
955cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadImages( ImageManager& aImageManager )
956cdf0e10cSrcweir {
957cdf0e10cSrcweir 	// Read the user-defined Images set and fill image manager
958cdf0e10cSrcweir 	::rtl::OUString                aAddonImagesNodeName( RTL_CONSTASCII_USTRINGPARAM( "AddonUI/Images" ));
959cdf0e10cSrcweir 	Sequence< ::rtl::OUString >	aAddonImagesNodeSeq = GetNodeNames( aAddonImagesNodeName );
960cdf0e10cSrcweir 	::rtl::OUString                aAddonImagesNode( aAddonImagesNodeName + m_aPathDelimiter );
961cdf0e10cSrcweir 
962cdf0e10cSrcweir 	sal_uInt32              nCount = aAddonImagesNodeSeq.getLength();
963cdf0e10cSrcweir 
964cdf0e10cSrcweir 	// Init the property value sequence
965cdf0e10cSrcweir 	Sequence< ::rtl::OUString >	aAddonImageItemNodePropNames( 1 );
966cdf0e10cSrcweir 	::rtl::OUString                aURL;
967cdf0e10cSrcweir 
968cdf0e10cSrcweir 	for ( sal_uInt32 n = 0; n < nCount; n++ )
969cdf0e10cSrcweir 	{
970cdf0e10cSrcweir 		::rtl::OUString aImagesItemNode( aAddonImagesNode + aAddonImagesNodeSeq[n] );
971cdf0e10cSrcweir 
972cdf0e10cSrcweir 		// Create sequence for data access
973cdf0e10cSrcweir 		::rtl::OUStringBuffer aBuffer( aImagesItemNode );
974cdf0e10cSrcweir 		aBuffer.append( m_aPathDelimiter );
975cdf0e10cSrcweir 		aBuffer.append( m_aPropNames[ OFFSET_MENUITEM_URL ] );
976cdf0e10cSrcweir 		aAddonImageItemNodePropNames[0] = aBuffer.makeStringAndClear();
977cdf0e10cSrcweir 
978cdf0e10cSrcweir 		Sequence< Any > aAddonImageItemNodeValues = GetProperties( aAddonImageItemNodePropNames );
979cdf0e10cSrcweir 
980cdf0e10cSrcweir 		// An user-defined image entry must have an URL. As "ImageIdentifier" has a higher priority
981cdf0e10cSrcweir 		// we also check if we already have an images association.
982cdf0e10cSrcweir 		if (( aAddonImageItemNodeValues[0] >>= aURL ) &&
983cdf0e10cSrcweir 		    aURL.getLength() > 0 &&
984cdf0e10cSrcweir 		    !HasAssociatedImages( aURL ))
985cdf0e10cSrcweir 		{
986cdf0e10cSrcweir 			::rtl::OUStringBuffer aBuf( aImagesItemNode );
987cdf0e10cSrcweir 			aBuf.append( m_aPathDelimiter );
988cdf0e10cSrcweir 			aBuf.append( IMAGES_NODENAME );
989cdf0e10cSrcweir 			aBuf.append( m_aPathDelimiter );
990cdf0e10cSrcweir 			::rtl::OUString aImagesUserDefinedItemNode = aBuf.makeStringAndClear();
991cdf0e10cSrcweir 
992cdf0e10cSrcweir 			// Read a user-defined images data
993cdf0e10cSrcweir 			ImageEntry* pImageEntry = ReadImageData( aImagesUserDefinedItemNode );
994cdf0e10cSrcweir 			if ( pImageEntry )
995cdf0e10cSrcweir 			{
996cdf0e10cSrcweir 				// Successfully read a user-defined images item, put it into our image manager
997cdf0e10cSrcweir 				aImageManager.insert( ImageManager::value_type( aURL, *pImageEntry ));
998cdf0e10cSrcweir 				delete pImageEntry; // We have the ownership of the pointer
999cdf0e10cSrcweir 			}
1000cdf0e10cSrcweir 		}
1001cdf0e10cSrcweir 	}
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir 	return sal_True;
1004cdf0e10cSrcweir }
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir //*****************************************************************************************************************
1007cdf0e10cSrcweir //	private method
1008cdf0e10cSrcweir //*****************************************************************************************************************
1009cdf0e10cSrcweir 
1010cdf0e10cSrcweir ::rtl::OUString AddonsOptions_Impl::GeneratePrefixURL()
1011cdf0e10cSrcweir {
1012cdf0e10cSrcweir 	// Create an unique prefixed Add-On popup menu URL so it can be identified later as a runtime popup menu.
1013cdf0e10cSrcweir 	// They use a different image manager, so they must be identified by the sfx2/framework code.
1014cdf0e10cSrcweir 	::rtl::OUString aPopupMenuURL;
1015cdf0e10cSrcweir 	::rtl::OUStringBuffer aBuf( m_aRootAddonPopupMenuURLPrexfix.getLength() + 3 );
1016cdf0e10cSrcweir 	aBuf.append( m_aRootAddonPopupMenuURLPrexfix );
1017cdf0e10cSrcweir 	aBuf.append( ::rtl::OUString::valueOf( ++m_nRootAddonPopupMenuId ));
1018cdf0e10cSrcweir 	aPopupMenuURL = aBuf.makeStringAndClear();
1019cdf0e10cSrcweir 	return aPopupMenuURL;
1020cdf0e10cSrcweir }
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir //*****************************************************************************************************************
1023cdf0e10cSrcweir //	private method
1024cdf0e10cSrcweir //*****************************************************************************************************************
1025cdf0e10cSrcweir 
1026cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContainer& aContainer )
1027cdf0e10cSrcweir {
1028cdf0e10cSrcweir     const ::rtl::OUString aMenuMergeRootName( RTL_CONSTASCII_USTRINGPARAM( "AddonUI/OfficeMenuBarMerging/" ));
1029cdf0e10cSrcweir 
1030cdf0e10cSrcweir 	Sequence< ::rtl::OUString >	aAddonMergeNodesSeq = GetNodeNames( aMenuMergeRootName );
1031cdf0e10cSrcweir 	::rtl::OUString                aAddonMergeNode( aMenuMergeRootName );
1032cdf0e10cSrcweir 
1033cdf0e10cSrcweir 	sal_uInt32              nCount = aAddonMergeNodesSeq.getLength();
1034cdf0e10cSrcweir 
1035cdf0e10cSrcweir 	// Init the property value sequence
1036cdf0e10cSrcweir 	Sequence< ::rtl::OUString >	aNodePropNames( 5 );
1037cdf0e10cSrcweir 	::rtl::OUString                aURL;
1038cdf0e10cSrcweir 
1039cdf0e10cSrcweir 	for ( sal_uInt32 i = 0; i < nCount; i++ )
1040cdf0e10cSrcweir     {
1041cdf0e10cSrcweir 		::rtl::OUString aMergeAddonInstructions( aAddonMergeNode + aAddonMergeNodesSeq[i] );
1042cdf0e10cSrcweir 
1043cdf0e10cSrcweir         Sequence< ::rtl::OUString > aAddonInstMergeNodesSeq = GetNodeNames( aMergeAddonInstructions );
1044cdf0e10cSrcweir         sal_uInt32           nCountAddons = aAddonInstMergeNodesSeq.getLength();
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir         for ( sal_uInt32 j = 0; j < nCountAddons; j++ )
1047cdf0e10cSrcweir 	    {
1048cdf0e10cSrcweir 		    ::rtl::OUStringBuffer aMergeAddonInstructionBase( aMergeAddonInstructions );
1049cdf0e10cSrcweir             aMergeAddonInstructionBase.append( m_aPathDelimiter );
1050cdf0e10cSrcweir             aMergeAddonInstructionBase.append( aAddonInstMergeNodesSeq[j] );
1051cdf0e10cSrcweir             aMergeAddonInstructionBase.append( m_aPathDelimiter );
1052cdf0e10cSrcweir 
1053cdf0e10cSrcweir             // Create sequence for data access
1054cdf0e10cSrcweir             ::rtl::OUStringBuffer aBuffer( aMergeAddonInstructionBase );
1055cdf0e10cSrcweir 		    aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEPOINT ] );
1056cdf0e10cSrcweir 		    aNodePropNames[0] = aBuffer.makeStringAndClear();
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir             aBuffer = aMergeAddonInstructionBase;
1059cdf0e10cSrcweir             aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMAND ] );
1060cdf0e10cSrcweir             aNodePropNames[1] = aBuffer.makeStringAndClear();
1061cdf0e10cSrcweir 
1062cdf0e10cSrcweir             aBuffer = aMergeAddonInstructionBase;
1063cdf0e10cSrcweir             aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ] );
1064cdf0e10cSrcweir             aNodePropNames[2] = aBuffer.makeStringAndClear();
1065cdf0e10cSrcweir 
1066cdf0e10cSrcweir             aBuffer = aMergeAddonInstructionBase;
1067cdf0e10cSrcweir             aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEFALLBACK ] );
1068cdf0e10cSrcweir             aNodePropNames[3] = aBuffer.makeStringAndClear();
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir             aBuffer = aMergeAddonInstructionBase;
1071cdf0e10cSrcweir             aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECONTEXT ] );
1072cdf0e10cSrcweir             aNodePropNames[4] = aBuffer.makeStringAndClear();
1073cdf0e10cSrcweir 
1074cdf0e10cSrcweir             Sequence< Any > aNodePropValues = GetProperties( aNodePropNames );
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir             MergeMenuInstruction aMergeMenuInstruction;
1077cdf0e10cSrcweir             aNodePropValues[0] >>= aMergeMenuInstruction.aMergePoint;
1078cdf0e10cSrcweir             aNodePropValues[1] >>= aMergeMenuInstruction.aMergeCommand;
1079cdf0e10cSrcweir             aNodePropValues[2] >>= aMergeMenuInstruction.aMergeCommandParameter;
1080cdf0e10cSrcweir             aNodePropValues[3] >>= aMergeMenuInstruction.aMergeFallback;
1081cdf0e10cSrcweir             aNodePropValues[4] >>= aMergeMenuInstruction.aMergeContext;
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir             ::rtl::OUString aMergeMenuBase = aMergeAddonInstructionBase.makeStringAndClear();
1084cdf0e10cSrcweir             ReadMergeMenuData( aMergeMenuBase, aMergeMenuInstruction.aMergeMenu );
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir             aContainer.push_back( aMergeMenuInstruction );
1087cdf0e10cSrcweir         }
1088cdf0e10cSrcweir     }
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir     return sal_True;
1091cdf0e10cSrcweir }
1092cdf0e10cSrcweir 
1093cdf0e10cSrcweir //*****************************************************************************************************************
1094cdf0e10cSrcweir //	private method
1095cdf0e10cSrcweir //*****************************************************************************************************************
1096cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadMergeMenuData( const ::rtl::OUString& aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeMenu )
1097cdf0e10cSrcweir {
1098cdf0e10cSrcweir     ::rtl::OUString aMergeMenuBaseNode( aMergeAddonInstructionBase+m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MENUITEMS ] );
1099cdf0e10cSrcweir 
1100cdf0e10cSrcweir     Sequence< ::rtl::OUString > aSubMenuNodeNames = GetNodeNames( aMergeMenuBaseNode );
1101cdf0e10cSrcweir     aMergeMenuBaseNode += m_aPathDelimiter;
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir     // extend the node names to have full path strings
1104cdf0e10cSrcweir     for ( sal_uInt32 i = 0; i < (sal_uInt32)aSubMenuNodeNames.getLength(); i++ )
1105cdf0e10cSrcweir 		aSubMenuNodeNames[i] = ::rtl::OUString( aMergeMenuBaseNode + aSubMenuNodeNames[i] );
1106cdf0e10cSrcweir 
1107cdf0e10cSrcweir     return ReadSubMenuEntries( aSubMenuNodeNames, rMergeMenu );
1108cdf0e10cSrcweir }
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir //*****************************************************************************************************************
1111cdf0e10cSrcweir //	private method
1112cdf0e10cSrcweir //*****************************************************************************************************************
1113cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstructions& rCachedToolbarMergingInstructions )
1114cdf0e10cSrcweir {
1115cdf0e10cSrcweir     const ::rtl::OUString aToolbarMergeRootName( RTL_CONSTASCII_USTRINGPARAM( "AddonUI/OfficeToolbarMerging/" ));
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir 	Sequence< ::rtl::OUString >	aAddonMergeNodesSeq = GetNodeNames( aToolbarMergeRootName );
1118cdf0e10cSrcweir 	::rtl::OUString                aAddonMergeNode( aToolbarMergeRootName );
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir 	sal_uInt32              nCount = aAddonMergeNodesSeq.getLength();
1121cdf0e10cSrcweir 
1122cdf0e10cSrcweir 	// Init the property value sequence
1123cdf0e10cSrcweir 	Sequence< ::rtl::OUString >	aNodePropNames( 6 );
1124cdf0e10cSrcweir 	::rtl::OUString                aURL;
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir 	for ( sal_uInt32 i = 0; i < nCount; i++ )
1127cdf0e10cSrcweir     {
1128cdf0e10cSrcweir 		::rtl::OUString aMergeAddonInstructions( aAddonMergeNode + aAddonMergeNodesSeq[i] );
1129cdf0e10cSrcweir 
1130cdf0e10cSrcweir         Sequence< ::rtl::OUString > aAddonInstMergeNodesSeq = GetNodeNames( aMergeAddonInstructions );
1131cdf0e10cSrcweir         sal_uInt32           nCountAddons = aAddonInstMergeNodesSeq.getLength();
1132cdf0e10cSrcweir 
1133cdf0e10cSrcweir         for ( sal_uInt32 j = 0; j < nCountAddons; j++ )
1134cdf0e10cSrcweir 	    {
1135cdf0e10cSrcweir 		    ::rtl::OUStringBuffer aMergeAddonInstructionBase( aMergeAddonInstructions );
1136cdf0e10cSrcweir             aMergeAddonInstructionBase.append( m_aPathDelimiter );
1137cdf0e10cSrcweir             aMergeAddonInstructionBase.append( aAddonInstMergeNodesSeq[j] );
1138cdf0e10cSrcweir             aMergeAddonInstructionBase.append( m_aPathDelimiter );
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir             // Create sequence for data access
1141cdf0e10cSrcweir             ::rtl::OUStringBuffer aBuffer( aMergeAddonInstructionBase );
1142cdf0e10cSrcweir 		    aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBAR ] );
1143cdf0e10cSrcweir 		    aNodePropNames[0] = aBuffer.makeStringAndClear();
1144cdf0e10cSrcweir 
1145cdf0e10cSrcweir             aBuffer = aMergeAddonInstructionBase;
1146cdf0e10cSrcweir 		    aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEPOINT ] );
1147cdf0e10cSrcweir 		    aNodePropNames[1] = aBuffer.makeStringAndClear();
1148cdf0e10cSrcweir 
1149cdf0e10cSrcweir             aBuffer = aMergeAddonInstructionBase;
1150cdf0e10cSrcweir             aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMAND ] );
1151cdf0e10cSrcweir             aNodePropNames[2] = aBuffer.makeStringAndClear();
1152cdf0e10cSrcweir 
1153cdf0e10cSrcweir             aBuffer = aMergeAddonInstructionBase;
1154cdf0e10cSrcweir             aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMANDPARAMETER ] );
1155cdf0e10cSrcweir             aNodePropNames[3] = aBuffer.makeStringAndClear();
1156cdf0e10cSrcweir 
1157cdf0e10cSrcweir             aBuffer = aMergeAddonInstructionBase;
1158cdf0e10cSrcweir             aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEFALLBACK ] );
1159cdf0e10cSrcweir             aNodePropNames[4] = aBuffer.makeStringAndClear();
1160cdf0e10cSrcweir 
1161cdf0e10cSrcweir             aBuffer = aMergeAddonInstructionBase;
1162cdf0e10cSrcweir             aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT ] );
1163cdf0e10cSrcweir             aNodePropNames[5] = aBuffer.makeStringAndClear();
1164cdf0e10cSrcweir 
1165cdf0e10cSrcweir             Sequence< Any > aNodePropValues = GetProperties( aNodePropNames );
1166cdf0e10cSrcweir 
1167cdf0e10cSrcweir             MergeToolbarInstruction aMergeToolbarInstruction;
1168cdf0e10cSrcweir             aNodePropValues[0] >>= aMergeToolbarInstruction.aMergeToolbar;
1169cdf0e10cSrcweir             aNodePropValues[1] >>= aMergeToolbarInstruction.aMergePoint;
1170cdf0e10cSrcweir             aNodePropValues[2] >>= aMergeToolbarInstruction.aMergeCommand;
1171cdf0e10cSrcweir             aNodePropValues[3] >>= aMergeToolbarInstruction.aMergeCommandParameter;
1172cdf0e10cSrcweir             aNodePropValues[4] >>= aMergeToolbarInstruction.aMergeFallback;
1173cdf0e10cSrcweir             aNodePropValues[5] >>= aMergeToolbarInstruction.aMergeContext;
1174cdf0e10cSrcweir 
1175cdf0e10cSrcweir             ReadMergeToolbarData( aMergeAddonInstructionBase.makeStringAndClear(),
1176cdf0e10cSrcweir                                   aMergeToolbarInstruction.aMergeToolbarItems );
1177cdf0e10cSrcweir 
1178cdf0e10cSrcweir             MergeToolbarInstructionContainer& rVector = rCachedToolbarMergingInstructions[ aMergeToolbarInstruction.aMergeToolbar ];
1179cdf0e10cSrcweir             rVector.push_back( aMergeToolbarInstruction );
1180cdf0e10cSrcweir         }
1181cdf0e10cSrcweir     }
1182cdf0e10cSrcweir 
1183cdf0e10cSrcweir     return sal_True;
1184cdf0e10cSrcweir }
1185cdf0e10cSrcweir 
1186cdf0e10cSrcweir //*****************************************************************************************************************
1187cdf0e10cSrcweir //	private method
1188cdf0e10cSrcweir //*****************************************************************************************************************
1189cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadMergeToolbarData( const ::rtl::OUString& aMergeAddonInstructionBase, Sequence< Sequence< PropertyValue > >& rMergeToolbarItems )
1190cdf0e10cSrcweir {
1191cdf0e10cSrcweir     ::rtl::OUStringBuffer aBuffer( aMergeAddonInstructionBase );
1192cdf0e10cSrcweir     aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBARITEMS ] );
1193cdf0e10cSrcweir 
1194cdf0e10cSrcweir     ::rtl::OUString aMergeToolbarBaseNode = aBuffer.makeStringAndClear();
1195cdf0e10cSrcweir 
1196cdf0e10cSrcweir     return ReadToolBarItemSet( aMergeToolbarBaseNode, rMergeToolbarItems );
1197cdf0e10cSrcweir }
1198cdf0e10cSrcweir 
1199fdaa53dfSAriel Constenla-Haile 
1200fdaa53dfSAriel Constenla-Haile sal_Bool AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructionContainer& aContainer )
1201fdaa53dfSAriel Constenla-Haile {
1202fdaa53dfSAriel Constenla-Haile     const ::rtl::OUString aStatusbarMergeRootName( RTL_CONSTASCII_USTRINGPARAM( "AddonUI/OfficeStatusbarMerging/" ));
1203fdaa53dfSAriel Constenla-Haile 
1204fdaa53dfSAriel Constenla-Haile     Sequence< ::rtl::OUString > aAddonMergeNodesSeq = GetNodeNames( aStatusbarMergeRootName );
1205fdaa53dfSAriel Constenla-Haile     ::rtl::OUString aAddonMergeNode( aStatusbarMergeRootName );
1206fdaa53dfSAriel Constenla-Haile     sal_uInt32  nCount = aAddonMergeNodesSeq.getLength();
1207fdaa53dfSAriel Constenla-Haile 
1208fdaa53dfSAriel Constenla-Haile     Sequence< ::rtl::OUString > aNodePropNames( 5 );
1209fdaa53dfSAriel Constenla-Haile     ::rtl::OUString aURL;
1210fdaa53dfSAriel Constenla-Haile 
1211fdaa53dfSAriel Constenla-Haile     for ( sal_uInt32 i = 0; i < nCount; i++ )
1212fdaa53dfSAriel Constenla-Haile     {
1213fdaa53dfSAriel Constenla-Haile         ::rtl::OUString aMergeAddonInstructions( aAddonMergeNode + aAddonMergeNodesSeq[i] );
1214fdaa53dfSAriel Constenla-Haile 
1215fdaa53dfSAriel Constenla-Haile         Sequence< ::rtl::OUString > aAddonInstMergeNodesSeq = GetNodeNames( aMergeAddonInstructions );
1216fdaa53dfSAriel Constenla-Haile         sal_uInt32 nCountAddons = aAddonInstMergeNodesSeq.getLength();
1217fdaa53dfSAriel Constenla-Haile 
1218fdaa53dfSAriel Constenla-Haile         for ( sal_uInt32 j = 0; j < nCountAddons; j++ )
1219fdaa53dfSAriel Constenla-Haile         {
1220fdaa53dfSAriel Constenla-Haile             ::rtl::OUStringBuffer aMergeAddonInstructionBase( aMergeAddonInstructions );
1221fdaa53dfSAriel Constenla-Haile             aMergeAddonInstructionBase.append( m_aPathDelimiter );
1222fdaa53dfSAriel Constenla-Haile             aMergeAddonInstructionBase.append( aAddonInstMergeNodesSeq[j] );
1223fdaa53dfSAriel Constenla-Haile             aMergeAddonInstructionBase.append( m_aPathDelimiter );
1224fdaa53dfSAriel Constenla-Haile 
1225fdaa53dfSAriel Constenla-Haile             // Create sequence for data access
1226fdaa53dfSAriel Constenla-Haile             ::rtl::OUStringBuffer aBuffer( aMergeAddonInstructionBase );
1227fdaa53dfSAriel Constenla-Haile             aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEPOINT ] );
1228fdaa53dfSAriel Constenla-Haile             aNodePropNames[0] = aBuffer.makeStringAndClear();
1229fdaa53dfSAriel Constenla-Haile 
1230fdaa53dfSAriel Constenla-Haile             aBuffer = aMergeAddonInstructionBase;
1231fdaa53dfSAriel Constenla-Haile             aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMAND ] );
1232fdaa53dfSAriel Constenla-Haile             aNodePropNames[1] = aBuffer.makeStringAndClear();
1233fdaa53dfSAriel Constenla-Haile 
1234fdaa53dfSAriel Constenla-Haile             aBuffer = aMergeAddonInstructionBase;
1235fdaa53dfSAriel Constenla-Haile             aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER ] );
1236fdaa53dfSAriel Constenla-Haile             aNodePropNames[2] = aBuffer.makeStringAndClear();
1237fdaa53dfSAriel Constenla-Haile 
1238fdaa53dfSAriel Constenla-Haile             aBuffer = aMergeAddonInstructionBase;
1239fdaa53dfSAriel Constenla-Haile             aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEFALLBACK ] );
1240fdaa53dfSAriel Constenla-Haile             aNodePropNames[3] = aBuffer.makeStringAndClear();
1241fdaa53dfSAriel Constenla-Haile 
1242fdaa53dfSAriel Constenla-Haile             aBuffer = aMergeAddonInstructionBase;
1243fdaa53dfSAriel Constenla-Haile             aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECONTEXT ] );
1244fdaa53dfSAriel Constenla-Haile             aNodePropNames[4] = aBuffer.makeStringAndClear();
1245fdaa53dfSAriel Constenla-Haile 
1246fdaa53dfSAriel Constenla-Haile             Sequence< Any > aNodePropValues = GetProperties( aNodePropNames );
1247fdaa53dfSAriel Constenla-Haile 
1248fdaa53dfSAriel Constenla-Haile             MergeStatusbarInstruction aMergeStatusbarInstruction;
1249fdaa53dfSAriel Constenla-Haile             aNodePropValues[0] >>= aMergeStatusbarInstruction.aMergePoint;
1250fdaa53dfSAriel Constenla-Haile             aNodePropValues[1] >>= aMergeStatusbarInstruction.aMergeCommand;
1251fdaa53dfSAriel Constenla-Haile             aNodePropValues[2] >>= aMergeStatusbarInstruction.aMergeCommandParameter;
1252fdaa53dfSAriel Constenla-Haile             aNodePropValues[3] >>= aMergeStatusbarInstruction.aMergeFallback;
1253fdaa53dfSAriel Constenla-Haile             aNodePropValues[4] >>= aMergeStatusbarInstruction.aMergeContext;
1254fdaa53dfSAriel Constenla-Haile 
1255fdaa53dfSAriel Constenla-Haile             ReadMergeStatusbarData( aMergeAddonInstructionBase.makeStringAndClear(),
1256fdaa53dfSAriel Constenla-Haile                                     aMergeStatusbarInstruction.aMergeStatusbarItems );
1257fdaa53dfSAriel Constenla-Haile 
1258fdaa53dfSAriel Constenla-Haile             aContainer.push_back( aMergeStatusbarInstruction );
1259fdaa53dfSAriel Constenla-Haile         }
1260fdaa53dfSAriel Constenla-Haile     }
1261fdaa53dfSAriel Constenla-Haile 
1262fdaa53dfSAriel Constenla-Haile     return sal_True;
1263fdaa53dfSAriel Constenla-Haile }
1264fdaa53dfSAriel Constenla-Haile 
1265fdaa53dfSAriel Constenla-Haile sal_Bool AddonsOptions_Impl::ReadMergeStatusbarData(
1266fdaa53dfSAriel Constenla-Haile     const ::rtl::OUString& aMergeAddonInstructionBase,
1267fdaa53dfSAriel Constenla-Haile     Sequence< Sequence< PropertyValue > >& rMergeStatusbarItems )
1268fdaa53dfSAriel Constenla-Haile {
1269fdaa53dfSAriel Constenla-Haile     sal_uInt32 nStatusbarItemCount = rMergeStatusbarItems.getLength();
1270fdaa53dfSAriel Constenla-Haile 
1271fdaa53dfSAriel Constenla-Haile     ::rtl::OUStringBuffer aBuffer( aMergeAddonInstructionBase );
1272fdaa53dfSAriel Constenla-Haile     aBuffer.append( m_aPropMergeStatusbarNames[ OFFSET_MERGESTATUSBAR_STATUSBARITEMS ] );
1273fdaa53dfSAriel Constenla-Haile     ::rtl::OUString aMergeStatusbarBaseNode = aBuffer.makeStringAndClear();
1274fdaa53dfSAriel Constenla-Haile 
1275fdaa53dfSAriel Constenla-Haile     ::rtl::OUString aAddonStatusbarItemSetNode( aMergeStatusbarBaseNode + m_aPathDelimiter );
1276fdaa53dfSAriel Constenla-Haile     Sequence< ::rtl::OUString > aAddonStatusbarItemSetNodeSeq = GetNodeNames( aMergeStatusbarBaseNode );
1277fdaa53dfSAriel Constenla-Haile 
1278fdaa53dfSAriel Constenla-Haile     Sequence< PropertyValue > aStatusbarItem( PROPERTYCOUNT_STATUSBARITEM );
1279fdaa53dfSAriel Constenla-Haile     aStatusbarItem[ OFFSET_STATUSBARITEM_URL       ].Name = m_aPropNames[ INDEX_URL       ];
1280fdaa53dfSAriel Constenla-Haile     aStatusbarItem[ OFFSET_STATUSBARITEM_TITLE     ].Name = m_aPropNames[ INDEX_TITLE     ];
1281fdaa53dfSAriel Constenla-Haile     aStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT   ].Name = m_aPropNames[ INDEX_CONTEXT   ];
1282fdaa53dfSAriel Constenla-Haile     aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN     ].Name = m_aPropNames[ INDEX_ALIGN     ];
1283fdaa53dfSAriel Constenla-Haile     aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE  ].Name = m_aPropNames[ INDEX_AUTOSIZE  ];
1284fdaa53dfSAriel Constenla-Haile     aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Name = m_aPropNames[ INDEX_OWNERDRAW ];
1285fdaa53dfSAriel Constenla-Haile     aStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH     ].Name = m_aPropNames[ INDEX_WIDTH     ];
1286fdaa53dfSAriel Constenla-Haile 
1287fdaa53dfSAriel Constenla-Haile     sal_uInt32 nCount = aAddonStatusbarItemSetNodeSeq.getLength();
1288fdaa53dfSAriel Constenla-Haile     for ( sal_uInt32 n = 0; n < nCount; n++ )
1289fdaa53dfSAriel Constenla-Haile     {
1290fdaa53dfSAriel Constenla-Haile         ::rtl::OUString aStatusbarItemNode( aAddonStatusbarItemSetNode + aAddonStatusbarItemSetNodeSeq[n] );
1291fdaa53dfSAriel Constenla-Haile 
1292fdaa53dfSAriel Constenla-Haile         if ( ReadStatusBarItem( aStatusbarItemNode, aStatusbarItem ) )
1293fdaa53dfSAriel Constenla-Haile         {
1294fdaa53dfSAriel Constenla-Haile             sal_uInt32 nAddonCount = rMergeStatusbarItems.getLength();
1295fdaa53dfSAriel Constenla-Haile             rMergeStatusbarItems.realloc( nAddonCount+1 );
1296fdaa53dfSAriel Constenla-Haile             rMergeStatusbarItems[nAddonCount] = aStatusbarItem;
1297fdaa53dfSAriel Constenla-Haile         }
1298fdaa53dfSAriel Constenla-Haile     }
1299fdaa53dfSAriel Constenla-Haile 
1300fdaa53dfSAriel Constenla-Haile     return ( (sal_uInt32)rMergeStatusbarItems.getLength() > nStatusbarItemCount );
1301fdaa53dfSAriel Constenla-Haile }
1302fdaa53dfSAriel Constenla-Haile 
1303fdaa53dfSAriel Constenla-Haile sal_Bool AddonsOptions_Impl::ReadStatusBarItem(
1304fdaa53dfSAriel Constenla-Haile     const ::rtl::OUString& aStatusarItemNodeName,
1305fdaa53dfSAriel Constenla-Haile     Sequence< PropertyValue >& aStatusbarItem )
1306fdaa53dfSAriel Constenla-Haile {
1307fdaa53dfSAriel Constenla-Haile     sal_Bool bResult( sal_False );
1308fdaa53dfSAriel Constenla-Haile     ::rtl::OUString aURL;
1309fdaa53dfSAriel Constenla-Haile     ::rtl::OUString aAddonStatusbarItemTreeNode( aStatusarItemNodeName + m_aPathDelimiter );
1310fdaa53dfSAriel Constenla-Haile     Sequence< Any > aStatusbarItemNodePropValues;
1311fdaa53dfSAriel Constenla-Haile 
1312fdaa53dfSAriel Constenla-Haile     aStatusbarItemNodePropValues = GetProperties( GetPropertyNamesStatusbarItem( aAddonStatusbarItemTreeNode ) );
1313fdaa53dfSAriel Constenla-Haile 
1314fdaa53dfSAriel Constenla-Haile     // Command URL is required
1315fdaa53dfSAriel Constenla-Haile     if (( aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_URL ] >>= aURL ) && aURL.getLength() > 0 )
1316fdaa53dfSAriel Constenla-Haile     {
1317fdaa53dfSAriel Constenla-Haile         aStatusbarItem[ OFFSET_STATUSBARITEM_URL        ].Value <<= aURL;
1318fdaa53dfSAriel Constenla-Haile         aStatusbarItem[ OFFSET_STATUSBARITEM_TITLE      ].Value <<= aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_TITLE     ];
1319fdaa53dfSAriel Constenla-Haile         aStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT    ].Value <<= aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_CONTEXT   ];
1320fdaa53dfSAriel Constenla-Haile         aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN      ].Value <<= aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_ALIGN     ];
1321fdaa53dfSAriel Constenla-Haile         aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE   ].Value <<= aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_AUTOSIZE  ];;
1322fdaa53dfSAriel Constenla-Haile         aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW  ].Value <<= aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_OWNERDRAW ];
1323fdaa53dfSAriel Constenla-Haile 
1324fdaa53dfSAriel Constenla-Haile         // Configuration uses hyper for long. Therefore transform into sal_Int32
1325fdaa53dfSAriel Constenla-Haile         sal_Int64 nValue( 0 );
1326fdaa53dfSAriel Constenla-Haile         aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_WIDTH ] >>= nValue;
1327fdaa53dfSAriel Constenla-Haile         aStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Value <<= sal_Int32( nValue );
1328fdaa53dfSAriel Constenla-Haile 
1329fdaa53dfSAriel Constenla-Haile         bResult = sal_True;
1330fdaa53dfSAriel Constenla-Haile     }
1331fdaa53dfSAriel Constenla-Haile 
1332fdaa53dfSAriel Constenla-Haile     return bResult;
1333fdaa53dfSAriel Constenla-Haile }
1334fdaa53dfSAriel Constenla-Haile 
1335cdf0e10cSrcweir //*****************************************************************************************************************
1336cdf0e10cSrcweir //	private method
1337cdf0e10cSrcweir //*****************************************************************************************************************
1338cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadMenuItem( const ::rtl::OUString& aMenuNodeName, Sequence< PropertyValue >& aMenuItem, sal_Bool bIgnoreSubMenu )
1339cdf0e10cSrcweir {
1340cdf0e10cSrcweir 	sal_Bool			bResult = sal_False;
1341cdf0e10cSrcweir 	::rtl::OUString			aStrValue;
1342cdf0e10cSrcweir 	::rtl::OUString			aAddonMenuItemTreeNode( aMenuNodeName + m_aPathDelimiter );
1343cdf0e10cSrcweir 	Sequence< Any >		aMenuItemNodePropValues;
1344cdf0e10cSrcweir 
1345cdf0e10cSrcweir 	aMenuItemNodePropValues = GetProperties( GetPropertyNamesMenuItem( aAddonMenuItemTreeNode ) );
1346cdf0e10cSrcweir 	if (( aMenuItemNodePropValues[ OFFSET_MENUITEM_TITLE ] >>= aStrValue ) && aStrValue.getLength() > 0 )
1347cdf0e10cSrcweir 	{
1348cdf0e10cSrcweir 		aMenuItem[ OFFSET_MENUITEM_TITLE ].Value <<= aStrValue;
1349cdf0e10cSrcweir 
1350cdf0e10cSrcweir 		::rtl::OUString aRootSubMenuName( aAddonMenuItemTreeNode + m_aPropNames[ INDEX_SUBMENU ] );
1351cdf0e10cSrcweir 		Sequence< ::rtl::OUString > aRootSubMenuNodeNames = GetNodeNames( aRootSubMenuName );
1352cdf0e10cSrcweir 		if ( aRootSubMenuNodeNames.getLength() > 0 && !bIgnoreSubMenu )
1353cdf0e10cSrcweir 		{
1354cdf0e10cSrcweir 			// Set a unique prefixed Add-On popup menu URL so it can be identified later
1355cdf0e10cSrcweir 			::rtl::OUString aPopupMenuURL     = GeneratePrefixURL();
1356cdf0e10cSrcweir             ::rtl::OUString aPopupMenuImageId;
1357cdf0e10cSrcweir 
1358cdf0e10cSrcweir             aMenuItemNodePropValues[ OFFSET_MENUITEM_IMAGEIDENTIFIER ] >>= aPopupMenuImageId;
1359cdf0e10cSrcweir             ReadAndAssociateImages( aPopupMenuURL, aPopupMenuImageId );
1360cdf0e10cSrcweir 
1361cdf0e10cSrcweir 			// A popup menu must have a title and can have a URL and ImageIdentifier
1362cdf0e10cSrcweir 			// Set the other property values to empty
1363cdf0e10cSrcweir 			aMenuItem[ OFFSET_MENUITEM_URL				].Value <<= aPopupMenuURL;
1364cdf0e10cSrcweir 			aMenuItem[ OFFSET_MENUITEM_TARGET			].Value <<= m_aEmpty;
1365cdf0e10cSrcweir 			aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER	].Value <<= aPopupMenuImageId;
1366cdf0e10cSrcweir 			aMenuItem[ OFFSET_MENUITEM_CONTEXT			].Value <<= aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT ];
1367cdf0e10cSrcweir 
1368cdf0e10cSrcweir 			// Continue to read the sub menu nodes
1369cdf0e10cSrcweir 			Sequence< Sequence< PropertyValue > > aSubMenuSeq;
1370cdf0e10cSrcweir 			::rtl::OUString aSubMenuRootNodeName( aRootSubMenuName + m_aPathDelimiter );
1371cdf0e10cSrcweir 			for ( sal_uInt32 n = 0; n < (sal_uInt32)aRootSubMenuNodeNames.getLength(); n++ )
1372cdf0e10cSrcweir 				aRootSubMenuNodeNames[n] = ::rtl::OUString( aSubMenuRootNodeName + aRootSubMenuNodeNames[n] );
1373cdf0e10cSrcweir 			ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq );
1374cdf0e10cSrcweir 			aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= aSubMenuSeq;
1375cdf0e10cSrcweir 			bResult = sal_True;
1376cdf0e10cSrcweir 		}
1377cdf0e10cSrcweir 		else if (( aMenuItemNodePropValues[ OFFSET_MENUITEM_URL ] >>= aStrValue ) && aStrValue.getLength() > 0 )
1378cdf0e10cSrcweir 		{
1379cdf0e10cSrcweir 			// A simple menu item => read the other properties;
1380cdf0e10cSrcweir 			::rtl::OUString aMenuImageId;
1381cdf0e10cSrcweir 
1382cdf0e10cSrcweir 			aMenuItemNodePropValues[ OFFSET_MENUITEM_IMAGEIDENTIFIER ] >>= aMenuImageId;
1383cdf0e10cSrcweir  			ReadAndAssociateImages( aStrValue, aMenuImageId );
1384cdf0e10cSrcweir 
1385cdf0e10cSrcweir 			aMenuItem[ OFFSET_MENUITEM_URL				].Value <<= aStrValue;
1386cdf0e10cSrcweir 			aMenuItem[ OFFSET_MENUITEM_TARGET			].Value <<= aMenuItemNodePropValues[ OFFSET_MENUITEM_TARGET			];
1387cdf0e10cSrcweir 			aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER	].Value <<= aMenuImageId;
1388cdf0e10cSrcweir 		    aMenuItem[ OFFSET_MENUITEM_CONTEXT			].Value <<= aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT        ];
1389cdf0e10cSrcweir 			aMenuItem[ OFFSET_MENUITEM_SUBMENU			].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set!
1390cdf0e10cSrcweir 
1391cdf0e10cSrcweir 			bResult = sal_True;
1392cdf0e10cSrcweir 		}
1393cdf0e10cSrcweir 	}
1394cdf0e10cSrcweir 	else if (( aMenuItemNodePropValues[ OFFSET_MENUITEM_URL ] >>= aStrValue ) &&
1395cdf0e10cSrcweir 			  aStrValue.equalsAsciiL( SEPARATOR_URL_STR, SEPARATOR_URL_LEN ))
1396cdf0e10cSrcweir 	{
1397cdf0e10cSrcweir 		// Separator
1398cdf0e10cSrcweir 		aMenuItem[ OFFSET_MENUITEM_URL				].Value <<= aStrValue;
1399cdf0e10cSrcweir 		aMenuItem[ OFFSET_MENUITEM_TARGET			].Value <<= m_aEmpty;
1400cdf0e10cSrcweir 		aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER	].Value <<= m_aEmpty;
1401cdf0e10cSrcweir 		aMenuItem[ OFFSET_MENUITEM_CONTEXT			].Value <<= m_aEmpty;
1402cdf0e10cSrcweir 		aMenuItem[ OFFSET_MENUITEM_SUBMENU			].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set!
1403cdf0e10cSrcweir 		bResult = sal_True;
1404cdf0e10cSrcweir 	}
1405cdf0e10cSrcweir 
1406cdf0e10cSrcweir 	return bResult;
1407cdf0e10cSrcweir }
1408cdf0e10cSrcweir 
1409cdf0e10cSrcweir //*****************************************************************************************************************
1410cdf0e10cSrcweir //	private method
1411cdf0e10cSrcweir //*****************************************************************************************************************
1412cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadPopupMenu( const ::rtl::OUString& aPopupMenuNodeName, Sequence< PropertyValue >& aPopupMenu )
1413cdf0e10cSrcweir {
1414cdf0e10cSrcweir 	sal_Bool			bResult = sal_False;
1415cdf0e10cSrcweir 	::rtl::OUString			aStrValue;
1416cdf0e10cSrcweir 	::rtl::OUString			aAddonPopupMenuTreeNode( aPopupMenuNodeName + m_aPathDelimiter );
1417cdf0e10cSrcweir 	Sequence< Any >		aPopupMenuNodePropValues;
1418cdf0e10cSrcweir 
1419cdf0e10cSrcweir 	aPopupMenuNodePropValues = GetProperties( GetPropertyNamesPopupMenu( aAddonPopupMenuTreeNode ) );
1420cdf0e10cSrcweir 	if (( aPopupMenuNodePropValues[ OFFSET_POPUPMENU_TITLE ] >>= aStrValue ) &&
1421cdf0e10cSrcweir 		 aStrValue.getLength() > 0 )
1422cdf0e10cSrcweir 	{
1423cdf0e10cSrcweir 		aPopupMenu[ OFFSET_POPUPMENU_TITLE ].Value <<= aStrValue;
1424cdf0e10cSrcweir 
1425cdf0e10cSrcweir 		::rtl::OUString aRootSubMenuName( aAddonPopupMenuTreeNode + m_aPropNames[ INDEX_SUBMENU ] );
1426cdf0e10cSrcweir 		Sequence< ::rtl::OUString > aRootSubMenuNodeNames = GetNodeNames( aRootSubMenuName );
1427cdf0e10cSrcweir 		if ( aRootSubMenuNodeNames.getLength() > 0 )
1428cdf0e10cSrcweir 		{
1429cdf0e10cSrcweir 			// A top-level popup menu needs a title
1430cdf0e10cSrcweir 			// Set a unique prefixed Add-On popup menu URL so it can be identified later
1431cdf0e10cSrcweir 			::rtl::OUString aPopupMenuURL = GeneratePrefixURL();
1432cdf0e10cSrcweir 
1433cdf0e10cSrcweir             aPopupMenu[ OFFSET_POPUPMENU_URL		].Value <<= aPopupMenuURL;
1434cdf0e10cSrcweir 			aPopupMenu[ OFFSET_POPUPMENU_CONTEXT	].Value <<= aPopupMenuNodePropValues[ OFFSET_POPUPMENU_CONTEXT ];
1435cdf0e10cSrcweir 
1436cdf0e10cSrcweir 			// Continue to read the sub menu nodes
1437cdf0e10cSrcweir 			Sequence< Sequence< PropertyValue > > aSubMenuSeq;
1438cdf0e10cSrcweir 			::rtl::OUString aSubMenuRootNodeName( aRootSubMenuName + m_aPathDelimiter );
1439cdf0e10cSrcweir 			for ( sal_uInt32 n = 0; n < (sal_uInt32)aRootSubMenuNodeNames.getLength(); n++ )
1440cdf0e10cSrcweir 				aRootSubMenuNodeNames[n] = ::rtl::OUString( aSubMenuRootNodeName + aRootSubMenuNodeNames[n] );
1441cdf0e10cSrcweir 			ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq );
1442cdf0e10cSrcweir 			aPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aSubMenuSeq;
1443cdf0e10cSrcweir 			bResult = sal_True;
1444cdf0e10cSrcweir 		}
1445cdf0e10cSrcweir 	}
1446cdf0e10cSrcweir 
1447cdf0e10cSrcweir 	return bResult;
1448cdf0e10cSrcweir }
1449cdf0e10cSrcweir 
1450cdf0e10cSrcweir //*****************************************************************************************************************
1451cdf0e10cSrcweir //	private method
1452cdf0e10cSrcweir //*****************************************************************************************************************
1453cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::AppendPopupMenu( Sequence< PropertyValue >& rTargetPopupMenu, const Sequence< PropertyValue >& rSourcePopupMenu )
1454cdf0e10cSrcweir {
1455cdf0e10cSrcweir     Sequence< Sequence< PropertyValue > > aTargetSubMenuSeq;
1456cdf0e10cSrcweir     Sequence< Sequence< PropertyValue > > aSourceSubMenuSeq;
1457cdf0e10cSrcweir 
1458cdf0e10cSrcweir     if (( rTargetPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value >>= aTargetSubMenuSeq ) &&
1459cdf0e10cSrcweir         ( rSourcePopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value >>= aSourceSubMenuSeq ))
1460cdf0e10cSrcweir     {
1461cdf0e10cSrcweir         sal_uInt32 nIndex = aTargetSubMenuSeq.getLength();
1462cdf0e10cSrcweir         aTargetSubMenuSeq.realloc( nIndex + aSourceSubMenuSeq.getLength() );
1463cdf0e10cSrcweir         for ( sal_uInt32 i = 0; i < sal_uInt32( aSourceSubMenuSeq.getLength() ); i++ )
1464cdf0e10cSrcweir             aTargetSubMenuSeq[nIndex++] = aSourceSubMenuSeq[i];
1465cdf0e10cSrcweir         rTargetPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aTargetSubMenuSeq;
1466cdf0e10cSrcweir     }
1467cdf0e10cSrcweir 
1468cdf0e10cSrcweir     return sal_True;
1469cdf0e10cSrcweir }
1470cdf0e10cSrcweir 
1471cdf0e10cSrcweir //*****************************************************************************************************************
1472cdf0e10cSrcweir //	private method
1473cdf0e10cSrcweir //*****************************************************************************************************************
1474cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadToolBarItem( const ::rtl::OUString& aToolBarItemNodeName, Sequence< PropertyValue >& aToolBarItem )
1475cdf0e10cSrcweir {
1476cdf0e10cSrcweir 	sal_Bool			bResult = sal_False;
1477cdf0e10cSrcweir 	::rtl::OUString			aTitle;
1478cdf0e10cSrcweir 	::rtl::OUString			aURL;
1479cdf0e10cSrcweir 	::rtl::OUString			aAddonToolBarItemTreeNode( aToolBarItemNodeName + m_aPathDelimiter );
1480cdf0e10cSrcweir 	Sequence< Any >		aToolBarItemNodePropValues;
1481cdf0e10cSrcweir 
1482cdf0e10cSrcweir 	aToolBarItemNodePropValues = GetProperties( GetPropertyNamesToolBarItem( aAddonToolBarItemTreeNode ) );
1483cdf0e10cSrcweir 
1484cdf0e10cSrcweir 	// A toolbar item must have a command URL
1485cdf0e10cSrcweir 	if (( aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_URL ] >>= aURL ) && aURL.getLength() > 0 )
1486cdf0e10cSrcweir 	{
1487cdf0e10cSrcweir 		if ( aURL.equals( SEPARATOR_URL ))
1488cdf0e10cSrcweir 		{
1489cdf0e10cSrcweir 			// A speparator toolbar item only needs a URL
1490cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_URL				].Value <<= aURL;
1491cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_TITLE				].Value <<= m_aEmpty;
1492cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_TARGET				].Value <<= m_aEmpty;
1493cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER	].Value <<= m_aEmpty;
1494cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT			].Value <<= m_aEmpty;
1495cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE		].Value <<= m_aEmpty;
1496cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_WIDTH		        ].Value <<= sal_Int32( 0 );
1497cdf0e10cSrcweir 
1498cdf0e10cSrcweir 			bResult = sal_True;
1499cdf0e10cSrcweir 		}
1500cdf0e10cSrcweir 		else if (( aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_TITLE	] >>= aTitle ) && aTitle.getLength() > 0 )
1501cdf0e10cSrcweir 		{
1502cdf0e10cSrcweir 			// A normal toolbar item must also have title => read the other properties;
1503cdf0e10cSrcweir 			::rtl::OUString aImageId;
1504cdf0e10cSrcweir 
1505cdf0e10cSrcweir             // Try to map a user-defined image URL to our internal private image URL
1506cdf0e10cSrcweir 			aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ] >>= aImageId;
1507cdf0e10cSrcweir  			ReadAndAssociateImages( aURL, aImageId );
1508cdf0e10cSrcweir 
1509cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_URL				].Value <<= aURL;
1510cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_TITLE				].Value <<= aTitle;
1511cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_TARGET				].Value <<= aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_TARGET	   ];
1512cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER	].Value <<= aImageId;
1513cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT			].Value <<= aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTEXT	   ];
1514cdf0e10cSrcweir 			aToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE		].Value <<= aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTROLTYPE ];
1515cdf0e10cSrcweir 
1516cdf0e10cSrcweir             // Configuration uses hyper for long. Therefore transform into sal_Int32
1517cdf0e10cSrcweir             sal_Int64 nValue( 0 );
1518cdf0e10cSrcweir             aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_WIDTH ] >>= nValue;
1519cdf0e10cSrcweir             aToolBarItem[ OFFSET_TOOLBARITEM_WIDTH		        ].Value <<= sal_Int32( nValue );
1520cdf0e10cSrcweir 
1521cdf0e10cSrcweir 			bResult = sal_True;
1522cdf0e10cSrcweir 		}
1523cdf0e10cSrcweir 	}
1524cdf0e10cSrcweir 
1525cdf0e10cSrcweir 	return bResult;
1526cdf0e10cSrcweir }
1527cdf0e10cSrcweir 
1528cdf0e10cSrcweir //*****************************************************************************************************************
1529cdf0e10cSrcweir //	private method
1530cdf0e10cSrcweir //*****************************************************************************************************************
1531cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::ReadSubMenuEntries( const Sequence< ::rtl::OUString >& aSubMenuNodeNames, Sequence< Sequence< PropertyValue > >& rSubMenuSeq )
1532cdf0e10cSrcweir {
1533cdf0e10cSrcweir 	Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM );
1534cdf0e10cSrcweir 
1535cdf0e10cSrcweir 	// Init the property value sequence
1536cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_URL				].Name = PROPERTYNAME_URL;
1537cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_TITLE			].Name = PROPERTYNAME_TITLE;
1538cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_TARGET			].Name = PROPERTYNAME_TARGET;
1539cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER	].Name = PROPERTYNAME_IMAGEIDENTIFIER;
1540cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_CONTEXT			].Name = PROPERTYNAME_CONTEXT;
1541cdf0e10cSrcweir 	aMenuItem[ OFFSET_MENUITEM_SUBMENU			].Name = PROPERTYNAME_SUBMENU;	// Submenu set!
1542cdf0e10cSrcweir 
1543cdf0e10cSrcweir 	sal_uInt32 nIndex = 0;
1544cdf0e10cSrcweir 	sal_uInt32 nCount = aSubMenuNodeNames.getLength();
1545cdf0e10cSrcweir 	for ( sal_uInt32 n = 0; n < nCount; n++ )
1546cdf0e10cSrcweir 	{
1547cdf0e10cSrcweir 		if ( ReadMenuItem( aSubMenuNodeNames[n], aMenuItem ))
1548cdf0e10cSrcweir 		{
1549cdf0e10cSrcweir 			sal_uInt32 nSubMenuCount = rSubMenuSeq.getLength() + 1;
1550cdf0e10cSrcweir 			rSubMenuSeq.realloc( nSubMenuCount );
1551cdf0e10cSrcweir 			rSubMenuSeq[nIndex++] = aMenuItem;
1552cdf0e10cSrcweir 		}
1553cdf0e10cSrcweir 	}
1554cdf0e10cSrcweir 
1555cdf0e10cSrcweir 	return sal_True;
1556cdf0e10cSrcweir }
1557cdf0e10cSrcweir 
1558cdf0e10cSrcweir //*****************************************************************************************************************
1559cdf0e10cSrcweir //	private method
1560cdf0e10cSrcweir //*****************************************************************************************************************
1561cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::HasAssociatedImages( const ::rtl::OUString& aURL )
1562cdf0e10cSrcweir {
1563cdf0e10cSrcweir 	ImageManager::const_iterator pIter = m_aImageManager.find( aURL );
1564cdf0e10cSrcweir 	return ( pIter != m_aImageManager.end() );
1565cdf0e10cSrcweir }
1566cdf0e10cSrcweir 
1567cdf0e10cSrcweir //*****************************************************************************************************************
1568cdf0e10cSrcweir //	private method
1569cdf0e10cSrcweir //*****************************************************************************************************************
1570cdf0e10cSrcweir void AddonsOptions_Impl::SubstituteVariables( ::rtl::OUString& aURL )
1571cdf0e10cSrcweir {
1572cdf0e10cSrcweir     if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) &&
1573cdf0e10cSrcweir         m_xMacroExpander.is() )
1574cdf0e10cSrcweir     {
1575cdf0e10cSrcweir         // cut protocol
1576cdf0e10cSrcweir         ::rtl::OUString macro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
1577cdf0e10cSrcweir         // decode uric class chars
1578cdf0e10cSrcweir         macro = ::rtl::Uri::decode(
1579cdf0e10cSrcweir             macro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
1580cdf0e10cSrcweir         // expand macro string
1581cdf0e10cSrcweir         aURL = m_xMacroExpander->expandMacros( macro );
1582cdf0e10cSrcweir     }
1583cdf0e10cSrcweir }
1584cdf0e10cSrcweir 
1585cdf0e10cSrcweir //*****************************************************************************************************************
1586cdf0e10cSrcweir //	private method
1587cdf0e10cSrcweir //*****************************************************************************************************************
1588cdf0e10cSrcweir void AddonsOptions_Impl::ReadImageFromURL( ImageSize nImageSize, const ::rtl::OUString& aImageURL, Image& aImage, Image& aImageNoScale )
1589cdf0e10cSrcweir {
1590cdf0e10cSrcweir     SvStream* pStream = UcbStreamHelper::CreateStream( aImageURL, STREAM_STD_READ );
1591cdf0e10cSrcweir     if ( pStream && ( pStream->GetErrorCode() == 0 ))
1592cdf0e10cSrcweir     {
1593cdf0e10cSrcweir         // Use graphic class to also support more graphic formats (bmp,png,...)
1594cdf0e10cSrcweir         Graphic aGraphic;
1595cdf0e10cSrcweir 
1596cdf0e10cSrcweir         GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
1597cdf0e10cSrcweir         pGF->ImportGraphic( aGraphic, String(), *pStream, GRFILTER_FORMAT_DONTKNOW );
1598cdf0e10cSrcweir 
1599cdf0e10cSrcweir         BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
1600cdf0e10cSrcweir 
1601cdf0e10cSrcweir 	    const Size aSize = ( nImageSize == IMGSIZE_SMALL ) ? aImageSizeSmall : aImageSizeBig; // Sizes used for menu/toolbox images
1602cdf0e10cSrcweir 
1603cdf0e10cSrcweir         Size aBmpSize = aBitmapEx.GetSizePixel();
1604cdf0e10cSrcweir 	    if ( aBmpSize.Width() > 0 && aBmpSize.Height() > 0 )
1605cdf0e10cSrcweir         {
1606cdf0e10cSrcweir             // Support non-transparent bitmaps to be downward compatible with OOo 1.1.x addons
1607cdf0e10cSrcweir             if( !aBitmapEx.IsTransparent() )
1608cdf0e10cSrcweir                 aBitmapEx = BitmapEx( aBitmapEx.GetBitmap(), COL_LIGHTMAGENTA );
1609cdf0e10cSrcweir 
1610cdf0e10cSrcweir             // A non-scaled bitmap can have a flexible width, but must have a defined height!
1611cdf0e10cSrcweir             Size aNoScaleSize( aBmpSize.Width(), aSize.Height() );
1612cdf0e10cSrcweir             if ( aBmpSize != aNoScaleSize )
1613cdf0e10cSrcweir             {
1614cdf0e10cSrcweir                 BitmapEx aNoScaleBmp( aBitmapEx );
1615cdf0e10cSrcweir                 aNoScaleBmp.Scale( aNoScaleSize, BMP_SCALE_INTERPOLATE );
1616cdf0e10cSrcweir             }
1617cdf0e10cSrcweir             else
1618cdf0e10cSrcweir                 aImageNoScale = Image( aBitmapEx );
1619cdf0e10cSrcweir 
1620cdf0e10cSrcweir             if ( aBmpSize != aSize )
1621cdf0e10cSrcweir                 aBitmapEx.Scale( aSize, BMP_SCALE_INTERPOLATE );
1622cdf0e10cSrcweir 
1623cdf0e10cSrcweir             aImage = Image( aBitmapEx );
1624cdf0e10cSrcweir         }
1625cdf0e10cSrcweir     }
1626cdf0e10cSrcweir 
1627cdf0e10cSrcweir     delete pStream;
1628cdf0e10cSrcweir }
1629cdf0e10cSrcweir 
1630cdf0e10cSrcweir //*****************************************************************************************************************
1631cdf0e10cSrcweir //	private method
1632cdf0e10cSrcweir //*****************************************************************************************************************
1633cdf0e10cSrcweir void AddonsOptions_Impl::ReadAndAssociateImages( const ::rtl::OUString& aURL, const ::rtl::OUString& aImageId )
1634cdf0e10cSrcweir {
1635cdf0e10cSrcweir     const int   MAX_NUM_IMAGES = 4;
1636cdf0e10cSrcweir     const char* aExtArray[MAX_NUM_IMAGES] = { "_16", "_26", "_16h", "_26h" };
1637cdf0e10cSrcweir     const char* pBmpExt = ".bmp";
1638cdf0e10cSrcweir 
1639cdf0e10cSrcweir     if ( aImageId.getLength() == 0 )
1640cdf0e10cSrcweir         return;
1641cdf0e10cSrcweir 
1642cdf0e10cSrcweir     bool        bImageFound = true;
1643cdf0e10cSrcweir     ImageEntry  aImageEntry;
1644cdf0e10cSrcweir     ::rtl::OUString    aImageURL( aImageId );
1645cdf0e10cSrcweir 
1646cdf0e10cSrcweir     SubstituteVariables( aImageURL );
1647cdf0e10cSrcweir 
1648cdf0e10cSrcweir     // Loop to create the four possible image names and try to read the bitmap files
1649cdf0e10cSrcweir     for ( int i = 0; i < MAX_NUM_IMAGES; i++ )
1650cdf0e10cSrcweir     {
1651cdf0e10cSrcweir         ::rtl::OUStringBuffer aFileURL( aImageURL );
1652cdf0e10cSrcweir         aFileURL.appendAscii( aExtArray[i] );
1653cdf0e10cSrcweir         aFileURL.appendAscii( pBmpExt );
1654cdf0e10cSrcweir 
1655cdf0e10cSrcweir         Image aImage;
1656cdf0e10cSrcweir         Image aImageNoScale;
1657cdf0e10cSrcweir         ReadImageFromURL( ((i==0)||(i==2)) ? IMGSIZE_SMALL : IMGSIZE_BIG, aFileURL.makeStringAndClear(), aImage, aImageNoScale );
1658cdf0e10cSrcweir         if ( !!aImage )
1659cdf0e10cSrcweir         {
1660cdf0e10cSrcweir             bImageFound = true;
1661cdf0e10cSrcweir             switch ( i )
1662cdf0e10cSrcweir             {
1663cdf0e10cSrcweir                 case 0:
1664cdf0e10cSrcweir                     aImageEntry.aImageSmall          = aImage;
1665cdf0e10cSrcweir                     aImageEntry.aImageSmallNoScale   = aImageNoScale;
1666cdf0e10cSrcweir                     break;
1667cdf0e10cSrcweir                 case 1:
1668cdf0e10cSrcweir                     aImageEntry.aImageBig            = aImage;
1669cdf0e10cSrcweir                     aImageEntry.aImageBigNoScale     = aImageNoScale;
1670cdf0e10cSrcweir                     break;
1671cdf0e10cSrcweir                 case 2:
1672cdf0e10cSrcweir                     aImageEntry.aImageSmallHC        = aImage;
1673cdf0e10cSrcweir                     aImageEntry.aImageSmallHCNoScale = aImageNoScale;
1674cdf0e10cSrcweir                     break;
1675cdf0e10cSrcweir                 case 3:
1676cdf0e10cSrcweir                     aImageEntry.aImageBigHC          = aImage;
1677cdf0e10cSrcweir                     aImageEntry.aImageBigHCNoScale   = aImageNoScale;
1678cdf0e10cSrcweir                     break;
1679cdf0e10cSrcweir             }
1680cdf0e10cSrcweir         }
1681cdf0e10cSrcweir     }
1682cdf0e10cSrcweir 
1683cdf0e10cSrcweir     if ( bImageFound )
1684cdf0e10cSrcweir         m_aImageManager.insert( ImageManager::value_type( aURL, aImageEntry ));
1685cdf0e10cSrcweir }
1686cdf0e10cSrcweir 
1687cdf0e10cSrcweir //*****************************************************************************************************************
1688cdf0e10cSrcweir //	private method
1689cdf0e10cSrcweir //*****************************************************************************************************************
1690cdf0e10cSrcweir AddonsOptions_Impl::ImageEntry* AddonsOptions_Impl::ReadImageData( const ::rtl::OUString& aImagesNodeName )
1691cdf0e10cSrcweir {
1692cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aImageDataNodeNames = GetPropertyNamesImages( aImagesNodeName );
1693cdf0e10cSrcweir 	Sequence< Any >		 aPropertyData;
1694cdf0e10cSrcweir 	Sequence< sal_Int8 > aImageDataSeq;
1695cdf0e10cSrcweir 	::rtl::OUString             aImageURL;
1696cdf0e10cSrcweir 
1697cdf0e10cSrcweir 	ImageEntry* pEntry = NULL;
1698cdf0e10cSrcweir 
1699cdf0e10cSrcweir     // It is possible to use both forms (embedded image data and URLs to external bitmap files) at the
1700cdf0e10cSrcweir     // same time. Embedded image data has a higher priority.
1701cdf0e10cSrcweir 	aPropertyData = GetProperties( aImageDataNodeNames );
1702cdf0e10cSrcweir 	for ( int i = 0; i < PROPERTYCOUNT_IMAGES; i++ )
1703cdf0e10cSrcweir 	{
1704cdf0e10cSrcweir         if ( i < PROPERTYCOUNT_EMBEDDED_IMAGES )
1705cdf0e10cSrcweir         {
1706cdf0e10cSrcweir             // Extract image data from the embedded hex binary sequence
1707cdf0e10cSrcweir             Image aImage;
1708cdf0e10cSrcweir 		    if (( aPropertyData[i] >>= aImageDataSeq ) &&
1709cdf0e10cSrcweir 		        aImageDataSeq.getLength() > 0 &&
1710cdf0e10cSrcweir 			    ( CreateImageFromSequence( aImage,
1711cdf0e10cSrcweir 									    (( i == OFFSET_IMAGES_BIG ) ||
1712cdf0e10cSrcweir 									    ( i == OFFSET_IMAGES_BIGHC )),
1713cdf0e10cSrcweir 									    aImageDataSeq )) )
1714cdf0e10cSrcweir 		    {
1715cdf0e10cSrcweir 			    if ( !pEntry )
1716cdf0e10cSrcweir 				    pEntry = new ImageEntry;
1717cdf0e10cSrcweir 
1718cdf0e10cSrcweir 			    if ( i == OFFSET_IMAGES_SMALL )
1719cdf0e10cSrcweir 				    pEntry->aImageSmall = aImage;
1720cdf0e10cSrcweir 			    else if ( i == OFFSET_IMAGES_BIG )
1721cdf0e10cSrcweir 				    pEntry->aImageBig = aImage;
1722cdf0e10cSrcweir 			    else if ( i == OFFSET_IMAGES_SMALLHC )
1723cdf0e10cSrcweir 				    pEntry->aImageSmallHC = aImage;
1724cdf0e10cSrcweir 			    else
1725cdf0e10cSrcweir 				    pEntry->aImageBigHC = aImage;
1726cdf0e10cSrcweir 		    }
1727cdf0e10cSrcweir         }
1728cdf0e10cSrcweir         else
1729cdf0e10cSrcweir         {
1730cdf0e10cSrcweir             // Retrieve image data from a external bitmap file. Make sure that embedded image data
1731cdf0e10cSrcweir             // has a higher priority.
1732cdf0e10cSrcweir             aPropertyData[i] >>= aImageURL;
1733cdf0e10cSrcweir 
1734cdf0e10cSrcweir             if ( aImageURL.getLength() > 0 )
1735cdf0e10cSrcweir             {
1736cdf0e10cSrcweir                 Image aImage;
1737cdf0e10cSrcweir                 Image aImageNoScale;
1738cdf0e10cSrcweir 
1739cdf0e10cSrcweir                 SubstituteVariables( aImageURL );
1740cdf0e10cSrcweir                 ReadImageFromURL( ((i==OFFSET_IMAGES_SMALL_URL)||(i==OFFSET_IMAGES_SMALLHC_URL)) ? IMGSIZE_SMALL : IMGSIZE_BIG,
1741cdf0e10cSrcweir                                   aImageURL, aImage, aImageNoScale );
1742cdf0e10cSrcweir                 if ( !!aImage )
1743cdf0e10cSrcweir                 {
1744cdf0e10cSrcweir                     if ( !pEntry )
1745cdf0e10cSrcweir                         pEntry = new ImageEntry;
1746cdf0e10cSrcweir 
1747cdf0e10cSrcweir                     if ( i == OFFSET_IMAGES_SMALL_URL && !pEntry->aImageSmall )
1748cdf0e10cSrcweir                     {
1749cdf0e10cSrcweir                         pEntry->aImageSmall = aImage;
1750cdf0e10cSrcweir                         pEntry->aImageSmallNoScale = aImageNoScale;
1751cdf0e10cSrcweir                     }
1752cdf0e10cSrcweir                     else if ( i == OFFSET_IMAGES_BIG_URL && !pEntry->aImageBig )
1753cdf0e10cSrcweir                     {
1754cdf0e10cSrcweir                         pEntry->aImageBig = aImage;
1755cdf0e10cSrcweir                         pEntry->aImageBigNoScale = aImageNoScale;
1756cdf0e10cSrcweir                     }
1757cdf0e10cSrcweir 			        else if ( i == OFFSET_IMAGES_SMALLHC_URL && !pEntry->aImageSmallHC )
1758cdf0e10cSrcweir                     {
1759cdf0e10cSrcweir 				        pEntry->aImageSmallHC = aImage;
1760cdf0e10cSrcweir 				        pEntry->aImageSmallHCNoScale = aImageNoScale;
1761cdf0e10cSrcweir                     }
1762cdf0e10cSrcweir 			        else if ( !pEntry->aImageBigHC )
1763cdf0e10cSrcweir                     {
1764cdf0e10cSrcweir 				        pEntry->aImageBigHC = aImage;
1765cdf0e10cSrcweir 				        pEntry->aImageBigHCNoScale = aImageNoScale;
1766cdf0e10cSrcweir                     }
1767cdf0e10cSrcweir                 }
1768cdf0e10cSrcweir             }
1769cdf0e10cSrcweir         }
1770cdf0e10cSrcweir 	}
1771cdf0e10cSrcweir 
1772cdf0e10cSrcweir 	return pEntry;
1773cdf0e10cSrcweir }
1774cdf0e10cSrcweir 
1775cdf0e10cSrcweir //*****************************************************************************************************************
1776cdf0e10cSrcweir //	private method
1777cdf0e10cSrcweir //*****************************************************************************************************************
1778cdf0e10cSrcweir sal_Bool AddonsOptions_Impl::CreateImageFromSequence( Image& rImage, sal_Bool bBig, Sequence< sal_Int8 >& rBitmapDataSeq ) const
1779cdf0e10cSrcweir {
1780cdf0e10cSrcweir 	sal_Bool	bResult = sal_False;
1781cdf0e10cSrcweir 	Size		aSize = bBig ? aImageSizeBig : aImageSizeSmall; // Sizes used for menu/toolbox images
1782cdf0e10cSrcweir 
1783cdf0e10cSrcweir 	if ( rBitmapDataSeq.getLength() > 0 )
1784cdf0e10cSrcweir 	{
1785cdf0e10cSrcweir 		SvMemoryStream	aMemStream( rBitmapDataSeq.getArray(), rBitmapDataSeq.getLength(), STREAM_STD_READ );
1786cdf0e10cSrcweir 		BitmapEx 		aBitmapEx;
1787cdf0e10cSrcweir 
1788cdf0e10cSrcweir         aMemStream >> aBitmapEx;
1789cdf0e10cSrcweir 
1790cdf0e10cSrcweir 		// Scale bitmap to fit the correct size for the menu/toolbar. Use best quality
1791cdf0e10cSrcweir 		if ( aBitmapEx.GetSizePixel() != aSize )
1792cdf0e10cSrcweir 			aBitmapEx.Scale( aSize, BMP_SCALE_INTERPOLATE );
1793cdf0e10cSrcweir 
1794cdf0e10cSrcweir         if( !aBitmapEx.IsTransparent() )
1795cdf0e10cSrcweir         {
1796cdf0e10cSrcweir             // Support non-transparent bitmaps to be downward compatible with OOo 1.1.x addons
1797cdf0e10cSrcweir             aBitmapEx = BitmapEx( aBitmapEx.GetBitmap(), COL_LIGHTMAGENTA );
1798cdf0e10cSrcweir         }
1799cdf0e10cSrcweir 
1800cdf0e10cSrcweir 		rImage = Image( aBitmapEx );
1801cdf0e10cSrcweir 		bResult = sal_True;
1802cdf0e10cSrcweir 	}
1803cdf0e10cSrcweir 
1804cdf0e10cSrcweir 	return bResult;
1805cdf0e10cSrcweir }
1806cdf0e10cSrcweir 
1807cdf0e10cSrcweir //*****************************************************************************************************************
1808cdf0e10cSrcweir //	private methods
1809cdf0e10cSrcweir //*****************************************************************************************************************
1810cdf0e10cSrcweir Sequence< ::rtl::OUString > AddonsOptions_Impl::GetPropertyNamesMergeMenuInstruction( const ::rtl::OUString& aPropertyRootNode ) const
1811cdf0e10cSrcweir {
1812cdf0e10cSrcweir 	Sequence< ::rtl::OUString > lResult( PROPERTYCOUNT_MERGE_MENUBAR );
1813cdf0e10cSrcweir 
1814cdf0e10cSrcweir     // Create property names dependent from the root node name
1815cdf0e10cSrcweir     lResult[ OFFSET_MERGEMENU_MERGEPOINT            ] = ::rtl::OUString( aPropertyRootNode + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEPOINT    ] );
1816cdf0e10cSrcweir     lResult[ OFFSET_MERGEMENU_MERGECOMMAND          ] = ::rtl::OUString( aPropertyRootNode + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMAND  ] );
1817cdf0e10cSrcweir     lResult[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ] = ::rtl::OUString( aPropertyRootNode + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ] );
1818cdf0e10cSrcweir     lResult[ OFFSET_MERGEMENU_MERGEFALLBACK         ] = ::rtl::OUString( aPropertyRootNode + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEFALLBACK ] );
1819cdf0e10cSrcweir     lResult[ OFFSET_MERGEMENU_MERGECONTEXT          ] = ::rtl::OUString( aPropertyRootNode + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECONTEXT  ] );
1820cdf0e10cSrcweir     lResult[ OFFSET_MERGEMENU_MENUITEMS             ] = ::rtl::OUString( aPropertyRootNode + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MENUITEMS     ] );
1821cdf0e10cSrcweir 
1822cdf0e10cSrcweir 	return lResult;
1823cdf0e10cSrcweir }
1824cdf0e10cSrcweir 
1825cdf0e10cSrcweir Sequence< ::rtl::OUString > AddonsOptions_Impl::GetPropertyNamesMenuItem( const ::rtl::OUString& aPropertyRootNode ) const
1826cdf0e10cSrcweir {
1827cdf0e10cSrcweir 	Sequence< ::rtl::OUString > lResult( PROPERTYCOUNT_MENUITEM );
1828cdf0e10cSrcweir 
1829cdf0e10cSrcweir     // Create property names dependent from the root node name
1830cdf0e10cSrcweir 	lResult[OFFSET_MENUITEM_URL]             = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_URL			 ] );
1831cdf0e10cSrcweir 	lResult[OFFSET_MENUITEM_TITLE]           = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_TITLE			 ] );
1832cdf0e10cSrcweir 	lResult[OFFSET_MENUITEM_IMAGEIDENTIFIER] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER ] );
1833cdf0e10cSrcweir 	lResult[OFFSET_MENUITEM_TARGET]          = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_TARGET			 ] );
1834cdf0e10cSrcweir 	lResult[OFFSET_MENUITEM_CONTEXT]         = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT	     ] );
1835cdf0e10cSrcweir 	lResult[OFFSET_MENUITEM_SUBMENU]         = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU	     ] );
1836cdf0e10cSrcweir 
1837cdf0e10cSrcweir 	return lResult;
1838cdf0e10cSrcweir }
1839cdf0e10cSrcweir 
1840cdf0e10cSrcweir //*****************************************************************************************************************
1841cdf0e10cSrcweir //	private method
1842cdf0e10cSrcweir //*****************************************************************************************************************
1843cdf0e10cSrcweir Sequence< ::rtl::OUString > AddonsOptions_Impl::GetPropertyNamesPopupMenu( const ::rtl::OUString& aPropertyRootNode ) const
1844cdf0e10cSrcweir {
1845cdf0e10cSrcweir 	// The URL is automatically set and not read from the configuration.
1846cdf0e10cSrcweir 	Sequence< ::rtl::OUString > lResult( PROPERTYCOUNT_POPUPMENU-1 );
1847cdf0e10cSrcweir 
1848cdf0e10cSrcweir 	// Create property names dependent from the root node name
1849cdf0e10cSrcweir 	lResult[OFFSET_POPUPMENU_TITLE]   = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_TITLE	] );
1850cdf0e10cSrcweir 	lResult[OFFSET_POPUPMENU_CONTEXT] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT	] );
1851cdf0e10cSrcweir 	lResult[OFFSET_POPUPMENU_SUBMENU] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU	] );
1852cdf0e10cSrcweir 
1853cdf0e10cSrcweir 	return lResult;
1854cdf0e10cSrcweir }
1855cdf0e10cSrcweir 
1856cdf0e10cSrcweir //*****************************************************************************************************************
1857cdf0e10cSrcweir //	private method
1858cdf0e10cSrcweir //*****************************************************************************************************************
1859*bb0b5665SAriel Constenla-Haile Sequence< ::rtl::OUString > AddonsOptions_Impl::GetPropertyNamesToolBar( const ::rtl::OUString& aPropertyRootNode ) const
1860*bb0b5665SAriel Constenla-Haile {
1861*bb0b5665SAriel Constenla-Haile     Sequence< ::rtl::OUString > lResult( PROPERTYCOUNT_TOOLBAR );
1862*bb0b5665SAriel Constenla-Haile 
1863*bb0b5665SAriel Constenla-Haile     // Create property names dependent from the root node name
1864*bb0b5665SAriel Constenla-Haile     lResult[OFFSET_TOOLBAR_TITLE]        = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_TITLE ] );
1865*bb0b5665SAriel Constenla-Haile     lResult[OFFSET_TOOLBAR_TOOLBARITEMS] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_TOOLBARITEMS ] );
1866*bb0b5665SAriel Constenla-Haile 
1867*bb0b5665SAriel Constenla-Haile     return lResult;
1868*bb0b5665SAriel Constenla-Haile }
1869*bb0b5665SAriel Constenla-Haile 
1870cdf0e10cSrcweir Sequence< ::rtl::OUString > AddonsOptions_Impl::GetPropertyNamesToolBarItem( const ::rtl::OUString& aPropertyRootNode ) const
1871cdf0e10cSrcweir {
1872cdf0e10cSrcweir 	Sequence< ::rtl::OUString > lResult( PROPERTYCOUNT_TOOLBARITEM );
1873cdf0e10cSrcweir 
1874cdf0e10cSrcweir 	// Create property names dependent from the root node name
1875cdf0e10cSrcweir 	lResult[0] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_URL			  ] );
1876cdf0e10cSrcweir 	lResult[1] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_TITLE		  ] );
1877cdf0e10cSrcweir 	lResult[2] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER] );
1878cdf0e10cSrcweir 	lResult[3] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_TARGET		  ] );
1879cdf0e10cSrcweir 	lResult[4] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT		  ] );
1880cdf0e10cSrcweir 	lResult[5] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_CONTROLTYPE	  ] );
1881cdf0e10cSrcweir 	lResult[6] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_WIDTH		  ] );
1882cdf0e10cSrcweir 
1883cdf0e10cSrcweir 	return lResult;
1884cdf0e10cSrcweir }
1885cdf0e10cSrcweir 
1886fdaa53dfSAriel Constenla-Haile Sequence< ::rtl::OUString > AddonsOptions_Impl::GetPropertyNamesStatusbarItem(
1887fdaa53dfSAriel Constenla-Haile     const ::rtl::OUString& aPropertyRootNode ) const
1888fdaa53dfSAriel Constenla-Haile {
1889fdaa53dfSAriel Constenla-Haile     Sequence< ::rtl::OUString > lResult( PROPERTYCOUNT_STATUSBARITEM );
1890fdaa53dfSAriel Constenla-Haile 
1891fdaa53dfSAriel Constenla-Haile     lResult[0] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_URL       ] );
1892fdaa53dfSAriel Constenla-Haile     lResult[1] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_TITLE     ] );
1893fdaa53dfSAriel Constenla-Haile     lResult[2] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT   ] );
1894fdaa53dfSAriel Constenla-Haile     lResult[3] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_ALIGN     ] );
1895fdaa53dfSAriel Constenla-Haile     lResult[4] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_AUTOSIZE  ] );
1896fdaa53dfSAriel Constenla-Haile     lResult[5] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_OWNERDRAW ] );
1897fdaa53dfSAriel Constenla-Haile     lResult[6] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_WIDTH     ] );
1898fdaa53dfSAriel Constenla-Haile 
1899fdaa53dfSAriel Constenla-Haile     return lResult;
1900fdaa53dfSAriel Constenla-Haile }
1901fdaa53dfSAriel Constenla-Haile 
1902cdf0e10cSrcweir //*****************************************************************************************************************
1903cdf0e10cSrcweir //	private method
1904cdf0e10cSrcweir //*****************************************************************************************************************
1905cdf0e10cSrcweir Sequence< ::rtl::OUString > AddonsOptions_Impl::GetPropertyNamesImages( const ::rtl::OUString& aPropertyRootNode ) const
1906cdf0e10cSrcweir {
1907cdf0e10cSrcweir 	Sequence< ::rtl::OUString > lResult( PROPERTYCOUNT_IMAGES );
1908cdf0e10cSrcweir 
1909cdf0e10cSrcweir 	// Create property names dependent from the root node name
1910cdf0e10cSrcweir 	lResult[0] = ::rtl::OUString( aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL		] );
1911cdf0e10cSrcweir 	lResult[1] = ::rtl::OUString( aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG		] );
1912cdf0e10cSrcweir 	lResult[2] = ::rtl::OUString( aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC	] );
1913cdf0e10cSrcweir 	lResult[3] = ::rtl::OUString( aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC		] );
1914cdf0e10cSrcweir 	lResult[4] = ::rtl::OUString( aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL_URL  ] );
1915cdf0e10cSrcweir 	lResult[5] = ::rtl::OUString( aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG_URL	] );
1916cdf0e10cSrcweir 	lResult[6] = ::rtl::OUString( aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC_URL] );
1917cdf0e10cSrcweir 	lResult[7] = ::rtl::OUString( aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC_URL	] );
1918cdf0e10cSrcweir 
1919cdf0e10cSrcweir 	return lResult;
1920cdf0e10cSrcweir }
1921cdf0e10cSrcweir 
1922cdf0e10cSrcweir //*****************************************************************************************************************
1923cdf0e10cSrcweir //	initialize static member
1924cdf0e10cSrcweir //	DON'T DO IT IN YOUR HEADER!
1925cdf0e10cSrcweir //	see definition for further informations
1926cdf0e10cSrcweir //*****************************************************************************************************************
1927cdf0e10cSrcweir AddonsOptions_Impl*		AddonsOptions::m_pDataContainer = NULL  ;
1928cdf0e10cSrcweir sal_Int32				AddonsOptions::m_nRefCount      = 0     ;
1929cdf0e10cSrcweir 
1930cdf0e10cSrcweir //*****************************************************************************************************************
1931cdf0e10cSrcweir //	constructor
1932cdf0e10cSrcweir //*****************************************************************************************************************
1933cdf0e10cSrcweir AddonsOptions::AddonsOptions()
1934cdf0e10cSrcweir {
1935cdf0e10cSrcweir     // Global access, must be guarded (multithreading!).
1936cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
1937cdf0e10cSrcweir 	// Increase ouer refcount ...
1938cdf0e10cSrcweir 	++m_nRefCount;
1939cdf0e10cSrcweir 	// ... and initialize ouer data container only if it not already exist!
1940cdf0e10cSrcweir     if( m_pDataContainer == NULL )
1941cdf0e10cSrcweir 	{
1942cdf0e10cSrcweir         m_pDataContainer = new AddonsOptions_Impl;
1943cdf0e10cSrcweir 	}
1944cdf0e10cSrcweir }
1945cdf0e10cSrcweir 
1946cdf0e10cSrcweir //*****************************************************************************************************************
1947cdf0e10cSrcweir //	destructor
1948cdf0e10cSrcweir //*****************************************************************************************************************
1949cdf0e10cSrcweir AddonsOptions::~AddonsOptions()
1950cdf0e10cSrcweir {
1951cdf0e10cSrcweir     // Global access, must be guarded (multithreading!)
1952cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
1953cdf0e10cSrcweir 	// Decrease ouer refcount.
1954cdf0e10cSrcweir 	--m_nRefCount;
1955cdf0e10cSrcweir 	// If last instance was deleted ...
1956cdf0e10cSrcweir 	// we must destroy ouer static data container!
1957cdf0e10cSrcweir     if( m_nRefCount <= 0 )
1958cdf0e10cSrcweir 	{
1959cdf0e10cSrcweir 		delete m_pDataContainer;
1960cdf0e10cSrcweir 		m_pDataContainer = NULL;
1961cdf0e10cSrcweir 	}
1962cdf0e10cSrcweir }
1963cdf0e10cSrcweir 
1964cdf0e10cSrcweir //*****************************************************************************************************************
1965cdf0e10cSrcweir //	public method
1966cdf0e10cSrcweir //*****************************************************************************************************************
1967cdf0e10cSrcweir sal_Bool AddonsOptions::HasAddonsMenu() const
1968cdf0e10cSrcweir {
1969cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
1970cdf0e10cSrcweir     return m_pDataContainer->HasAddonsMenu();
1971cdf0e10cSrcweir }
1972cdf0e10cSrcweir 
1973cdf0e10cSrcweir //*****************************************************************************************************************
1974cdf0e10cSrcweir //	public method
1975cdf0e10cSrcweir //*****************************************************************************************************************
1976cdf0e10cSrcweir 
1977cdf0e10cSrcweir sal_Bool AddonsOptions::HasAddonsHelpMenu() const
1978cdf0e10cSrcweir {
1979cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
1980cdf0e10cSrcweir     return m_pDataContainer->HasAddonsHelpMenu();
1981cdf0e10cSrcweir }
1982cdf0e10cSrcweir 
1983cdf0e10cSrcweir //*****************************************************************************************************************
1984cdf0e10cSrcweir //	public method
1985cdf0e10cSrcweir //*****************************************************************************************************************
1986cdf0e10cSrcweir 
1987cdf0e10cSrcweir sal_Int32 AddonsOptions::GetAddonsToolBarCount() const
1988cdf0e10cSrcweir {
1989cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
1990cdf0e10cSrcweir     return m_pDataContainer->GetAddonsToolBarCount();
1991cdf0e10cSrcweir }
1992cdf0e10cSrcweir 
1993cdf0e10cSrcweir //*****************************************************************************************************************
1994cdf0e10cSrcweir //	public method
1995cdf0e10cSrcweir //*****************************************************************************************************************
1996cdf0e10cSrcweir const Sequence< Sequence< PropertyValue > >& AddonsOptions::GetAddonsMenu() const
1997cdf0e10cSrcweir {
1998cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
1999cdf0e10cSrcweir     return m_pDataContainer->GetAddonsMenu();
2000cdf0e10cSrcweir }
2001cdf0e10cSrcweir 
2002cdf0e10cSrcweir //*****************************************************************************************************************
2003cdf0e10cSrcweir //	public method
2004cdf0e10cSrcweir //*****************************************************************************************************************
2005cdf0e10cSrcweir const Sequence< Sequence< PropertyValue > >& AddonsOptions::GetAddonsMenuBarPart() const
2006cdf0e10cSrcweir {
2007cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
2008cdf0e10cSrcweir     return m_pDataContainer->GetAddonsMenuBarPart();
2009cdf0e10cSrcweir }
2010cdf0e10cSrcweir 
2011cdf0e10cSrcweir //*****************************************************************************************************************
2012cdf0e10cSrcweir //	public method
2013cdf0e10cSrcweir //*****************************************************************************************************************
2014cdf0e10cSrcweir const Sequence< Sequence< PropertyValue > >& AddonsOptions::GetAddonsToolBarPart( sal_uInt32 nIndex ) const
2015cdf0e10cSrcweir {
2016cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
2017cdf0e10cSrcweir     return m_pDataContainer->GetAddonsToolBarPart( nIndex );
2018cdf0e10cSrcweir }
2019cdf0e10cSrcweir 
2020cdf0e10cSrcweir //*****************************************************************************************************************
2021cdf0e10cSrcweir //	public method
2022cdf0e10cSrcweir //*****************************************************************************************************************
2023cdf0e10cSrcweir const ::rtl::OUString AddonsOptions::GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const
2024cdf0e10cSrcweir {
2025cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
2026cdf0e10cSrcweir     return m_pDataContainer->GetAddonsToolbarResourceName( nIndex );
2027cdf0e10cSrcweir }
2028cdf0e10cSrcweir 
2029*bb0b5665SAriel Constenla-Haile const ::rtl::OUString AddonsOptions::GetAddonsToolbarUIName( sal_uInt32 nIndex ) const
2030*bb0b5665SAriel Constenla-Haile {
2031*bb0b5665SAriel Constenla-Haile     MutexGuard aGuard( GetOwnStaticMutex() );
2032*bb0b5665SAriel Constenla-Haile     return m_pDataContainer->GetAddonsToolbarUIName( nIndex );
2033*bb0b5665SAriel Constenla-Haile }
2034*bb0b5665SAriel Constenla-Haile 
2035cdf0e10cSrcweir //*****************************************************************************************************************
2036cdf0e10cSrcweir //	public method
2037cdf0e10cSrcweir //*****************************************************************************************************************
2038cdf0e10cSrcweir const Sequence< Sequence< PropertyValue > >& AddonsOptions::GetAddonsHelpMenu() const
2039cdf0e10cSrcweir {
2040cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
2041cdf0e10cSrcweir     return m_pDataContainer->GetAddonsHelpMenu();
2042cdf0e10cSrcweir }
2043cdf0e10cSrcweir 
2044cdf0e10cSrcweir //*****************************************************************************************************************
2045cdf0e10cSrcweir //	public method
2046cdf0e10cSrcweir //*****************************************************************************************************************
2047cdf0e10cSrcweir const MergeMenuInstructionContainer& AddonsOptions::GetMergeMenuInstructions() const
2048cdf0e10cSrcweir {
2049cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
2050cdf0e10cSrcweir     return m_pDataContainer->GetMergeMenuInstructions();
2051cdf0e10cSrcweir }
2052cdf0e10cSrcweir 
2053cdf0e10cSrcweir //*****************************************************************************************************************
2054cdf0e10cSrcweir //	public method
2055cdf0e10cSrcweir //*****************************************************************************************************************
2056cdf0e10cSrcweir bool AddonsOptions::GetMergeToolbarInstructions(
2057cdf0e10cSrcweir     const ::rtl::OUString& rToolbarName,
2058cdf0e10cSrcweir     MergeToolbarInstructionContainer& rToolbarInstructions ) const
2059cdf0e10cSrcweir {
2060cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
2061cdf0e10cSrcweir     return m_pDataContainer->GetMergeToolbarInstructions(
2062cdf0e10cSrcweir         rToolbarName, rToolbarInstructions );
2063cdf0e10cSrcweir }
2064cdf0e10cSrcweir 
2065fdaa53dfSAriel Constenla-Haile const MergeStatusbarInstructionContainer& AddonsOptions::GetMergeStatusbarInstructions() const
2066fdaa53dfSAriel Constenla-Haile {
2067fdaa53dfSAriel Constenla-Haile     MutexGuard aGuard( GetOwnStaticMutex() );
2068fdaa53dfSAriel Constenla-Haile     return m_pDataContainer->GetMergeStatusbarInstructions();
2069fdaa53dfSAriel Constenla-Haile }
2070fdaa53dfSAriel Constenla-Haile 
2071cdf0e10cSrcweir //*****************************************************************************************************************
2072cdf0e10cSrcweir //	public method
2073cdf0e10cSrcweir //*****************************************************************************************************************
2074cdf0e10cSrcweir Image AddonsOptions::GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast, sal_Bool bNoScale ) const
2075cdf0e10cSrcweir {
2076cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
2077cdf0e10cSrcweir     return m_pDataContainer->GetImageFromURL( aURL, bBig, bHiContrast, bNoScale );
2078cdf0e10cSrcweir }
2079cdf0e10cSrcweir 
2080cdf0e10cSrcweir //*****************************************************************************************************************
2081cdf0e10cSrcweir //	public method
2082cdf0e10cSrcweir //*****************************************************************************************************************
2083cdf0e10cSrcweir Image AddonsOptions::GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast ) const
2084cdf0e10cSrcweir {
2085cdf0e10cSrcweir     return GetImageFromURL( aURL, bBig, bHiContrast, sal_False );
2086cdf0e10cSrcweir }
2087cdf0e10cSrcweir 
2088cdf0e10cSrcweir //*****************************************************************************************************************
2089cdf0e10cSrcweir //	private method
2090cdf0e10cSrcweir //*****************************************************************************************************************
2091cdf0e10cSrcweir Mutex& AddonsOptions::GetOwnStaticMutex()
2092cdf0e10cSrcweir {
2093cdf0e10cSrcweir 	// Initialize static mutex only for one time!
2094cdf0e10cSrcweir     static Mutex* pMutex = NULL;
2095cdf0e10cSrcweir 	// If these method first called (Mutex not already exist!) ...
2096cdf0e10cSrcweir     if( pMutex == NULL )
2097cdf0e10cSrcweir     {
2098cdf0e10cSrcweir 		// ... we must create a new one. Protect follow code with the global mutex -
2099cdf0e10cSrcweir 		// It must be - we create a static variable!
2100cdf0e10cSrcweir         MutexGuard aGuard( Mutex::getGlobalMutex() );
2101cdf0e10cSrcweir 		// We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
2102cdf0e10cSrcweir         if( pMutex == NULL )
2103cdf0e10cSrcweir         {
2104cdf0e10cSrcweir 			// Create the new mutex and set it for return on static variable.
2105cdf0e10cSrcweir             static Mutex aMutex;
2106cdf0e10cSrcweir             pMutex = &aMutex;
2107cdf0e10cSrcweir         }
2108cdf0e10cSrcweir     }
2109cdf0e10cSrcweir 	// Return new created or already existing mutex object.
2110cdf0e10cSrcweir     return *pMutex;
2111cdf0e10cSrcweir }
2112cdf0e10cSrcweir 
2113cdf0e10cSrcweir //*****************************************************************************************************************
2114cdf0e10cSrcweir //	private method
2115cdf0e10cSrcweir //*****************************************************************************************************************
2116cdf0e10cSrcweir IMPL_STATIC_LINK_NOINSTANCE( AddonsOptions, Notify, void*, EMPTYARG )
2117cdf0e10cSrcweir {
2118cdf0e10cSrcweir     MutexGuard aGuard( GetOwnStaticMutex() );
2119cdf0e10cSrcweir     m_pDataContainer->ReadConfigurationData();
2120cdf0e10cSrcweir 	return 0;
2121cdf0e10cSrcweir }
2122cdf0e10cSrcweir 
2123cdf0e10cSrcweir }
2124cdf0e10cSrcweir 
2125