Branch data Line data Source code
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 : :
21 : : #include "WrappedCharacterHeightProperty.hxx"
22 : : #include "macros.hxx"
23 : : #include "RelativeSizeHelper.hxx"
24 : : #include "ReferenceSizePropertyProvider.hxx"
25 : :
26 : : using namespace ::com::sun::star;
27 : : using ::com::sun::star::uno::Reference;
28 : : using ::com::sun::star::uno::Any;
29 : : using ::rtl::OUString;
30 : :
31 : : //.............................................................................
32 : :
33 : : namespace chart
34 : : {
35 : : namespace wrapper
36 : : {
37 : 453 : WrappedCharacterHeightProperty_Base::WrappedCharacterHeightProperty_Base(
38 : : const OUString& rOuterEqualsInnerName
39 : : , ReferenceSizePropertyProvider* pRefSizePropProvider )
40 : : : WrappedProperty( rOuterEqualsInnerName, rOuterEqualsInnerName )
41 : 453 : , m_pRefSizePropProvider( pRefSizePropProvider )
42 : : {
43 : 453 : }
44 : 453 : WrappedCharacterHeightProperty_Base::~WrappedCharacterHeightProperty_Base()
45 : : {
46 [ - + ]: 453 : }
47 : :
48 : 151 : void WrappedCharacterHeightProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
49 : : , ReferenceSizePropertyProvider* pRefSizePropProvider )
50 : : {
51 [ + - ][ + - ]: 151 : rList.push_back( new WrappedCharacterHeightProperty( pRefSizePropProvider ) );
52 [ + - ][ + - ]: 151 : rList.push_back( new WrappedAsianCharacterHeightProperty( pRefSizePropProvider ) );
53 [ + - ][ + - ]: 151 : rList.push_back( new WrappedComplexCharacterHeightProperty( pRefSizePropProvider ) );
54 : 151 : }
55 : :
56 : 224 : void WrappedCharacterHeightProperty_Base::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
57 : : throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
58 : : {
59 [ + - ]: 224 : if(xInnerPropertySet.is())
60 : : {
61 [ + - ]: 224 : if( m_pRefSizePropProvider )
62 : 224 : m_pRefSizePropProvider->updateReferenceSize();
63 : 224 : xInnerPropertySet->setPropertyValue( m_aInnerName, rOuterValue );
64 : : }
65 : 224 : }
66 : :
67 : 526 : Any WrappedCharacterHeightProperty_Base::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
68 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
69 : : {
70 : 526 : Any aRet;
71 [ + - ]: 526 : if( xInnerPropertySet.is() )
72 : : {
73 [ + - ][ + - ]: 526 : aRet = xInnerPropertySet->getPropertyValue( m_aInnerName );
74 : 526 : float fHeight = 0;
75 [ + - ]: 526 : if( aRet >>= fHeight )
76 : : {
77 [ + - ]: 526 : if( m_pRefSizePropProvider )
78 : : {
79 : 526 : awt::Size aReferenceSize;
80 [ + - ][ - + ]: 526 : if( m_pRefSizePropProvider->getReferenceSize() >>= aReferenceSize )
[ + - ]
81 : : {
82 [ # # ]: 0 : awt::Size aCurrentSize = m_pRefSizePropProvider->getCurrentSizeForReference();
83 : : aRet <<= static_cast< float >(
84 [ # # ][ # # ]: 526 : RelativeSizeHelper::calculate( fHeight, aReferenceSize, aCurrentSize ));
85 : : }
86 : : }
87 : : }
88 : : }
89 : 526 : return aRet;
90 : : }
91 : :
92 : 0 : Any WrappedCharacterHeightProperty_Base::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
93 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
94 : : {
95 : 0 : Any aRet;
96 [ # # ]: 0 : if( xInnerPropertyState.is() )
97 : : {
98 [ # # ][ # # ]: 0 : aRet = xInnerPropertyState->getPropertyDefault( m_aInnerName );
99 : : }
100 : 0 : return aRet;
101 : : }
102 : :
103 : 384 : beans::PropertyState WrappedCharacterHeightProperty_Base::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
104 : : throw (beans::UnknownPropertyException, uno::RuntimeException)
105 : : {
106 : 384 : return beans::PropertyState_DIRECT_VALUE;
107 : : }
108 : :
109 : 0 : Any WrappedCharacterHeightProperty_Base::convertInnerToOuterValue( const Any& rInnerValue ) const
110 : : {
111 : : OSL_FAIL("should not be used: WrappedCharacterHeightProperty_Base::convertInnerToOuterValue - check if you miss data");
112 : 0 : return rInnerValue;
113 : : }
114 : 0 : Any WrappedCharacterHeightProperty_Base::convertOuterToInnerValue( const Any& rOuterValue ) const
115 : : {
116 : : OSL_FAIL("should not be used: WrappedCharacterHeightProperty_Base::convertOuterToInnerValue - check if you miss data");
117 : 0 : return rOuterValue;
118 : : }
119 : :
120 : : //-----------------------------------------------------------------------------
121 : :
122 : 151 : WrappedCharacterHeightProperty::WrappedCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
123 [ + - ]: 151 : : WrappedCharacterHeightProperty_Base( "CharHeight", pRefSizePropProvider )
124 : : {
125 : 151 : }
126 : 151 : WrappedCharacterHeightProperty::~WrappedCharacterHeightProperty()
127 : : {
128 [ - + ]: 302 : }
129 : :
130 : : //-----------------------------------------------------------------------------
131 : :
132 : 151 : WrappedAsianCharacterHeightProperty::WrappedAsianCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
133 [ + - ]: 151 : : WrappedCharacterHeightProperty_Base( "CharHeightAsian", pRefSizePropProvider )
134 : : {
135 : 151 : }
136 : 151 : WrappedAsianCharacterHeightProperty::~WrappedAsianCharacterHeightProperty()
137 : : {
138 [ - + ]: 302 : }
139 : :
140 : : //-----------------------------------------------------------------------------
141 : :
142 : 151 : WrappedComplexCharacterHeightProperty::WrappedComplexCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
143 [ + - ]: 151 : : WrappedCharacterHeightProperty_Base( "CharHeightComplex", pRefSizePropProvider )
144 : : {
145 : 151 : }
146 : 151 : WrappedComplexCharacterHeightProperty::~WrappedComplexCharacterHeightProperty()
147 : : {
148 [ - + ]: 302 : }
149 : :
150 : : } //namespace wrapper
151 : : } //namespace chart
152 : : //.............................................................................
153 : :
154 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|