Avoid potential negative array index access to cached text.
[LibreOffice.git] / framework / source / fwe / classes / actiontriggercontainer.cxx
blob360223e6eb6715b13e517b6fa10682dfc22b6d7d
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 <classes/actiontriggercontainer.hxx>
21 #include <classes/actiontriggerpropertyset.hxx>
22 #include <classes/actiontriggerseparatorpropertyset.hxx>
23 #include <cppuhelper/queryinterface.hxx>
24 #include <cppuhelper/supportsservice.hxx>
25 #include <cppuhelper/typeprovider.hxx>
27 using namespace cppu;
28 using namespace com::sun::star::uno;
29 using namespace com::sun::star::lang;
30 using namespace com::sun::star::container;
32 namespace framework
35 ActionTriggerContainer::ActionTriggerContainer()
39 ActionTriggerContainer::~ActionTriggerContainer()
43 // XInterface
44 Any SAL_CALL ActionTriggerContainer::queryInterface( const Type& aType )
46 Any a = ::cppu::queryInterface(
47 aType ,
48 static_cast< XMultiServiceFactory* >(this),
49 static_cast< XServiceInfo* >(this),
50 static_cast< XTypeProvider* >(this));
52 if( a.hasValue() )
54 return a;
57 return PropertySetContainer::queryInterface( aType );
60 void ActionTriggerContainer::acquire() noexcept
62 PropertySetContainer::acquire();
65 void ActionTriggerContainer::release() noexcept
67 PropertySetContainer::release();
70 // XMultiServiceFactory
71 Reference< XInterface > SAL_CALL ActionTriggerContainer::createInstance( const OUString& aServiceSpecifier )
73 if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGER )
74 return static_cast<OWeakObject *>( new ActionTriggerPropertySet());
75 else if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGERCONTAINER )
76 return static_cast<OWeakObject *>( new ActionTriggerContainer());
77 else if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGERSEPARATOR )
78 return static_cast<OWeakObject *>( new ActionTriggerSeparatorPropertySet());
79 else
80 throw css::uno::RuntimeException("Unknown service specifier!", static_cast<OWeakObject *>(this) );
83 Reference< XInterface > SAL_CALL ActionTriggerContainer::createInstanceWithArguments( const OUString& ServiceSpecifier, const Sequence< Any >& /*Arguments*/ )
85 return createInstance( ServiceSpecifier );
88 Sequence< OUString > SAL_CALL ActionTriggerContainer::getAvailableServiceNames()
90 Sequence< OUString > aSeq{ SERVICENAME_ACTIONTRIGGER,
91 SERVICENAME_ACTIONTRIGGERCONTAINER,
92 SERVICENAME_ACTIONTRIGGERSEPARATOR };
94 return aSeq;
97 // XServiceInfo
98 OUString SAL_CALL ActionTriggerContainer::getImplementationName()
100 return IMPLEMENTATIONNAME_ACTIONTRIGGERCONTAINER;
103 sal_Bool SAL_CALL ActionTriggerContainer::supportsService( const OUString& ServiceName )
105 return cppu::supportsService(this, ServiceName);
108 Sequence< OUString > SAL_CALL ActionTriggerContainer::getSupportedServiceNames()
110 Sequence< OUString > seqServiceNames { SERVICENAME_ACTIONTRIGGERCONTAINER };
111 return seqServiceNames;
114 // XTypeProvider
115 Sequence< Type > SAL_CALL ActionTriggerContainer::getTypes()
117 // Create a static typecollection ...
118 static ::cppu::OTypeCollection ourTypeCollection(
119 cppu::UnoType<XMultiServiceFactory>::get(),
120 cppu::UnoType<XIndexContainer>::get(),
121 cppu::UnoType<XServiceInfo>::get(),
122 cppu::UnoType<XTypeProvider>::get());
124 return ourTypeCollection.getTypes();
127 Sequence< sal_Int8 > SAL_CALL ActionTriggerContainer::getImplementationId()
129 return css::uno::Sequence<sal_Int8>();
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */