Files
libreoffice/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx

115 lines
4.5 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
INTEGRATION: CWS chart2mst3 (1.1.2); FILE ADDED 2007/02/08 21:25:30 iha 1.1.2.15: resync m195 -> m202 2006/12/07 23:26:26 iha 1.1.2.14: use new method DiagramHelper::isPieOrDonutChart 2006/11/22 17:31:18 iha 1.1.2.13: resync 2006/09/29 15:01:11 iha 1.1.2.12: corrected creation of 3D pies and donuts (extrude instead of lathe objects- for corect texture, get rid of problem with extended scene due to rotating bounding box, fixed #i67743# and no 90degree rotation difference between old and new API anymore) 2006/06/30 22:25:27 iha 1.1.2.11: correct 3D pie rotation: different default camera for pies + 90 degree rotation caused by different object creation 2006/06/23 15:49:05 iha 1.1.2.10: use corrected decomposition method for matrices + use matrix from basegfx instead of Matrix4D 2006/06/09 16:23:42 iha 1.1.2.9: worked around Pie Rotation offset for compatibility with old chart 2006/02/17 20:57:49 iha 1.1.2.8: enlarge validity of api wrapper objects to lifetime of new chartmodel 2006/01/26 15:42:58 bm 1.1.2.7: deprecated (and unused) header included 2006/01/16 18:34:35 iha 1.1.2.6: changed pie rotation correction 2006/01/11 13:26:08 iha 1.1.2.5: pie is rotated 90 degree compared to other charts 2005/11/02 13:49:16 bm 1.1.2.4: scene properties changed from SceneDescriptor property to the D3D properties offered by SceneProperties.hxx (this way XML im-/export works with the xmloff helper) 2005/10/11 09:19:59 bm 1.1.2.3: license header change 2005/06/24 16:16:57 iha 1.1.2.2: temporary workaround: disable loading of 3d transformation -> 3d charts especially pie charts are better visible 2005/04/19 17:33:09 iha 1.1.2.1: improved old api support (introduced wrappedpropertyset ...)
2007-05-22 16:23:02 +00:00
#include "WrappedSceneProperty.hxx"
#include "macros.hxx"
#include "DiagramHelper.hxx"
#include "servicenames_charttypes.hxx"
#include "BaseGFXHelper.hxx"
using namespace ::com::sun::star;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
namespace chart
{
namespace wrapper
{
void WrappedSceneProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
{
rList.push_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact ) );
}
WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
2012-04-08 10:48:08 -04:30
: WrappedProperty("D3DTransformMatrix","D3DTransformMatrix")
INTEGRATION: CWS chart2mst3 (1.1.2); FILE ADDED 2007/02/08 21:25:30 iha 1.1.2.15: resync m195 -> m202 2006/12/07 23:26:26 iha 1.1.2.14: use new method DiagramHelper::isPieOrDonutChart 2006/11/22 17:31:18 iha 1.1.2.13: resync 2006/09/29 15:01:11 iha 1.1.2.12: corrected creation of 3D pies and donuts (extrude instead of lathe objects- for corect texture, get rid of problem with extended scene due to rotating bounding box, fixed #i67743# and no 90degree rotation difference between old and new API anymore) 2006/06/30 22:25:27 iha 1.1.2.11: correct 3D pie rotation: different default camera for pies + 90 degree rotation caused by different object creation 2006/06/23 15:49:05 iha 1.1.2.10: use corrected decomposition method for matrices + use matrix from basegfx instead of Matrix4D 2006/06/09 16:23:42 iha 1.1.2.9: worked around Pie Rotation offset for compatibility with old chart 2006/02/17 20:57:49 iha 1.1.2.8: enlarge validity of api wrapper objects to lifetime of new chartmodel 2006/01/26 15:42:58 bm 1.1.2.7: deprecated (and unused) header included 2006/01/16 18:34:35 iha 1.1.2.6: changed pie rotation correction 2006/01/11 13:26:08 iha 1.1.2.5: pie is rotated 90 degree compared to other charts 2005/11/02 13:49:16 bm 1.1.2.4: scene properties changed from SceneDescriptor property to the D3D properties offered by SceneProperties.hxx (this way XML im-/export works with the xmloff helper) 2005/10/11 09:19:59 bm 1.1.2.3: license header change 2005/06/24 16:16:57 iha 1.1.2.2: temporary workaround: disable loading of 3d transformation -> 3d charts especially pie charts are better visible 2005/04/19 17:33:09 iha 1.1.2.1: improved old api support (introduced wrappedpropertyset ...)
2007-05-22 16:23:02 +00:00
, m_spChart2ModelContact( spChart2ModelContact )
{
}
WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
{
}
void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
{
drawing::HomogenMatrix aHM;
if( rOuterValue >>= aHM )
{
::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
::basegfx::B3DHomMatrix aMatrix;
aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
::basegfx::B3DHomMatrix aObjectMatrix;
::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
WrappedProperty::setPropertyValue( uno::makeAny(aHM), xInnerPropertySet );
return;
}
}
WrappedProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
}
Any WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
{
uno::Any aAMatrix( WrappedProperty::getPropertyValue( xInnerPropertySet ) );
drawing::HomogenMatrix aHM;
if( aAMatrix >>= aHM )
{
::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
::basegfx::B3DHomMatrix aMatrix;
aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
::basegfx::B3DHomMatrix aObjectMatrix;
::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
return uno::makeAny(aHM);
}
}
return WrappedProperty::getPropertyValue( xInnerPropertySet );
}
Any WrappedD3DTransformMatrixProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
return WrappedProperty::getPropertyDefault( xInnerPropertyState );
}
} //namespace wrapper
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */