1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "WrappedSceneProperty.hxx"
22 #include "DiagramHelper.hxx"
23 #include "servicenames_charttypes.hxx"
24 #include "BaseGFXHelper.hxx"
26 using namespace ::com::sun::star
;
27 using ::com::sun::star::uno::Any
;
28 using ::com::sun::star::uno::Reference
;
29 using ::com::sun::star::uno::Sequence
;
36 void WrappedSceneProperty::addWrappedProperties( std::vector
< WrappedProperty
* >& rList
37 , ::boost::shared_ptr
< Chart2ModelContact
> spChart2ModelContact
)
39 rList
.push_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact
) );
42 WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
43 ::boost::shared_ptr
< Chart2ModelContact
> spChart2ModelContact
)
44 : WrappedProperty("D3DTransformMatrix","D3DTransformMatrix")
45 , m_spChart2ModelContact( spChart2ModelContact
)
49 WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
53 void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any
& rOuterValue
, const Reference
< beans::XPropertySet
>& xInnerPropertySet
) const
54 throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
56 if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact
->getChart2Diagram() ) )
58 drawing::HomogenMatrix aHM
;
59 if( rOuterValue
>>= aHM
)
61 ::basegfx::B3DTuple
aRotation( BaseGFXHelper::GetRotationFromMatrix(
62 BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM
) ) );
64 ::basegfx::B3DHomMatrix aMatrix
;
65 aMatrix
.rotate( aRotation
.getX(), aRotation
.getY(), aRotation
.getZ() );
66 ::basegfx::B3DHomMatrix aObjectMatrix
;
67 ::basegfx::B3DHomMatrix aNewMatrix
= aMatrix
*aObjectMatrix
;
69 aHM
= BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix
);
71 WrappedProperty::setPropertyValue( uno::makeAny(aHM
), xInnerPropertySet
);
76 WrappedProperty::setPropertyValue( rOuterValue
, xInnerPropertySet
);
79 Any
WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference
< beans::XPropertySet
>& xInnerPropertySet
) const
80 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
82 if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact
->getChart2Diagram() ) )
84 uno::Any
aAMatrix( WrappedProperty::getPropertyValue( xInnerPropertySet
) );
85 drawing::HomogenMatrix aHM
;
86 if( aAMatrix
>>= aHM
)
88 ::basegfx::B3DTuple
aRotation( BaseGFXHelper::GetRotationFromMatrix(
89 BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM
) ) );
91 ::basegfx::B3DHomMatrix aMatrix
;
92 aMatrix
.rotate( aRotation
.getX(), aRotation
.getY(), aRotation
.getZ() );
93 ::basegfx::B3DHomMatrix aObjectMatrix
;
94 ::basegfx::B3DHomMatrix aNewMatrix
= aMatrix
*aObjectMatrix
;
96 aHM
= BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix
);
98 return uno::makeAny(aHM
);
102 return WrappedProperty::getPropertyValue( xInnerPropertySet
);
105 Any
WrappedD3DTransformMatrixProperty::getPropertyDefault( const Reference
< beans::XPropertyState
>& xInnerPropertyState
) const
106 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
108 return WrappedProperty::getPropertyDefault( xInnerPropertyState
);
111 } //namespace wrapper
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */