Avoid potential negative array index access to cached text.
[LibreOffice.git] / framework / source / uifactory / statusbarfactory.cxx
blob2914dc4cc430e5f5260aa9404643015f83ebcbb3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <uifactory/menubarfactory.hxx>
21 #include <uielement/statusbarwrapper.hxx>
23 #include <cppuhelper/supportsservice.hxx>
25 using namespace com::sun::star::uno;
26 using namespace com::sun::star::lang;
27 using namespace com::sun::star::beans;
28 using namespace com::sun::star::util;
29 using namespace ::com::sun::star::ui;
31 using namespace framework;
33 namespace {
35 class StatusBarFactory : public MenuBarFactory
37 public:
38 explicit StatusBarFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext );
40 virtual OUString SAL_CALL getImplementationName() override
42 return "com.sun.star.comp.framework.StatusBarFactory";
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.StatusBarFactory"};
55 // XUIElementFactory
56 virtual css::uno::Reference< css::ui::XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const css::uno::Sequence< css::beans::PropertyValue >& Args ) override;
59 StatusBarFactory::StatusBarFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext ) :
60 MenuBarFactory( xContext )
64 // XUIElementFactory
65 Reference< XUIElement > SAL_CALL StatusBarFactory::createUIElement(
66 const OUString& ResourceURL,
67 const Sequence< PropertyValue >& Args )
69 Reference< css::ui::XUIElement > xStatusBar = new StatusBarWrapper(m_xContext);
70 MenuBarFactory::CreateUIElement(ResourceURL, Args, u"private:resource/statusbar/", xStatusBar, m_xContext);
71 return xStatusBar;
76 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
77 com_sun_star_comp_framework_StatusBarFactory_get_implementation(
78 css::uno::XComponentContext *context,
79 css::uno::Sequence<css::uno::Any> const &)
81 return cppu::acquire(new StatusBarFactory(context));
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */