Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
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>
24 :
25 : #include "helper/unopropertyarrayhelper.hxx"
26 :
27 : // class UnoControlContainerModel
28 :
29 1105 : UnoControlContainerModel::UnoControlContainerModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_factory )
30 1105 : :UnoControlModel( i_factory )
31 : {
32 1105 : ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
33 1105 : ImplRegisterProperty( BASEPROPERTY_BORDER );
34 1105 : ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
35 1105 : ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
36 1105 : ImplRegisterProperty( BASEPROPERTY_ENABLED );
37 1105 : ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
38 1105 : ImplRegisterProperty( BASEPROPERTY_HELPURL );
39 1105 : ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
40 1105 : ImplRegisterProperty( BASEPROPERTY_TEXT );
41 1105 : }
42 :
43 1107 : OUString UnoControlContainerModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
44 : {
45 1107 : return OUString::createFromAscii( szServiceName_UnoControlContainerModel );
46 : }
47 :
48 5 : OUString UnoControlContainerModel::getImplementationName()
49 : throw (css::uno::RuntimeException, std::exception)
50 : {
51 5 : return OUString("stardiv.Toolkit.UnoControlContainerModel");
52 : }
53 :
54 : css::uno::Sequence<OUString>
55 3 : UnoControlContainerModel::getSupportedServiceNames()
56 : throw (css::uno::RuntimeException, std::exception)
57 : {
58 3 : auto s(UnoControlModel::getSupportedServiceNames());
59 3 : s.realloc(s.getLength() + 2);
60 3 : s[s.getLength() - 2] = "com.sun.star.awt.UnoControlContainerModel";
61 3 : s[s.getLength() - 1] = "stardiv.vcl.controlmodel.ControlContainer";
62 3 : return s;
63 : }
64 :
65 9954 : ::com::sun::star::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
66 : {
67 9954 : ::com::sun::star::uno::Any aDefault;
68 9954 : if ( nPropId == BASEPROPERTY_BORDER )
69 1106 : aDefault <<= (sal_Int16) 0;
70 : else
71 8848 : aDefault <<= UnoControlModel::ImplGetDefaultValue( nPropId );
72 9954 : return aDefault;
73 : }
74 :
75 :
76 2216 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
77 : {
78 2216 : static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
79 2216 : return xInfo;
80 : }
81 :
82 346 : ::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper()
83 : {
84 346 : ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
85 :
86 : static UnoPropertyArrayHelper* pHelper = NULL;
87 346 : if ( !pHelper )
88 : {
89 77 : ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
90 77 : pHelper = new UnoPropertyArrayHelper( aIDs );
91 : }
92 346 : return *pHelper;
93 : }
94 :
95 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
96 79 : stardiv_Toolkit_UnoControlContainerModel_get_implementation(
97 : css::uno::XComponentContext *context,
98 : css::uno::Sequence<css::uno::Any> const &)
99 : {
100 79 : return cppu::acquire(new UnoControlContainerModel(context));
101 : }
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|