Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / toolkit / source / controls / unocontrolcontainermodel.cxx
blobd7ded7950c2ffda48c4a078008985b80e0caa666
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 <toolkit/controls/unocontrolcontainermodel.hxx>
22 #include <toolkit/helper/property.hxx>
23 #include <toolkit/helper/servicenames.hxx>
25 #include <helper/unopropertyarrayhelper.hxx>
27 // class UnoControlContainerModel
29 UnoControlContainerModel::UnoControlContainerModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory )
30 :UnoControlModel( i_factory )
32 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
33 ImplRegisterProperty( BASEPROPERTY_BORDER );
34 ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
35 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
36 ImplRegisterProperty( BASEPROPERTY_ENABLED );
37 ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
38 ImplRegisterProperty( BASEPROPERTY_HELPURL );
39 ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
40 ImplRegisterProperty( BASEPROPERTY_TEXT );
43 OUString UnoControlContainerModel::getServiceName()
45 return OUString::createFromAscii( szServiceName_UnoControlContainerModel );
48 OUString UnoControlContainerModel::getImplementationName()
50 return OUString("stardiv.Toolkit.UnoControlContainerModel");
53 css::uno::Sequence<OUString>
54 UnoControlContainerModel::getSupportedServiceNames()
56 auto s(UnoControlModel::getSupportedServiceNames());
57 s.realloc(s.getLength() + 2);
58 s[s.getLength() - 2] = "com.sun.star.awt.UnoControlContainerModel";
59 s[s.getLength() - 1] = "stardiv.vcl.controlmodel.ControlContainer";
60 return s;
63 css::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
65 css::uno::Any aDefault;
66 if ( nPropId == BASEPROPERTY_BORDER )
67 aDefault <<= sal_Int16(0);
68 else
69 aDefault = UnoControlModel::ImplGetDefaultValue( nPropId );
70 return aDefault;
74 css::uno::Reference< css::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( )
76 static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
77 return xInfo;
80 ::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper()
82 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
84 static UnoPropertyArrayHelper* pHelper = nullptr;
85 if ( !pHelper )
87 css::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
88 pHelper = new UnoPropertyArrayHelper( aIDs );
90 return *pHelper;
93 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
94 stardiv_Toolkit_UnoControlContainerModel_get_implementation(
95 css::uno::XComponentContext *context,
96 css::uno::Sequence<css::uno::Any> const &)
98 return cppu::acquire(new UnoControlContainerModel(context));
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */