diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-18 14:08:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-19 11:01:18 +0200 |
commit | 9df2821e61979dab32390d5c64dd49bee868adbb (patch) | |
tree | 5b827e29e73ac2300c164b0a389a784a358956e6 /chart2/source/tools | |
parent | 8b0a69498b025e13d9772689e9e4fa3d6b05e609 (diff) |
loplugin:flatten in chart2
Change-Id: Iadc4da6515a7d82e7a92b33d74d589b61fa2c64f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92480
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/tools')
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 114 | ||||
-rw-r--r-- | chart2/source/tools/DataSeriesHelper.cxx | 72 | ||||
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 70 | ||||
-rw-r--r-- | chart2/source/tools/ExplicitCategoriesProvider.cxx | 38 | ||||
-rw-r--r-- | chart2/source/tools/InternalData.cxx | 56 | ||||
-rw-r--r-- | chart2/source/tools/InternalDataProvider.cxx | 88 | ||||
-rw-r--r-- | chart2/source/tools/ModifyListenerHelper.cxx | 30 | ||||
-rw-r--r-- | chart2/source/tools/OPropertySet.cxx | 108 | ||||
-rw-r--r-- | chart2/source/tools/RangeHighlighter.cxx | 222 | ||||
-rw-r--r-- | chart2/source/tools/RegressionCurveHelper.cxx | 64 | ||||
-rw-r--r-- | chart2/source/tools/ThreeDHelper.cxx | 28 |
11 files changed, 445 insertions, 445 deletions
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 78c9cf5e4e28..6b5b43d0c891 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -1076,69 +1076,69 @@ Reference< XChartType > AxisHelper::getChartTypeByIndex( const Reference< XCoord void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys ) { - if( xCooSys.is() ) - { - bool bCartesian = xCooSys->getViewServiceName() == CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME; - if( bCartesian ) - { - bool bVertical = false; - Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY ); - if( xCooSysProp.is() ) - xCooSysProp->getPropertyValue( "SwapXAndYAxis" ) >>= bVertical; + if( !xCooSys.is() ) + return; - sal_Int32 nHorizontalAxisDimension = bVertical ? 1 : 0; - sal_Int32 nVerticalAxisDimension = bVertical ? 0 : 1; + bool bCartesian = xCooSys->getViewServiceName() == CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME; + if( !bCartesian ) + return; - try - { - //reverse direction for horizontal main axis - Reference< chart2::XAxis > xHorizontalMainAxis( AxisHelper::getAxis( nHorizontalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) ); - if( xHorizontalMainAxis.is() ) - { - chart2::ScaleData aScale = xHorizontalMainAxis->getScaleData(); - aScale.Orientation = chart2::AxisOrientation_REVERSE; - xHorizontalMainAxis->setScaleData(aScale); - } + bool bVertical = false; + Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY ); + if( xCooSysProp.is() ) + xCooSysProp->getPropertyValue( "SwapXAndYAxis" ) >>= bVertical; - //mathematical direction for vertical main axis - Reference< chart2::XAxis > xVerticalMainAxis( AxisHelper::getAxis( nVerticalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) ); - if( xVerticalMainAxis.is() ) - { - chart2::ScaleData aScale = xVerticalMainAxis->getScaleData(); - aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL; - xVerticalMainAxis->setScaleData(aScale); - } - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2" ); - } + sal_Int32 nHorizontalAxisDimension = bVertical ? 1 : 0; + sal_Int32 nVerticalAxisDimension = bVertical ? 0 : 1; - try - { - //reverse direction for horizontal secondary axis - Reference< chart2::XAxis > xHorizontalSecondaryAxis( AxisHelper::getAxis( nHorizontalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) ); - if( xHorizontalSecondaryAxis.is() ) - { - chart2::ScaleData aScale = xHorizontalSecondaryAxis->getScaleData(); - aScale.Orientation = chart2::AxisOrientation_REVERSE; - xHorizontalSecondaryAxis->setScaleData(aScale); - } + try + { + //reverse direction for horizontal main axis + Reference< chart2::XAxis > xHorizontalMainAxis( AxisHelper::getAxis( nHorizontalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) ); + if( xHorizontalMainAxis.is() ) + { + chart2::ScaleData aScale = xHorizontalMainAxis->getScaleData(); + aScale.Orientation = chart2::AxisOrientation_REVERSE; + xHorizontalMainAxis->setScaleData(aScale); + } - //mathematical direction for vertical secondary axis - Reference< chart2::XAxis > xVerticalSecondaryAxis( AxisHelper::getAxis( nVerticalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) ); - if( xVerticalSecondaryAxis.is() ) - { - chart2::ScaleData aScale = xVerticalSecondaryAxis->getScaleData(); - aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL; - xVerticalSecondaryAxis->setScaleData(aScale); - } - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } + //mathematical direction for vertical main axis + Reference< chart2::XAxis > xVerticalMainAxis( AxisHelper::getAxis( nVerticalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) ); + if( xVerticalMainAxis.is() ) + { + chart2::ScaleData aScale = xVerticalMainAxis->getScaleData(); + aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL; + xVerticalMainAxis->setScaleData(aScale); + } + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2" ); + } + + try + { + //reverse direction for horizontal secondary axis + Reference< chart2::XAxis > xHorizontalSecondaryAxis( AxisHelper::getAxis( nHorizontalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) ); + if( xHorizontalSecondaryAxis.is() ) + { + chart2::ScaleData aScale = xHorizontalSecondaryAxis->getScaleData(); + aScale.Orientation = chart2::AxisOrientation_REVERSE; + xHorizontalSecondaryAxis->setScaleData(aScale); } + + //mathematical direction for vertical secondary axis + Reference< chart2::XAxis > xVerticalSecondaryAxis( AxisHelper::getAxis( nVerticalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) ); + if( xVerticalSecondaryAxis.is() ) + { + chart2::ScaleData aScale = xVerticalSecondaryAxis->getScaleData(); + aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL; + xVerticalSecondaryAxis->setScaleData(aScale); + } + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2"); } } diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index d2b0b27e04fb..3dbcd65f70a2 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -111,26 +111,26 @@ void lcl_getCooSysAndChartTypeOfSeries( Reference< chart2::XChartType > & xOutChartType ) { Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY ); - if( xCooSysCnt.is()) + if( !xCooSysCnt.is()) + return; + + Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); + for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx ) { - Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx ) + Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW ); + Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); + for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx ) { - Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); - for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx ) + Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nCTIdx], uno::UNO_QUERY ); + if( xSeriesCnt.is()) { - Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nCTIdx], uno::UNO_QUERY ); - if( xSeriesCnt.is()) + Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries()); + for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx ) { - Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries()); - for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx ) + if( aSeries[nSeriesIdx] == xSeries ) { - if( aSeries[nSeriesIdx] == xSeries ) - { - xOutCooSys.set( aCooSysSeq[nCooSysIdx] ); - xOutChartType.set( aChartTypes[nCTIdx] ); - } + xOutCooSys.set( aCooSysSeq[nCooSysIdx] ); + xOutChartType.set( aChartTypes[nCTIdx] ); } } } @@ -411,31 +411,31 @@ void setStackModeAtSeries( } } - if( xCorrespondingCoordinateSystem.is() && - 1 < xCorrespondingCoordinateSystem->getDimension() ) + if( !(xCorrespondingCoordinateSystem.is() && + 1 < xCorrespondingCoordinateSystem->getDimension()) ) + return; + + if( aAxisIndexSet.empty() ) { - if( aAxisIndexSet.empty() ) - { - aAxisIndexSet.insert(0); - } + aAxisIndexSet.insert(0); + } - for (auto const& axisIndex : aAxisIndexSet) + for (auto const& axisIndex : aAxisIndexSet) + { + Reference< chart2::XAxis > xAxis( + xCorrespondingCoordinateSystem->getAxisByDimension(1, axisIndex)); + if( xAxis.is()) { - Reference< chart2::XAxis > xAxis( - xCorrespondingCoordinateSystem->getAxisByDimension(1, axisIndex)); - if( xAxis.is()) - { - bool bPercent = (eStackMode == StackMode::YStackedPercent); - chart2::ScaleData aScaleData = xAxis->getScaleData(); + bool bPercent = (eStackMode == StackMode::YStackedPercent); + chart2::ScaleData aScaleData = xAxis->getScaleData(); - if( bPercent != (aScaleData.AxisType==chart2::AxisType::PERCENT) ) - { - if( bPercent ) - aScaleData.AxisType = chart2::AxisType::PERCENT; - else - aScaleData.AxisType = chart2::AxisType::REALNUMBER; - xAxis->setScaleData( aScaleData ); - } + if( bPercent != (aScaleData.AxisType==chart2::AxisType::PERCENT) ) + { + if( bPercent ) + aScaleData.AxisType = chart2::AxisType::PERCENT; + else + aScaleData.AxisType = chart2::AxisType::REALNUMBER; + xAxis->setScaleData( aScaleData ); } } } diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 0ea291db6c47..5f5abd19c191 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -531,27 +531,27 @@ void DiagramHelper::replaceCoordinateSystem( // update the coordinate-system container Reference< XCoordinateSystemContainer > xCont( xDiagram, uno::UNO_QUERY ); - if( xCont.is()) + if( !xCont.is()) + return; + + try { - try - { - Reference< chart2::data::XLabeledDataSequence > xCategories = DiagramHelper::getCategoriesFromDiagram( xDiagram ); + Reference< chart2::data::XLabeledDataSequence > xCategories = DiagramHelper::getCategoriesFromDiagram( xDiagram ); - // move chart types of xCooSysToReplace to xReplacement - Reference< XChartTypeContainer > xCTCntCooSys( xCooSysToReplace, uno::UNO_QUERY_THROW ); - Reference< XChartTypeContainer > xCTCntReplacement( xReplacement, uno::UNO_QUERY_THROW ); - xCTCntReplacement->setChartTypes( xCTCntCooSys->getChartTypes()); + // move chart types of xCooSysToReplace to xReplacement + Reference< XChartTypeContainer > xCTCntCooSys( xCooSysToReplace, uno::UNO_QUERY_THROW ); + Reference< XChartTypeContainer > xCTCntReplacement( xReplacement, uno::UNO_QUERY_THROW ); + xCTCntReplacement->setChartTypes( xCTCntCooSys->getChartTypes()); - xCont->removeCoordinateSystem( xCooSysToReplace ); - xCont->addCoordinateSystem( xReplacement ); + xCont->removeCoordinateSystem( xCooSysToReplace ); + xCont->addCoordinateSystem( xReplacement ); - if( xCategories.is() ) - DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram ); - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } + if( xCategories.is() ) + DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram ); + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2"); } } @@ -923,25 +923,25 @@ static void lcl_generateAutomaticCategoriesFromChartType( return; OUString aMainSeq( xChartType->getRoleOfSequenceForSeriesLabel() ); Reference< XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY ); - if( xSeriesCnt.is() ) + if( !xSeriesCnt.is() ) + return; + + Sequence< Reference< XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries() ); + for( sal_Int32 nS = 0; nS < aSeriesSeq.getLength(); nS++ ) { - Sequence< Reference< XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries() ); - for( sal_Int32 nS = 0; nS < aSeriesSeq.getLength(); nS++ ) - { - Reference< data::XDataSource > xDataSource( aSeriesSeq[nS], uno::UNO_QUERY ); - if( !xDataSource.is() ) - continue; - Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( - ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aMainSeq )); - if( !xLabeledSeq.is() ) - continue; - Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() ); - if( !xValueSeq.is() ) - continue; - rRet = xValueSeq->generateLabel( chart2::data::LabelOrigin_LONG_SIDE ); - if( rRet.hasElements() ) - return; - } + Reference< data::XDataSource > xDataSource( aSeriesSeq[nS], uno::UNO_QUERY ); + if( !xDataSource.is() ) + continue; + Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( + ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aMainSeq )); + if( !xLabeledSeq.is() ) + continue; + Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() ); + if( !xValueSeq.is() ) + continue; + rRet = xValueSeq->generateLabel( chart2::data::LabelOrigin_LONG_SIDE ); + if( rRet.hasElements() ) + return; } } diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 401d6eaa70e1..e75fe8376a40 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -463,32 +463,32 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& void ExplicitCategoriesProvider::init() { - if( m_bDirty ) - { - m_aComplexCats.clear();//not one per index - m_aDateCategories.clear(); + if( !m_bDirty ) + return; - if( m_xOriginalCategories.is() ) + m_aComplexCats.clear();//not one per index + m_aDateCategories.clear(); + + if( m_xOriginalCategories.is() ) + { + if( !hasComplexCategories() ) { - if( !hasComplexCategories() ) + if(m_bIsDateAxis) { - if(m_bIsDateAxis) - { - if( ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( m_xCooSysModel, 0 ), 0 ) ) - m_bIsDateAxis = lcl_fillDateCategories( m_xOriginalCategories->getValues(), m_aDateCategories, m_bIsAutoDate, mrModel ); - else - m_bIsDateAxis = false; - } - } - else - { - m_bIsDateAxis = false; + if( ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( m_xCooSysModel, 0 ), 0 ) ) + m_bIsDateAxis = lcl_fillDateCategories( m_xOriginalCategories->getValues(), m_aDateCategories, m_bIsAutoDate, mrModel ); + else + m_bIsDateAxis = false; } } else - m_bIsDateAxis=false; - m_bDirty = false; + { + m_bIsDateAxis = false; + } } + else + m_bIsDateAxis=false; + m_bDirty = false; } Sequence< OUString > const & ExplicitCategoriesProvider::getSimpleCategories() diff --git a/chart2/source/tools/InternalData.cxx b/chart2/source/tools/InternalData.cxx index fcf3bf44c8e6..5fc4d17244a4 100644 --- a/chart2/source/tools/InternalData.cxx +++ b/chart2/source/tools/InternalData.cxx @@ -249,42 +249,42 @@ vector< uno::Any > InternalData::getComplexRowLabel( sal_Int32 nRowIndex ) const void InternalData::swapRowWithNext( sal_Int32 nRowIndex ) { - if( nRowIndex < m_nRowCount - 1 ) - { - const sal_Int32 nMax = m_nColumnCount; - for( sal_Int32 nColIdx=0; nColIdx<nMax; ++nColIdx ) - { - size_t nIndex1 = nColIdx + nRowIndex*m_nColumnCount; - size_t nIndex2 = nIndex1 + m_nColumnCount; - double fTemp = m_aData[nIndex1]; - m_aData[nIndex1] = m_aData[nIndex2]; - m_aData[nIndex2] = fTemp; - } + if( nRowIndex >= m_nRowCount - 1 ) + return; - vector< uno::Any > aTemp( m_aRowLabels[nRowIndex] ); - m_aRowLabels[nRowIndex] = m_aRowLabels[nRowIndex + 1]; - m_aRowLabels[nRowIndex + 1] = aTemp; + const sal_Int32 nMax = m_nColumnCount; + for( sal_Int32 nColIdx=0; nColIdx<nMax; ++nColIdx ) + { + size_t nIndex1 = nColIdx + nRowIndex*m_nColumnCount; + size_t nIndex2 = nIndex1 + m_nColumnCount; + double fTemp = m_aData[nIndex1]; + m_aData[nIndex1] = m_aData[nIndex2]; + m_aData[nIndex2] = fTemp; } + + vector< uno::Any > aTemp( m_aRowLabels[nRowIndex] ); + m_aRowLabels[nRowIndex] = m_aRowLabels[nRowIndex + 1]; + m_aRowLabels[nRowIndex + 1] = aTemp; } void InternalData::swapColumnWithNext( sal_Int32 nColumnIndex ) { - if( nColumnIndex < m_nColumnCount - 1 ) - { - const sal_Int32 nMax = m_nRowCount; - for( sal_Int32 nRowIdx=0; nRowIdx<nMax; ++nRowIdx ) - { - size_t nIndex1 = nColumnIndex + nRowIdx*m_nColumnCount; - size_t nIndex2 = nIndex1 + 1; - double fTemp = m_aData[nIndex1]; - m_aData[nIndex1] = m_aData[nIndex2]; - m_aData[nIndex2] = fTemp; - } + if( nColumnIndex >= m_nColumnCount - 1 ) + return; - vector< uno::Any > aTemp( m_aColumnLabels[nColumnIndex] ); - m_aColumnLabels[nColumnIndex] = m_aColumnLabels[nColumnIndex + 1]; - m_aColumnLabels[nColumnIndex + 1] = aTemp; + const sal_Int32 nMax = m_nRowCount; + for( sal_Int32 nRowIdx=0; nRowIdx<nMax; ++nRowIdx ) + { + size_t nIndex1 = nColumnIndex + nRowIdx*m_nColumnCount; + size_t nIndex2 = nIndex1 + 1; + double fTemp = m_aData[nIndex1]; + m_aData[nIndex1] = m_aData[nIndex2]; + m_aData[nIndex2] = fTemp; } + + vector< uno::Any > aTemp( m_aColumnLabels[nColumnIndex] ); + m_aColumnLabels[nColumnIndex] = m_aColumnLabels[nColumnIndex + 1]; + m_aColumnLabels[nColumnIndex + 1] = aTemp; } bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount ) diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 08d03b4118d1..7c826e8f6129 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -116,60 +116,60 @@ struct lcl_internalizeSeries { Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY ); Reference< chart2::data::XDataSink > xSink( xSeries, uno::UNO_QUERY ); - if( xSource.is() && xSink.is() ) + if( !(xSource.is() && xSink.is()) ) + return; + + Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeriesData = xSource->getDataSequences(); + Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeriesData( aOldSeriesData.getLength() ); + for( sal_Int32 i=0; i<aOldSeriesData.getLength(); ++i ) { - Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeriesData = xSource->getDataSequences(); - Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeriesData( aOldSeriesData.getLength() ); - for( sal_Int32 i=0; i<aOldSeriesData.getLength(); ++i ) + sal_Int32 nNewIndex( m_bDataInColumns ? m_rInternalData.appendColumn() : m_rInternalData.appendRow() ); + OUString aIdentifier( OUString::number( nNewIndex )); + //@todo: deal also with genericXDataSequence + Reference< chart2::data::XNumericalDataSequence > xValues( aOldSeriesData[i]->getValues(), uno::UNO_QUERY ); + Reference< chart2::data::XTextualDataSequence > xLabel( aOldSeriesData[i]->getLabel(), uno::UNO_QUERY ); + Reference< chart2::data::XDataSequence > xNewValues; + + if( xValues.is() ) { - sal_Int32 nNewIndex( m_bDataInColumns ? m_rInternalData.appendColumn() : m_rInternalData.appendRow() ); - OUString aIdentifier( OUString::number( nNewIndex )); - //@todo: deal also with genericXDataSequence - Reference< chart2::data::XNumericalDataSequence > xValues( aOldSeriesData[i]->getValues(), uno::UNO_QUERY ); - Reference< chart2::data::XTextualDataSequence > xLabel( aOldSeriesData[i]->getLabel(), uno::UNO_QUERY ); - Reference< chart2::data::XDataSequence > xNewValues; - - if( xValues.is() ) + auto aValues( comphelper::sequenceToContainer<std::vector< double >>( xValues->getNumericalData())); + if( m_bDataInColumns ) + m_rInternalData.setColumnValues( nNewIndex, aValues ); + else + m_rInternalData.setRowValues( nNewIndex, aValues ); + if( m_bConnectToModel ) { - auto aValues( comphelper::sequenceToContainer<std::vector< double >>( xValues->getNumericalData())); - if( m_bDataInColumns ) - m_rInternalData.setColumnValues( nNewIndex, aValues ); - else - m_rInternalData.setRowValues( nNewIndex, aValues ); - if( m_bConnectToModel ) - { - xNewValues.set( m_rProvider.createDataSequenceByRangeRepresentation( aIdentifier )); - comphelper::copyProperties( - Reference< beans::XPropertySet >( xValues, uno::UNO_QUERY ), - Reference< beans::XPropertySet >( xNewValues, uno::UNO_QUERY )); - } + xNewValues.set( m_rProvider.createDataSequenceByRangeRepresentation( aIdentifier )); + comphelper::copyProperties( + Reference< beans::XPropertySet >( xValues, uno::UNO_QUERY ), + Reference< beans::XPropertySet >( xNewValues, uno::UNO_QUERY )); } + } - if( xLabel.is() ) - { - if( m_bDataInColumns ) - m_rInternalData.setComplexColumnLabel( nNewIndex, lcl_StringToAnyVector( xLabel->getTextualData() ) ); - else - m_rInternalData.setComplexRowLabel( nNewIndex, lcl_StringToAnyVector( xLabel->getTextualData() ) ); - if( m_bConnectToModel ) - { - Reference< chart2::data::XDataSequence > xNewLabel( - m_rProvider.createDataSequenceByRangeRepresentation( lcl_aLabelRangePrefix + aIdentifier )); - comphelper::copyProperties( - Reference< beans::XPropertySet >( xLabel, uno::UNO_QUERY ), - Reference< beans::XPropertySet >( xNewLabel, uno::UNO_QUERY )); - aNewSeriesData[i].set( new LabeledDataSequence( xNewValues, xNewLabel ) ); - } - } + if( xLabel.is() ) + { + if( m_bDataInColumns ) + m_rInternalData.setComplexColumnLabel( nNewIndex, lcl_StringToAnyVector( xLabel->getTextualData() ) ); else + m_rInternalData.setComplexRowLabel( nNewIndex, lcl_StringToAnyVector( xLabel->getTextualData() ) ); + if( m_bConnectToModel ) { - if( m_bConnectToModel ) - aNewSeriesData[i].set( new LabeledDataSequence( xNewValues ) ); + Reference< chart2::data::XDataSequence > xNewLabel( + m_rProvider.createDataSequenceByRangeRepresentation( lcl_aLabelRangePrefix + aIdentifier )); + comphelper::copyProperties( + Reference< beans::XPropertySet >( xLabel, uno::UNO_QUERY ), + Reference< beans::XPropertySet >( xNewLabel, uno::UNO_QUERY )); + aNewSeriesData[i].set( new LabeledDataSequence( xNewValues, xNewLabel ) ); } } - if( m_bConnectToModel ) - xSink->setData( aNewSeriesData ); + else + { + if( m_bConnectToModel ) + aNewSeriesData[i].set( new LabeledDataSequence( xNewValues ) ); + } } + if( m_bConnectToModel ) + xSink->setData( aNewSeriesData ); } private: diff --git a/chart2/source/tools/ModifyListenerHelper.cxx b/chart2/source/tools/ModifyListenerHelper.cxx index 7d482f3e6d8a..3266af1d037e 100644 --- a/chart2/source/tools/ModifyListenerHelper.cxx +++ b/chart2/source/tools/ModifyListenerHelper.cxx @@ -36,23 +36,23 @@ void lcl_fireModifyEvent( { ::cppu::OInterfaceContainerHelper * pCntHlp = rBroadcastHelper.getContainer( cppu::UnoType<util::XModifyListener>::get()); - if( pCntHlp ) - { - lang::EventObject aEventToSend; - if( pEvent ) - aEventToSend = *pEvent; - else - aEventToSend.Source.set( xEventSource ); - OSL_ENSURE( aEventToSend.Source.is(), "Sending event without source" ); + if( !pCntHlp ) + return; - ::cppu::OInterfaceIteratorHelper aIt( *pCntHlp ); + lang::EventObject aEventToSend; + if( pEvent ) + aEventToSend = *pEvent; + else + aEventToSend.Source.set( xEventSource ); + OSL_ENSURE( aEventToSend.Source.is(), "Sending event without source" ); - while( aIt.hasMoreElements()) - { - Reference< util::XModifyListener > xModListener( aIt.next(), uno::UNO_QUERY ); - if( xModListener.is()) - xModListener->modified( aEventToSend ); - } + ::cppu::OInterfaceIteratorHelper aIt( *pCntHlp ); + + while( aIt.hasMoreElements()) + { + Reference< util::XModifyListener > xModListener( aIt.next(), uno::UNO_QUERY ); + if( xModListener.is()) + xModListener->modified( aEventToSend ); } } diff --git a/chart2/source/tools/OPropertySet.cxx b/chart2/source/tools/OPropertySet.cxx index 859dbcfdf757..252cfb605be1 100644 --- a/chart2/source/tools/OPropertySet.cxx +++ b/chart2/source/tools/OPropertySet.cxx @@ -257,75 +257,75 @@ void SAL_CALL OPropertySet::getFastPropertyValue ( Any& rValue, sal_Int32 nHandle ) const { - if( ! m_pImplProperties->GetPropertyValueByHandle( rValue, nHandle )) + if( m_pImplProperties->GetPropertyValueByHandle( rValue, nHandle )) + return; + + // property was not set -> try style + uno::Reference< beans::XFastPropertySet > xStylePropSet( m_pImplProperties->GetStyle(), uno::UNO_QUERY ); + if( xStylePropSet.is() ) { - // property was not set -> try style - uno::Reference< beans::XFastPropertySet > xStylePropSet( m_pImplProperties->GetStyle(), uno::UNO_QUERY ); - if( xStylePropSet.is() ) - { #ifdef DBG_UTIL + { + // check if the handle of the style points to the same property + // name as the handle in this property set + uno::Reference< beans::XPropertySet > xPropSet( xStylePropSet, uno::UNO_QUERY ); + if( xPropSet.is()) { - // check if the handle of the style points to the same property - // name as the handle in this property set - uno::Reference< beans::XPropertySet > xPropSet( xStylePropSet, uno::UNO_QUERY ); - if( xPropSet.is()) + uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo(); + if( xInfo.is() ) { - uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo(); - if( xInfo.is() ) + // for some reason the virtual method getInfoHelper() is + // not const + ::cppu::IPropertyArrayHelper & rPH = + const_cast< OPropertySet * >( this )->getInfoHelper(); + + // find the Property with Handle nHandle in Style + Sequence< beans::Property > aProps( xInfo->getProperties() ); + sal_Int32 nI = aProps.getLength() - 1; + while( ( nI >= 0 ) && nHandle != aProps[ nI ].Handle ) + --nI; + + if( nI >= 0 ) // => nHandle == aProps[nI].Handle { - // for some reason the virtual method getInfoHelper() is - // not const - ::cppu::IPropertyArrayHelper & rPH = - const_cast< OPropertySet * >( this )->getInfoHelper(); - - // find the Property with Handle nHandle in Style - Sequence< beans::Property > aProps( xInfo->getProperties() ); - sal_Int32 nI = aProps.getLength() - 1; - while( ( nI >= 0 ) && nHandle != aProps[ nI ].Handle ) - --nI; - - if( nI >= 0 ) // => nHandle == aProps[nI].Handle - { - // check whether the handle in this property set is - // the same as the one in the style - beans::Property aProp( rPH.getPropertyByName( aProps[ nI ].Name ) ); - OSL_ENSURE( nHandle == aProp.Handle, - "HandleCheck: Handles for same property differ!" ); - - if( nHandle == aProp.Handle ) - { - OSL_ENSURE( aProp.Type == aProps[nI].Type, - "HandleCheck: Types differ!" ); - OSL_ENSURE( aProp.Attributes == aProps[nI].Attributes, - "HandleCheck: Attributes differ!" ); - } - } - else + // check whether the handle in this property set is + // the same as the one in the style + beans::Property aProp( rPH.getPropertyByName( aProps[ nI ].Name ) ); + OSL_ENSURE( nHandle == aProp.Handle, + "HandleCheck: Handles for same property differ!" ); + + if( nHandle == aProp.Handle ) { - OSL_FAIL( "HandleCheck: Handle not found in Style" ); + OSL_ENSURE( aProp.Type == aProps[nI].Type, + "HandleCheck: Types differ!" ); + OSL_ENSURE( aProp.Attributes == aProps[nI].Attributes, + "HandleCheck: Attributes differ!" ); } } else - OSL_FAIL( "HandleCheck: Invalid XPropertySetInfo returned" ); + { + OSL_FAIL( "HandleCheck: Handle not found in Style" ); + } } else - OSL_FAIL( "HandleCheck: XPropertySet not supported" ); + OSL_FAIL( "HandleCheck: Invalid XPropertySetInfo returned" ); } + else + OSL_FAIL( "HandleCheck: XPropertySet not supported" ); + } #endif - rValue = xStylePropSet->getFastPropertyValue( nHandle ); + rValue = xStylePropSet->getFastPropertyValue( nHandle ); + } + else + { + // there is no style (or the style does not support XFastPropertySet) + // => take the default value + try + { + rValue = GetDefaultValue( nHandle ); } - else + catch( const beans::UnknownPropertyException& ) { - // there is no style (or the style does not support XFastPropertySet) - // => take the default value - try - { - rValue = GetDefaultValue( nHandle ); - } - catch( const beans::UnknownPropertyException& ) - { - rValue.clear(); - } + rValue.clear(); } } } diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx index fe67460230a3..ea49fc64a07f 100644 --- a/chart2/source/tools/RangeHighlighter.cxx +++ b/chart2/source/tools/RangeHighlighter.cxx @@ -86,110 +86,110 @@ Sequence< chart2::data::HighlightedRange > SAL_CALL RangeHighlighter::getSelecte void RangeHighlighter::determineRanges() { m_aSelectedRanges.realloc( 0 ); - if( m_xSelectionSupplier.is()) + if( !m_xSelectionSupplier.is()) + return; + + try { - try - { - Reference< frame::XController > xController( m_xSelectionSupplier, uno::UNO_QUERY ); - Reference< frame::XModel > xChartModel; - if( xController.is()) - xChartModel.set( xController->getModel()); + Reference< frame::XController > xController( m_xSelectionSupplier, uno::UNO_QUERY ); + Reference< frame::XModel > xChartModel; + if( xController.is()) + xChartModel.set( xController->getModel()); - m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( xChartModel ); + m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( xChartModel ); - uno::Any aSelection( m_xSelectionSupplier->getSelection()); - const uno::Type& rType = aSelection.getValueType(); + uno::Any aSelection( m_xSelectionSupplier->getSelection()); + const uno::Type& rType = aSelection.getValueType(); - if ( rType == cppu::UnoType<OUString>::get() ) - { - // @todo??: maybe getSelection() should return a model object rather than a CID + if ( rType == cppu::UnoType<OUString>::get() ) + { + // @todo??: maybe getSelection() should return a model object rather than a CID - OUString aCID; - aSelection >>= aCID; - if ( !aCID.isEmpty() ) + OUString aCID; + aSelection >>= aCID; + if ( !aCID.isEmpty() ) + { + ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID ); + sal_Int32 nIndex = ObjectIdentifier::getIndexFromParticleOrCID( aCID ); + Reference< chart2::XDataSeries > xDataSeries( ObjectIdentifier::getDataSeriesForCID( aCID, xChartModel ) ); + if( eObjectType == OBJECTTYPE_LEGEND_ENTRY ) { - ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID ); - sal_Int32 nIndex = ObjectIdentifier::getIndexFromParticleOrCID( aCID ); - Reference< chart2::XDataSeries > xDataSeries( ObjectIdentifier::getDataSeriesForCID( aCID, xChartModel ) ); - if( eObjectType == OBJECTTYPE_LEGEND_ENTRY ) - { - OUString aParentParticel( ObjectIdentifier::getFullParentParticle( aCID ) ); - ObjectType eParentObjectType = ObjectIdentifier::getObjectType( aParentParticel ); - eObjectType = eParentObjectType; - if( eObjectType == OBJECTTYPE_DATA_POINT ) - nIndex = ObjectIdentifier::getIndexFromParticleOrCID( aParentParticel ); - } + OUString aParentParticel( ObjectIdentifier::getFullParentParticle( aCID ) ); + ObjectType eParentObjectType = ObjectIdentifier::getObjectType( aParentParticel ); + eObjectType = eParentObjectType; + if( eObjectType == OBJECTTYPE_DATA_POINT ) + nIndex = ObjectIdentifier::getIndexFromParticleOrCID( aParentParticel ); + } - if( eObjectType == OBJECTTYPE_DATA_POINT || eObjectType == OBJECTTYPE_DATA_LABEL ) - { - // Data Point - fillRangesForDataPoint( xDataSeries, nIndex ); - return; - } - else if( eObjectType == OBJECTTYPE_DATA_ERRORS_X || - eObjectType == OBJECTTYPE_DATA_ERRORS_Y || - eObjectType == OBJECTTYPE_DATA_ERRORS_Z ) + if( eObjectType == OBJECTTYPE_DATA_POINT || eObjectType == OBJECTTYPE_DATA_LABEL ) + { + // Data Point + fillRangesForDataPoint( xDataSeries, nIndex ); + return; + } + else if( eObjectType == OBJECTTYPE_DATA_ERRORS_X || + eObjectType == OBJECTTYPE_DATA_ERRORS_Y || + eObjectType == OBJECTTYPE_DATA_ERRORS_Z ) + { + // select error bar ranges, or data series, if the style is + // not set to FROM_DATA + fillRangesForErrorBars( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), xDataSeries ); + return; + } + else if( xDataSeries.is() ) + { + // Data Series + fillRangesForDataSeries( xDataSeries ); + return; + } + else if( eObjectType == OBJECTTYPE_AXIS ) + { + // Axis (Categories) + Reference< chart2::XAxis > xAxis( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), uno::UNO_QUERY ); + if( xAxis.is()) { - // select error bar ranges, or data series, if the style is - // not set to FROM_DATA - fillRangesForErrorBars( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), xDataSeries ); + fillRangesForCategories( xAxis ); return; } - else if( xDataSeries.is() ) + } + else if( eObjectType == OBJECTTYPE_PAGE + || eObjectType == OBJECTTYPE_DIAGRAM + || eObjectType == OBJECTTYPE_DIAGRAM_WALL + || eObjectType == OBJECTTYPE_DIAGRAM_FLOOR + ) + { + // Diagram + Reference< chart2::XDiagram > xDia( ObjectIdentifier::getDiagramForCID( aCID, xChartModel ) ); + if( xDia.is()) { - // Data Series - fillRangesForDataSeries( xDataSeries ); + fillRangesForDiagram( xDia ); return; } - else if( eObjectType == OBJECTTYPE_AXIS ) - { - // Axis (Categories) - Reference< chart2::XAxis > xAxis( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), uno::UNO_QUERY ); - if( xAxis.is()) - { - fillRangesForCategories( xAxis ); - return; - } - } - else if( eObjectType == OBJECTTYPE_PAGE - || eObjectType == OBJECTTYPE_DIAGRAM - || eObjectType == OBJECTTYPE_DIAGRAM_WALL - || eObjectType == OBJECTTYPE_DIAGRAM_FLOOR - ) - { - // Diagram - Reference< chart2::XDiagram > xDia( ObjectIdentifier::getDiagramForCID( aCID, xChartModel ) ); - if( xDia.is()) - { - fillRangesForDiagram( xDia ); - return; - } - } - } - } - else if ( rType == cppu::UnoType< drawing::XShape >::get() ) - { - // #i12587# support for shapes in chart - Reference< drawing::XShape > xShape; - aSelection >>= xShape; - if ( xShape.is() ) - { - return; } } - else + } + else if ( rType == cppu::UnoType< drawing::XShape >::get() ) + { + // #i12587# support for shapes in chart + Reference< drawing::XShape > xShape; + aSelection >>= xShape; + if ( xShape.is() ) { - //if nothing is selected select all ranges - Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY_THROW ); - fillRangesForDiagram( xChartDoc->getFirstDiagram() ); return; } } - catch( const uno::Exception & ) + else { - DBG_UNHANDLED_EXCEPTION("chart2"); + //if nothing is selected select all ranges + Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY_THROW ); + fillRangesForDiagram( xChartDoc->getFirstDiagram() ); + return; } } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2"); + } } void RangeHighlighter::fillRangesForDiagram( const Reference< chart2::XDiagram > & xDiagram ) @@ -264,37 +264,37 @@ void RangeHighlighter::fillRangesForCategories( const Reference< chart2::XAxis > void RangeHighlighter::fillRangesForDataPoint( const Reference< uno::XInterface > & xDataSeries, sal_Int32 nIndex ) { - if( xDataSeries.is()) + if( !xDataSeries.is()) + return; + + Reference< chart2::data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY ); + if( !xSource.is() ) + return; + + Color nPreferredColor = defaultPreferredColor; + std::vector< chart2::data::HighlightedRange > aHilightedRanges; + Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences()); + for( sal_Int32 i=0; i<aLSeqSeq.getLength(); ++i ) { - Reference< chart2::data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY ); - if( xSource.is() ) - { - Color nPreferredColor = defaultPreferredColor; - std::vector< chart2::data::HighlightedRange > aHilightedRanges; - Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences()); - for( sal_Int32 i=0; i<aLSeqSeq.getLength(); ++i ) - { - Reference< chart2::data::XDataSequence > xLabel( aLSeqSeq[i]->getLabel()); - Reference< chart2::data::XDataSequence > xValues( aLSeqSeq[i]->getValues()); - - if( xLabel.is()) - aHilightedRanges.emplace_back( - xLabel->getSourceRangeRepresentation(), - -1, - sal_Int32(nPreferredColor), - false ); - - sal_Int32 nUnhiddenIndex = DataSeriesHelper::translateIndexFromHiddenToFullSequence( nIndex, xValues, !m_bIncludeHiddenCells ); - if( xValues.is()) - aHilightedRanges.emplace_back( - xValues->getSourceRangeRepresentation(), - nUnhiddenIndex, - sal_Int32(nPreferredColor), - false ); - } - m_aSelectedRanges = comphelper::containerToSequence( aHilightedRanges ); - } + Reference< chart2::data::XDataSequence > xLabel( aLSeqSeq[i]->getLabel()); + Reference< chart2::data::XDataSequence > xValues( aLSeqSeq[i]->getValues()); + + if( xLabel.is()) + aHilightedRanges.emplace_back( + xLabel->getSourceRangeRepresentation(), + -1, + sal_Int32(nPreferredColor), + false ); + + sal_Int32 nUnhiddenIndex = DataSeriesHelper::translateIndexFromHiddenToFullSequence( nIndex, xValues, !m_bIncludeHiddenCells ); + if( xValues.is()) + aHilightedRanges.emplace_back( + xValues->getSourceRangeRepresentation(), + nUnhiddenIndex, + sal_Int32(nPreferredColor), + false ); } + m_aSelectedRanges = comphelper::containerToSequence( aHilightedRanges ); } void SAL_CALL RangeHighlighter::addSelectionChangeListener( const Reference< view::XSelectionChangeListener >& xListener ) diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 5d3d41a0a0f0..7e4a9dd17043 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -431,35 +431,35 @@ bool RegressionCurveHelper::removeAllExceptMeanValueLine( void RegressionCurveHelper::removeEquations( uno::Reference< chart2::XRegressionCurveContainer > const & xRegCnt ) { - if( xRegCnt.is()) + if( !xRegCnt.is()) + return; + + try { - try + uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves( + xRegCnt->getRegressionCurves()); + for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) { - uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves( - xRegCnt->getRegressionCurves()); - for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + if( !isMeanValueLine( aCurves[i] ) ) { - if( !isMeanValueLine( aCurves[i] ) ) + uno::Reference< chart2::XRegressionCurve > xRegCurve( aCurves[ i ] ); + if( xRegCurve.is() ) { - uno::Reference< chart2::XRegressionCurve > xRegCurve( aCurves[ i ] ); - if( xRegCurve.is() ) + uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties() ) ; + if( xEqProp.is()) { - uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties() ) ; - if( xEqProp.is()) - { - xEqProp->setPropertyValue( "ShowEquation", uno::Any( false )); - xEqProp->setPropertyValue( "XName", uno::Any( OUString("x") )); - xEqProp->setPropertyValue( "YName", uno::Any( OUString("f(x) ") )); - xEqProp->setPropertyValue( "ShowCorrelationCoefficient", uno::Any( false )); - } + xEqProp->setPropertyValue( "ShowEquation", uno::Any( false )); + xEqProp->setPropertyValue( "XName", uno::Any( OUString("x") )); + xEqProp->setPropertyValue( "YName", uno::Any( OUString("f(x) ") )); + xEqProp->setPropertyValue( "ShowCorrelationCoefficient", uno::Any( false )); } } } } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2"); } } @@ -707,19 +707,19 @@ std::vector< Reference< chart2::XRegressionCurve > > void RegressionCurveHelper::resetEquationPosition( const Reference< chart2::XRegressionCurve > & xCurve ) { - if( xCurve.is()) + if( !xCurve.is()) + return; + + try { - try - { - const OUString aPosPropertyName( "RelativePosition" ); - Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties()); // since m233: , uno::UNO_SET_THROW ); - if( xEqProp->getPropertyValue( aPosPropertyName ).hasValue()) - xEqProp->setPropertyValue( aPosPropertyName, uno::Any()); - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2" ); - } + const OUString aPosPropertyName( "RelativePosition" ); + Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties()); // since m233: , uno::UNO_SET_THROW ); + if( xEqProp->getPropertyValue( aPosPropertyName ).hasValue()) + xEqProp->setPropertyValue( aPosPropertyName, uno::Any()); + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2" ); } } diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index b1c086599926..fd45dc44e257 100644 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -69,23 +69,23 @@ void lcl_RotateLightSource( const Reference< beans::XPropertySet >& xSceneProper , const OUString& rLightSourceOn , const ::basegfx::B3DHomMatrix& rRotationMatrix ) { - if( xSceneProperties.is() ) + if( !xSceneProperties.is() ) + return; + + bool bLightOn = false; + if( !(xSceneProperties->getPropertyValue( rLightSourceOn ) >>= bLightOn) ) + return; + + if( bLightOn ) { - bool bLightOn = false; - if( xSceneProperties->getPropertyValue( rLightSourceOn ) >>= bLightOn ) + drawing::Direction3D aLight; + if( xSceneProperties->getPropertyValue( rLightSourceDirection ) >>= aLight ) { - if( bLightOn ) - { - drawing::Direction3D aLight; - if( xSceneProperties->getPropertyValue( rLightSourceDirection ) >>= aLight ) - { - ::basegfx::B3DVector aLightVector( BaseGFXHelper::Direction3DToB3DVector( aLight ) ); - aLightVector = rRotationMatrix*aLightVector; + ::basegfx::B3DVector aLightVector( BaseGFXHelper::Direction3DToB3DVector( aLight ) ); + aLightVector = rRotationMatrix*aLightVector; - xSceneProperties->setPropertyValue( rLightSourceDirection - , uno::Any( BaseGFXHelper::B3DVectorToDirection3D( aLightVector ) ) ); - } - } + xSceneProperties->setPropertyValue( rLightSourceDirection + , uno::Any( BaseGFXHelper::B3DVectorToDirection3D( aLightVector ) ) ); } } } |