diff options
-rw-r--r-- | chart2/source/inc/ChartTypeHelper.hxx | 3 | ||||
-rw-r--r-- | chart2/source/tools/ChartTypeHelper.cxx | 9 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 3 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 5 | ||||
-rw-r--r-- | chart2/source/view/inc/VDataSeries.hxx | 1 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 28 | ||||
-rw-r--r-- | chart2/source/view/main/VDataSeries.cxx | 16 | ||||
-rw-r--r-- | sw/qa/extras/layout/data/testAreaChartNumberFormat.docx | bin | 0 -> 26115 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 16 |
9 files changed, 33 insertions, 48 deletions
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index c2945dfb9380..b97a256802c3 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -78,9 +78,6 @@ public: static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const css::uno::Reference< css::chart2::XChartType >& xChartType ); - static bool shouldLabelNumberFormatKeyBeDetectedFromYAxis( const css::uno::Reference< - css::chart2::XChartType >& xChartType ); - static bool isSupportingOnlyDeepStackingFor3D( const css::uno::Reference< css::chart2::XChartType >& xChartType ); }; diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 78d841755374..c8efc90b3f0f 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -657,15 +657,6 @@ OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( co return aRet; } -bool ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( const uno::Reference< XChartType >& xChartType ) -{ - bool bRet = true; - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) - bRet = false; - return bRet; -} - bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const uno::Reference< XChartType >& xChartType ) { bool bRet = false; diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 2699121ed357..89ba4db47b2f 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -724,6 +724,7 @@ void AreaChart::createShapes() if( m_nDimension==3 && m_bArea && rXSlot.m_aSeriesVector.size()!=1 ) fLogicY = fabs( fLogicY ); + double fLogicValueForLabeDisplay = fLogicY; std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex]; if (rPosHelper.isPercentY() && rLogicYSumMap[nAttachedAxisIndex] != 0.0) { @@ -751,8 +752,6 @@ void AreaChart::createShapes() if( rLogicYForNextSeriesMap.find(nAttachedAxisIndex) == rLogicYForNextSeriesMap.end() ) rLogicYForNextSeriesMap[nAttachedAxisIndex] = 0.0; - double fLogicValueForLabeDisplay = fLogicY; - fLogicY += rLogicYForNextSeriesMap[nAttachedAxisIndex]; rLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY; diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 6a3b142a0ce9..16fc40428b5a 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -367,10 +367,7 @@ OUString VSeriesPlotter::getLabelTextForValue( VDataSeries const & rDataSeries } else { - if( rDataSeries.shouldLabelNumberFormatKeyBeDetectedFromYAxis() && m_aAxesNumberFormats.hasFormat(1,rDataSeries.getAttachedAxisIndex()) ) //y-axis - nNumberFormatKey = m_aAxesNumberFormats.getFormat(1,rDataSeries.getAttachedAxisIndex()); - else - nNumberFormatKey = rDataSeries.detectNumberFormatKey( nPointIndex ); + nNumberFormatKey = rDataSeries.detectNumberFormatKey( nPointIndex ); } if(nNumberFormatKey<0) nNumberFormatKey=0; diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx index 4a20eb79bfea..b65ea66f1009 100644 --- a/chart2/source/view/inc/VDataSeries.hxx +++ b/chart2/source/view/inc/VDataSeries.hxx @@ -102,7 +102,6 @@ public: bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const; sal_Int32 getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const; sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const; - bool shouldLabelNumberFormatKeyBeDetectedFromYAxis() const; sal_Int32 getLabelPlacement( sal_Int32 nPointIndex, const css::uno::Reference<css::chart2::XChartType>& xChartType, diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 9d3bf0bb46e6..3192da14afe3 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1915,26 +1915,16 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( { uno::Reference< chart2::XChartType > xChartType( DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) ); - bool bFormatFound = false; - if( ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( xChartType ) ) - { - uno::Reference< beans::XPropertySet > xAttachedAxisProps( DiagramHelper::getAttachedAxis( xSeries, xDiagram ), uno::UNO_QUERY ); - if (xAttachedAxisProps.is() && (xAttachedAxisProps->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat)) - bFormatFound = true; - } - if( !bFormatFound ) - { - Reference< chart2::data::XDataSource > xSeriesSource( xSeries, uno::UNO_QUERY ); - OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) ); + Reference< chart2::data::XDataSource > xSeriesSource( xSeries, uno::UNO_QUERY ); + OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) ); - Reference< data::XLabeledDataSequence > xLabeledSequence( - DataSeriesHelper::getDataSequenceByRole( xSeriesSource, aRole )); - if( xLabeledSequence.is() ) - { - Reference< data::XDataSequence > xValues( xLabeledSequence->getValues() ); - if( xValues.is() ) - nFormat = xValues->getNumberFormatKeyByIndex( nPointIndex ); - } + Reference< data::XLabeledDataSequence > xLabeledSequence( + DataSeriesHelper::getDataSequenceByRole( xSeriesSource, aRole )); + if( xLabeledSequence.is() ) + { + Reference< data::XDataSequence > xValues( xLabeledSequence->getValues() ); + if( xValues.is() ) + nFormat = xValues->getNumberFormatKeyByIndex( nPointIndex ); } if (nFormat >= 0 && nOldFormat != nFormat) diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index b9ea9266abd0..003bc9cf9fe5 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -552,10 +552,14 @@ bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPerce { OUString aPropName = bForPercentage ? OUString("PercentageNumberFormat") : OUString(CHART_UNONAME_NUMFMT); bool bHasNumberFormat = false; + bool bLinkToSource = true; uno::Reference< beans::XPropertySet > xPointProp( getPropertiesOfPoint( nPointIndex )); sal_Int32 nNumberFormat = -1; - if( xPointProp.is() && (xPointProp->getPropertyValue(aPropName) >>= nNumberFormat) ) - bHasNumberFormat = true; + if( xPointProp.is() && (xPointProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource)) + { + if( !bLinkToSource && (xPointProp->getPropertyValue(aPropName) >>= nNumberFormat)) + bHasNumberFormat = true; + } return bHasNumberFormat; } sal_Int32 VDataSeries::getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const @@ -584,14 +588,6 @@ void VDataSeries::setRoleOfSequenceForDataLabelNumberFormatDetection( const OUSt else if (rRole == "values-x") m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_X; } -bool VDataSeries::shouldLabelNumberFormatKeyBeDetectedFromYAxis() const -{ - if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_Bubble_Size ) - return false; - else if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_X ) - return false; - return true; -} sal_Int32 VDataSeries::detectNumberFormatKey( sal_Int32 index ) const { sal_Int32 nRet = 0; diff --git a/sw/qa/extras/layout/data/testAreaChartNumberFormat.docx b/sw/qa/extras/layout/data/testAreaChartNumberFormat.docx Binary files differnew file mode 100644 index 000000000000..33e1c58788a5 --- /dev/null +++ b/sw/qa/extras/layout/data/testAreaChartNumberFormat.docx diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 80b0ecdac7f9..eaa790cb9878 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2515,6 +2515,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) "15"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129173) +{ + SwDoc* pDoc = createDoc("testAreaChartNumberFormat.docx"); + SwDocShell* pShell = pDoc->GetDocShell(); + + // Dump the rendering of the first page as an XML file. + std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); + MetafileXmlDump dumper; + xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + + // Check the first data label of area chart. + assertXPathContent( + pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[22]/text", "56"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116925) { SwDoc* pDoc = createDoc("tdf116925.docx"); |