LibreOffice Module framework (master) 1
toolbarfactory.cxx
Go to the documentation of this file.
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
21#include <vcl/svapp.hxx>
24
25using namespace com::sun::star::uno;
26using namespace com::sun::star::lang;
27using namespace com::sun::star::beans;
28using namespace com::sun::star::util;
29using namespace ::com::sun::star::ui;
30using namespace framework;
31
32namespace {
33
34class ToolBarFactory : public MenuBarFactory
35{
36public:
37 explicit ToolBarFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext );
38
39 virtual OUString SAL_CALL getImplementationName() override
40 {
41 return "com.sun.star.comp.framework.ToolBarFactory";
42 }
43
44 virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override
45 {
46 return cppu::supportsService(this, ServiceName);
47 }
48
49 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
50 {
51 return {"com.sun.star.ui.ToolBarFactory"};
52 }
53
54 // XUIElementFactory
55 virtual css::uno::Reference< css::ui::XUIElement > SAL_CALL createUIElement(
56 const OUString& ResourceURL, const css::uno::Sequence< css::beans::PropertyValue >& Args ) override;
57};
58
59ToolBarFactory::ToolBarFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext ) :
60 MenuBarFactory( xContext )
61{
62}
63
64// XUIElementFactory
65Reference< XUIElement > SAL_CALL ToolBarFactory::createUIElement(
66 const OUString& ResourceURL,
67 const Sequence< PropertyValue >& Args )
68{
70 CreateUIElement(ResourceURL, Args, u"private:resource/toolbar/", xToolBar, m_xContext);
71 return xToolBar;
72}
73
74}
75
76extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
78 css::uno::XComponentContext *context,
79 css::uno::Sequence<css::uno::Any> const &)
80{
81 return cppu::acquire(new ToolBarFactory(context));
82}
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::ui::XUIElement > SAL_CALL createUIElement(const OUString &ResourceURL, const css::uno::Sequence< css::beans::PropertyValue > &Args) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_framework_ToolBarFactory_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
unsigned char sal_Bool