fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / chartapiwrapper / WrappedCharacterHeightProperty.cxx
blob78a0076f82f88e9c1efaae6efd3d1e2f84b47880
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 "WrappedCharacterHeightProperty.hxx"
21 #include "macros.hxx"
22 #include "RelativeSizeHelper.hxx"
23 #include "ReferenceSizePropertyProvider.hxx"
24 #include <osl/diagnose.h>
26 using namespace ::com::sun::star;
27 using ::com::sun::star::uno::Reference;
28 using ::com::sun::star::uno::Any;
30 namespace chart
32 namespace wrapper
34 WrappedCharacterHeightProperty_Base::WrappedCharacterHeightProperty_Base(
35 const OUString& rOuterEqualsInnerName
36 , ReferenceSizePropertyProvider* pRefSizePropProvider )
37 : WrappedProperty( rOuterEqualsInnerName, rOuterEqualsInnerName )
38 , m_pRefSizePropProvider( pRefSizePropProvider )
41 WrappedCharacterHeightProperty_Base::~WrappedCharacterHeightProperty_Base()
45 void WrappedCharacterHeightProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
46 , ReferenceSizePropertyProvider* pRefSizePropProvider )
48 rList.push_back( new WrappedCharacterHeightProperty( pRefSizePropProvider ) );
49 rList.push_back( new WrappedAsianCharacterHeightProperty( pRefSizePropProvider ) );
50 rList.push_back( new WrappedComplexCharacterHeightProperty( pRefSizePropProvider ) );
53 void WrappedCharacterHeightProperty_Base::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
54 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
56 if(xInnerPropertySet.is())
58 if( m_pRefSizePropProvider )
59 m_pRefSizePropProvider->updateReferenceSize();
60 xInnerPropertySet->setPropertyValue( m_aInnerName, rOuterValue );
64 Any WrappedCharacterHeightProperty_Base::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
65 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
67 Any aRet;
68 if( xInnerPropertySet.is() )
70 aRet = xInnerPropertySet->getPropertyValue( m_aInnerName );
71 float fHeight = 0;
72 if( aRet >>= fHeight )
74 if( m_pRefSizePropProvider )
76 awt::Size aReferenceSize;
77 if( m_pRefSizePropProvider->getReferenceSize() >>= aReferenceSize )
79 awt::Size aCurrentSize = m_pRefSizePropProvider->getCurrentSizeForReference();
80 aRet <<= static_cast< float >(
81 RelativeSizeHelper::calculate( fHeight, aReferenceSize, aCurrentSize ));
86 return aRet;
89 Any WrappedCharacterHeightProperty_Base::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
90 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
92 Any aRet;
93 if( xInnerPropertyState.is() )
95 aRet = xInnerPropertyState->getPropertyDefault( m_aInnerName );
97 return aRet;
100 beans::PropertyState WrappedCharacterHeightProperty_Base::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
101 throw (beans::UnknownPropertyException, uno::RuntimeException)
103 return beans::PropertyState_DIRECT_VALUE;
106 Any WrappedCharacterHeightProperty_Base::convertInnerToOuterValue( const Any& rInnerValue ) const
108 OSL_FAIL("should not be used: WrappedCharacterHeightProperty_Base::convertInnerToOuterValue - check if you miss data");
109 return rInnerValue;
111 Any WrappedCharacterHeightProperty_Base::convertOuterToInnerValue( const Any& rOuterValue ) const
113 OSL_FAIL("should not be used: WrappedCharacterHeightProperty_Base::convertOuterToInnerValue - check if you miss data");
114 return rOuterValue;
117 WrappedCharacterHeightProperty::WrappedCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
118 : WrappedCharacterHeightProperty_Base( "CharHeight", pRefSizePropProvider )
121 WrappedCharacterHeightProperty::~WrappedCharacterHeightProperty()
125 WrappedAsianCharacterHeightProperty::WrappedAsianCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
126 : WrappedCharacterHeightProperty_Base( "CharHeightAsian", pRefSizePropProvider )
129 WrappedAsianCharacterHeightProperty::~WrappedAsianCharacterHeightProperty()
133 WrappedComplexCharacterHeightProperty::WrappedComplexCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
134 : WrappedCharacterHeightProperty_Base( "CharHeightComplex", pRefSizePropProvider )
137 WrappedComplexCharacterHeightProperty::~WrappedComplexCharacterHeightProperty()
141 } //namespace wrapper
142 } //namespace chart
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */