summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@suse.com>2013-07-18 14:04:32 +0530
committerMuthu Subramanian <sumuthu@suse.com>2013-07-18 14:06:07 +0530
commit675a50a26390fc7c98c107ec6728ccfdc32ec5c0 (patch)
treed86c113012f10f7e273c3bcfa64e0e30f6df2afe /oox
parent8bb2c7f1556c10508c8ac451c579539ccf5dacfb (diff)
n#819822: XLSX Chart import with internal data table.
When the import with xlsx ranges fail - try with internal data table. Ported from: 7da06efd74be6500895bab6e5e8ed485914ff45e and: da4ec594da45210a1f97d31ecb3e7f9c127954e5
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/core/xmlfilterbase.hxx3
-rw-r--r--oox/source/drawingml/shape.cxx15
2 files changed, 18 insertions, 0 deletions
diff --git a/oox/inc/oox/core/xmlfilterbase.hxx b/oox/inc/oox/core/xmlfilterbase.hxx
index bf066fdfddb3..f75c69d8c05c 100644
--- a/oox/inc/oox/core/xmlfilterbase.hxx
+++ b/oox/inc/oox/core/xmlfilterbase.hxx
@@ -90,6 +90,9 @@ public:
converter object, that should be global per imported document. */
virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() = 0;
+ /** Helper to switch chart data table - specifically for xlsx imports */
+ virtual void useInternalChartDataTable( bool /*bInternal*/ ) { }
+
/** Has to be implemented by each filter to return the table style list. */
virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 8a4cdcacd19b..6c30d12a079f 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -52,6 +52,7 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <com/sun/star/document/XActionLockable.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
using rtl::OUString;
using namespace ::oox::core;
@@ -695,7 +696,21 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >&
if( !mxChartShapeInfo->mbEmbedShapes )
xExternalPage = rxShapes;
if( rFilter.getChartConverter() )
+ {
rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
+ if( !xChartDoc->hasInternalDataProvider() )
+ {
+ Reference< chart2::data::XDataReceiver > xDataRec( xChartDoc, UNO_QUERY );
+ Reference< chart2::data::XDataSource > xData( xDataRec->getUsedData(), UNO_QUERY );
+ if( xData->getDataSequences().getLength() <= 0 || xData->getDataSequences()[0]->getValues()->getData().getLength() <= 0 )
+ {
+ rFilter.useInternalChartDataTable( true );
+ rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
+ rFilter.useInternalChartDataTable( false );
+ }
+ }
+
+ }
}
catch( Exception& )
{