fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / chartapiwrapper / WrappedNumberFormatProperty.cxx
blobcfee9372cf233c348e5972049f14bfae40e3a64c
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 .
20 #include "WrappedNumberFormatProperty.hxx"
21 #include "macros.hxx"
22 #include <unonames.hxx>
23 #include <osl/diagnose.h>
25 using namespace ::com::sun::star;
26 using ::com::sun::star::uno::Reference;
27 using ::com::sun::star::uno::Any;
29 namespace chart
31 namespace wrapper
34 WrappedNumberFormatProperty::WrappedNumberFormatProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
35 : WrappedDirectStateProperty( CHART_UNONAME_NUMFMT, CHART_UNONAME_NUMFMT )
36 , m_spChart2ModelContact(spChart2ModelContact)
40 WrappedNumberFormatProperty::~WrappedNumberFormatProperty()
44 void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
45 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
47 sal_Int32 nFormat = 0;
48 if( ! (rOuterValue >>= nFormat) )
49 throw lang::IllegalArgumentException( "Property 'NumberFormat' requires value of type sal_Int32", 0, 0 );
51 if(xInnerPropertySet.is())
52 xInnerPropertySet->setPropertyValue(getInnerName(), this->convertOuterToInnerValue(rOuterValue));
55 Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
56 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
58 if( !xInnerPropertySet.is() )
60 OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
61 return Any();
63 Any aRet( xInnerPropertySet->getPropertyValue(getInnerName()));
64 if( !aRet.hasValue() )
66 sal_Int32 nKey = 0;
67 Reference< chart2::XDataSeries > xSeries( xInnerPropertySet, uno::UNO_QUERY );
68 if( xSeries.is() )
69 nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForSeries( xSeries );
70 else
72 Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
73 nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForAxis( xAxis );
75 aRet <<= nKey;
77 return aRet;
80 Any WrappedNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
81 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
83 return uno::makeAny( sal_Int32( 0 ) );
86 WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact ) :
87 WrappedDirectStateProperty(CHART_UNONAME_LINK_TO_SRC_NUMFMT, CHART_UNONAME_LINK_TO_SRC_NUMFMT),
88 m_pChart2ModelContact(pChart2ModelContact)
92 WrappedLinkNumberFormatProperty::~WrappedLinkNumberFormatProperty()
96 void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
97 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
99 if( !xInnerPropertySet.is() )
101 OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::setPropertyValue");
102 return;
105 xInnerPropertySet->setPropertyValue(getInnerName(), rOuterValue);
108 Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
109 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
111 if( !xInnerPropertySet.is() )
113 OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
114 return getPropertyDefault(0);
117 return xInnerPropertySet->getPropertyValue(getInnerName());
120 Any WrappedLinkNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
121 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
123 bool bLink = true;
124 return uno::makeAny( bLink );
127 } //namespace wrapper
128 } //namespace chart
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */