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/statusbarfactory.hxx>
31 #include <uifactory/menubarfactory.hxx>
32 
33 //_________________________________________________________________________________________________________________
34 //	my own includes
35 //_________________________________________________________________________________________________________________
36 #include <uielement/statusbarwrapper.hxx>
37 #include <threadhelp/resetableguard.hxx>
38 
39 //_________________________________________________________________________________________________________________
40 //	interface includes
41 //_________________________________________________________________________________________________________________
42 #include <com/sun/star/util/XURLTransformer.hpp>
43 #include <com/sun/star/frame/XFrame.hpp>
44 #include <com/sun/star/frame/XModel.hpp>
45 #include <com/sun/star/lang/XInitialization.hpp>
46 #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
47 
48 #ifndef _COM_SUN_STAR_UI_XUICONFIGURATIONMANAGERSUPLLIER_HPP_
49 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
50 #endif
51 
52 //_________________________________________________________________________________________________________________
53 //	includes of other projects
54 //_________________________________________________________________________________________________________________
55 #include <vcl/svapp.hxx>
56 #include <tools/urlobj.hxx>
57 #include <rtl/ustrbuf.hxx>
58 
59 //_________________________________________________________________________________________________________________
60 //	Defines
61 //_________________________________________________________________________________________________________________
62 //
63 
64 using namespace com::sun::star::uno;
65 using namespace com::sun::star::lang;
66 using namespace com::sun::star::frame;
67 using namespace com::sun::star::beans;
68 using namespace com::sun::star::util;
69 using namespace ::com::sun::star::ui;
70 
71 namespace framework
72 {
73 
74 //*****************************************************************************************************************
75 //	XInterface, XTypeProvider, XServiceInfo
76 //*****************************************************************************************************************
77 DEFINE_XSERVICEINFO_ONEINSTANCESERVICE  (   StatusBarFactory				                ,
78                                             ::cppu::OWeakObject							    ,
79                                             SERVICENAME_STATUSBARFACTORY	                ,
80 											IMPLEMENTATIONNAME_STATUSBARFACTORY
81 										)
82 
83 DEFINE_INIT_SERVICE                     (   StatusBarFactory, {} )
84 
85 StatusBarFactory::StatusBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
86     MenuBarFactory( xServiceManager,true )
87 {
88     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarFactory::StatusBarFactory" );
89 }
90 
91 // XUIElementFactory
92 Reference< XUIElement > SAL_CALL StatusBarFactory::createUIElement(
93     const ::rtl::OUString& ResourceURL,
94     const Sequence< PropertyValue >& Args )
95 throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
96 {
97     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarFactory::createUIElement" );
98     // SAFE
99     ResetableGuard aLock( m_aLock );
100     StatusBarWrapper* pWrapper = new StatusBarWrapper( m_xServiceManager );
101     Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
102     Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager;
103     aLock.unlock();
104     MenuBarFactory::CreateUIElement(ResourceURL,Args,NULL,"private:resource/statusbar/",xMenuBar,xModuleManager,m_xServiceManager);
105     return xMenuBar;
106 }
107 
108 }
109 
110