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 <com/sun/star/frame/ModuleManager.hpp>
21 :
22 : #include <cppuhelper/supportsservice.hxx>
23 : #include <vcl/svapp.hxx>
24 : #include <rtl/ustrbuf.hxx>
25 : #include <uielement/toolbarwrapper.hxx>
26 : #include <uifactory/menubarfactory.hxx>
27 :
28 : using namespace com::sun::star::uno;
29 : using namespace com::sun::star::lang;
30 : using namespace com::sun::star::frame;
31 : using namespace com::sun::star::beans;
32 : using namespace com::sun::star::util;
33 : using namespace ::com::sun::star::ui;
34 : using namespace framework;
35 :
36 : namespace {
37 :
38 0 : class ToolBarFactory : public MenuBarFactory
39 : {
40 : public:
41 : ToolBarFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext );
42 :
43 0 : virtual OUString SAL_CALL getImplementationName()
44 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
45 : {
46 0 : return OUString("com.sun.star.comp.framework.ToolBarFactory");
47 : }
48 :
49 0 : virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
50 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
51 : {
52 0 : return cppu::supportsService(this, ServiceName);
53 : }
54 :
55 0 : virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
56 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
57 : {
58 0 : css::uno::Sequence< OUString > aSeq(1);
59 0 : aSeq[0] = OUString("com.sun.star.ui.ToolBarFactory");
60 0 : return aSeq;
61 : }
62 :
63 : // XUIElementFactory
64 : virtual css::uno::Reference< css::ui::XUIElement > SAL_CALL createUIElement(
65 : const OUString& ResourceURL, const css::uno::Sequence< css::beans::PropertyValue >& Args )
66 : throw ( css::container::NoSuchElementException, css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
67 : };
68 :
69 0 : ToolBarFactory::ToolBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) :
70 0 : MenuBarFactory( xContext )
71 : {
72 0 : }
73 :
74 : // XUIElementFactory
75 0 : Reference< XUIElement > SAL_CALL ToolBarFactory::createUIElement(
76 : const OUString& ResourceURL,
77 : const Sequence< PropertyValue >& Args )
78 : throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception )
79 : {
80 : Reference< ::com::sun::star::ui::XUIElement > xToolBar(
81 0 : static_cast<OWeakObject *>(new ToolBarWrapper(m_xContext)), UNO_QUERY);
82 0 : CreateUIElement(ResourceURL, Args, "PopupMode", "private:resource/toolbar/", xToolBar, m_xContext);
83 0 : return xToolBar;
84 : }
85 :
86 : }
87 :
88 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
89 0 : com_sun_star_comp_framework_ToolBarFactory_get_implementation(
90 : css::uno::XComponentContext *context,
91 : css::uno::Sequence<css::uno::Any> const &)
92 : {
93 0 : return cppu::acquire(new ToolBarFactory(context));
94 : }
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|