1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WrappedSceneProperty.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
34 #include "WrappedSceneProperty.hxx"
36 #include "DiagramHelper.hxx"
37 #include "servicenames_charttypes.hxx"
38 #include "BaseGFXHelper.hxx"
40 using namespace ::com::sun::star
;
41 using ::com::sun::star::uno::Any
;
42 using ::com::sun::star::uno::Reference
;
43 using ::com::sun::star::uno::Sequence
;
44 using ::rtl::OUString
;
46 //.............................................................................
53 void WrappedSceneProperty::addWrappedProperties( std::vector
< WrappedProperty
* >& rList
54 , ::boost::shared_ptr
< Chart2ModelContact
> spChart2ModelContact
)
56 rList
.push_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact
) );
59 //----------------------------------------------------------------------------------------------------------------------
60 //----------------------------------------------------------------------------------------------------------------------
61 //----------------------------------------------------------------------------------------------------------------------
63 WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
64 ::boost::shared_ptr
< Chart2ModelContact
> spChart2ModelContact
)
65 : WrappedProperty(C2U("D3DTransformMatrix"),C2U("D3DTransformMatrix"))
66 , m_spChart2ModelContact( spChart2ModelContact
)
70 WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
74 void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any
& rOuterValue
, const Reference
< beans::XPropertySet
>& xInnerPropertySet
) const
75 throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
77 if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact
->getChart2Diagram() ) )
79 drawing::HomogenMatrix aHM
;
80 if( rOuterValue
>>= aHM
)
82 ::basegfx::B3DTuple
aRotation( BaseGFXHelper::GetRotationFromMatrix(
83 BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM
) ) );
85 ::basegfx::B3DHomMatrix aMatrix
;
86 aMatrix
.rotate( aRotation
.getX(), aRotation
.getY(), aRotation
.getZ() );
87 ::basegfx::B3DHomMatrix aObjectMatrix
;
88 ::basegfx::B3DHomMatrix aNewMatrix
= aMatrix
*aObjectMatrix
;
90 aHM
= BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix
);
92 WrappedProperty::setPropertyValue( uno::makeAny(aHM
), xInnerPropertySet
);
97 WrappedProperty::setPropertyValue( rOuterValue
, xInnerPropertySet
);
100 Any
WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference
< beans::XPropertySet
>& xInnerPropertySet
) const
101 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
103 if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact
->getChart2Diagram() ) )
105 uno::Any
aAMatrix( WrappedProperty::getPropertyValue( xInnerPropertySet
) );
106 drawing::HomogenMatrix aHM
;
107 if( aAMatrix
>>= aHM
)
109 ::basegfx::B3DTuple
aRotation( BaseGFXHelper::GetRotationFromMatrix(
110 BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM
) ) );
112 ::basegfx::B3DHomMatrix aMatrix
;
113 aMatrix
.rotate( aRotation
.getX(), aRotation
.getY(), aRotation
.getZ() );
114 ::basegfx::B3DHomMatrix aObjectMatrix
;
115 ::basegfx::B3DHomMatrix aNewMatrix
= aMatrix
*aObjectMatrix
;
117 aHM
= BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix
);
119 return uno::makeAny(aHM
);
123 return WrappedProperty::getPropertyValue( xInnerPropertySet
);
126 Any
WrappedD3DTransformMatrixProperty::getPropertyDefault( const Reference
< beans::XPropertyState
>& xInnerPropertyState
) const
127 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
129 return WrappedProperty::getPropertyDefault( xInnerPropertyState
);
132 } //namespace wrapper
134 //.............................................................................