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