Avoid potential negative array index access to cached text.
[LibreOffice.git] / toolkit / source / controls / unocontrolcontainermodel.cxx
blob6bfaf4448cd1d71cd948e19fc3b8372591a86f87
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 <com/sun/star/uno/XComponentContext.hpp>
21 #include <controls/unocontrolcontainermodel.hxx>
22 #include <helper/property.hxx>
24 #include <helper/unopropertyarrayhelper.hxx>
27 UnoControlContainerModel::UnoControlContainerModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory )
28 :UnoControlModel( i_factory )
30 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
31 ImplRegisterProperty( BASEPROPERTY_BORDER );
32 ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
33 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
34 ImplRegisterProperty( BASEPROPERTY_ENABLED );
35 ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
36 ImplRegisterProperty( BASEPROPERTY_HELPURL );
37 ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
38 ImplRegisterProperty( BASEPROPERTY_TEXT );
41 OUString UnoControlContainerModel::getServiceName()
43 return "stardiv.vcl.controlmodel.ControlContainer";
46 OUString UnoControlContainerModel::getImplementationName()
48 return "stardiv.Toolkit.UnoControlContainerModel";
51 css::uno::Sequence<OUString>
52 UnoControlContainerModel::getSupportedServiceNames()
54 auto s(UnoControlModel::getSupportedServiceNames());
55 s.realloc(s.getLength() + 2);
56 auto ps = s.getArray();
57 ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlContainerModel";
58 ps[s.getLength() - 1] = "stardiv.vcl.controlmodel.ControlContainer";
59 return s;
62 css::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
64 css::uno::Any aDefault;
65 if ( nPropId == BASEPROPERTY_BORDER )
66 aDefault <<= sal_Int16(0);
67 else
68 aDefault = UnoControlModel::ImplGetDefaultValue( nPropId );
69 return aDefault;
73 css::uno::Reference< css::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( )
75 static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
76 return xInfo;
79 ::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper()
81 static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() );
82 return aHelper;
85 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
86 stardiv_Toolkit_UnoControlContainerModel_get_implementation(
87 css::uno::XComponentContext *context,
88 css::uno::Sequence<css::uno::Any> const &)
90 return cppu::acquire(new UnoControlContainerModel(context));
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */