LibreOffice Module svx (master)  1
propertyset.hxx
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 
20 #ifndef INCLUDED_SVX_SOURCE_TABLE_PROPERTYSET_HXX
21 #define INCLUDED_SVX_SOURCE_TABLE_PROPERTYSET_HXX
22 
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/beans/XMultiPropertySet.hpp>
25 #include <com/sun/star/beans/XFastPropertySet.hpp>
26 #include <rtl/ref.hxx>
27 #include <unordered_map>
28 #include <vector>
29 
30 #include <cppuhelper/implbase1.hxx>
31 #include <cppuhelper/implbase3.hxx>
32 
33 namespace sdr { namespace table {
34 
35 typedef std::vector< css::beans::Property > PropertyVector;
36 typedef std::unordered_map< OUString, ::sal_uInt32 > PropertyMap;
37 
38 class FastPropertySetInfo : public ::cppu::WeakAggImplHelper1< css::beans::XPropertySetInfo >
39 {
40 public:
41  explicit FastPropertySetInfo( const PropertyVector& rProps );
42  virtual ~FastPropertySetInfo() override;
43 
44  void addProperties( const PropertyVector& rProps );
45 
47  const css::beans::Property& getProperty( const OUString& aName );
48  const css::beans::Property* hasProperty( const OUString& aName );
49 
50  // XPropertySetInfo
51  virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties( ) override;
52  virtual css::beans::Property SAL_CALL getPropertyByName( const OUString& aName ) override;
53  virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override;
54 
55 private:
56  PropertyVector maProperties;
57  PropertyMap maMap;
58 };
59 
60 
61 class FastPropertySet : public ::cppu::WeakAggImplHelper3< css::beans::XPropertySet, css::beans::XMultiPropertySet, css::beans::XFastPropertySet >
62 {
63 public:
65  virtual ~FastPropertySet() override;
66 
67  // XPropertySet
68  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
69  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
70  virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
71  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
72  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
73  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
74  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
75 
76  // XMultiPropertySet
77 // virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (css::uno::RuntimeException);
78  virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
79  virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
80  virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
81  virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
82  virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
83 
84  // XFastPropertySet
85  virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle, const css::uno::Any& aValue ) override = 0;
86  virtual css::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle ) override = 0;
87 
88 private:
90 };
91 
92 }}
93 
94 #endif
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::beans::Property SAL_CALL getPropertyByName(const OUString &aName) override
Definition: propertyset.cxx:81
virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
std::vector< css::beans::Property > PropertyVector
Definition: propertyset.hxx:35
OUString Name
std::unordered_map< OUString,::sal_uInt32 > PropertyMap
Definition: propertyset.hxx:36
const css::beans::Property & getProperty(const OUString &aName)
Definition: propertyset.cxx:53
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
rtl::Reference< FastPropertySetInfo > mxInfo
Definition: propertyset.hxx:89
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual sal_Bool SAL_CALL hasPropertyByName(const OUString &Name) override
Definition: propertyset.cxx:87
unsigned char sal_Bool
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames) override
virtual void SAL_CALL setFastPropertyValue(::sal_Int32 nHandle, const css::uno::Any &aValue) override=0
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
sal_Int32 const nHandle
virtual ~FastPropertySet() override
Definition: propertyset.cxx:98
void addProperties(const PropertyVector &rProps)
Definition: propertyset.cxx:40
virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
OUString aName
virtual css::uno::Any SAL_CALL getFastPropertyValue(::sal_Int32 nHandle) override=0
FastPropertySetInfo(const PropertyVector &rProps)
Definition: propertyset.cxx:29
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
FastPropertySet(const rtl::Reference< FastPropertySetInfo > &xInfo)
Definition: propertyset.cxx:92
virtual void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
virtual ~FastPropertySetInfo() override
Definition: propertyset.cxx:35
virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override
Definition: propertyset.cxx:75
const css::beans::Property * hasProperty(const OUString &aName)
Definition: propertyset.cxx:62