diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-19 16:03:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-20 07:51:22 +0200 |
commit | 19f3b88c1ee2ab546a92c28f155f4d65e0c464df (patch) | |
tree | f12119740ba1d7245b51e03364a490575a8f830a /chart2/source/controller/main | |
parent | loplugin:oncevar accessibility..basic (diff) | |
download | core-19f3b88c1ee2ab546a92c28f155f4d65e0c464df.tar.gz core-19f3b88c1ee2ab546a92c28f155f4d65e0c464df.zip |
loplugin:oncevar chart2
Change-Id: I2dd0939db440b5357225395e88680dd0b0fdbf43
Reviewed-on: https://gerrit.libreoffice.org/38970
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/controller/main')
6 files changed, 41 insertions, 54 deletions
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index ed48e382f06d..880dbe6e1d7d 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -422,8 +422,7 @@ OUString lcl_getGridCIDForCommand( const OString& rDispatchCommand, const uno::R nDimensionIndex=2; bMainGrid=false; } - bool bMainAxis = true; - uno::Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) ); + uno::Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, true/*bMainAxis*/, xDiagram ) ); sal_Int32 nSubGridIndex= bMainGrid ? (-1) : 0; OUString aCID( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGridIndex ) ); @@ -779,7 +778,7 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( pSymbolShapeProperties = new SfxItemSet( aSymbolItemConverter.CreateEmptyItemSet() ); aSymbolItemConverter.FillItemSet( *pSymbolShapeProperties ); - sal_Int32 nStandardSymbol=0;//@todo get from somewhere + sal_Int32 const nStandardSymbol=0;//@todo get from somewhere Graphic* pAutoSymbolGraphic = new Graphic( aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, pSymbolShapeProperties ) ); // note: the dialog takes the ownership of pSymbolShapeProperties and pAutoSymbolGraphic aDlg->setSymbolInformation( pSymbolShapeProperties, pAutoSymbolGraphic ); diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx index deb3c2db2b04..9cd4f9a57a9c 100644 --- a/chart2/source/controller/main/ChartDropTargetHelper.cxx +++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx @@ -117,54 +117,50 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt ) if( xParentModel.is() && m_xChartDocument.is()) { - bool bDataComesFromParent = true; // @todo: get the title somehow and compare it to // aDocName if successful (the document is the // parent) - if( bDataComesFromParent ) + Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() ); + Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider()); + if( xDataProvider.is() && xDiagram.is() && + DataSourceHelper::allArgumentsForRectRangeDetected( m_xChartDocument )) { - Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() ); - Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider()); - if( xDataProvider.is() && xDiagram.is() && - DataSourceHelper::allArgumentsForRectRangeDetected( m_xChartDocument )) + Reference< chart2::data::XDataSource > xDataSource( + DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument )); + Sequence< beans::PropertyValue > aArguments( + xDataProvider->detectArguments( xDataSource )); + + OUString aOldRange; + beans::PropertyValue * pCellRange = nullptr; + for( sal_Int32 i=0; i<aArguments.getLength(); ++i ) { - Reference< chart2::data::XDataSource > xDataSource( - DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument )); - Sequence< beans::PropertyValue > aArguments( - xDataProvider->detectArguments( xDataSource )); - - OUString aOldRange; - beans::PropertyValue * pCellRange = nullptr; - for( sal_Int32 i=0; i<aArguments.getLength(); ++i ) + if ( aArguments[i].Name == "CellRangeRepresentation" ) { - if ( aArguments[i].Name == "CellRangeRepresentation" ) - { - pCellRange = (aArguments.getArray() + i); - aArguments[i].Value >>= aOldRange; - break; - } + pCellRange = (aArguments.getArray() + i); + aArguments[i].Value >>= aOldRange; + break; } - if( pCellRange ) + } + if( pCellRange ) + { + // copy means add ranges, move means replace + if( rEvt.mnAction == DND_ACTION_COPY ) + { + // @todo: using implicit knowledge that ranges can be + // merged with ";". This should be done more general + pCellRange->Value <<= (aOldRange + ";" + aRangeString ); + } + // move means replace range + else { - // copy means add ranges, move means replace - if( rEvt.mnAction == DND_ACTION_COPY ) - { - // @todo: using implicit knowledge that ranges can be - // merged with ";". This should be done more general - pCellRange->Value <<= (aOldRange + ";" + aRangeString ); - } - // move means replace range - else - { - pCellRange->Value <<= aRangeString; - } - - xDataSource.set( xDataProvider->createDataSource( aArguments )); - xDiagram->setDiagramData( xDataSource, aArguments ); - - // always return copy state to avoid deletion of the dragged range - nResult = DND_ACTION_COPY; + pCellRange->Value <<= aRangeString; } + + xDataSource.set( xDataProvider->createDataSource( aArguments )); + xDiagram->setDiagramData( xDataSource, aArguments ); + + // always return copy state to avoid deletion of the dragged range + nResult = DND_ACTION_COPY; } } } diff --git a/chart2/source/controller/main/ChartFrameloader.cxx b/chart2/source/controller/main/ChartFrameloader.cxx index 8d153a1e07fe..8c48feddb2e7 100644 --- a/chart2/source/controller/main/ChartFrameloader.cxx +++ b/chart2/source/controller/main/ChartFrameloader.cxx @@ -169,8 +169,7 @@ sal_Bool SAL_CALL ChartFrameLoader::load( const uno::Sequence< beans::PropertyVa if( xComponentWindow.is() && aMDHelper.ISSET_FilterName && aMDHelper.FilterName == "StarChart 5.0" ) { awt::Rectangle aRect( xComponentWindow->getPosSize() ); - sal_Int16 nFlags=0; - xComponentWindow->setPosSize( aRect.X, aRect.Y, aRect.Width, aRect.Height, nFlags ); + xComponentWindow->setPosSize( aRect.X, aRect.Y, aRect.Width, aRect.Height, 0 ); } } } diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index 4cfbd3a0f4a9..16c97974dcfb 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -527,10 +527,6 @@ void ControllerCommandDispatch::updateCommandAvailability() // read-only bool bIsWritable = bModelStateIsValid && (! m_apModelState->bIsReadOnly); - // paste is available - // @todo: determine correctly - bool bHasSuitableClipboardContent = true; - bool bShapeContext = m_xChartController.is() && m_xChartController->isShapeContext(); bool bEnableDataTableDialog = false; @@ -553,7 +549,7 @@ void ControllerCommandDispatch::updateCommandAvailability() // edit commands m_aCommandAvailability[ ".uno:Cut" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsDeleteableObjectSelected; m_aCommandAvailability[ ".uno:Copy" ] = bControllerStateIsValid && m_apControllerState->bHasSelectedObject; - m_aCommandAvailability[ ".uno:Paste" ] = bIsWritable && bHasSuitableClipboardContent; + m_aCommandAvailability[ ".uno:Paste" ] = bIsWritable; // toolbar commands m_aCommandAvailability[ ".uno:ToggleGridHorizontal" ] = bIsWritable; diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index 53929d720a81..9c328a0887de 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -443,9 +443,7 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID ) pDrawViewWrapper->GetCurrentObjIdentifier(), pPage ); if ( pObj ) { - long nDefaultObjectSizeWidth = 4000; - long nDefaultObjectSizeHeight = 2500; - Size aObjectSize( nDefaultObjectSizeWidth, nDefaultObjectSizeHeight ); + Size aObjectSize( 4000, 2500 ); tools::Rectangle aPageRect( tools::Rectangle( Point( 0, 0 ), pPage->GetSize() ) ); Point aObjectPos = aPageRect.Center(); aObjectPos.X() -= aObjectSize.Width() / 2; diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index b65e990841da..7889d679b107 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -410,7 +410,6 @@ void ImplObjectHierarchy::createDataSeriesTree( try { - sal_Int32 nDiagramIndex = 0; sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); Sequence< Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); @@ -430,7 +429,7 @@ void ImplObjectHierarchy::createDataSeriesTree( { OUString aSeriesParticle( ObjectIdentifier::createParticleForSeries( - nDiagramIndex, nCooSysIdx, nCTIdx, nSeriesIdx )); + 0, nCooSysIdx, nCTIdx, nSeriesIdx )); ObjectIdentifier aSeriesOID( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForParticle( aSeriesParticle ) ) ); rOutDiagramSubContainer.push_back( aSeriesOID ); |