Branch libreoffice-5-0-4
[LibreOffice.git] / toolkit / source / controls / unocontrolcontainermodel.cxx
blob5784645fc29ebc1f614309d59b03f7ccc6c6600a
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 ::com::sun::star::uno::Reference< ::com::sun::star::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() throw(::com::sun::star::uno::RuntimeException, std::exception)
45 return OUString::createFromAscii( szServiceName_UnoControlContainerModel );
48 OUString UnoControlContainerModel::getImplementationName()
49 throw (css::uno::RuntimeException, std::exception)
51 return OUString("stardiv.Toolkit.UnoControlContainerModel");
54 css::uno::Sequence<OUString>
55 UnoControlContainerModel::getSupportedServiceNames()
56 throw (css::uno::RuntimeException, std::exception)
58 auto s(UnoControlModel::getSupportedServiceNames());
59 s.realloc(s.getLength() + 2);
60 s[s.getLength() - 2] = "com.sun.star.awt.UnoControlContainerModel";
61 s[s.getLength() - 1] = "stardiv.vcl.controlmodel.ControlContainer";
62 return s;
65 ::com::sun::star::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
67 ::com::sun::star::uno::Any aDefault;
68 if ( nPropId == BASEPROPERTY_BORDER )
69 aDefault <<= (sal_Int16) 0;
70 else
71 aDefault <<= UnoControlModel::ImplGetDefaultValue( nPropId );
72 return aDefault;
76 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
78 static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
79 return xInfo;
82 ::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper()
84 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
86 static UnoPropertyArrayHelper* pHelper = NULL;
87 if ( !pHelper )
89 ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
90 pHelper = new UnoPropertyArrayHelper( aIDs );
92 return *pHelper;
95 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
96 stardiv_Toolkit_UnoControlContainerModel_get_implementation(
97 css::uno::XComponentContext *context,
98 css::uno::Sequence<css::uno::Any> const &)
100 return cppu::acquire(new UnoControlContainerModel(context));
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */