Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <uifactory/toolboxfactory.hxx>
21 :
22 : #include <uielement/toolbarwrapper.hxx>
23 : #include <threadhelp/resetableguard.hxx>
24 :
25 : #include <com/sun/star/util/XURLTransformer.hpp>
26 : #include <com/sun/star/frame/XFrame.hpp>
27 : #include <com/sun/star/frame/XModel.hpp>
28 : #include <com/sun/star/lang/XInitialization.hpp>
29 : #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
30 :
31 : #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
32 :
33 : #include <vcl/svapp.hxx>
34 : #include <rtl/ustrbuf.hxx>
35 :
36 : //_________________________________________________________________________________________________________________
37 : // Defines
38 : //_________________________________________________________________________________________________________________
39 :
40 : using namespace com::sun::star::uno;
41 : using namespace com::sun::star::lang;
42 : using namespace com::sun::star::frame;
43 : using namespace com::sun::star::beans;
44 : using namespace com::sun::star::util;
45 : using namespace ::com::sun::star::ui;
46 :
47 : namespace framework
48 : {
49 :
50 : //*****************************************************************************************************************
51 : // XInterface, XTypeProvider, XServiceInfo
52 : //*****************************************************************************************************************
53 137 : DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( ToolBoxFactory ,
54 : ::cppu::OWeakObject ,
55 : SERVICENAME_TOOLBARFACTORY ,
56 : IMPLEMENTATIONNAME_TOOLBARFACTORY
57 : )
58 :
59 8 : DEFINE_INIT_SERVICE ( ToolBoxFactory, {} )
60 :
61 8 : ToolBoxFactory::ToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
62 8 : MenuBarFactory( xServiceManager,true )
63 : {
64 8 : }
65 :
66 : // XUIElementFactory
67 495 : Reference< XUIElement > SAL_CALL ToolBoxFactory::createUIElement(
68 : const ::rtl::OUString& ResourceURL,
69 : const Sequence< PropertyValue >& Args )
70 : throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
71 : {
72 495 : ResetableGuard aLock( m_aLock );
73 495 : ToolBarWrapper* pWrapper = new ToolBarWrapper( m_xServiceManager );
74 495 : Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
75 495 : Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager;
76 495 : aLock.unlock();
77 495 : CreateUIElement(ResourceURL,Args,"PopupMode","private:resource/toolbar/",xMenuBar,xModuleManager,comphelper::getComponentContext(m_xServiceManager));
78 495 : return xMenuBar;
79 : }
80 :
81 : }
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|