summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-04-28 18:05:57 +0200
committerTomaž Vajngerl <quikee@gmail.com>2017-04-29 12:28:39 +0200
commit9e5314f19c9dcff35b5cee5c5a1b7f744e495b2e (patch)
treef6247953df15c2d606753ba09d2a13a378e1d99d /xmloff
parent0a3ded1def24194b01c9f2849ed91af4954fbb5f (diff)
tdf#107097 invoke internal DP and correctly handle "range" names
When we copy/paste a pivot chart to another (new) document, we "send" a chart data as ODC to the other document. In the new document we can't use the pivot table (as there is none in this document) so we read-in the table data from the document to the internal data provider. The problem was that we didn't match the (fake) range names from the pivot table correctly in the internal data provider and the data wasn't populated. This commit fixes that and changes the fake range names to something that is easy to parse and matches the names in internal data provider. Change-Id: I9872160cca68abd91738a25bf9b3b27bc77ce38d Reviewed-on: https://gerrit.libreoffice.org/37086 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx20
1 files changed, 15 insertions, 5 deletions
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index 1dc1c145e16e..8e264843e2dd 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -241,6 +241,13 @@ SchXMLChartContext::SchXMLChartContext( SchXMLImportHelper& rImpHelper,
SchXMLChartContext::~SchXMLChartContext()
{}
+bool lcl_hasServiceName(Reference<lang::XMultiServiceFactory> & xFactory, OUString const & rServiceName)
+{
+ const uno::Sequence<OUString> aServiceNames(xFactory->getAvailableServiceNames());
+
+ return std::find(aServiceNames.begin(), aServiceNames.end(), rServiceName) != aServiceNames.end();
+}
+
void lcl_setDataProvider(uno::Reference<chart2::XChartDocument> const & xChartDoc, OUString const & sDataPilotSource)
{
if (!xChartDoc.is())
@@ -264,21 +271,24 @@ void lcl_setDataProvider(uno::Reference<chart2::XChartDocument> const & xChartDo
if (bHasDataPilotSource)
aDataProviderServiceName = "com.sun.star.chart2.data.PivotTableDataProvider";
- const uno::Sequence<OUString> aServiceNames(xFact->getAvailableServiceNames());
-
- if (std::find(aServiceNames.begin(), aServiceNames.end(), aDataProviderServiceName) != aServiceNames.end())
+ if (lcl_hasServiceName(xFact, aDataProviderServiceName))
{
Reference<chart2::data::XDataProvider> xProvider(xFact->createInstance(aDataProviderServiceName), uno::UNO_QUERY);
if (xProvider.is())
{
- xDataReceiver->attachDataProvider(xProvider);
if (bHasDataPilotSource)
{
Reference<chart2::data::XPivotTableDataProvider> xPivotTableDataProvider(xProvider, uno::UNO_QUERY);
xPivotTableDataProvider->setPivotTableName(sDataPilotSource);
+ xDataReceiver->attachDataProvider(xProvider);
+ bHasOwnData = !xPivotTableDataProvider->hasPivotTable();
+ }
+ else
+ {
+ xDataReceiver->attachDataProvider(xProvider);
+ bHasOwnData = false;
}
- bHasOwnData = false;
}
}
}