diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-03-17 12:48:51 +0000 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-03-23 02:55:31 +0100 |
commit | bb1979b96bcd51c2a2d85508027b42942fceecd1 (patch) | |
tree | b19100f497e5dbdd36d3a57c9d10410c2acde90c /chart2/source/controller | |
parent | 2713c4bf0f8d4869c7c59ebc479d3140ec55b11a (diff) |
Allow deleting any chart errorbar and set correct action description.
Diffstat (limited to 'chart2/source/controller')
-rw-r--r-- | chart2/source/controller/main/ChartController_Tools.cxx | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 9da159cffee5..eb96489f311a 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -553,17 +553,29 @@ bool ChartController::isObjectDeleteable( const uno::Any& rSelection ) { OUString aSelObjCID( aSelOID.getObjectCID() ); ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID )); - if( (OBJECTTYPE_TITLE == aObjectType) || (OBJECTTYPE_LEGEND == aObjectType) ) - return true; - if( (OBJECTTYPE_DATA_SERIES == aObjectType) || (OBJECTTYPE_LEGEND_ENTRY == aObjectType) ) - return true; - if( (OBJECTTYPE_DATA_CURVE_EQUATION == aObjectType) || (OBJECTTYPE_DATA_CURVE == aObjectType) || - (OBJECTTYPE_DATA_AVERAGE_LINE == aObjectType) || (OBJECTTYPE_DATA_ERRORS == aObjectType)) - return true; - if( (OBJECTTYPE_DATA_LABELS == aObjectType) || (OBJECTTYPE_DATA_LABEL == aObjectType) ) - return true; - if( (OBJECTTYPE_AXIS == aObjectType) || (OBJECTTYPE_GRID == aObjectType) || (OBJECTTYPE_SUBGRID == aObjectType) ) + + switch(aObjectType) + { + case OBJECTTYPE_TITLE: + case OBJECTTYPE_LEGEND: + case OBJECTTYPE_DATA_SERIES: + case OBJECTTYPE_LEGEND_ENTRY: + case OBJECTTYPE_DATA_CURVE_EQUATION: + case OBJECTTYPE_DATA_CURVE: + case OBJECTTYPE_DATA_AVERAGE_LINE: + case OBJECTTYPE_DATA_ERRORS: + case OBJECTTYPE_DATA_ERRORS_X: + case OBJECTTYPE_DATA_ERRORS_Y: + case OBJECTTYPE_DATA_ERRORS_Z: + case OBJECTTYPE_DATA_LABELS: + case OBJECTTYPE_DATA_LABEL: + case OBJECTTYPE_AXIS: + case OBJECTTYPE_GRID: + case OBJECTTYPE_SUBGRID: return true; + default: + break; + } } else if ( aSelOID.isAdditionalShape() ) { @@ -714,16 +726,29 @@ bool ChartController::executeDispatch_Delete() } case OBJECTTYPE_DATA_ERRORS: + case OBJECTTYPE_DATA_ERRORS_X: + case OBJECTTYPE_DATA_ERRORS_Y: + case OBJECTTYPE_DATA_ERRORS_Z: { uno::Reference< beans::XPropertySet > xErrorBarProp( ObjectIdentifier::getObjectPropertySet( aCID, getModel() )); if( xErrorBarProp.is()) { + sal_Int16 nId; + + if ( aObjectType == OBJECTTYPE_DATA_ERRORS_X ) + nId = STR_OBJECT_ERROR_BARS_X; + else if ( aObjectType == OBJECTTYPE_DATA_ERRORS_Y || + aObjectType == OBJECTTYPE_DATA_ERRORS ) + nId = STR_OBJECT_ERROR_BARS_Y; + else + nId = STR_OBJECT_ERROR_BARS_Z; + uno::Reference< frame::XModel > xModel( getModel() ); // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_ERROR_BARS_Y ))), + ActionDescriptionProvider::DELETE, String( SchResId( nId ))), m_xUndoManager ); { ControllerLockGuard aCtlLockGuard( xModel ); |