summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/qa/extras/chart2import.cxx16
-rw-r--r--chart2/qa/extras/data/xls/piechart_outside.xlsbin0 -> 60928 bytes
-rw-r--r--sc/source/filter/excel/xichart.cxx13
-rw-r--r--sc/source/filter/inc/xichart.hxx4
4 files changed, 27 insertions, 6 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index e38612724ed0..2399cf7f5034 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -93,6 +93,8 @@ public:
void testSecondaryAxisTitleDefaultRotationXLSX();
void testAxisTitleRotationXLSX();
+ void testTdf90510(); // Pie chart label placement settings(XLS)
+
void testInternalDataProvider();
CPPUNIT_TEST_SUITE(Chart2ImportTest);
@@ -147,6 +149,7 @@ public:
CPPUNIT_TEST(testAxisTitleDefaultRotationXLSX);
CPPUNIT_TEST(testSecondaryAxisTitleDefaultRotationXLSX);
CPPUNIT_TEST(testAxisTitleRotationXLSX);
+ CPPUNIT_TEST(testTdf90510);
CPPUNIT_TEST(testInternalDataProvider);
@@ -1246,6 +1249,19 @@ void Chart2ImportTest::testInternalDataProvider() {
CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("world")), xSequence[3]);
}
+void Chart2ImportTest::testTdf90510()
+{
+ load("/chart2/qa/extras/data/xls/", "piechart_outside.xls");
+ uno::Reference< chart::XChartDocument > xChart1Doc( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW );
+ CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart1Doc.is() );
+ Reference<beans::XPropertySet> xPropSet( xChart1Doc->getDiagram()->getDataPointProperties( 0, 0 ), uno::UNO_QUERY_THROW );
+ uno::Any aAny = xPropSet->getPropertyValue( "LabelPlacement" );
+ CPPUNIT_ASSERT( aAny.hasValue() );
+ sal_Int32 nLabelPlacement = 0;
+ CPPUNIT_ASSERT( aAny >>= nLabelPlacement );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Data labels should be placed outside", chart::DataLabelPlacement::OUTSIDE, nLabelPlacement );
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xls/piechart_outside.xls b/chart2/qa/extras/data/xls/piechart_outside.xls
new file mode 100644
index 000000000000..02a4f7b85549
--- /dev/null
+++ b/chart2/qa/extras/data/xls/piechart_outside.xls
Binary files differ
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index f444ab05d5cf..cb04ee83c429 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -1072,7 +1072,7 @@ void XclImpChText::ConvertNumFmt( ScfPropertySet& rPropSet, bool bPercent ) cons
mxSrcLink->ConvertNumFmt( rPropSet, bPercent );
}
-void XclImpChText::ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeInfo& rTypeInfo ) const
+void XclImpChText::ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeInfo& rTypeInfo, const ScfPropertySet* pGlobalPropSet ) const
{
// existing CHFRLABELPROPS record wins over flags from CHTEXT
sal_uInt16 nShowFlags = mxLabelProps ? mxLabelProps->mnFlags : maData.mnFlags;
@@ -1125,6 +1125,11 @@ void XclImpChText::ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeIn
case EXC_CHTEXT_POS_RIGHT: nPlacement = RIGHT; break;
case EXC_CHTEXT_POS_AUTO: nPlacement = AVOID_OVERLAP; break;
}
+ sal_Int32 nGlobalPlacement = 0;
+ if ( ( nPlacement == rTypeInfo.mnDefaultLabelPos ) && pGlobalPropSet &&
+ pGlobalPropSet->GetProperty( nGlobalPlacement, EXC_CHPROP_LABELPLACEMENT ) )
+ nPlacement = nGlobalPlacement;
+
rPropSet.SetProperty( EXC_CHPROP_LABELPLACEMENT, nPlacement );
// label number format (percentage format wins over value format)
if( bShowPercent || bShowValue )
@@ -1507,7 +1512,7 @@ void XclImpChDataFormat::UpdateTrendLineFormat()
UpdateDataLabel( nullptr );
}
-void XclImpChDataFormat::Convert( ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo ) const
+void XclImpChDataFormat::Convert( ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo, const ScfPropertySet* pGlobalPropSet ) const
{
/* Line and area format.
#i71810# If the data points are filled with bitmaps, textures, or
@@ -1530,7 +1535,7 @@ void XclImpChDataFormat::Convert( ScfPropertySet& rPropSet, const XclChExtTypeIn
if( mx3dDataFmt )
mx3dDataFmt->Convert( rPropSet );
if( mxLabel )
- mxLabel->ConvertDataLabel( rPropSet, rTypeInfo );
+ mxLabel->ConvertDataLabel( rPropSet, rTypeInfo, pGlobalPropSet );
// 3D settings
rPropSet.SetProperty< sal_Int16 >( EXC_CHPROP_PERCENTDIAGONAL, 0 );
@@ -2068,7 +2073,7 @@ Reference< XDataSeries > XclImpChSeries::CreateDataSeries() const
for( XclImpChDataFormatMap::const_iterator aIt = maPointFmts.begin(), aEnd = maPointFmts.end(); aIt != aEnd; ++aIt )
{
ScfPropertySet aPointProp = lclGetPointPropSet( xDataSeries, aIt->first );
- aIt->second->Convert( aPointProp, rTypeInfo );
+ aIt->second->Convert( aPointProp, rTypeInfo, &aSeriesProp );
}
}
return xDataSeries;
diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx
index d4be01621e23..7389226e6298 100644
--- a/sc/source/filter/inc/xichart.hxx
+++ b/sc/source/filter/inc/xichart.hxx
@@ -507,7 +507,7 @@ public:
/** Converts and writes the contained number format to the passed property set. */
void ConvertNumFmt( ScfPropertySet& rPropSet, bool bPercent ) const;
/** Converts and writes all contained data to the passed data point label property set. */
- void ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeInfo& rTypeInfo ) const;
+ void ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeInfo& rTypeInfo, const ScfPropertySet* pGlobalPropSet = nullptr ) const;
/** Creates a title text object. */
css::uno::Reference< css::chart2::XTitle >
CreateTitle() const;
@@ -665,7 +665,7 @@ public:
const XclImpChText* GetDataLabel() const { return mxLabel.get(); }
/** Converts and writes the contained data to the passed property set. */
- void Convert( ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo ) const;
+ void Convert( ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo, const ScfPropertySet* pGlobalPropSet = nullptr ) const;
/** Writes the line format only, e.g. for trend lines or error bars. */
void ConvertLine( ScfPropertySet& rPropSet, XclChObjectType eObjType ) const;
/** Writes the area format only for the series or a data point. */