1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_framework.hxx"
30 #include <uifactory/toolboxfactory.hxx>
31 
32 //_________________________________________________________________________________________________________________
33 //	my own includes
34 //_________________________________________________________________________________________________________________
35 #include <uielement/toolbarwrapper.hxx>
36 #include <threadhelp/resetableguard.hxx>
37 
38 //_________________________________________________________________________________________________________________
39 //	interface includes
40 //_________________________________________________________________________________________________________________
41 #include <com/sun/star/util/XURLTransformer.hpp>
42 #include <com/sun/star/frame/XFrame.hpp>
43 #include <com/sun/star/frame/XModel.hpp>
44 #include <com/sun/star/lang/XInitialization.hpp>
45 #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
46 
47 #ifndef _COM_SUN_STAR_UI_XUICONFIGURATIONMANAGERSUPLLIER_HPP_
48 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
49 #endif
50 
51 //_________________________________________________________________________________________________________________
52 //	includes of other projects
53 //_________________________________________________________________________________________________________________
54 #include <vcl/svapp.hxx>
55 #include <tools/urlobj.hxx>
56 #include <rtl/ustrbuf.hxx>
57 
58 //_________________________________________________________________________________________________________________
59 //	Defines
60 //_________________________________________________________________________________________________________________
61 //
62 
63 using namespace com::sun::star::uno;
64 using namespace com::sun::star::lang;
65 using namespace com::sun::star::frame;
66 using namespace com::sun::star::beans;
67 using namespace com::sun::star::util;
68 using namespace ::com::sun::star::ui;
69 
70 namespace framework
71 {
72 
73 //*****************************************************************************************************************
74 //	XInterface, XTypeProvider, XServiceInfo
75 //*****************************************************************************************************************
76 DEFINE_XSERVICEINFO_ONEINSTANCESERVICE  (   ToolBoxFactory				                    ,
77                                             ::cppu::OWeakObject							    ,
78                                             SERVICENAME_TOOLBARFACTORY	                    ,
79 											IMPLEMENTATIONNAME_TOOLBARFACTORY
80 										)
81 
82 DEFINE_INIT_SERVICE                     (   ToolBoxFactory, {} )
83 
84 ToolBoxFactory::ToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
85     MenuBarFactory( xServiceManager,true )
86 {
87 }
88 
89 // XUIElementFactory
90 Reference< XUIElement > SAL_CALL ToolBoxFactory::createUIElement(
91     const ::rtl::OUString& ResourceURL,
92     const Sequence< PropertyValue >& Args )
93 throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
94 {
95     ResetableGuard aLock( m_aLock );
96     ToolBarWrapper* pWrapper = new ToolBarWrapper( m_xServiceManager );
97     Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
98     Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager;
99     aLock.unlock();
100     CreateUIElement(ResourceURL,Args,"PopupMode","private:resource/toolbar/",xMenuBar,xModuleManager,m_xServiceManager);
101     return xMenuBar;
102 }
103 
104 }
105 
106