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 : #include "WrappedSceneProperty.hxx"
21 : #include "macros.hxx"
22 : #include "DiagramHelper.hxx"
23 : #include "servicenames_charttypes.hxx"
24 : #include "BaseGFXHelper.hxx"
25 :
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;
30 :
31 : namespace chart
32 : {
33 : namespace wrapper
34 : {
35 :
36 0 : void WrappedSceneProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
37 : , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
38 : {
39 0 : rList.push_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact ) );
40 0 : }
41 :
42 0 : WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
43 : ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
44 : : WrappedProperty("D3DTransformMatrix","D3DTransformMatrix")
45 0 : , m_spChart2ModelContact( spChart2ModelContact )
46 : {
47 0 : }
48 :
49 0 : WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
50 : {
51 0 : }
52 :
53 0 : void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
54 : throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
55 : {
56 0 : if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
57 : {
58 0 : drawing::HomogenMatrix aHM;
59 0 : if( rOuterValue >>= aHM )
60 : {
61 : ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
62 0 : BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
63 :
64 0 : ::basegfx::B3DHomMatrix aMatrix;
65 0 : aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
66 0 : ::basegfx::B3DHomMatrix aObjectMatrix;
67 0 : ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
68 :
69 0 : aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
70 :
71 0 : WrappedProperty::setPropertyValue( uno::makeAny(aHM), xInnerPropertySet );
72 0 : return;
73 : }
74 : }
75 :
76 0 : WrappedProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
77 : }
78 :
79 0 : Any WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
80 : throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
81 : {
82 0 : if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
83 : {
84 0 : uno::Any aAMatrix( WrappedProperty::getPropertyValue( xInnerPropertySet ) );
85 0 : drawing::HomogenMatrix aHM;
86 0 : if( aAMatrix >>= aHM )
87 : {
88 : ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
89 0 : BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
90 :
91 0 : ::basegfx::B3DHomMatrix aMatrix;
92 0 : aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
93 0 : ::basegfx::B3DHomMatrix aObjectMatrix;
94 0 : ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
95 :
96 0 : aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
97 :
98 0 : return uno::makeAny(aHM);
99 0 : }
100 : }
101 :
102 0 : return WrappedProperty::getPropertyValue( xInnerPropertySet );
103 : }
104 :
105 0 : Any WrappedD3DTransformMatrixProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
106 : throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
107 : {
108 0 : return WrappedProperty::getPropertyDefault( xInnerPropertyState );
109 : }
110 :
111 : } //namespace wrapper
112 : } //namespace chart
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|