diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-11-09 21:37:01 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-11-09 21:37:01 +0100 |
commit | 587dfc9e8a00e8b97d5460e4e1d7c48de91b7425 (patch) | |
tree | 367b890166129337879f3b8c90c6560d32fd0552 /chart2 | |
parent | 78fed9b8623faca46c3e1ef4dc633d80682d0414 (diff) |
undoapi: step 2.0 of the migration of css.chart2.XUndoManager to css.document.XUndoManager: rename css.chart2.XUndoManager to XDocumentActions. Not sure this class will still exist (in either form) after the refactoring is finished.
Diffstat (limited to 'chart2')
25 files changed, 320 insertions, 212 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 64dbac8db86e..2ba38e9582e1 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -56,7 +56,7 @@ #include "WrappedAddInProperty.hxx" #include "WrappedIgnoreProperty.hxx" #include "ChartRenderer.hxx" -#include "UndoManager.hxx" +#include "DocumentActions.hxx" #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> @@ -1412,11 +1412,11 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( xResult.set( m_xChartView ); bServiceFound = true; } - else if ( aServiceSpecifier.equals( CHART_UNDOMANAGER_SERVICE_NAME ) ) + else if ( aServiceSpecifier.equals( CHART_DOCUMENT_ACTIONS_SERVICE_NAME ) ) { Reference< XModel > xModel( queryInterface( XModel::static_type() ), UNO_QUERY_THROW ); - Reference< chart2::XUndoManager > xUndoManager( new UndoManager( xModel ) ); - xResult.set( xUndoManager ); + Reference< chart2::XDocumentActions > xDocumentActions( new DocumentActions( xModel ) ); + xResult.set( xDocumentActions ); bServiceFound = true; } else diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 55acbf6a7389..4e29cc45907b 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -53,13 +53,12 @@ #include "AccessibleChartView.hxx" #include "DrawCommandDispatch.hxx" #include "ShapeController.hxx" -#include "UndoManager.hxx" +#include "DocumentActions.hxx" #include <comphelper/InlineContainer.hxx> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> -#include <com/sun/star/chart2/XUndoSupplier.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/util/XCloneable.hpp> @@ -128,12 +127,11 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const & , m_bWaitingForDoubleClick(false) , m_bWaitingForMouseUp(false) , m_bConnectingToView(false) - , m_xUndoManager( 0 ) + , m_xDocumentActions( 0 ) , m_aDispatchContainer( m_xCC, this ) , m_eDrawMode( CHARTDRAW_SELECT ) { DBG_CTOR(ChartController,NULL); -// m_aDispatchContainer.setUndoManager( m_xUndoManager ); m_aDoubleClickTimer.SetTimeoutHdl( LINK( this, ChartController, DoubleClickWaitingHdl ) ); } @@ -615,9 +613,7 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent if( m_pChartWindow ) m_pChartWindow->Invalidate(); - uno::Reference< chart2::XUndoSupplier > xUndoSupplier( getModel(), uno::UNO_QUERY ); - if( xUndoSupplier.is()) - m_xUndoManager.set( xUndoSupplier->getUndoManager()); + m_xDocumentActions.set( getModel(), uno::UNO_QUERY ); return sal_True; } @@ -818,7 +814,7 @@ void ChartController::impl_deleteDrawViewController() } m_xFrame.clear(); - m_xUndoManager.clear(); + m_xDocumentActions.clear(); TheModelRef aModelRef( m_aModel, m_aModelMutex); m_aModel = NULL; @@ -955,7 +951,7 @@ bool ChartController::impl_releaseThisModel( const uno::Reference< uno::XInterfa if( m_aModel.is() && m_aModel->getModel() == xModel ) { m_aModel = NULL; - m_xUndoManager.clear(); + m_xDocumentActions.clear(); bReleaseModel = true; } } @@ -1327,7 +1323,7 @@ void SAL_CALL ChartController::executeDispatch_ChartType() { // using assignment for broken gcc 3.3 UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard( - String( SchResId( STR_ACTION_EDIT_CHARTTYPE )), m_xUndoManager ); + String( SchResId( STR_ACTION_EDIT_CHARTTYPE )), m_xDocumentActions ); // /-- ::vos::OGuard aSolarGuard( Application::GetSolarMutex()); @@ -1352,7 +1348,7 @@ void SAL_CALL ChartController::executeDispatch_SourceData() // using assignment for broken gcc 3.3 UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard( - String( SchResId( STR_ACTION_EDIT_DATA_RANGES )), m_xUndoManager ); + String( SchResId( STR_ACTION_EDIT_DATA_RANGES )), m_xDocumentActions ); if( xChartDoc.is()) { // /-- @@ -1380,7 +1376,7 @@ void SAL_CALL ChartController::executeDispatch_MoveSeries( sal_Bool bForward ) ActionDescriptionProvider::createDescription( (bForward ? ActionDescriptionProvider::MOVE_TOTOP : ActionDescriptionProvider::MOVE_TOBOTTOM), String( SchResId( STR_OBJECT_DATASERIES ))), - m_xUndoManager ); + m_xDocumentActions ); bool bChanged = DiagramHelper::moveSeries( ChartModelHelper::findDiagram( getModel() ), xGivenDataSeries, bForward ); if( bChanged ) @@ -1449,10 +1445,10 @@ IMPL_LINK( ChartController, NotifyUndoActionHdl, SdrUndoAction*, pUndoAction ) ::rtl::OUString aObjectCID = m_aSelection.getSelectedCID(); if ( aObjectCID.getLength() == 0 ) { - UndoManager* pUndoManager = UndoManager::getImplementation( m_xUndoManager ); - if ( pUndoManager ) + DocumentActions* pDocumentActions = DocumentActions::getImplementation( m_xDocumentActions ); + if ( pDocumentActions ) { - pUndoManager->addShapeUndoAction( pUndoAction ); + pDocumentActions->addShapeUndoAction( pUndoAction ); } } return 0L; diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index f2b64eb7a9c5..aa9ade1f17b5 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -42,7 +42,7 @@ #include <cppuhelper/implbase12.hxx> #include <com/sun/star/accessibility/XAccessible.hpp> -#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/chart2/XDocumentActions.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -578,7 +578,7 @@ private: bool volatile m_bConnectingToView; - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > m_xUndoManager; + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDocumentActions > m_xDocumentActions; /// needed for dispatching URLs in FeatureStateEvents mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx index 06cb8882c2c0..cbc66a2368b3 100644 --- a/chart2/source/controller/main/ChartController_EditData.cxx +++ b/chart2/source/controller/main/ChartController_EditData.cxx @@ -67,7 +67,7 @@ void ChartController::executeDispatch_EditData() // using assignment for broken gcc 3.3 UndoLiveUpdateGuardWithData aUndoGuard = UndoLiveUpdateGuardWithData( String( SchResId( STR_ACTION_EDIT_CHART_DATA )), - m_xUndoManager ); + m_xDocumentActions ); DataEditor aDataEditorDialog( pParent, xChartDoc, m_xCC ); // the dialog has no OK/Cancel aDataEditorDialog.Execute(); diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 6581e092d7d4..adb6cf91a62e 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -122,7 +122,7 @@ void ChartController::executeDispatch_InsertAxes() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AXES ))), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -160,7 +160,7 @@ void ChartController::executeDispatch_InsertGrid() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRIDS ))), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -197,7 +197,7 @@ void ChartController::executeDispatch_InsertTitles() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_TITLES ))), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -228,7 +228,7 @@ void ChartController::executeDispatch_DeleteLegend() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_LEGEND ))), - m_xUndoManager ); + m_xDocumentActions ); LegendHelper::hideLegend( getModel() ); aUndoGuard.commitAction(); @@ -239,7 +239,7 @@ void ChartController::executeDispatch_InsertLegend() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_LEGEND ))), - m_xUndoManager ); + m_xDocumentActions ); Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( getModel(), m_xCC ); aUndoGuard.commitAction(); @@ -250,7 +250,7 @@ void ChartController::executeDispatch_OpenLegendDialog() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_LEGEND ))), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -281,7 +281,7 @@ void ChartController::executeDispatch_InsertMenu_DataLabels() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_DATALABELS ))), - m_xUndoManager ); + m_xDocumentActions ); //if a series is selected insert labels for that series only: uno::Reference< chart2::XDataSeries > xSeries( @@ -354,7 +354,7 @@ void ChartController::executeDispatch_InsertMenu_YErrorBars() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) ), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -394,7 +394,7 @@ void ChartController::executeDispatch_InsertMeanValue() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AVERAGE_LINE ))), - m_xUndoManager ); + m_xDocumentActions ); lcl_InsertMeanValueLine( m_xCC ).operator()( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() )); aUndoGuard.commitAction(); @@ -405,7 +405,7 @@ void ChartController::executeDispatch_InsertMenu_MeanValues() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AVERAGE_LINE ))), - m_xUndoManager ); + m_xDocumentActions ); uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); @@ -437,7 +437,7 @@ void ChartController::executeDispatch_InsertMenu_Trendlines() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) ), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -478,7 +478,7 @@ void ChartController::executeDispatch_InsertTrendline() UndoLiveUpdateGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE ))), - m_xUndoManager ); + m_xDocumentActions ); // add a linear curve RegressionCurveHelper::addRegressionCurve( @@ -532,7 +532,7 @@ void ChartController::executeDispatch_InsertYErrorBars() UndoLiveUpdateGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_ERROR_BARS ))), - m_xUndoManager ); + m_xDocumentActions ); // add error bars with standard deviation uno::Reference< beans::XPropertySet > xErrorBarProp( @@ -592,7 +592,7 @@ void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 ) UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), - m_xUndoManager ); + m_xDocumentActions ); xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( true )); xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bInsertR2 )); aUndoGuard.commitAction(); @@ -609,7 +609,7 @@ void ChartController::executeDispatch_InsertR2Value() UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), - m_xUndoManager ); + m_xDocumentActions ); xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( true )); aUndoGuard.commitAction(); } @@ -624,7 +624,7 @@ void ChartController::executeDispatch_DeleteR2Value() UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), - m_xUndoManager ); + m_xDocumentActions ); xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false )); aUndoGuard.commitAction(); } @@ -639,7 +639,7 @@ void ChartController::executeDispatch_DeleteMeanValue() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AVERAGE_LINE ))), - m_xUndoManager ); + m_xDocumentActions ); RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt ); aUndoGuard.commitAction(); } @@ -654,7 +654,7 @@ void ChartController::executeDispatch_DeleteTrendline() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE ))), - m_xUndoManager ); + m_xDocumentActions ); RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCurveCnt ); aUndoGuard.commitAction(); } @@ -669,7 +669,7 @@ void ChartController::executeDispatch_DeleteTrendlineEquation() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), - m_xUndoManager ); + m_xDocumentActions ); RegressionCurveHelper::removeEquations( xRegCurveCnt ); aUndoGuard.commitAction(); } @@ -684,7 +684,7 @@ void ChartController::executeDispatch_DeleteYErrorBars() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE ))), - m_xUndoManager ); + m_xDocumentActions ); StatisticsHelper::removeErrorBars( xDataSeries ); aUndoGuard.commitAction(); } @@ -698,7 +698,7 @@ void ChartController::executeDispatch_InsertDataLabels() { UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_DATALABELS ))), - m_xUndoManager ); + m_xDocumentActions ); DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries ); aUndoGuard.commitAction(); } @@ -708,7 +708,7 @@ void ChartController::executeDispatch_InsertDataLabel() { UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_LABEL ))), - m_xUndoManager ); + m_xDocumentActions ); DataSeriesHelper::insertDataLabelToPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) ); aUndoGuard.commitAction(); } @@ -721,7 +721,7 @@ void ChartController::executeDispatch_DeleteDataLabels() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_DATALABELS ))), - m_xUndoManager ); + m_xDocumentActions ); DataSeriesHelper::deleteDataLabelsFromSeriesAndAllPoints( xSeries ); aUndoGuard.commitAction(); } @@ -731,7 +731,7 @@ void ChartController::executeDispatch_DeleteDataLabel() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_LABEL ))), - m_xUndoManager ); + m_xDocumentActions ); DataSeriesHelper::deleteDataLabelsFromPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) ); aUndoGuard.commitAction(); } @@ -740,7 +740,7 @@ void ChartController::executeDispatch_ResetAllDataPoints() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT, String( SchResId( STR_OBJECT_DATAPOINTS ))), - m_xUndoManager ); + m_xDocumentActions ); uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); if( xSeries.is() ) xSeries->resetAllDataPoints(); @@ -750,7 +750,7 @@ void ChartController::executeDispatch_ResetDataPoint() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT, String( SchResId( STR_OBJECT_DATAPOINT ))), - m_xUndoManager ); + m_xDocumentActions ); uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); if( xSeries.is() ) { @@ -769,7 +769,7 @@ void ChartController::executeDispatch_InsertAxisTitle() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_TITLE ))), - m_xUndoManager ); + m_xDocumentActions ); Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() ); sal_Int32 nDimensionIndex = -1; @@ -810,7 +810,7 @@ void ChartController::executeDispatch_InsertAxis() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AXIS ))), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -832,7 +832,7 @@ void ChartController::executeDispatch_DeleteAxis() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AXIS ))), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -854,7 +854,7 @@ void ChartController::executeDispatch_InsertMajorGrid() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRID ))), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -876,7 +876,7 @@ void ChartController::executeDispatch_DeleteMajorGrid() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_GRID ))), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -898,7 +898,7 @@ void ChartController::executeDispatch_InsertMinorGrid() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRID ))), - m_xUndoManager ); + m_xDocumentActions ); try { @@ -922,7 +922,7 @@ void ChartController::executeDispatch_DeleteMinorGrid() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_GRID ))), - m_xUndoManager ); + m_xDocumentActions ); try { diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index 8acc8bf10e17..78f607773ca9 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -139,7 +139,7 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize() ActionDescriptionProvider::createDescription( ActionDescriptionProvider::POS_SIZE, ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aCID ))), - m_xUndoManager ); + m_xDocumentActions ); SfxAbstractTabDialog * pDlg = NULL; try diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 7bd99e8fa74c..f6508c74f462 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -720,7 +720,7 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT, ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))), - m_xUndoManager ); + m_xDocumentActions ); bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, false ); if( bSuccess ) @@ -839,7 +839,7 @@ void SAL_CALL ChartController::executeDispatch_View3D() // using assignment for broken gcc 3.3 UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard( String( SchResId( STR_ACTION_EDIT_3D_VIEW )), - m_xUndoManager ); + m_xDocumentActions ); // /-- //open dialog diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index 50037f0846e8..96175fb119ca 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -80,7 +80,7 @@ void ChartController::StartTextEdit( const Point* pMousePixel ) if(!pTextObj) return; - m_xUndoManager->preAction(); + m_xDocumentActions->preAction(); SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner(); //pOutliner->SetRefDevice(m_pChartWindow); //pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)pStyleSheetPool); @@ -166,7 +166,7 @@ bool ChartController::EndTextEdit() try { - m_xUndoManager->postAction( C2U("Edit Text") ); + m_xDocumentActions->postAction( C2U("Edit Text") ); } catch( uno::RuntimeException& e) { @@ -177,7 +177,7 @@ bool ChartController::EndTextEdit() { try { - m_xUndoManager->cancelAction(); + m_xDocumentActions->cancelAction(); } catch ( uno::RuntimeException& e ) { diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index c142ad33bcb9..9b2115fff83b 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -102,7 +102,7 @@ namespace bool lcl_deleteDataSeries( const OUString & rCID, const Reference< frame::XModel > & xModel, - const Reference< chart2::XUndoManager > & xUndoManager ) + const Reference< chart2::XDocumentActions > & xDocumentActions ) { bool bResult = false; uno::Reference< chart2::XDataSeries > xSeries( ::chart::ObjectIdentifier::getDataSeriesForCID( rCID, xModel )); @@ -116,7 +116,7 @@ bool lcl_deleteDataSeries( ::chart::UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( ::chart::SchResId( STR_OBJECT_DATASERIES ))), - xUndoManager ); + xDocumentActions ); Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( xModel ) ); uno::Reference< chart2::XAxis > xAxis( ::chart::DiagramHelper::getAttachedAxis( xSeries, xDiagram ) ); @@ -135,7 +135,7 @@ bool lcl_deleteDataSeries( bool lcl_deleteDataCurve( const OUString & rCID, const Reference< frame::XModel > & xModel, - const Reference< chart2::XUndoManager > & xUndoManager ) + const Reference< chart2::XDocumentActions > & xDocumentActions ) { bool bResult = false; uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( @@ -146,7 +146,7 @@ bool lcl_deleteDataCurve( ::chart::UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( ::chart::SchResId( STR_OBJECT_CURVE ))), - xUndoManager ); + xDocumentActions ); ::chart::RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCurveCnt ); bResult = true; aUndoGuard.commitAction(); @@ -236,7 +236,7 @@ void ChartController::executeDispatch_NewArrangement() // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( String( SchResId( STR_ACTION_REARRANGE_CHART )), - m_xUndoManager ); + m_xDocumentActions ); ControllerLockGuard aCtlLockGuard( xModel ); // diagram @@ -286,7 +286,7 @@ void ChartController::executeDispatch_ScaleText() // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( String( SchResId( STR_ACTION_SCALE_TEXT )), - m_xUndoManager ); + m_xDocumentActions ); ControllerLockGuard aCtlLockGuard( getModel() ); ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProv( impl_createReferenceSizeProvider()); OSL_ASSERT( apRefSizeProv.get()); @@ -656,7 +656,7 @@ bool ChartController::executeDispatch_Delete() UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_TITLE ))), - m_xUndoManager ); + m_xDocumentActions ); TitleHelper::removeTitle( ObjectIdentifier::getTitleTypeForCID( aCID ), getModel() ); bReturn = true; @@ -675,7 +675,7 @@ bool ChartController::executeDispatch_Delete() UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_LEGEND ))), - m_xUndoManager ); + m_xDocumentActions ); xLegendProp->setPropertyValue( C2U("Show"), uno::makeAny( false )); bReturn = true; aUndoGuard.commitAction(); @@ -685,7 +685,7 @@ bool ChartController::executeDispatch_Delete() } case OBJECTTYPE_DATA_SERIES: - bReturn = lcl_deleteDataSeries( aCID, getModel(), m_xUndoManager ); + bReturn = lcl_deleteDataSeries( aCID, getModel(), m_xDocumentActions ); break; case OBJECTTYPE_LEGEND_ENTRY: @@ -693,9 +693,9 @@ bool ChartController::executeDispatch_Delete() ObjectType eParentObjectType = ObjectIdentifier::getObjectType( ObjectIdentifier::getFullParentParticle( aCID )); if( eParentObjectType == OBJECTTYPE_DATA_SERIES ) - bReturn = lcl_deleteDataSeries( aCID, getModel(), m_xUndoManager ); + bReturn = lcl_deleteDataSeries( aCID, getModel(), m_xDocumentActions ); else if( eParentObjectType == OBJECTTYPE_DATA_CURVE ) - bReturn = lcl_deleteDataCurve( aCID, getModel(), m_xUndoManager ); + bReturn = lcl_deleteDataCurve( aCID, getModel(), m_xDocumentActions ); break; } @@ -710,7 +710,7 @@ bool ChartController::executeDispatch_Delete() UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AVERAGE_LINE ))), - m_xUndoManager ); + m_xDocumentActions ); RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt ); bReturn = true; aUndoGuard.commitAction(); @@ -719,7 +719,7 @@ bool ChartController::executeDispatch_Delete() } case OBJECTTYPE_DATA_CURVE: - bReturn = lcl_deleteDataCurve( aCID, getModel(), m_xUndoManager ); + bReturn = lcl_deleteDataCurve( aCID, getModel(), m_xDocumentActions ); break; case OBJECTTYPE_DATA_CURVE_EQUATION: @@ -733,7 +733,7 @@ bool ChartController::executeDispatch_Delete() UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), - m_xUndoManager ); + m_xDocumentActions ); { ControllerLockGuard aCtlLockGuard( xModel ); xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( false )); @@ -756,7 +756,7 @@ bool ChartController::executeDispatch_Delete() UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_ERROR_BARS ))), - m_xUndoManager ); + m_xDocumentActions ); { ControllerLockGuard aCtlLockGuard( xModel ); xErrorBarProp->setPropertyValue( @@ -780,7 +780,7 @@ bool ChartController::executeDispatch_Delete() ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( aObjectType == OBJECTTYPE_DATA_LABEL ? STR_OBJECT_LABEL : STR_OBJECT_DATALABELS )))), - m_xUndoManager ); + m_xDocumentActions ); chart2::DataPointLabel aLabel; xObjectProperties->getPropertyValue( C2U( "Label" ) ) >>= aLabel; aLabel.ShowNumber = false; @@ -844,7 +844,7 @@ void ChartController::executeDispatch_ToggleLegend() { Reference< frame::XModel > xModel( getModel() ); UndoGuard aUndoGuard = UndoGuard( - String( SchResId( STR_ACTION_TOGGLE_LEGEND )), m_xUndoManager ); + String( SchResId( STR_ACTION_TOGGLE_LEGEND )), m_xDocumentActions ); Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend( xModel ), uno::UNO_QUERY ); bool bChanged = false; if( xLegendProp.is()) @@ -878,7 +878,7 @@ void ChartController::executeDispatch_ToggleGridHorizontal() { Reference< frame::XModel > xModel( getModel() ); UndoGuard aUndoGuard = UndoGuard( - String( SchResId( STR_ACTION_TOGGLE_GRID_HORZ )), m_xUndoManager ); + String( SchResId( STR_ACTION_TOGGLE_GRID_HORZ )), m_xDocumentActions ); Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( getModel() )); if( xDiagram.is()) { @@ -911,7 +911,7 @@ void ChartController::impl_switchDiagramPositioningToExcludingPositioning() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::POS_SIZE, ObjectNameProvider::getName( OBJECTTYPE_DIAGRAM)), - m_xUndoManager ); + m_xDocumentActions ); if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( m_aModel->getModel(), true, true ) ) aUndoGuard.commitAction(); } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 1b060431df5e..c12ce38fa7cd 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -839,7 +839,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) if( pChartDragMethod ) { UndoGuard aUndoGuard( pChartDragMethod->getUndoDescription(), - m_xUndoManager ); + m_xDocumentActions ); if( pDrawViewWrapper->EndDragObj(false) ) { @@ -872,7 +872,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) ActionDescriptionProvider::createDescription( eActionType, ObjectNameProvider::getName( ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ))), - m_xUndoManager ); + m_xDocumentActions ); bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() , getModel() , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) @@ -1808,7 +1808,7 @@ bool ChartController::impl_moveOrResizeObject( ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID ); UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager ); + eActionType, ObjectNameProvider::getName( eObjectType )), m_xDocumentActions ); { ControllerLockGuard aCLGuard( xChartModel ); if( bNeedShift ) diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx index e0d689340760..c0847a490ea1 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.cxx +++ b/chart2/source/controller/main/CommandDispatchContainer.cxx @@ -75,12 +75,6 @@ void CommandDispatchContainer::setModel( m_xModel = xModel; } -// void CommandDispatchContainer::setUndoManager( -// const Reference< chart2::XUndoManager > & xUndoManager ) -// { -// m_xUndoManager = xUndoManager; -// } - void CommandDispatchContainer::setChartDispatch( const Reference< frame::XDispatch > xChartDispatch, const ::std::set< OUString > & rChartCommands ) diff --git a/chart2/source/controller/main/CommandDispatchContainer.hxx b/chart2/source/controller/main/CommandDispatchContainer.hxx index 1c8769e0a6d9..38f0c2ce8771 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.hxx +++ b/chart2/source/controller/main/CommandDispatchContainer.hxx @@ -28,7 +28,7 @@ #define CHART2_COMMANDDISPATCHCONTAINER_HXX #include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/chart2/XDocumentActions.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/DispatchDescriptor.hpp> @@ -86,9 +86,6 @@ public: void setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel ); -// void setUndoManager( -// const ::com::sun::star::uno::Reference< -// ::com::sun::star::chart2::XUndoManager > & xUndoManager ); /** Set a chart dispatcher that is used for all commands contained in rChartCommands @@ -140,9 +137,9 @@ private: mutable tDispatchMap m_aCachedDispatches; mutable tDisposeVector m_aToBeDisposedDispatches; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xModel; - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > m_xUndoManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xModel; + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDocumentActions > m_xDocumentActions; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xChartDispatcher; ::std::set< ::rtl::OUString > m_aChartCommands; diff --git a/chart2/source/controller/main/UndoManager.cxx b/chart2/source/controller/main/DocumentActions.cxx index a76a8c356852..e4fe1ab0fc3f 100644 --- a/chart2/source/controller/main/UndoManager.cxx +++ b/chart2/source/controller/main/DocumentActions.cxx @@ -28,8 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_chart2.hxx" -#include "UndoManager.hxx" -#include "ImplUndoManager.hxx" +#include "DocumentActions.hxx" +#include "ImplDocumentActions.hxx" #include "DisposeHelper.hxx" #include "MutexContainer.hxx" #include "macros.hxx" @@ -118,8 +118,8 @@ void ModifyBroadcaster::fireEvent() } // namespace impl -UndoManager::UndoManager( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel ) : - impl::UndoManager_Base( m_aMutex ), +DocumentActions::DocumentActions( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel ) : + impl::DocumentActions_Base( m_aMutex ), m_apUndoStack( new impl::UndoStack()), m_apRedoStack( new impl::UndoStack()), m_pLastRemeberedUndoElement( 0 ), @@ -128,7 +128,7 @@ UndoManager::UndoManager( const ::com::sun::star::uno::Reference< ::com::sun::st m_aModel( rModel ) {} -UndoManager::~UndoManager() +DocumentActions::~DocumentActions() { DisposeHelper::Dispose( m_xModifyBroadcaster ); m_apUndoStack->disposeAndClear(); @@ -138,7 +138,7 @@ UndoManager::~UndoManager() m_pLastRemeberedUndoElement = 0; } -void UndoManager::addShapeUndoAction( SdrUndoAction* pAction ) +void DocumentActions::addShapeUndoAction( SdrUndoAction* pAction ) { if ( !pAction ) { @@ -158,13 +158,13 @@ void UndoManager::addShapeUndoAction( SdrUndoAction* pAction ) } } -Reference< XModel > UndoManager::impl_getModel() const +Reference< XModel > DocumentActions::impl_getModel() const { Reference< XModel > xModel( m_aModel ); return xModel; } -void UndoManager::impl_undoRedo( +void DocumentActions::impl_undoRedo( impl::UndoStack * pStackToRemoveFrom, impl::UndoStack * pStackToAddTo, bool bUndo ) @@ -214,7 +214,7 @@ void UndoManager::impl_undoRedo( } } -void UndoManager::fireModifyEvent() +void DocumentActions::fireModifyEvent() { if( m_xModifyBroadcaster.is()) m_pModifyBroadcaster->fireEvent(); @@ -222,7 +222,7 @@ void UndoManager::fireModifyEvent() // ____ ConfigItemListener ____ -void UndoManager::notify( const ::rtl::OUString & rPropertyName ) +void DocumentActions::notify( const ::rtl::OUString & rPropertyName ) { OSL_ENSURE( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Steps" )), "Unwanted config property change Notified" ); @@ -230,7 +230,7 @@ void UndoManager::notify( const ::rtl::OUString & rPropertyName ) retrieveConfigUndoSteps(); } -void UndoManager::retrieveConfigUndoSteps() +void DocumentActions::retrieveConfigUndoSteps() { if( ! m_apUndoStepsConfigItem.get()) m_apUndoStepsConfigItem.reset( new impl::UndoStepsConfigItem( *this )); @@ -243,7 +243,7 @@ void UndoManager::retrieveConfigUndoSteps() } // ____ XModifyBroadcaster ____ -void SAL_CALL UndoManager::addModifyListener( const Reference< util::XModifyListener >& aListener ) +void SAL_CALL DocumentActions::addModifyListener( const Reference< util::XModifyListener >& aListener ) throw (uno::RuntimeException) { if( ! m_xModifyBroadcaster.is()) @@ -254,7 +254,7 @@ void SAL_CALL UndoManager::addModifyListener( const Reference< util::XModifyList m_xModifyBroadcaster->addModifyListener( aListener ); } -void SAL_CALL UndoManager::removeModifyListener( const Reference< util::XModifyListener >& aListener ) +void SAL_CALL DocumentActions::removeModifyListener( const Reference< util::XModifyListener >& aListener ) throw (uno::RuntimeException) { if( ! m_xModifyBroadcaster.is()) @@ -265,15 +265,15 @@ void SAL_CALL UndoManager::removeModifyListener( const Reference< util::XModifyL m_xModifyBroadcaster->removeModifyListener( aListener ); } -// ____ chart2::XUndoManager ____ -void SAL_CALL UndoManager::preAction( ) +// ____ chart2::XDocumentActions ____ +void SAL_CALL DocumentActions::preAction( ) throw (uno::RuntimeException) { OSL_ENSURE( ! m_pLastRemeberedUndoElement, "Looks like postAction or cancelAction call was missing" ); m_pLastRemeberedUndoElement = new impl::UndoElement( impl_getModel() ); } -void SAL_CALL UndoManager::preActionWithArguments( +void SAL_CALL DocumentActions::preActionWithArguments( const Sequence< beans::PropertyValue >& aArguments ) throw (uno::RuntimeException) { @@ -299,7 +299,7 @@ void SAL_CALL UndoManager::preActionWithArguments( preAction(); } -void SAL_CALL UndoManager::postAction( const OUString& aUndoText ) +void SAL_CALL DocumentActions::postAction( const OUString& aUndoText ) throw (uno::RuntimeException) { OSL_ENSURE( m_pLastRemeberedUndoElement, "Looks like preAction call was missing" ); @@ -321,14 +321,14 @@ void SAL_CALL UndoManager::postAction( const OUString& aUndoText ) } } -void SAL_CALL UndoManager::cancelAction() +void SAL_CALL DocumentActions::cancelAction() throw (uno::RuntimeException) { delete m_pLastRemeberedUndoElement; m_pLastRemeberedUndoElement = 0; } -void SAL_CALL UndoManager::cancelActionWithUndo( ) +void SAL_CALL DocumentActions::cancelActionWithUndo( ) throw (uno::RuntimeException) { if( m_pLastRemeberedUndoElement ) @@ -338,58 +338,58 @@ void SAL_CALL UndoManager::cancelActionWithUndo( ) } } -void SAL_CALL UndoManager::undo( ) +void SAL_CALL DocumentActions::undo( ) throw (uno::RuntimeException) { OSL_ASSERT( m_apUndoStack.get() && m_apRedoStack.get()); impl_undoRedo( m_apUndoStack.get(), m_apRedoStack.get(), true ); } -void SAL_CALL UndoManager::redo( ) +void SAL_CALL DocumentActions::redo( ) throw (uno::RuntimeException) { OSL_ASSERT( m_apUndoStack.get() && m_apRedoStack.get()); impl_undoRedo( m_apRedoStack.get(), m_apUndoStack.get(), false ); } -::sal_Bool SAL_CALL UndoManager::undoPossible() +::sal_Bool SAL_CALL DocumentActions::undoPossible() throw (uno::RuntimeException) { return ! m_apUndoStack->empty(); } -::sal_Bool SAL_CALL UndoManager::redoPossible() +::sal_Bool SAL_CALL DocumentActions::redoPossible() throw (uno::RuntimeException) { return ! m_apRedoStack->empty(); } -OUString SAL_CALL UndoManager::getCurrentUndoString() +OUString SAL_CALL DocumentActions::getCurrentUndoString() throw (uno::RuntimeException) { return m_apUndoStack->topUndoString(); } -OUString SAL_CALL UndoManager::getCurrentRedoString() +OUString SAL_CALL DocumentActions::getCurrentRedoString() throw (uno::RuntimeException) { return m_apRedoStack->topUndoString(); } -Sequence< OUString > SAL_CALL UndoManager::getAllUndoStrings() +Sequence< OUString > SAL_CALL DocumentActions::getAllUndoStrings() throw (uno::RuntimeException) { return m_apUndoStack->getUndoStrings(); } -Sequence< OUString > SAL_CALL UndoManager::getAllRedoStrings() +Sequence< OUString > SAL_CALL DocumentActions::getAllRedoStrings() throw (uno::RuntimeException) { return m_apRedoStack->getUndoStrings(); } // ____ XUnoTunnel ____ -sal_Int64 UndoManager::getSomething( const Sequence< sal_Int8 >& rId ) +sal_Int64 DocumentActions::getSomething( const Sequence< sal_Int8 >& rId ) throw (uno::RuntimeException) { if ( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) @@ -400,7 +400,7 @@ sal_Int64 UndoManager::getSomething( const Sequence< sal_Int8 >& rId ) } // static -const Sequence< sal_Int8 >& UndoManager::getUnoTunnelId() +const Sequence< sal_Int8 >& DocumentActions::getUnoTunnelId() { static Sequence< sal_Int8 >* pSeq = 0; if( !pSeq ) @@ -417,13 +417,13 @@ const Sequence< sal_Int8 >& UndoManager::getUnoTunnelId() } // static -UndoManager* UndoManager::getImplementation( const Reference< uno::XInterface > xObj ) +DocumentActions* DocumentActions::getImplementation( const Reference< uno::XInterface > xObj ) { - UndoManager* pRet = NULL; + DocumentActions* pRet = NULL; Reference< lang::XUnoTunnel > xUT( xObj, uno::UNO_QUERY ); if ( xUT.is() ) { - pRet = reinterpret_cast< UndoManager* >( sal::static_int_cast< sal_IntPtr >( xUT->getSomething( getUnoTunnelId() ) ) ); + pRet = reinterpret_cast< DocumentActions* >( sal::static_int_cast< sal_IntPtr >( xUT->getSomething( getUnoTunnelId() ) ) ); } return pRet; } diff --git a/chart2/source/controller/main/ImplUndoManager.cxx b/chart2/source/controller/main/ImplDocumentActions.cxx index 4426433791c4..8103bec54114 100644 --- a/chart2/source/controller/main/ImplUndoManager.cxx +++ b/chart2/source/controller/main/ImplDocumentActions.cxx @@ -28,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_chart2.hxx" -#include "ImplUndoManager.hxx" +#include "ImplDocumentActions.hxx" #include "DisposeHelper.hxx" #include "CommonFunctors.hxx" #include "ControllerLockGuard.hxx" diff --git a/chart2/source/controller/main/ImplUndoManager.hxx b/chart2/source/controller/main/ImplDocumentActions.hxx index aaf8f18c1231..aaf8f18c1231 100644 --- a/chart2/source/controller/main/ImplUndoManager.hxx +++ b/chart2/source/controller/main/ImplDocumentActions.hxx diff --git a/chart2/source/controller/main/UndoCommandDispatch.cxx b/chart2/source/controller/main/UndoCommandDispatch.cxx index 97201efa2e04..0d1a26d6fc65 100644 --- a/chart2/source/controller/main/UndoCommandDispatch.cxx +++ b/chart2/source/controller/main/UndoCommandDispatch.cxx @@ -31,7 +31,6 @@ #include "UndoCommandDispatch.hxx" #include "macros.hxx" -#include <com/sun/star/chart2/XUndoSupplier.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <vos/mutex.hxx> @@ -57,10 +56,7 @@ UndoCommandDispatch::UndoCommandDispatch( CommandDispatch( xContext ), m_xModel( xModel ) { - Reference< chart2::XUndoSupplier > xUndoSupplier( xModel, uno::UNO_QUERY ); - OSL_ASSERT( xUndoSupplier.is()); - if( xUndoSupplier.is()) - m_xUndoManager.set( xUndoSupplier->getUndoManager()); + m_xDocumentActions.set( xModel, uno::UNO_QUERY ); } UndoCommandDispatch::~UndoCommandDispatch() @@ -68,7 +64,7 @@ UndoCommandDispatch::~UndoCommandDispatch() void UndoCommandDispatch::initialize() { - Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager, uno::UNO_QUERY ); + Reference< util::XModifyBroadcaster > xBroadcaster( m_xDocumentActions, uno::UNO_QUERY ); if( xBroadcaster.is() ) { xBroadcaster->addModifyListener( this ); @@ -79,27 +75,27 @@ void UndoCommandDispatch::fireStatusEvent( const OUString & rURL, const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ ) { - if( m_xUndoManager.is() ) + if( m_xDocumentActions.is() ) { bool bFireAll = (rURL.getLength() == 0); uno::Any aUndoState, aRedoState; - if( m_xUndoManager->undoPossible()) + if( m_xDocumentActions->undoPossible()) { // using assignment for broken gcc 3.3 OUString aUndo = OUString( String( SchResId( STR_UNDO ))); - aUndoState <<= ( aUndo + m_xUndoManager->getCurrentUndoString()); + aUndoState <<= ( aUndo + m_xDocumentActions->getCurrentUndoString()); } - if( m_xUndoManager->redoPossible()) + if( m_xDocumentActions->redoPossible()) { // using assignment for broken gcc 3.3 OUString aRedo = OUString( String( SchResId( STR_REDO ))); - aRedoState <<= ( aRedo + m_xUndoManager->getCurrentRedoString()); + aRedoState <<= ( aRedo + m_xDocumentActions->getCurrentRedoString()); } if( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:Undo"))) - fireStatusEventForURL( C2U(".uno:Undo"), aUndoState, m_xUndoManager->undoPossible(), xSingleListener ); + fireStatusEventForURL( C2U(".uno:Undo"), aUndoState, m_xDocumentActions->undoPossible(), xSingleListener ); if( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:Redo"))) - fireStatusEventForURL( C2U(".uno:Redo"), aRedoState, m_xUndoManager->redoPossible(), xSingleListener ); + fireStatusEventForURL( C2U(".uno:Redo"), aRedoState, m_xDocumentActions->redoPossible(), xSingleListener ); } } @@ -109,15 +105,15 @@ void SAL_CALL UndoCommandDispatch::dispatch( const Sequence< beans::PropertyValue >& /* Arguments */ ) throw (uno::RuntimeException) { - if( m_xUndoManager.is() ) + if( m_xDocumentActions.is() ) { // why is it necessary to lock the solar mutex here? // /-- ::vos::OGuard aSolarGuard( Application::GetSolarMutex()); if( URL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Undo" ))) - m_xUndoManager->undo(); + m_xDocumentActions->undo(); else - m_xUndoManager->redo(); + m_xDocumentActions->redo(); // \-- } } @@ -126,13 +122,13 @@ void SAL_CALL UndoCommandDispatch::dispatch( /// is called when this is disposed void SAL_CALL UndoCommandDispatch::disposing() { - Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager, uno::UNO_QUERY ); + Reference< util::XModifyBroadcaster > xBroadcaster( m_xDocumentActions, uno::UNO_QUERY ); if( xBroadcaster.is() ) { xBroadcaster->removeModifyListener( this ); } - m_xUndoManager.clear(); + m_xDocumentActions.clear(); m_xModel.clear(); } @@ -140,7 +136,7 @@ void SAL_CALL UndoCommandDispatch::disposing() void SAL_CALL UndoCommandDispatch::disposing( const lang::EventObject& /* Source */ ) throw (uno::RuntimeException) { - m_xUndoManager.clear(); + m_xDocumentActions.clear(); m_xModel.clear(); } diff --git a/chart2/source/controller/main/UndoCommandDispatch.hxx b/chart2/source/controller/main/UndoCommandDispatch.hxx index 28fb813f63de..3130863dec61 100644 --- a/chart2/source/controller/main/UndoCommandDispatch.hxx +++ b/chart2/source/controller/main/UndoCommandDispatch.hxx @@ -30,14 +30,14 @@ #include "CommandDispatch.hxx" #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/chart2/XDocumentActions.hpp> namespace chart { /** This is a CommandDispatch implementation for Undo and Redo. - You need to pass an UndoManager to this class that is then used for Undo and + You need to pass an DocumentActions to this class that is then used for Undo and Redo. The changes are applied to the given XModel. */ class UndoCommandDispatch : public CommandDispatch @@ -77,7 +77,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XUndoManager > m_xUndoManager; + ::com::sun::star::chart2::XDocumentActions > m_xDocumentActions; }; } // namespace chart diff --git a/chart2/source/controller/main/UndoGuard.cxx b/chart2/source/controller/main/UndoGuard.cxx index d55d52f8d41e..e38bb89d9249 100644 --- a/chart2/source/controller/main/UndoGuard.cxx +++ b/chart2/source/controller/main/UndoGuard.cxx @@ -40,8 +40,8 @@ namespace chart { UndoGuard_Base::UndoGuard_Base( const OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager ) - : m_xUndoManager( xUndoManager ) + , const uno::Reference< chart2::XDocumentActions > & xDocumentActions ) + : m_xDocumentActions( xDocumentActions ) , m_aUndoString( rUndoString ) , m_bActionPosted( false ) { @@ -53,85 +53,85 @@ UndoGuard_Base::~UndoGuard_Base() void UndoGuard_Base::commitAction() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->postAction( m_aUndoString ); + if( !m_bActionPosted && m_xDocumentActions.is() ) + m_xDocumentActions->postAction( m_aUndoString ); m_bActionPosted = true; } //----------------------------------------------------------------------------- UndoGuard::UndoGuard( const OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager ) - : UndoGuard_Base( rUndoString, xUndoManager ) + , const uno::Reference< chart2::XDocumentActions > & xDocumentActions ) + : UndoGuard_Base( rUndoString, xDocumentActions ) { - if( m_xUndoManager.is() ) - m_xUndoManager->preAction(); + if( m_xDocumentActions.is() ) + m_xDocumentActions->preAction(); } UndoGuard::~UndoGuard() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->cancelAction(); + if( !m_bActionPosted && m_xDocumentActions.is() ) + m_xDocumentActions->cancelAction(); } //----------------------------------------------------------------------------- UndoLiveUpdateGuard::UndoLiveUpdateGuard( const OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager ) - : UndoGuard_Base( rUndoString, xUndoManager ) + , const uno::Reference< chart2::XDocumentActions > & xDocumentActions ) + : UndoGuard_Base( rUndoString, xDocumentActions ) { - if( m_xUndoManager.is() ) - m_xUndoManager->preAction(); + if( m_xDocumentActions.is() ) + m_xDocumentActions->preAction(); } UndoLiveUpdateGuard::~UndoLiveUpdateGuard() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->cancelActionWithUndo(); + if( !m_bActionPosted && m_xDocumentActions.is() ) + m_xDocumentActions->cancelActionWithUndo(); } //----------------------------------------------------------------------------- UndoLiveUpdateGuardWithData::UndoLiveUpdateGuardWithData( const OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager ) - : UndoGuard_Base( rUndoString, xUndoManager ) + , const uno::Reference< chart2::XDocumentActions > & xDocumentActions ) + : UndoGuard_Base( rUndoString, xDocumentActions ) { - if( m_xUndoManager.is() ) + if( m_xDocumentActions.is() ) { Sequence< beans::PropertyValue > aArgs(1); aArgs[0] = beans::PropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("WithData")), -1, uno::Any(), beans::PropertyState_DIRECT_VALUE ); - m_xUndoManager->preActionWithArguments( aArgs ); + m_xDocumentActions->preActionWithArguments( aArgs ); } } UndoLiveUpdateGuardWithData::~UndoLiveUpdateGuardWithData() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->cancelActionWithUndo(); + if( !m_bActionPosted && m_xDocumentActions.is() ) + m_xDocumentActions->cancelActionWithUndo(); } //----------------------------------------------------------------------------- UndoGuardWithSelection::UndoGuardWithSelection( const rtl::OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager ) - : UndoGuard_Base( rUndoString, xUndoManager ) + , const uno::Reference< chart2::XDocumentActions > & xDocumentActions ) + : UndoGuard_Base( rUndoString, xDocumentActions ) { - if( m_xUndoManager.is() ) + if( m_xDocumentActions.is() ) { Sequence< beans::PropertyValue > aArgs(1); aArgs[0] = beans::PropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("WithSelection")), -1, uno::Any(), beans::PropertyState_DIRECT_VALUE ); - m_xUndoManager->preActionWithArguments( aArgs ); + m_xDocumentActions->preActionWithArguments( aArgs ); } } UndoGuardWithSelection::~UndoGuardWithSelection() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->cancelAction(); + if( !m_bActionPosted && m_xDocumentActions.is() ) + m_xDocumentActions->cancelAction(); } } // namespace chart diff --git a/chart2/source/controller/main/makefile.mk b/chart2/source/controller/main/makefile.mk index 729276d5bd0e..a90d1537b89b 100644 --- a/chart2/source/controller/main/makefile.mk +++ b/chart2/source/controller/main/makefile.mk @@ -72,8 +72,8 @@ SLOFILES = \ $(SLO)$/DrawCommandDispatch.obj \ $(SLO)$/ShapeController.obj \ $(SLO)$/ShapeToolbarController.obj \ - $(SLO)$/ImplUndoManager.obj \ - $(SLO)$/UndoManager.obj \ + $(SLO)$/ImplDocumentActions.obj \ + $(SLO)$/DocumentActions.obj \ $(SLO)$/UndoGuard.obj # $(SLO)$/CommonConverters.obj \ diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx index fb087abf15fd..9518d3362e84 100644 --- a/chart2/source/inc/ChartModelHelper.hxx +++ b/chart2/source/inc/ChartModelHelper.hxx @@ -31,7 +31,7 @@ #include <com/sun/star/chart2/XDataSeries.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> -#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/chart2/XDocumentActions.hpp> #include <com/sun/star/chart2/data/XDataProvider.hpp> #include <com/sun/star/chart2/data/XRangeHighlighter.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> diff --git a/chart2/source/inc/UndoManager.hxx b/chart2/source/inc/DocumentActions.hxx index a73bbc69a9d0..52c3282002a9 100644 --- a/chart2/source/inc/UndoManager.hxx +++ b/chart2/source/inc/DocumentActions.hxx @@ -34,7 +34,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/util/XModifyListener.hpp> -#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/chart2/XDocumentActions.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -67,9 +67,9 @@ class ModifyBroadcaster; typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::util::XModifyBroadcaster, - ::com::sun::star::chart2::XUndoManager, + ::com::sun::star::chart2::XDocumentActions, ::com::sun::star::lang::XUnoTunnel > - UndoManager_Base; + DocumentActions_Base; } // namespace impl // ---------------------------------------- @@ -81,14 +81,14 @@ typedef ::cppu::WeakComponentImplHelper3< redo-stacks support the css::util::XCloneable interface, which is implemented such that the entire model is cloned. */ -class UndoManager : +class DocumentActions : public MutexContainer, public ConfigItemListener, - public impl::UndoManager_Base + public impl::DocumentActions_Base { public: - explicit UndoManager( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel ); - virtual ~UndoManager(); + explicit DocumentActions( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel ); + virtual ~DocumentActions(); void addShapeUndoAction( SdrUndoAction* pAction ); @@ -97,7 +97,7 @@ public: throw (::com::sun::star::uno::RuntimeException); static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); - static UndoManager* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xObj ); + static DocumentActions* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xObj ); protected: // ____ ConfigItemListener ____ @@ -111,7 +111,7 @@ protected: const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - // ____ chart2::XUndoManager ____ + // ____ chart2::XDocumentActions ____ virtual void SAL_CALL preAction( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL preActionWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL postAction( const ::rtl::OUString& aUndoText ) throw (::com::sun::star::uno::RuntimeException); diff --git a/chart2/source/inc/UndoGuard.hxx b/chart2/source/inc/UndoGuard.hxx index cf59337eaf53..e36949bcdb18 100644 --- a/chart2/source/inc/UndoGuard.hxx +++ b/chart2/source/inc/UndoGuard.hxx @@ -27,7 +27,7 @@ #ifndef CHART2_UNDOGUARD_HXX #define CHART2_UNDOGUARD_HXX -#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/chart2/XDocumentActions.hpp> // header for class OUString #include <rtl/ustring.hxx> @@ -41,14 +41,14 @@ class UndoGuard_Base public: explicit UndoGuard_Base( const rtl::OUString & rUndoMessage , const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XUndoManager > & xUndoManager ); + ::com::sun::star::chart2::XDocumentActions > & xDocumentActions ); virtual ~UndoGuard_Base(); void commitAction(); protected: ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XUndoManager > m_xUndoManager; + ::com::sun::star::chart2::XDocumentActions > m_xDocumentActions; rtl::OUString m_aUndoString; bool m_bActionPosted; @@ -63,7 +63,7 @@ class UndoGuard : public UndoGuard_Base public: explicit UndoGuard( const rtl::OUString& rUndoMessage , const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XUndoManager > & xUndoManager ); + ::com::sun::star::chart2::XDocumentActions > & xDocumentActions ); virtual ~UndoGuard(); }; @@ -76,7 +76,7 @@ class UndoLiveUpdateGuard : public UndoGuard_Base public: explicit UndoLiveUpdateGuard( const rtl::OUString& rUndoMessage , const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XUndoManager > & xUndoManager ); + ::com::sun::star::chart2::XDocumentActions > & xDocumentActions ); virtual ~UndoLiveUpdateGuard(); }; @@ -89,7 +89,7 @@ class UndoLiveUpdateGuardWithData : public: explicit UndoLiveUpdateGuardWithData( const rtl::OUString& rUndoMessage , const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XUndoManager > & xUndoManager ); + ::com::sun::star::chart2::XDocumentActions > & xDocumentActions ); virtual ~UndoLiveUpdateGuardWithData(); }; @@ -98,7 +98,7 @@ class UndoGuardWithSelection : public UndoGuard_Base public: explicit UndoGuardWithSelection( const rtl::OUString& rUndoMessage , const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XUndoManager > & xUndoManager ); + ::com::sun::star::chart2::XDocumentActions > & xDocumentActions ); virtual ~UndoGuardWithSelection(); }; diff --git a/chart2/source/inc/servicenames.hxx b/chart2/source/inc/servicenames.hxx index d1af0edb3335..98fd7cdf2db0 100644 --- a/chart2/source/inc/servicenames.hxx +++ b/chart2/source/inc/servicenames.hxx @@ -62,7 +62,7 @@ namespace chart #define CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartRenderer") -#define CHART_UNDOMANAGER_SERVICE_NAME ::rtl::OUString::createFromAscii( "com.sun.star.chart2.UndoManager" ) +#define CHART_DOCUMENT_ACTIONS_SERVICE_NAME ::rtl::OUString::createFromAscii( "com.sun.star.chart2.DocumentActions" ) //............................................................................. } //namespace chart diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 9b77f4aa2b94..fea1ef1544f0 100755 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -73,6 +73,7 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Any; using ::rtl::OUString; using ::osl::MutexGuard; @@ -152,7 +153,7 @@ ChartModel::ChartModel( const ChartModel & rOther ) , m_aGraphicObjectVector( rOther.m_aGraphicObjectVector ) , m_xDataProvider( rOther.m_xDataProvider ) , m_xInternalDataProvider( rOther.m_xInternalDataProvider ) - , m_xUndoManager( NULL ) + , m_xDocumentActions( NULL ) { OSL_TRACE( "ChartModel: Copy-CTOR called" ); @@ -1342,14 +1343,110 @@ void SAL_CALL ChartModel::setParent( const Reference< uno::XInterface >& Parent m_xParent.set( Parent, uno::UNO_QUERY ); } -// ____ XUndoManager ____ -Reference< chart2::XUndoManager > SAL_CALL ChartModel::getUndoManager() - throw (uno::RuntimeException) +bool ChartModel::impl_getDocumentActions_lck() +{ + if ( !m_xDocumentActions.is() ) + m_xDocumentActions.set( createInstance( CHART_DOCUMENT_ACTIONS_SERVICE_NAME ), uno::UNO_QUERY ); + OSL_POSTCOND( m_xDocumentActions.is(), "ChartModel::impl_getDocumentActions_lck: could not create the legacy DocumentActions service!" ); + return m_xDocumentActions.is(); +} + +// ____ XDocumentActions ____ +void SAL_CALL ChartModel::preAction( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + m_xDocumentActions->preAction(); +} + +void SAL_CALL ChartModel::preActionWithArguments( const Sequence< beans::PropertyValue >& aArguments ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + m_xDocumentActions->preActionWithArguments( aArguments ); +} + +void SAL_CALL ChartModel::postAction( const ::rtl::OUString& aUndoText ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + m_xDocumentActions->postAction( aUndoText ); +} + +void SAL_CALL ChartModel::cancelAction( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + m_xDocumentActions->cancelAction(); +} + +void SAL_CALL ChartModel::cancelActionWithUndo( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + m_xDocumentActions->cancelActionWithUndo(); +} + +void SAL_CALL ChartModel::undo( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + m_xDocumentActions->undo(); +} + +void SAL_CALL ChartModel::redo( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + m_xDocumentActions->redo(); +} + +::sal_Bool SAL_CALL ChartModel::undoPossible( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + return m_xDocumentActions->undoPossible(); + return sal_False; +} + +::sal_Bool SAL_CALL ChartModel::redoPossible( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + return m_xDocumentActions->redoPossible(); + return sal_False; +} + +::rtl::OUString SAL_CALL ChartModel::getCurrentUndoString( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + return m_xDocumentActions->getCurrentUndoString(); + return ::rtl::OUString(); +} + +::rtl::OUString SAL_CALL ChartModel::getCurrentRedoString( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + return m_xDocumentActions->getCurrentRedoString(); + return ::rtl::OUString(); +} + +Sequence< ::rtl::OUString > SAL_CALL ChartModel::getAllUndoStrings( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aModelMutex ); + if ( impl_getDocumentActions_lck() ) + return m_xDocumentActions->getAllUndoStrings(); + return Sequence< ::rtl::OUString >(); +} + +Sequence< ::rtl::OUString > SAL_CALL ChartModel::getAllRedoStrings( ) throw (RuntimeException) { ::osl::MutexGuard aGuard( m_aModelMutex ); - if ( !m_xUndoManager.is() ) - m_xUndoManager.set( createInstance( CHART_UNDOMANAGER_SERVICE_NAME ), uno::UNO_QUERY ); - return m_xUndoManager; + if ( impl_getDocumentActions_lck() ) + return m_xDocumentActions->getAllRedoStrings(); + return Sequence< ::rtl::OUString >(); } // ____ XDataSource ____ diff --git a/chart2/source/model/main/ChartModel.hxx b/chart2/source/model/main/ChartModel.hxx index 962324c29cef..7b6610836466 100644 --- a/chart2/source/model/main/ChartModel.hxx +++ b/chart2/source/model/main/ChartModel.hxx @@ -45,7 +45,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/chart2/XUndoSupplier.hpp> +#include <com/sun/star/chart2/XDocumentActions.hpp> #include <com/sun/star/chart2/data/XDataSource.hpp> #include <com/sun/star/chart2/XChartTypeTemplate.hpp> #include <com/sun/star/container/XNameContainer.hpp> @@ -108,7 +108,7 @@ typedef ::comphelper::WeakImplHelper20< ,::com::sun::star::container::XChild ,::com::sun::star::util::XModifyListener ,::com::sun::star::datatransfer::XTransferable - ,::com::sun::star::chart2::XUndoSupplier + ,::com::sun::star::chart2::XDocumentActions ,::com::sun::star::document::XDocumentPropertiesSupplier ,::com::sun::star::chart2::data::XDataSource > @@ -171,8 +171,8 @@ private: bool m_bIsDisposed; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xPageBackground; - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > - m_xUndoManager; + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDocumentActions > + m_xDocumentActions; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xXMLNamespaceMap; @@ -594,13 +594,41 @@ public: throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); - // ____ XUndoSupplier ____ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > SAL_CALL getUndoManager() + // ____ XDocumentActions ____ + virtual void SAL_CALL preAction( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL preActionWithArguments( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL postAction( const ::rtl::OUString& aUndoText ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelAction( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelActionWithUndo( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL undo( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL redo( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL undoPossible( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL redoPossible( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCurrentUndoString( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCurrentRedoString( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllUndoStrings( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllRedoStrings( ) throw (::com::sun::star::uno::RuntimeException); // ____ XDataSource ____ allows access to the curently used data and data ranges virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() throw (::com::sun::star::uno::RuntimeException); + +private: + bool impl_getDocumentActions_lck(); }; } // namespace chart |