diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-04-19 14:35:16 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-04-20 16:10:35 +0200 |
commit | df69f1c4aa8db8c9c48b364f0e8809be6d598fd9 (patch) | |
tree | 1f360d1ca90e4f048acb5670e20ffd5ab8dd79e1 /chart2 | |
parent | f44fb845f275e9be3861bb299f2bb3689280a92e (diff) |
tdf#107071 remove "Data Range" from context menu in a pivot chart
Change-Id: Idb0087941e64af3b3373fd9a041ac04b96705934
Reviewed-on: https://gerrit.libreoffice.org/36737
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/main/ControllerCommandDispatch.cxx | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index 35fa134db732..696c06d9e22d 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -19,6 +19,7 @@ #include "ControllerCommandDispatch.hxx" #include "ChartModelHelper.hxx" +#include "ChartModel.hxx" #include "DiagramHelper.hxx" #include "AxisHelper.hxx" #include "TitleHelper.hxx" @@ -329,6 +330,7 @@ struct ModelState bool bIsReadOnly; bool bIsThreeD; bool bHasOwnData; + bool bHasDataFromPivotTable; bool bHasMainTitle; bool bHasSubTitle; @@ -361,34 +363,34 @@ struct ModelState }; ModelState::ModelState() : - bIsReadOnly( true ), - bIsThreeD( false ), - bHasOwnData( false ), - bHasMainTitle( false ), - bHasSubTitle( false ), - bHasXAxisTitle( false ), - bHasYAxisTitle( false ), - bHasZAxisTitle( false ), - bHasSecondaryXAxisTitle( false ), - bHasSecondaryYAxisTitle( false ), - bHasXAxis( false ), - bHasYAxis( false ), - bHasZAxis( false ), - bHasAAxis( false ), - bHasBAxis( false ), - bHasMainXGrid( false ), - bHasMainYGrid( false ), - bHasMainZGrid( false ), - bHasHelpXGrid( false ), - bHasHelpYGrid( false ), - bHasHelpZGrid( false ), - bHasAutoScaledText( false ), - bHasLegend( false ), - bHasWall( false ), - bHasFloor( false ), - bSupportsStatistics( false ), - bSupportsAxes( false ) - + bIsReadOnly(true), + bIsThreeD(false), + bHasOwnData(false), + bHasDataFromPivotTable(false), + bHasMainTitle(false), + bHasSubTitle(false), + bHasXAxisTitle(false), + bHasYAxisTitle(false), + bHasZAxisTitle(false), + bHasSecondaryXAxisTitle(false), + bHasSecondaryYAxisTitle(false), + bHasXAxis(false), + bHasYAxis(false), + bHasZAxis(false), + bHasAAxis(false), + bHasBAxis(false), + bHasMainXGrid(false), + bHasMainYGrid(false), + bHasMainZGrid(false), + bHasHelpXGrid(false), + bHasHelpYGrid(false), + bHasHelpZGrid(false), + bHasAutoScaledText(false), + bHasLegend(false), + bHasWall(false), + bHasFloor(false), + bSupportsStatistics(false), + bSupportsAxes(false) {} void ModelState::update( const Reference< frame::XModel > & xModel ) @@ -408,7 +410,12 @@ void ModelState::update( const Reference< frame::XModel > & xModel ) bSupportsAxes = ChartTypeHelper::isSupportingMainAxis( xFirstChartType, nDimensionCount, 0 ); bIsThreeD = (nDimensionCount == 3); - bHasOwnData = (xChartDoc.is() && xChartDoc->hasInternalDataProvider()); + if (xChartDoc.is()) + { + ChartModel* pModel = dynamic_cast<ChartModel*>(xChartDoc.get()); + bHasOwnData = pModel->hasInternalDataProvider(); + bHasDataFromPivotTable = pModel->isDataFromPivotTable(); + } bHasMainTitle = TitleHelper::getTitle( TitleHelper::MAIN_TITLE, xModel ).is(); bHasSubTitle = TitleHelper::getTitle( TitleHelper::SUB_TITLE, xModel ).is(); @@ -613,7 +620,8 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[ ".uno:FormatLegend" ] = m_aCommandAvailability[ ".uno:Legend" ]; // depending on own data - m_aCommandAvailability[ ".uno:DataRanges" ] = bIsWritable && bModelStateIsValid && (! m_apModelState->bHasOwnData); + m_aCommandAvailability[ ".uno:DataRanges" ] = bIsWritable && bModelStateIsValid && + (!m_apModelState->bHasOwnData) && (!m_apModelState->bHasDataFromPivotTable); m_aCommandAvailability[ ".uno:DiagramData" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasOwnData && bEnableDataTableDialog; // titles |