LibreOffice Module connectivity (master) 1
VDescriptor.cxx
Go to the documentation of this file.
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
21#include <com/sun/star/beans/PropertyAttribute.hpp>
25
26#include <algorithm>
27
28namespace connectivity::sdbcx
29{
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::lang;
32 using namespace ::com::sun::star::beans;
33
34
35 // = ODescriptor
36
37
38 ODescriptor::ODescriptor(::cppu::OBroadcastHelper& _rBHelper, bool _bCase, bool _bNew)
39 :ODescriptor_PBASE(_rBHelper)
40 ,m_aCase(_bCase)
41 ,m_bNew(_bNew)
42 {
43 }
44
45
46 // css::lang::XUnoTunnel
47 namespace
48 {
49 struct ResetROAttribute
50 {
51 void operator ()( Property& _rProperty ) const
52 {
53 _rProperty.Attributes &= ~PropertyAttribute::READONLY;
54 }
55 };
56 struct SetROAttribute
57 {
58 void operator ()( Property& _rProperty ) const
59 {
60 _rProperty.Attributes |= PropertyAttribute::READONLY;
61 }
62 };
63 }
64
65
67 {
68 Sequence< Property > aProperties;
70
71 auto [begin, end] = asNonConstRange(aProperties);
72 if ( isNew() )
73 std::for_each( begin, end, ResetROAttribute() );
74 else
75 std::for_each( begin, end, SetROAttribute() );
76
77 return new ::cppu::OPropertyArrayHelper( aProperties );
78 }
79
80
81 bool ODescriptor::isNew( const Reference< XInterface >& _rxDescriptor )
82 {
83 ODescriptor* pImplementation = dynamic_cast<ODescriptor*>( _rxDescriptor.get() );
84 return pImplementation && pImplementation->isNew();
85 }
86
87
88 void ODescriptor::setNew(bool _bNew)
89 {
90 m_bNew = _bNew;
91 }
92
93
94 Sequence< Type > SAL_CALL ODescriptor::getTypes( )
95 {
99 return aTypes.getTypes();
100 }
101
102}
103
104
105/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
Definition: VDescriptor.cxx:94
ODescriptor(::cppu::OBroadcastHelper &_rBHelper, bool _bCase, bool _bNew=false)
Definition: VDescriptor.cxx:38
::cppu::IPropertyArrayHelper * doCreateArrayHelper() const
helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper
Definition: VDescriptor.cxx:66
enumrange< T >::Iterator begin(enumrange< T >)
end
const SvXMLTokenMapEntry aTypes[]