1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <cppuhelper/supportsservice.hxx>
21 #include <vcl/svapp.hxx>
22 #include <rtl/ustrbuf.hxx>
23 #include <uielement/toolbarwrapper.hxx>
24 #include <uifactory/menubarfactory.hxx>
26 using namespace com::sun::star::uno
;
27 using namespace com::sun::star::lang
;
28 using namespace com::sun::star::beans
;
29 using namespace com::sun::star::util
;
30 using namespace ::com::sun::star::ui
;
31 using namespace framework
;
35 class ToolBarFactory
: public MenuBarFactory
38 explicit ToolBarFactory( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
40 virtual OUString SAL_CALL
getImplementationName() override
42 return "com.sun.star.comp.framework.ToolBarFactory";
45 virtual sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
) override
47 return cppu::supportsService(this, ServiceName
);
50 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
52 return {"com.sun.star.ui.ToolBarFactory"};
56 virtual css::uno::Reference
< css::ui::XUIElement
> SAL_CALL
createUIElement(
57 const OUString
& ResourceURL
, const css::uno::Sequence
< css::beans::PropertyValue
>& Args
) override
;
60 ToolBarFactory::ToolBarFactory( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
) :
61 MenuBarFactory( xContext
)
66 Reference
< XUIElement
> SAL_CALL
ToolBarFactory::createUIElement(
67 const OUString
& ResourceURL
,
68 const Sequence
< PropertyValue
>& Args
)
70 Reference
< css::ui::XUIElement
> xToolBar(
71 static_cast<OWeakObject
*>(new ToolBarWrapper(m_xContext
)), UNO_QUERY
);
72 CreateUIElement(ResourceURL
, Args
, "private:resource/toolbar/", xToolBar
, m_xContext
);
78 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
79 com_sun_star_comp_framework_ToolBarFactory_get_implementation(
80 css::uno::XComponentContext
*context
,
81 css::uno::Sequence
<css::uno::Any
> const &)
83 return cppu::acquire(new ToolBarFactory(context
));
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */