diff options
-rw-r--r-- | chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx | 4 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Tools.cxx | 1 | ||||
-rw-r--r-- | chart2/source/model/main/DataPointProperties.cxx | 3 | ||||
-rw-r--r-- | chart2/source/tools/DataSeriesHelper.cxx | 6 | ||||
-rw-r--r-- | chart2/source/view/main/VDataSeries.cxx | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/chart/ChartDataCaption.idl | 8 | ||||
-rw-r--r-- | offapi/com/sun/star/chart2/DataPointLabel.idl | 7 | ||||
-rw-r--r-- | oox/source/drawingml/chart/seriesconverter.cxx | 11 | ||||
-rw-r--r-- | sc/source/filter/excel/xichart.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/layout/data/tdf136061.docx | bin | 0 -> 25928 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 14 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLSeries2Context.cxx | 2 |
12 files changed, 49 insertions, 11 deletions
diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx index f55540f67db8..c786c1b3913c 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx @@ -71,7 +71,7 @@ sal_Int32 lcl_LabelToCaption( const chart2::DataPointLabel& rLabel ) chart2::DataPointLabel lcl_CaptionToLabel( sal_Int32 nCaption ) { - chart2::DataPointLabel aLabel(false,false,false,false); + chart2::DataPointLabel aLabel(false,false,false,false,false); if( nCaption & css::chart::ChartDataCaption::VALUE ) aLabel.ShowNumber = true; @@ -81,6 +81,8 @@ chart2::DataPointLabel lcl_CaptionToLabel( sal_Int32 nCaption ) aLabel.ShowCategoryName = true; if( nCaption & css::chart::ChartDataCaption::SYMBOL ) aLabel.ShowLegendSymbol = true; + if( nCaption & css::chart::ChartDataCaption::CUSTOM ) + aLabel.ShowCustomLabel = true; return aLabel; } diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 2d8435d9b436..3668321589db 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -761,6 +761,7 @@ bool ChartController::executeDispatch_Delete() aLabel.ShowNumberInPercent = false; aLabel.ShowCategoryName = false; aLabel.ShowLegendSymbol = false; + aLabel.ShowCustomLabel = false; if( aObjectType == OBJECTTYPE_DATA_LABELS ) { uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( aCID, getModel() )); diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx index dba488fdd924..dcc343002ffb 100644 --- a/chart2/source/model/main/DataPointProperties.cxx +++ b/chart2/source/model/main/DataPointProperties.cxx @@ -515,7 +515,8 @@ void DataPointProperties::AddDefaultsToMap( false, // ShowNumber false, // ShowNumberInPercent false, // ShowCategoryName - false // ShowLegendSymbol + false, // ShowLegendSymbol + false // ShowCustomLabel )); PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_TEXT_WORD_WRAP, false ); diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index 11f6bf2d94b3..809ba67a931e 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -170,6 +170,7 @@ void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const Reference< chart2:: { aLabel.ShowNumberInPercent = false; aLabel.ShowCategoryName = false; + aLabel.ShowCustomLabel = false; } xPointProp->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel)); } @@ -746,7 +747,7 @@ bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries ) { DataPointLabel aLabel; if( xPointProp->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel ) - bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName; + bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName || aLabel.ShowCustomLabel; if( bRet ) break; } @@ -784,7 +785,7 @@ bool hasDataLabelAtPoint( const Reference< chart2::XDataSeries >& xSeries, sal_I { DataPointLabel aLabel; if( xProp->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel ) - bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName; + bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName || aLabel.ShowCustomLabel; } } } @@ -834,6 +835,7 @@ void deleteDataLabelsFromPoint( const Reference< beans::XPropertySet >& xPointPr aLabel.ShowNumber = false; aLabel.ShowNumberInPercent = false; aLabel.ShowCategoryName = false; + aLabel.ShowCustomLabel = false; xPointProp->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel)); } } diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 91388d1c2eda..db93d255fe21 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -996,7 +996,7 @@ DataPointLabel* VDataSeries::getDataPointLabelIfLabel( sal_Int32 index ) const { DataPointLabel* pLabel = getDataPointLabel( index ); if( !pLabel || (!pLabel->ShowNumber && !pLabel->ShowNumberInPercent - && !pLabel->ShowCategoryName ) ) + && !pLabel->ShowCategoryName && !pLabel->ShowCustomLabel ) ) return nullptr; return pLabel; } diff --git a/offapi/com/sun/star/chart/ChartDataCaption.idl b/offapi/com/sun/star/chart/ChartDataCaption.idl index c0b589a2efe9..fb5da8034961 100644 --- a/offapi/com/sun/star/chart/ChartDataCaption.idl +++ b/offapi/com/sun/star/chart/ChartDataCaption.idl @@ -68,6 +68,14 @@ published constants ChartDataCaption /** The symbol of data column/row is additionally displayed in the caption. */ const long SYMBOL = 16; + + + /** The caption contains a custom text, which belongs + to a data point label. + + @since LibreOffice 7.1 + */ + const long CUSTOM = 32; }; diff --git a/offapi/com/sun/star/chart2/DataPointLabel.idl b/offapi/com/sun/star/chart2/DataPointLabel.idl index 5963e8dd93b2..f16245c8797a 100644 --- a/offapi/com/sun/star/chart2/DataPointLabel.idl +++ b/offapi/com/sun/star/chart2/DataPointLabel.idl @@ -57,6 +57,13 @@ struct DataPointLabel caption. */ boolean ShowLegendSymbol; + + /** The caption contains a custom label text, which belongs + to a data point label. + + @since LibreOffice 7.1 + */ + boolean ShowCustomLabel; }; diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index b80ea05ae481..b1b6019dfb40 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -109,7 +109,7 @@ void convertTextProperty(PropertySet& rPropSet, ObjectFormatter& rFormatter, void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatter, const DataLabelModelBase& rDataLabel, const TypeGroupConverter& rTypeGroup, - bool bDataSeriesLabel, bool bMSO2007Doc ) + bool bDataSeriesLabel, bool bCustomLabelField, bool bMSO2007Doc ) { const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo(); @@ -137,7 +137,7 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt // type of attached label if( bHasAnyElement || rDataLabel.mbDeleted ) { - DataPointLabel aPointLabel( bShowValue, bShowPercent, bShowCateg, bShowSymbol ); + DataPointLabel aPointLabel( bShowValue, bShowPercent, bShowCateg, bShowSymbol, bCustomLabelField ); rPropSet.setProperty( PROP_Label, aPointLabel ); } @@ -271,7 +271,8 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat { bool bMSO2007Doc = getFilter().isMSO2007Document(); PropertySet aPropSet( rxDataSeries->getDataPointByIndex( mrModel.mnIndex ) ); - lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false, bMSO2007Doc ); + bool bCustomLabelField = mrModel.mxText && mrModel.mxText->mxTextBody && !mrModel.mxText->mxTextBody->getParagraphs().empty(); + lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false, bCustomLabelField, bMSO2007Doc ); const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo(); bool bIsPie = rTypeInfo.meTypeCategory == TYPECATEGORY_PIE; @@ -289,7 +290,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat importFillProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper(), rHelper); } - if( mrModel.mxText && mrModel.mxText->mxTextBody && !mrModel.mxText->mxTextBody->getParagraphs().empty() ) + if( bCustomLabelField ) { css::uno::Reference< XComponentContext > xContext = getComponentContext(); uno::Sequence< css::uno::Reference< XDataPointCustomLabelField > > aSequence; @@ -405,7 +406,7 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa // tdf#132174: the inner data table has no own cell number format. if( getChartDocument()->hasInternalDataProvider() && mrModel.mobShowVal.get(!bMSO2007Doc) ) mrModel.maNumberFormat.mbSourceLinked = false; - lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, true, bMSO2007Doc ); + lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, true, false, bMSO2007Doc ); if (mrModel.mxShapeProp) { diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 4683fec797b9..43f6d7c2ccb8 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -1102,7 +1102,7 @@ void XclImpChText::ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeIn bool bShowSymbol = bShowAny && ::get_flag( maData.mnFlags, EXC_CHTEXT_SHOWSYMBOL ); // create API struct for label values, set API label separator - cssc2::DataPointLabel aPointLabel( bShowValue, bShowPercent, bShowCateg, bShowSymbol ); + cssc2::DataPointLabel aPointLabel( bShowValue, bShowPercent, bShowCateg, bShowSymbol, false ); rPropSet.SetProperty( EXC_CHPROP_LABEL, aPointLabel ); OUString aSep = mxLabelProps ? mxLabelProps->maSeparator : OUString('\n'); if( aSep.isEmpty() ) diff --git a/sw/qa/extras/layout/data/tdf136061.docx b/sw/qa/extras/layout/data/tdf136061.docx Binary files differnew file mode 100644 index 000000000000..c91e3438ffbf --- /dev/null +++ b/sw/qa/extras/layout/data/tdf136061.docx diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 5e8f2d89eed4..008419887c75 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3068,6 +3068,20 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134146) assertXPath(pXmlDoc, "//textarray", 14); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf136061) +{ + SwDoc* pDoc = createDoc("tdf136061.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; + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + // This failed, if the custom text of data label is missing. + assertXPathContent(pXmlDoc, "//textarray[16]/text", "Customlabel"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116925) { SwDoc* pDoc = createDoc("tdf116925.docx"); diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index 11031697a180..5a9ef3800060 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/chart/ChartAxisAssign.hpp> #include <com/sun/star/chart/ChartSymbolType.hpp> +#include <com/sun/star/chart/ChartDataCaption.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -1142,6 +1143,7 @@ void SchXMLSeries2Context::setStylesToDataPoints( SeriesDefaultsAndStyles& rSeri } } xPointProp->setPropertyValue("CustomLabelFields", uno::Any(xLabels)); + xPointProp->setPropertyValue("DataCaption", uno::Any(chart::ChartDataCaption::CUSTOM)); } if( seriesStyle.mCustomLabelPos[0] != 0.0 || seriesStyle.mCustomLabelPos[1] != 0.0 ) |