diff options
Diffstat (limited to 'chart2/source/controller/main')
10 files changed, 101 insertions, 9 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 397e7bc44342..3aac05b8102c 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -129,7 +129,7 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const & , m_bWaitingForMouseUp(false) , m_bConnectingToView(false) , m_xUndoManager( 0 ) - , m_aDispatchContainer( m_xCC ) + , m_aDispatchContainer( m_xCC, this ) , m_eDrawMode( CHARTDRAW_SELECT ) { DBG_CTOR(ChartController,NULL); diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index 177fedf524f0..b148fc32d505 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -474,6 +474,8 @@ public: void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; } ChartDrawMode getDrawMode() const { return m_eDrawMode; } + bool isShapeContext() const; + public: //----------------------------------------------------------------- //----------------------------------------------------------------- diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index fdbda4589abd..1be741a4301d 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -520,6 +520,17 @@ bool ChartController::isObjectDeleteable( const uno::Any& rSelection ) return false; } +bool ChartController::isShapeContext() const +{ + if ( m_aSelection.isNonGraphicObjectShapeSelected() || + ( m_pDrawViewWrapper->AreObjectsMarked() && ( m_pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) ) ) + { + return true; + } + + return false; +} + void ChartController::impl_ClearSelection() { if( m_aSelection.hasSelection()) diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 50abaae78dce..47338d443ebc 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -897,8 +897,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() ) impl_notifySelectionChangeListeners(); - if ( m_aSelection.isNonGraphicObjectShapeSelected() || - ( m_pDrawViewWrapper->AreObjectsMarked() && ( m_pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) ) ) + if ( isShapeContext() ) { // #i12587# support for shapes in chart PopupMenu aContextMenu( SchResId( m_pDrawViewWrapper->IsTextEdit() ? diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx index 8c0f4f1f5c8e..96707ac837a1 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.cxx +++ b/chart2/source/controller/main/CommandDispatchContainer.cxx @@ -36,6 +36,7 @@ #include "StatusBarCommandDispatch.hxx" #include "DisposeHelper.hxx" #include "macros.hxx" +#include "ChartController.hxx" #include "DrawCommandDispatch.hxx" #include "ShapeController.hxx" @@ -53,8 +54,9 @@ namespace chart { CommandDispatchContainer::CommandDispatchContainer( - const Reference< uno::XComponentContext > & xContext ) + const Reference< uno::XComponentContext > & xContext, ChartController* pController ) :m_xContext( xContext ) + ,m_pChartController( pController ) ,m_pDrawCommandDispatch( NULL ) ,m_pShapeController( NULL ) { @@ -97,6 +99,14 @@ Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL( { Reference< frame::XDispatch > xResult; + // #i12587# support for shapes in chart + if ( m_pChartController && m_pChartController->isShapeContext() && + rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TransformDialog" ) ) ) + { + xResult.set( m_pShapeController ); + return xResult; + } + tDispatchMap::const_iterator aIt( m_aCachedDispatches.find( rURL.Complete )); if( aIt != m_aCachedDispatches.end()) { @@ -142,7 +152,8 @@ Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL( } // #i12587# support for shapes in chart // Note, that the chart dispatcher must be queried first, because - // the chart dispatcher handles all context sensitive commands. + // the chart dispatcher is the default dispatcher for all context + // sensitive commands. else if ( m_pDrawCommandDispatch && m_pDrawCommandDispatch->isFeatureSupported( rURL ) ) { xResult.set( m_pDrawCommandDispatch ); @@ -179,6 +190,7 @@ void CommandDispatchContainer::DisposeAndClear() m_aToBeDisposedDispatches.clear(); m_xChartDispatcher.clear(); m_aChartCommands.clear(); + m_pChartController = NULL; m_pDrawCommandDispatch = NULL; m_pShapeController = NULL; } diff --git a/chart2/source/controller/main/CommandDispatchContainer.hxx b/chart2/source/controller/main/CommandDispatchContainer.hxx index d5828e9f1550..70825ff3930d 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.hxx +++ b/chart2/source/controller/main/CommandDispatchContainer.hxx @@ -44,6 +44,7 @@ namespace chart { +class ChartController; class DrawCommandDispatch; class ShapeController; @@ -81,7 +82,8 @@ public: // itself) explicit CommandDispatchContainer( const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > & xContext ); + ::com::sun::star::uno::XComponentContext > & xContext, + ChartController* pController ); void setModel( const ::com::sun::star::uno::Reference< @@ -147,6 +149,7 @@ private: ::std::set< ::rtl::OUString > m_aContainerDocumentCommands; + ChartController* m_pChartController; DrawCommandDispatch* m_pDrawCommandDispatch; ShapeController* m_pShapeController; }; diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 0393af45c90b..9c50d316c2f6 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -321,7 +321,7 @@ bool Selection::isDragableObjectSelected() return m_xSelectAdditionalShape.is(); } -bool Selection::isNonGraphicObjectShapeSelected() +bool Selection::isNonGraphicObjectShapeSelected() const { if ( m_xSelectAdditionalShape.is() ) { diff --git a/chart2/source/controller/main/SelectionHelper.hxx b/chart2/source/controller/main/SelectionHelper.hxx index d24c91d25de4..bf540e86802e 100644 --- a/chart2/source/controller/main/SelectionHelper.hxx +++ b/chart2/source/controller/main/SelectionHelper.hxx @@ -59,7 +59,7 @@ public: //methods ::com::sun::star::frame::XModel >& xChartModel ); bool isDragableObjectSelected(); - bool isNonGraphicObjectShapeSelected(); + bool isNonGraphicObjectShapeSelected() const; //returns true if selection has changed bool setSelection( const ::rtl::OUString& rCID ); diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index 25e8aede83cc..83bb9542ddb0 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -40,7 +40,9 @@ #include <vos/mutex.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> +#include <svx/svxdlg.hxx> #include <svx/svxids.hrc> +#include <svx/dialogs.hrc> #include <boost/scoped_ptr.hpp> @@ -91,6 +93,7 @@ FeatureState ShapeController::getState( const ::rtl::OUString& rCommand ) const switch ( nFeatureId ) { + case SID_ATTR_TRANSFORM: case SID_CHAR_DLG: { aReturn.bEnabled = true; @@ -116,6 +119,11 @@ void ShapeController::execute( const ::rtl::OUString& rCommand, const Sequence< switch ( nFeatureId ) { + case SID_ATTR_TRANSFORM: + { + executeDispatch_TransformDialog(); + } + break; case SID_CHAR_DLG: { executeDispatch_FontDialog(); @@ -130,7 +138,63 @@ void ShapeController::execute( const ::rtl::OUString& rCommand, const Sequence< void ShapeController::describeSupportedFeatures() { - implDescribeSupportedFeature( ".uno:FontDialog", SID_CHAR_DLG, CommandGroup::TEXT ); + implDescribeSupportedFeature( ".uno:TransformDialog", SID_ATTR_TRANSFORM, CommandGroup::FORMAT ); + implDescribeSupportedFeature( ".uno:FontDialog", SID_CHAR_DLG, CommandGroup::EDIT ); +} + +void ShapeController::executeDispatch_TransformDialog() +{ + if ( m_pChartController ) + { + Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); + DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); + if ( pDrawViewWrapper ) + { + SdrObject* pObj = pDrawViewWrapper->getSelectedObject(); + if ( pObj && pObj->GetObjIdentifier() == OBJ_CAPTION ) + { + // item set for caption + SfxItemSet aSet( pDrawViewWrapper->GetModel()->GetItemPool() ); + pDrawViewWrapper->GetAttributes( aSet ); + // item set for position and size + SfxItemSet aGeoSet( pDrawViewWrapper->GetGeoAttrFromMarked() ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if ( pFact ) + { + ::boost::scoped_ptr< SfxAbstractTabDialog > pDlg( + pFact->CreateCaptionDialog( pParent, pDrawViewWrapper, RID_SVXDLG_CAPTION ) ); + const USHORT* pRange = pDlg->GetInputRanges( *aSet.GetPool() ); + SfxItemSet aCombSet( *aSet.GetPool(), pRange ); + aCombSet.Put( aSet ); + aCombSet.Put( aGeoSet ); + pDlg->SetInputSet( &aCombSet ); + if ( pDlg->Execute() == RET_OK ) + { + const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); + pDrawViewWrapper->SetAttributes( *pOutSet ); + pDrawViewWrapper->SetGeoAttrToMarked( *pOutSet ); + } + } + } + else + { + SfxItemSet aGeoSet( pDrawViewWrapper->GetGeoAttrFromMarked() ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if ( pFact ) + { + ::boost::scoped_ptr< SfxAbstractTabDialog > pDlg( + pFact->CreateSvxTransformTabDialog( pParent, &aGeoSet, pDrawViewWrapper, RID_SVXDLG_TRANSFORM ) ); + if ( pDlg->Execute() == RET_OK ) + { + const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); + pDrawViewWrapper->SetGeoAttrToMarked( *pOutSet ); + } + } + } + } + } } void ShapeController::executeDispatch_FontDialog() diff --git a/chart2/source/controller/main/ShapeController.hxx b/chart2/source/controller/main/ShapeController.hxx index afdcfd82f74e..14420be501df 100644 --- a/chart2/source/controller/main/ShapeController.hxx +++ b/chart2/source/controller/main/ShapeController.hxx @@ -69,6 +69,7 @@ protected: virtual void describeSupportedFeatures(); private: + void executeDispatch_TransformDialog(); void executeDispatch_FontDialog(); ChartController* m_pChartController; |