1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CHART_WRAPPEDPROPERTY_HXX
24 #define CHART_WRAPPEDPROPERTY_HXX
25 
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/beans/XPropertyState.hpp>
28 #include "charttoolsdllapi.hxx"
29 
30 #include <map>
31 
32 //.............................................................................
33 namespace chart
34 {
35 //.............................................................................
36 
37 class OOO_DLLPUBLIC_CHARTTOOLS WrappedProperty
38 {
39     /** The property visible to the outer PropertySet in the PropertySetWrapper may have a different name, type and value than
40     a corresponding property of the inner PropertySet. Use this class to do the conversion between the two.
41     */
42 public:
43     WrappedProperty( const ::rtl::OUString& rOuterName, const ::rtl::OUString& rInnerName );
44     virtual ~WrappedProperty();
45 
46     const ::rtl::OUString& getOuterName() const;
47     virtual ::rtl::OUString getInnerName() const;
48 
49     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
50                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
51 
52     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
53                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
54 
55     virtual void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
56                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
57 
58     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
59                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
60 
61     virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
62                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
63 
64 protected:
65     virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
66     virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
67 
68 protected:
69     ::rtl::OUString             m_aOuterName;
70     ::rtl::OUString             m_aInnerName;
71 };
72 
73 //.............................................................................
74 
75 typedef ::std::map< sal_Int32, const WrappedProperty* > tWrappedPropertyMap;
76 
77 //.............................................................................
78 } //namespace chart
79 //.............................................................................
80 
81 // CHART_WRAPPEDPROPERTY_HXX
82 #endif
83