1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_framework.hxx"
26 #include <uifactory/toolboxfactory.hxx>
27 
28 //_________________________________________________________________________________________________________________
29 //	my own includes
30 //_________________________________________________________________________________________________________________
31 #include <uielement/toolbarwrapper.hxx>
32 #include <threadhelp/resetableguard.hxx>
33 
34 //_________________________________________________________________________________________________________________
35 //	interface includes
36 //_________________________________________________________________________________________________________________
37 #include <com/sun/star/util/XURLTransformer.hpp>
38 #include <com/sun/star/frame/XFrame.hpp>
39 #include <com/sun/star/frame/XModel.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
42 
43 #ifndef _COM_SUN_STAR_UI_XUICONFIGURATIONMANAGERSUPLLIER_HPP_
44 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
45 #endif
46 
47 //_________________________________________________________________________________________________________________
48 //	includes of other projects
49 //_________________________________________________________________________________________________________________
50 #include <vcl/svapp.hxx>
51 #include <tools/urlobj.hxx>
52 #include <rtl/ustrbuf.hxx>
53 
54 //_________________________________________________________________________________________________________________
55 //	Defines
56 //_________________________________________________________________________________________________________________
57 //
58 
59 using namespace com::sun::star::uno;
60 using namespace com::sun::star::lang;
61 using namespace com::sun::star::frame;
62 using namespace com::sun::star::beans;
63 using namespace com::sun::star::util;
64 using namespace ::com::sun::star::ui;
65 
66 namespace framework
67 {
68 
69 //*****************************************************************************************************************
70 //	XInterface, XTypeProvider, XServiceInfo
71 //*****************************************************************************************************************
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE(ToolBoxFactory,::cppu::OWeakObject,SERVICENAME_TOOLBARFACTORY,IMPLEMENTATIONNAME_TOOLBARFACTORY)72 DEFINE_XSERVICEINFO_ONEINSTANCESERVICE  (   ToolBoxFactory				                    ,
73                                             ::cppu::OWeakObject							    ,
74                                             SERVICENAME_TOOLBARFACTORY	                    ,
75 											IMPLEMENTATIONNAME_TOOLBARFACTORY
76 										)
77 
78 DEFINE_INIT_SERVICE                     (   ToolBoxFactory, {} )
79 
80 ToolBoxFactory::ToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
81     MenuBarFactory( xServiceManager,true )
82 {
83 }
84 
85 // XUIElementFactory
createUIElement(const::rtl::OUString & ResourceURL,const Sequence<PropertyValue> & Args)86 Reference< XUIElement > SAL_CALL ToolBoxFactory::createUIElement(
87     const ::rtl::OUString& ResourceURL,
88     const Sequence< PropertyValue >& Args )
89 throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
90 {
91     ResetableGuard aLock( m_aLock );
92     ToolBarWrapper* pWrapper = new ToolBarWrapper( m_xServiceManager );
93     Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
94     Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager;
95     aLock.unlock();
96     CreateUIElement(ResourceURL,Args,"PopupMode","private:resource/toolbar/",xMenuBar,xModuleManager,m_xServiceManager);
97     return xMenuBar;
98 }
99 
100 }
101 
102