Avoid potential negative array index access to cached text.
[LibreOffice.git] / chart2 / source / inc / WrappedProperty.hxx
blob1ec91f71f93e41e13387c56468bb10977605d21c
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 .
19 #pragma once
21 #include <com/sun/star/beans/PropertyState.hpp>
22 #include <com/sun/star/uno/Any.hxx>
23 #include <rtl/ustring.hxx>
24 #include "charttoolsdllapi.hxx"
26 #include <map>
27 #include <memory>
29 namespace com::sun::star::beans { class XPropertySet; }
30 namespace com::sun::star::beans { class XPropertyState; }
31 namespace com::sun::star::uno { template <class interface_type> class Reference; }
33 namespace chart
36 class OOO_DLLPUBLIC_CHARTTOOLS WrappedProperty
38 /** The property visible to the outer PropertySet in the PropertySetWrapper may have a different name, type and value than
39 a corresponding property of the inner PropertySet. Use this class to do the conversion between the two.
41 public:
42 WrappedProperty( OUString aOuterName, OUString aInnerName );
43 virtual ~WrappedProperty();
45 const OUString& getOuterName() const { return m_aOuterName;}
46 virtual OUString getInnerName() const;
48 /// @throws css::beans::UnknownPropertyException
49 /// @throws css::beans::PropertyVetoException
50 /// @throws css::lang::IllegalArgumentException
51 /// @throws css::lang::WrappedTargetException
52 /// @throws css::uno::RuntimeException
53 virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const;
55 /// @throws css::beans::UnknownPropertyException
56 /// @throws css::lang::WrappedTargetException
57 /// @throws css::uno::RuntimeException
58 virtual css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const;
60 /// @throws css::beans::UnknownPropertyException
61 /// @throws css::uno::RuntimeException
62 virtual void setPropertyToDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const;
64 /// @throws css::beans::UnknownPropertyException
65 /// @throws css::lang::WrappedTargetException
66 /// @throws css::uno::RuntimeException
67 virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const;
69 /// @throws css::beans::UnknownPropertyException
70 /// @throws css::uno::RuntimeException
71 virtual css::beans::PropertyState getPropertyState( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const;
73 protected:
74 virtual css::uno::Any convertInnerToOuterValue( const css::uno::Any& rInnerValue ) const;
75 virtual css::uno::Any convertOuterToInnerValue( const css::uno::Any& rOuterValue ) const;
77 protected:
78 OUString m_aOuterName;
79 OUString m_aInnerName;
82 typedef std::map< sal_Int32, std::unique_ptr<const WrappedProperty> > tWrappedPropertyMap;
84 } //namespace chart
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */