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