diff options
10 files changed, 554 insertions, 14 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 8368e76baa82..98ce927708dc 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -53,6 +53,7 @@ #include "dlg_CreationWizard.hxx" #include "dlg_ChartType.hxx" //#include "svx/ActionDescriptionProvider.hxx" +#include "DrawCommandDispatch.hxx" #include <comphelper/InlineContainer.hxx> @@ -128,6 +129,7 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const & , m_bConnectingToView(false) , m_xUndoManager( 0 ) , m_aDispatchContainer( m_xCC ) + , m_eDrawMode( CHARTDRAW_SELECT ) { DBG_CTOR(ChartController,NULL); // m_aDispatchContainer.setUndoManager( m_xUndoManager ); @@ -441,6 +443,13 @@ APPHELPER_XSERVICEINFO_IMPL(ChartController,CHART_CONTROLLER_SERVICE_IMPLEMENTAT //@todo: createElement should become unnecessary, remove when #i79198# is fixed xLayoutManager->createElement( C2U( "private:resource/toolbar/toolbar" ) ); xLayoutManager->requestElement( C2U( "private:resource/toolbar/toolbar" ) ); + + // #i12587# support for shapes in chart + xLayoutManager->createElement( C2U( "private:resource/toolbar/drawbar" ) ); + xLayoutManager->requestElement( C2U( "private:resource/toolbar/drawbar" ) ); + //xLayoutManager->createElement( C2U( "private:resource/toolbar/basicshapes" ) ); + //xLayoutManager->requestElement( C2U( "private:resource/toolbar/basicshapes" ) ); + xLayoutManager->requestElement( C2U( "private:resource/statusbar/statusbar" ) ); xLayoutManager->unlock(); @@ -567,6 +576,13 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent // is called here at the ChartController. m_aDispatchContainer.setFallbackDispatch( pDispatch, impl_getAvailableCommands() ); + DrawCommandDispatch* pDrawDispatch = new DrawCommandDispatch( m_xCC, this ); + if ( pDrawDispatch ) + { + pDrawDispatch->initialize(); + m_aDispatchContainer.setDrawCommandDispatch( pDrawDispatch ); + } + #ifdef TEST_ENABLE_MODIFY_LISTENER uno::Reference< util::XModifyBroadcaster > xMBroadcaster( aNewModelRef->getModel(),uno::UNO_QUERY ); if( xMBroadcaster.is()) @@ -1339,6 +1355,15 @@ DrawModelWrapper* ChartController::GetDrawModelWrapper() return m_pDrawModelWrapper.get(); } +DrawViewWrapper* ChartController::GetDrawViewWrapper() +{ + if ( !m_pDrawViewWrapper ) + { + impl_createDrawViewController(); + } + return m_pDrawViewWrapper; +} + uno::Reference< accessibility::XAccessible > ChartController::CreateAccessible() { uno::Reference< accessibility::XAccessible > xResult( diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index 0b81df0a2367..439067fd738d 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -91,6 +91,8 @@ namespace chart { //............................................................................. +enum ChartDrawMode { CHARTDRAW_INSERT, CHARTDRAW_SELECT }; + class WindowController { public: @@ -158,6 +160,8 @@ class ChartController : public ::cppu::WeakImplHelper12 < > , public WindowController { + friend class DrawCommandDispatch; + public: //no default constructor ChartController(::com::sun::star::uno::Reference< @@ -466,6 +470,9 @@ public: static bool isObjectDeleteable( const ::com::sun::star::uno::Any& rSelection ); + void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; } + ChartDrawMode getDrawMode() const { return m_eDrawMode; } + public: //----------------------------------------------------------------- //----------------------------------------------------------------- @@ -480,6 +487,7 @@ public: private: DrawModelWrapper* GetDrawModelWrapper(); + DrawViewWrapper* GetDrawViewWrapper(); private: class TheModelRef; @@ -580,6 +588,8 @@ private: ::com::sun::star::frame::XLayoutManagerEventBroadcaster > m_xLayoutManagerEventBroadcaster; + ChartDrawMode m_eDrawMode; + private: //private methods diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index 27cfc441be8a..bf6993b5d5c9 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -141,15 +141,20 @@ bool ChartController::EndTextEdit() String aString = pOutliner->GetText( pOutliner->GetParagraph( 0 ), pOutliner->GetParagraphCount() ); - uno::Reference< beans::XPropertySet > xPropSet = - ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ); - // lock controllers till end of block - ControllerLockGuard aCLGuard( m_aModel->getModel()); + ::rtl::OUString aObjectCID = m_aSelection.getSelectedCID(); + if ( aObjectCID.getLength() > 0 ) + { + uno::Reference< beans::XPropertySet > xPropSet = + ObjectIdentifier::getObjectPropertySet( aObjectCID, getModel() ); + + // lock controllers till end of block + ControllerLockGuard aCLGuard( m_aModel->getModel()); + + TitleHelper::setCompleteString( aString, uno::Reference< + ::com::sun::star::chart2::XTitle >::query( xPropSet ), m_xCC ); + } - //Paragraph* pPara = - TitleHelper::setCompleteString( aString, uno::Reference< - ::com::sun::star::chart2::XTitle >::query( xPropSet ), m_xCC ); try { m_xUndoManager->postAction( C2U("Edit Text") ); diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 55aafb1e5538..411c456694cf 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -560,6 +560,21 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) if( isDoubleClick(rMEvt) ) //do not change selection if double click return;//double click is handled further in mousebutton up + // #i12587# support for shapes in chart + if ( m_eDrawMode == CHARTDRAW_INSERT ) + { + if ( m_aSelection.hasSelection() ) + { + m_aSelection.clearSelection(); + } + if ( !pDrawViewWrapper->IsAction() ) + { + pDrawViewWrapper->BegCreateObj( aMPos); + } + impl_SetMousePointer( rMEvt ); + return; + } + SdrHdl* pHitSelectionHdl = 0; //switch from move to resize if handle is hit on a resizeable object if( m_aSelection.isResizeableObjectSelected() ) @@ -669,7 +684,33 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) return; } - if(pDrawViewWrapper->IsDragObj()) + // #i12587# support for shapes in chart + if ( m_eDrawMode == CHARTDRAW_INSERT ) + { + if ( pDrawViewWrapper->IsCreateObj() ) + { + pDrawViewWrapper->EndCreateObj( SDRCREATE_FORCEEND ); + if ( pDrawViewWrapper->AreObjectsMarked() ) + { + if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) + { + executeDispatch_EditText(); + } + else + { + m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper, rMEvt.IsRight(), m_bWaitingForDoubleClick ); + m_aSelection.applySelection( pDrawViewWrapper ); + } + } + else + { + m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper, rMEvt.IsRight(), m_bWaitingForDoubleClick ); + m_aSelection.applySelection( pDrawViewWrapper ); + setDrawMode( CHARTDRAW_SELECT ); + } + } + } + else if ( pDrawViewWrapper->IsDragObj() ) { bool bDraggingDone = false; SdrDragMethod* pDragMethod = pDrawViewWrapper->SdrView::GetDragMethod(); @@ -771,11 +812,37 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) void ChartController::execute_DoubleClick() { - ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ); - if( OBJECTTYPE_TITLE==eObjectType ) + bool bEditText = false; + if ( m_aSelection.hasSelection() ) + { + ::rtl::OUString aCID( m_aSelection.getSelectedCID() ); + if ( aCID.getLength() ) + { + ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID ); + if ( OBJECTTYPE_TITLE == eObjectType ) + { + bEditText = true; + } + } + else + { + // #i12587# support for shapes in chart + SdrObject* pObj = DrawViewWrapper::getSdrObject( m_aSelection.getSelectedAdditionalShape() ); + if ( pObj && pObj->ISA( SdrTextObj ) ) + { + bEditText = true; + } + } + } + + if ( bEditText ) + { executeDispatch_EditText(); + } else + { executeDispatch_ObjectProperties(); + } } void ChartController::execute_Resize() @@ -1389,7 +1456,38 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) sal_uInt16 nModifier = rEvent.GetModifier(); BOOL bLeftDown = rEvent.IsLeft(); - if( m_pDrawViewWrapper->IsTextEdit() ) + if ( m_eDrawMode == CHARTDRAW_INSERT ) + { + // #i12587# support for shapes in chart + PointerStyle ePointerStyle = POINTER_DRAW_RECT; + SdrObjKind eKind = static_cast< SdrObjKind >( m_pDrawViewWrapper->GetCurrentObjIdentifier() ); + switch ( eKind ) + { + case OBJ_LINE: + { + ePointerStyle = POINTER_DRAW_LINE; + } + break; + case OBJ_RECT: + { + ePointerStyle = POINTER_DRAW_RECT; + } + break; + case OBJ_TEXT: + { + ePointerStyle = POINTER_DRAW_TEXT; + } + break; + default: + { + ePointerStyle = POINTER_DRAW_RECT; + } + break; + } + pWindow->SetPointer( Pointer( ePointerStyle ) ); + return; + } + else if ( m_pDrawViewWrapper->IsTextEdit() ) { if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) ) { diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx index 72e8dcf5ed8e..fbd6dbc22f88 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 "DrawCommandDispatch.hxx" #include <comphelper/InlineContainer.hxx> @@ -51,8 +52,9 @@ namespace chart { CommandDispatchContainer::CommandDispatchContainer( - const Reference< uno::XComponentContext > & xContext ) : - m_xContext( xContext ) + const Reference< uno::XComponentContext > & xContext ) + :m_xContext( xContext ) + ,m_pDrawCommandDispatch( NULL ) { m_aContainerDocumentCommands = ::comphelper::MakeSet< OUString > @@ -130,6 +132,11 @@ Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL( // ToDo: can those dispatches be cached? m_aCachedDispatches[ rURL.Complete ].set( xResult ); } + else if ( m_pDrawCommandDispatch && m_pDrawCommandDispatch->isFeatureSupported( rURL ) ) + { + xResult.set( m_pDrawCommandDispatch ); + m_aCachedDispatches[ rURL.Complete ].set( xResult ); + } else if( m_xFallbackDispatcher.is() && (m_aFallbackCommands.find( rURL.Path ) != m_aFallbackCommands.end()) ) { @@ -162,6 +169,7 @@ void CommandDispatchContainer::DisposeAndClear() m_aToBeDisposedDispatches.clear(); m_xFallbackDispatcher.clear(); m_aFallbackCommands.clear(); + m_pDrawCommandDispatch = NULL; } Reference< frame::XDispatch > CommandDispatchContainer::getContainerDispatchForURL( @@ -182,4 +190,10 @@ Reference< frame::XDispatch > CommandDispatchContainer::getContainerDispatchForU return xResult; } +void CommandDispatchContainer::setDrawCommandDispatch( DrawCommandDispatch* pDispatch ) +{ + m_pDrawCommandDispatch = pDispatch; + m_aToBeDisposedDispatches.push_back( Reference< frame::XDispatch >( pDispatch ) ); +} + } // namespace chart diff --git a/chart2/source/controller/main/CommandDispatchContainer.hxx b/chart2/source/controller/main/CommandDispatchContainer.hxx index 90b9c94cc5d5..8f310e34a833 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.hxx +++ b/chart2/source/controller/main/CommandDispatchContainer.hxx @@ -44,6 +44,8 @@ namespace chart { +class DrawCommandDispatch; + /** @HTML Helper class for implementing the <code>XDispatchProvider</code> interface @@ -119,6 +121,8 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > & xChartController, const ::com::sun::star::util::URL & rURL ); + void setDrawCommandDispatch( DrawCommandDispatch* pDispatch ); + private: typedef ::std::map< ::rtl::OUString, @@ -140,6 +144,8 @@ private: ::std::set< ::rtl::OUString > m_aFallbackCommands; ::std::set< ::rtl::OUString > m_aContainerDocumentCommands; + + DrawCommandDispatch* m_pDrawCommandDispatch; }; } // namespace chart diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx new file mode 100644 index 000000000000..4ae9f06e2744 --- /dev/null +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -0,0 +1,243 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: DrawCommandDispatch.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_chart2.hxx" + +#include "DrawCommandDispatch.hxx" +#include "ChartController.hxx" +#include "DrawViewWrapper.hxx" + +#include <svx/svxids.hrc> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::frame; + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; + +namespace chart +{ + + +DrawCommandDispatch::DrawCommandDispatch( const Reference< uno::XComponentContext >& rxContext, + ChartController* pController ) + :CommandDispatch( rxContext ) + ,m_pChartController( pController ) +{ + fillSupportedFeatures(); +} + +DrawCommandDispatch::~DrawCommandDispatch() +{ +} + +void DrawCommandDispatch::initialize() +{ +} + +bool DrawCommandDispatch::isFeatureSupported( const util::URL& rURL ) const +{ + SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rURL.Complete ); + if ( aIter != m_aSupportedFeatures.end() ) + { + return true; + } + return false; +} + +void DrawCommandDispatch::fireStatusEvent( const ::rtl::OUString& rURL, + const Reference< frame::XStatusListener >& xSingleListener /* = 0 */ ) +{ + if ( rURL.getLength() == 0 ) + { + SupportedFeatures::const_iterator aEnd( m_aSupportedFeatures.end() ); + for ( SupportedFeatures::const_iterator aIter( m_aSupportedFeatures.begin() ); aIter != aEnd; ++aIter ) + { + sal_uInt16 nId = aIter->second.nFeatureId; + FeatureState aFeatureState( getState( nId ) ); + fireStatusEventForURL( aIter->first, aFeatureState.aState, aFeatureState.bEnabled, xSingleListener ); + } + } + else + { + sal_uInt16 nId = m_aSupportedFeatures[ rURL ].nFeatureId; + FeatureState aFeatureState( getState( nId ) ); + fireStatusEventForURL( rURL, aFeatureState.aState, aFeatureState.bEnabled, xSingleListener ); + } +} + +// XDispatch +void DrawCommandDispatch::dispatch( const util::URL& URL, + const Sequence< beans::PropertyValue >& Arguments ) + throw (uno::RuntimeException) +{ + SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( URL.Complete ); + if ( aIter != m_aSupportedFeatures.end() ) + { + sal_uInt16 nFeatureId = aIter->second.nFeatureId; + if ( getState( nFeatureId ).bEnabled ) // ??? + { + execute( nFeatureId, Arguments ); + } + } +} + +// WeakComponentImplHelperBase +void DrawCommandDispatch::disposing() +{ +} + +// XEventListener +void DrawCommandDispatch::disposing( const lang::EventObject& /* Source */ ) + throw (uno::RuntimeException) +{ +} + +FeatureState DrawCommandDispatch::getState( sal_uInt16 nId ) const +{ + FeatureState aReturn; + + switch ( nId ) + { + case SID_OBJECT_SELECT: + case SID_DRAW_LINE: + case SID_DRAW_RECT: + case SID_DRAW_TEXT: + { + aReturn.bEnabled = true; + aReturn.aState <<= false; + } + break; + default: + { + aReturn.bEnabled = false; + aReturn.aState <<= false; + } + break; + } + + return aReturn; +} + +void DrawCommandDispatch::execute( sal_uInt16 nId, const Sequence< beans::PropertyValue>& rArgs ) +{ + (void)rArgs; + + ChartDrawMode eDrawMode = CHARTDRAW_SELECT; + SdrObjKind eKind = OBJ_NONE; + bool bCreate = false; + + switch ( nId ) + { + case SID_OBJECT_SELECT: + { + eDrawMode = CHARTDRAW_SELECT; + eKind = OBJ_NONE; + } + break; + case SID_DRAW_LINE: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_LINE; + } + break; + case SID_DRAW_RECT: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_RECT; + } + break; + case SID_DRAW_TEXT: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_TEXT; + bCreate = true; + } + break; + default: + { + eDrawMode = CHARTDRAW_SELECT; + eKind = OBJ_NONE; + } + break; + } + + if ( m_pChartController ) + { + m_pChartController->setDrawMode( eDrawMode ); + setInsertObj( sal::static_int_cast< USHORT >( eKind ) ); + if ( bCreate ) + { + DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); + if ( pDrawViewWrapper ) + { + pDrawViewWrapper->SetCreateMode(); + } + } + } +} + +void DrawCommandDispatch::describeSupportedFeatures() +{ + implDescribeSupportedFeature( ".uno:SelectObject", SID_OBJECT_SELECT, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:Line", SID_DRAW_LINE, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:Rect", SID_DRAW_RECT, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:DrawText", SID_DRAW_TEXT, CommandGroup::INSERT ); +} + +void DrawCommandDispatch::implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL, + sal_uInt16 nId, sal_Int16 nGroup ) +{ + ControllerFeature aFeature; + aFeature.Command = ::rtl::OUString::createFromAscii( pAsciiCommandURL ); + aFeature.nFeatureId = nId; + aFeature.GroupId = nGroup; + + m_aSupportedFeatures[ aFeature.Command ] = aFeature; +} + +void DrawCommandDispatch::fillSupportedFeatures() +{ + describeSupportedFeatures(); +} + +void DrawCommandDispatch::setInsertObj( USHORT eObj, const ::rtl::OUString& rShapeType ) +{ + (void)rShapeType; + + DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL ); + if ( pDrawViewWrapper ) + { + pDrawViewWrapper->SetCurrentObj( eObj /*, Inventor */); + } +} + +} // namespace chart diff --git a/chart2/source/controller/main/DrawCommandDispatch.hxx b/chart2/source/controller/main/DrawCommandDispatch.hxx new file mode 100644 index 000000000000..36e0ed879094 --- /dev/null +++ b/chart2/source/controller/main/DrawCommandDispatch.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: DrawCommandDispatch.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CHART2_DRAWCOMMANDDISPATCH_HXX +#define CHART2_DRAWCOMMANDDISPATCH_HXX + +#include "CommandDispatch.hxx" + +#include <com/sun/star/frame/CommandGroup.hpp> +#include <com/sun/star/frame/DispatchInformation.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/util/URL.hpp> + +#include <tools/solar.h> + +namespace chart +{ + +struct ControllerFeature: public ::com::sun::star::frame::DispatchInformation +{ + sal_uInt16 nFeatureId; +}; + +typedef ::std::map< ::rtl::OUString, + ControllerFeature, + ::std::less< ::rtl::OUString > > SupportedFeatures; + +struct FeatureState +{ + bool bEnabled; + ::com::sun::star::uno::Any aState; + + FeatureState() : bEnabled( false ) { } +}; + +class ChartController; + +/** This is a CommandDispatch implementation for drawing objects. + */ +class DrawCommandDispatch: public CommandDispatch +{ +public: + DrawCommandDispatch( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext >& rxContext, ChartController* pController ); + virtual ~DrawCommandDispatch(); + + // late initialisation, especially for adding as listener + virtual void initialize(); + + bool isFeatureSupported( const ::com::sun::star::util::URL& rURL ) const; + +protected: + // XDispatch + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& URL, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) + throw (::com::sun::star::uno::RuntimeException); + + // WeakComponentImplHelperBase + virtual void SAL_CALL disposing(); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) + throw (::com::sun::star::uno::RuntimeException); + + virtual void fireStatusEvent( const ::rtl::OUString& rURL, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xSingleListener ); + + // state of a feature + virtual FeatureState getState( sal_uInt16 nId ) const; + + // execute a feature + virtual void execute( sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs ); + + // all the features which should be handled by this class + virtual void describeSupportedFeatures(); + + /** describes a feature supported by the controller + + Must not be called outside <member>describeSupportedFeatures</member>. + + @param pAsciiCommandURL + the URL of the feature command + @param nId + the id of the feature. Later references to this feature usually happen by id, not by + URL. + @param nGroup + the command group of the feature. This is important for configuring the controller UI + by the user, see also <type scope="com::sun::star::frame">CommandGroup</type>. + */ + void implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL, sal_uInt16 nId, + sal_Int16 nGroup = ::com::sun::star::frame::CommandGroup::INTERNAL ); + + +private: + void fillSupportedFeatures(); + + void setInsertObj( USHORT eObj, const ::rtl::OUString& rShapeType = ::rtl::OUString() ); + + mutable SupportedFeatures m_aSupportedFeatures; + ChartController* m_pChartController; +}; + +} // namespace chart + +// CHART2_DRAWCOMMANDDISPATCH_HXX +#endif diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 8e2b8911be77..703d7b49e303 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -291,6 +291,12 @@ void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper* bool Selection::isResizeableObjectSelected() { + // #i12587# support for shapes in chart + if ( m_xSelectAdditionalShape.is() ) + { + return true; + } + ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelectedObjectCID ); switch( eObjectType ) { diff --git a/chart2/source/controller/main/makefile.mk b/chart2/source/controller/main/makefile.mk index 6ee09d8c7c72..6471911e3866 100644 --- a/chart2/source/controller/main/makefile.mk +++ b/chart2/source/controller/main/makefile.mk @@ -70,7 +70,8 @@ SLOFILES = \ $(SLO)$/_serviceregistration_controller.obj \ $(SLO)$/ChartDropTargetHelper.obj \ $(SLO)$/StatusBarCommandDispatch.obj \ - $(SLO)$/ChartTransferable.obj + $(SLO)$/ChartTransferable.obj \ + $(SLO)$/DrawCommandDispatch.obj # $(SLO)$/CommonConverters.obj \ # $(SLO)$/Scaling.obj \ |