summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-08-18 02:01:58 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-01-09 18:41:34 +0100
commitcccb58855d5093dee32f125df8dda8bbc94aa343 (patch)
treeae33c884a4e822b9f1b17e0801b601bddc52f3ae
parent3ffac303c73d4ca3fbf32d93d2b5efabeb037b4b (diff)
use orcus for table import
This is a proof of concept and shows that it is possible to partially replace the OOXML import with orcus. Change-Id: I610cec4ba4ec6f966848397ec9f0c465520a3c65
-rw-r--r--sc/source/filter/oox/worksheetfragment.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index 666550f4b7da..6e96e0f93d4b 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -44,11 +44,15 @@
#include "workbooksettings.hxx"
#include "worksheetsettings.hxx"
+#include "orcusinterface.hxx"
+#include <orcus/orcus_import_xlsx.hpp>
+
namespace oox {
namespace xls {
using namespace ::com::sun::star::table;
using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
using namespace ::oox::core;
namespace {
@@ -196,7 +200,19 @@ WorksheetFragment::WorksheetFragment( const WorksheetHelper& rHelper, const OUSt
// import data tables related to this worksheet
RelationsRef xTableRels = getRelations().getRelationsFromTypeFromOfficeDoc( "table" );
for( ::std::map< OUString, Relation >::const_iterator aIt = xTableRels->begin(), aEnd = xTableRels->end(); aIt != aEnd; ++aIt )
- importOoxFragment( new TableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
+ {
+ OUString aFragmentPath = getFragmentPathFromRelation( aIt->second );
+ uno::Reference<io::XInputStream> xStream = rHelper.getBaseFilter().openInputStream(aFragmentPath);
+ uno::Sequence<sal_Int8> aData(8000);
+ sal_Int32 nRead = 0;
+ OStringBuffer aString;
+ do {
+ nRead = xStream->readBytes(aData, 8000);
+ aString.append(OString((char*) aData.getConstArray(), nRead));
+ } while(nRead == 8000);
+ ScOrcusTable aTable(getSheetIndex());
+ orcus::import_xlsx::read_table(aString.getStr(), aString.getLength(), &aTable);
+ }
// import comments related to this worksheet
OUString aCommentsFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "comments" );