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