fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / svx / source / table / propertyset.cxx
blobdb14b3ae7c6b6f3b9c820ad1063c31ce57439477
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 .
21 #include "propertyset.hxx"
23 using namespace ::com::sun::star::uno;
24 using namespace ::com::sun::star::beans;
25 using namespace ::com::sun::star::lang;
27 namespace sdr { namespace table {
29 FastPropertySetInfo::FastPropertySetInfo( const PropertyVector& rProps )
31 addProperties( rProps );
36 FastPropertySetInfo::~FastPropertySetInfo()
42 void FastPropertySetInfo::addProperties( const PropertyVector& rProps )
44 sal_uInt32 nIndex = maProperties.size();
45 sal_uInt32 nCount = rProps.size();
46 maProperties.resize( nIndex + nCount );
47 PropertyVector::const_iterator aIter( rProps.begin() );
48 while( nCount-- )
50 const Property& rProperty = (*aIter++);
51 maProperties[nIndex] = rProperty;
52 maMap[ rProperty.Name ] = nIndex++;
58 const Property& FastPropertySetInfo::getProperty( const OUString& aName ) throw (UnknownPropertyException )
60 PropertyMap::iterator aIter( maMap.find( aName ) );
61 if( aIter == maMap.end() )
62 throw UnknownPropertyException();
63 return maProperties[(*aIter).second];
68 const Property* FastPropertySetInfo::hasProperty( const OUString& aName )
70 PropertyMap::iterator aIter( maMap.find( aName ) );
71 if( aIter == maMap.end() )
72 return 0;
73 else
74 return &maProperties[(*aIter).second];
78 // XPropertySetInfo
81 Sequence< Property > SAL_CALL FastPropertySetInfo::getProperties() throw (RuntimeException, std::exception)
83 return Sequence< Property >( &maProperties[0], maProperties.size() );
88 Property SAL_CALL FastPropertySetInfo::getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException, std::exception)
90 return getProperty( aName );
95 sal_Bool SAL_CALL FastPropertySetInfo::hasPropertyByName( const OUString& aName ) throw (RuntimeException, std::exception)
97 return hasProperty( aName ) != 0 ? sal_True : sal_False;
100 FastPropertySet::FastPropertySet( const rtl::Reference< FastPropertySetInfo >& xInfo )
101 : mxInfo( xInfo )
107 FastPropertySet::~FastPropertySet()
112 // XPropertySet
115 Reference< XPropertySetInfo > SAL_CALL FastPropertySet::getPropertySetInfo( ) throw (RuntimeException, std::exception)
117 return Reference< XPropertySetInfo >( mxInfo.get() );
122 void SAL_CALL FastPropertySet::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
124 setFastPropertyValue( mxInfo->getProperty( aPropertyName ).Handle, aValue );
129 Any SAL_CALL FastPropertySet::getPropertyValue( const OUString& aPropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
131 return getFastPropertyValue( mxInfo->getProperty( aPropertyName ).Handle );
136 void SAL_CALL FastPropertySet::addPropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
142 void SAL_CALL FastPropertySet::removePropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
148 void SAL_CALL FastPropertySet::addVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
154 void SAL_CALL FastPropertySet::removeVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
159 // XMultiPropertySet
162 void SAL_CALL FastPropertySet::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
164 const OUString* pPropertyNames = aPropertyNames.getConstArray();
165 const Any* pValues = aValues.getConstArray();
166 sal_Int32 nCount = aPropertyNames.getLength();
167 if( nCount != aValues.getLength() )
168 throw IllegalArgumentException();
170 while( nCount-- )
172 const Property* pProperty = mxInfo->hasProperty( *pPropertyNames++ );
173 if( pProperty ) try
175 setFastPropertyValue( pProperty->Handle, *pValues );
177 catch( UnknownPropertyException& )
180 pValues++;
186 Sequence< Any > SAL_CALL FastPropertySet::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException, std::exception)
188 sal_Int32 nCount = aPropertyNames.getLength();
189 Sequence< Any > aValues( nCount );
191 const OUString* pPropertyNames = aPropertyNames.getConstArray();
192 Any* pValues = aValues.getArray();
193 while( nCount-- )
195 const Property* pProperty = mxInfo->hasProperty( *pPropertyNames++ );
196 if( pProperty ) try
198 *pValues = getFastPropertyValue( pProperty->Handle );
200 catch( UnknownPropertyException& )
203 pValues++;
205 return aValues;
210 void SAL_CALL FastPropertySet::addPropertiesChangeListener( const Sequence< OUString >&, const Reference< XPropertiesChangeListener >& ) throw (RuntimeException, std::exception)
216 void SAL_CALL FastPropertySet::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& ) throw (RuntimeException, std::exception)
222 void SAL_CALL FastPropertySet::firePropertiesChangeEvent( const Sequence< OUString >&, const Reference< XPropertiesChangeListener >& ) throw (RuntimeException, std::exception)
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */