1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <connectivity/sdbcx/VDescriptor.hxx>
21 #include <com/sun/star/beans/PropertyAttribute.hpp>
22 #include <comphelper/servicehelper.hxx>
23 #include <cppuhelper/queryinterface.hxx>
24 #include <cppuhelper/typeprovider.hxx>
28 namespace connectivity::sdbcx
30 using namespace ::com::sun::star::uno
;
31 using namespace ::com::sun::star::beans
;
37 ODescriptor::ODescriptor(::cppu::OBroadcastHelper
& _rBHelper
, bool _bCase
, bool _bNew
)
38 :ODescriptor_PBASE(_rBHelper
)
45 // css::lang::XUnoTunnel
48 struct ResetROAttribute
50 void operator ()( Property
& _rProperty
) const
52 _rProperty
.Attributes
&= ~PropertyAttribute::READONLY
;
57 void operator ()( Property
& _rProperty
) const
59 _rProperty
.Attributes
|= PropertyAttribute::READONLY
;
65 ::cppu::IPropertyArrayHelper
* ODescriptor::doCreateArrayHelper() const
67 Sequence
< Property
> aProperties
;
68 describeProperties( aProperties
);
70 auto [begin
, end
] = asNonConstRange(aProperties
);
72 std::for_each( begin
, end
, ResetROAttribute() );
74 std::for_each( begin
, end
, SetROAttribute() );
76 return new ::cppu::OPropertyArrayHelper( aProperties
);
80 bool ODescriptor::isNew( const Reference
< XInterface
>& _rxDescriptor
)
82 ODescriptor
* pImplementation
= dynamic_cast<ODescriptor
*>( _rxDescriptor
.get() );
83 return pImplementation
&& pImplementation
->isNew();
87 void ODescriptor::setNew(bool _bNew
)
93 Sequence
< Type
> SAL_CALL
ODescriptor::getTypes( )
95 ::cppu::OTypeCollection
aTypes( cppu::UnoType
<XMultiPropertySet
>::get(),
96 cppu::UnoType
<XFastPropertySet
>::get(),
97 cppu::UnoType
<XPropertySet
>::get());
98 return aTypes
.getTypes();
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */