diff options
author | Ingrid Halama <iha@openoffice.org> | 2003-12-09 16:12:06 +0000 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2003-12-09 16:12:06 +0000 |
commit | 29be76ddcc826bb182c0efd0226a7551bd4e199d (patch) | |
tree | 5a36cbe35fb22df186b681fe602700a133107ac4 /chart2/source/controller/main/ChartController_Position.cxx | |
parent | new Dialog for Diagram Rotation (diff) | |
download | core-29be76ddcc826bb182c0efd0226a7551bd4e199d.tar.gz core-29be76ddcc826bb182c0efd0226a7551bd4e199d.zip |
new Dialog for Diagram Rotation
Diffstat (limited to 'chart2/source/controller/main/ChartController_Position.cxx')
-rw-r--r-- | chart2/source/controller/main/ChartController_Position.cxx | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx new file mode 100644 index 000000000000..9c7f449b3f6d --- /dev/null +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -0,0 +1,71 @@ +#include "ChartController.hxx" + +#include "dlg_RotateDiagram.hxx" +#include "macros.hxx" +#include "ChartWindow.hxx" +#include "Rotation.hxx" +#include "ChartModelHelper.hxx" + +#ifndef _DRAFTS_COM_SUN_STAR_CHART2_SCENEDESCRIPTOR_HPP_ +#include <drafts/com/sun/star/chart2/SceneDescriptor.hpp> +#endif + +// header for define RET_OK +#ifndef _SV_MSGBOX_HXX +#include <vcl/msgbox.hxx> +#endif + +//............................................................................. +namespace chart +{ +//............................................................................. +using namespace ::com::sun::star; +using namespace ::drafts::com::sun::star::chart2; + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +void SAL_CALL ChartController::executeDispatch_RotateDiagram() +{ + bool bChanged = false; + try + { + Window* pParent( NULL ); + double fXAngle, fYAngle, fZAngle; + fXAngle=fYAngle=fZAngle=0.0; + + //get angle from model + SceneDescriptor aSceneDescriptor; + uno::Reference< beans::XPropertySet > xProp( ChartModelHelper::findDiagram( m_aModel->getModel() ), uno::UNO_QUERY ); + if( xProp.is() && (xProp->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor) ) + { + Rotation::getEulerFromAxisAngleRepresentation( aSceneDescriptor.aDirection, aSceneDescriptor.fRotationAngle + , fXAngle, fYAngle, fZAngle ); + } + + //open dialog + RotateDiagramDialog aDlg( pParent, fXAngle, fYAngle, fZAngle ); + if( aDlg.Execute() == RET_OK ) + { + aDlg.getAngle( fXAngle, fYAngle, fZAngle ); + Rotation::getAxisAngleFromEulerRepresentation( aSceneDescriptor.aDirection, aSceneDescriptor.fRotationAngle + , fXAngle, fYAngle, fZAngle ); + xProp->setPropertyValue( C2U( "SceneProperties" ), uno::makeAny(aSceneDescriptor) ); + bChanged = true; + } + } + catch( uno::RuntimeException& e) + { + ASSERT_EXCEPTION( e ); + } + //make sure that all objects using m_pChartView are already deleted + if(bChanged) + { + m_bViewDirty = true; + m_pChartWindow->Invalidate(); + } +} + +//............................................................................. +} //namespace chart +//............................................................................. |