diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 17:03:42 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 17:03:42 +0000 |
commit | e0eb57b0fb403b9468ccb9fa6201bcbd372c06a5 (patch) | |
tree | 5721d3add333b56af6acefe0b45e95615c81d4c5 /chart2/source/controller/main/ChartController_Position.cxx | |
parent | INTEGRATION: CWS chart2mst3 (1.8.4); FILE MERGED (diff) | |
download | core-e0eb57b0fb403b9468ccb9fa6201bcbd372c06a5.tar.gz core-e0eb57b0fb403b9468ccb9fa6201bcbd372c06a5.zip |
INTEGRATION: CWS chart2mst3 (1.4.2); FILE MERGED
2007/05/14 20:04:49 bm 1.4.2.16: RESYNC: (1.6-1.7); FILE MERGED
2007/01/16 16:27:11 iha 1.4.2.15: #i73426# wrong help context bvecause of wrong window hirarchy
2006/11/26 11:41:06 bm 1.4.2.14: includes for solar mutex missing
2006/10/20 21:13:09 iha 1.4.2.13: implement selection of additional shapes
2006/10/18 17:07:42 bm 1.4.2.12: RESYNC: (1.5-1.6); FILE MERGED
2005/11/22 10:53:20 bm 1.4.2.11: use correct undo strings
2005/11/15 20:49:35 iha 1.4.2.10: use UndoGuard
2005/11/15 15:32:21 iha 1.4.2.9: guard dialogs with solarmutex
2005/11/15 14:00:01 iha 1.4.2.8: remove explicit view dirty setting as model changes are now notified
2005/10/11 12:50:28 bm 1.4.2.7: #i27351# implement Undo
2005/10/07 11:34:04 bm 1.4.2.6: RESYNC: (1.4-1.5); FILE MERGED
2005/07/23 00:01:19 iha 1.4.2.5: include axis title sizes in diagram position to support old api and fileformat
2005/05/31 18:59:36 iha 1.4.2.4: create old api without controller
2004/06/04 12:07:18 iha 1.4.2.3: removed unused code
2004/06/01 19:04:21 iha 1.4.2.2: new 3D view/effects dialog
2004/04/27 13:32:41 iha 1.4.2.1: warnings removed
Diffstat (limited to 'chart2/source/controller/main/ChartController_Position.cxx')
-rw-r--r-- | chart2/source/controller/main/ChartController_Position.cxx | 95 |
1 files changed, 33 insertions, 62 deletions
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index 9021c0836a18..1e55b2e0204e 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -4,9 +4,9 @@ * * $RCSfile: ChartController_Position.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: rt $ $Date: 2007-04-26 09:38:20 $ + * last change: $Author: vg $ $Date: 2007-05-22 18:03:42 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,16 +37,17 @@ #include "precompiled_chart2.hxx" #include "ChartController.hxx" -#include "dlg_RotateDiagram.hxx" #include "macros.hxx" #include "ChartWindow.hxx" -#include "Rotation.hxx" -#include "ChartModelHelper.hxx" #include "DrawViewWrapper.hxx" #include "PositionAndSizeHelper.hxx" +#include "ChartModelHelper.hxx" +#include "UndoGuard.hxx" +#include "Strings.hrc" +#include "ObjectNameProvider.hxx" -#ifndef _COM_SUN_STAR_CHART2_SCENEDESCRIPTOR_HPP_ -#include <com/sun/star/chart2/SceneDescriptor.hpp> +#ifndef _SVX_ACTIONDESCRIPTIONPROVIDER_HXX +#include <svx/ActionDescriptionProvider.hxx> #endif // header for define RET_OK @@ -64,6 +65,12 @@ #ifndef _SVX_DIALOGS_HRC #include <svx/dialogs.hrc> #endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef _VOS_MUTEX_HXX_ +#include <vos/mutex.hxx> +#endif //............................................................................. namespace chart @@ -97,28 +104,36 @@ void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, Rectangle& r rPosAndSize = Rectangle(Point(nPosX,nPosY),Size(nSizX,nSizY)); } -void SAL_CALL ChartController::executeDispatch_PositionAndSize( const ::rtl::OUString& rObjectCID ) +void SAL_CALL ChartController::executeDispatch_PositionAndSize() { - if( !rObjectCID.getLength() ) + const ::rtl::OUString aCID( m_aSelection.getSelectedCID() ); + + if( !aCID.getLength() ) return; - bool bChanged = false; + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::POS_SIZE, + ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aCID ))), + m_aUndoManager, m_aModel->getModel() ); + SfxAbstractTabDialog * pDlg = NULL; try { SfxItemSet aItemSet = m_pDrawViewWrapper->getPositionAndSizeItemSetFromMarkedObject(); //prepare and open dialog - Window* pParent( NULL ); SdrView* pSdrView = m_pDrawViewWrapper; bool bResizePossible=true; + ::vos::OGuard aGuard( Application::GetSolarMutex()); SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT( pFact, "No dialog factory" ); pDlg = pFact->CreateSchTransformTabDialog( - NULL, &aItemSet, pSdrView, RID_SCH_TransformTabDLG_SVXPAGE_ANGLE, bResizePossible ); + m_pChartWindow, &aItemSet, pSdrView, RID_SCH_TransformTabDLG_SVXPAGE_ANGLE, bResizePossible ); DBG_ASSERT( pDlg, "Couldn't create SchTransformTabDialog" ); + if( pDlg->Execute() == RET_OK ) { const SfxItemSet* pOutItemSet = pDlg->GetOutputItemSet(); @@ -127,13 +142,16 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize( const ::rtl::OUS Rectangle aObjectRect; aItemSet.Put(*pOutItemSet);//overwrite old values with new values (-> all items are set) lcl_getPositionAndSizeFromItemSet( aItemSet, aObjectRect ); - Rectangle aPageRect( Point(0,0),m_pChartWindow->GetOutputSize() ); + awt::Size aPageSize( ChartModelHelper::getPageSize( m_aModel->getModel() ) ); + Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height ); - bChanged = PositionAndSizeHelper::moveObject( m_aSelectedObjectCID + bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() , m_aModel->getModel() , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) - ); + , m_xChartView ); + if( bChanged ) + aUndoGuard.commitAction(); } } delete pDlg; @@ -143,53 +161,6 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize( const ::rtl::OUS delete pDlg; ASSERT_EXCEPTION( e ); } - //make sure that all objects using m_pChartView are already deleted - if(bChanged) - { - m_bViewDirty = true; - m_pChartWindow->Invalidate(); - } -} - -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(); - } } //............................................................................. |