summaryrefslogtreecommitdiff
path: root/sc/source/filter/oox/workbookhelper.cxx
diff options
context:
space:
mode:
authorDaniel Bankston <daniel.e.bankston@gmail.com>2012-08-07 04:21:54 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-08-23 11:49:57 -0400
commitccce242c3a8892f1bc5b649ca43a544cdced28d9 (patch)
tree33c2eebc92ceba88658e7388405f5d42bff3cd06 /sc/source/filter/oox/workbookhelper.cxx
parent5d906574f2e7a7c7dd3ba166e3b1a58fdba0d5b8 (diff)
Convert xlsx unnamed database range import to direct sc
Will evaluate later if further conversion is useful here Change-Id: I6af5296b95075066335783e371d87be15f09f112
Diffstat (limited to 'sc/source/filter/oox/workbookhelper.cxx')
-rw-r--r--sc/source/filter/oox/workbookhelper.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 701b2b8075e0..7d6aa77d7974 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -76,6 +76,10 @@
#include "rangenam.hxx"
#include "tokenarray.hxx"
#include "tokenuno.hxx"
+#include "convuno.hxx"
+#include "dbdata.hxx"
+#include "datauno.hxx"
+#include "globalnames.hxx"
#include "formulabuffer.hxx"
namespace oox {
@@ -464,12 +468,20 @@ Reference< XDatabaseRange > WorkbookGlobals::createUnnamedDatabaseRangeObject( c
// create database range and insert it into the Calc document
Reference< XDatabaseRange > xDatabaseRange;
- PropertySet aDocProps( mxDoc );
- Reference< XUnnamedDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_UnnamedDatabaseRanges ), UNO_QUERY_THROW );
if( bValidRange ) try
{
- xDatabaseRanges->setByTable( aDestRange );
- xDatabaseRange.set( xDatabaseRanges->getByTable( aDestRange.Sheet ), UNO_QUERY );
+ ScDocument& rDoc = getScDocument();
+ if( rDoc.GetTableCount() <= aDestRange.Sheet )
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ ScRange aScRange;
+ ScUnoConversion::FillScRange(aScRange, aDestRange);
+ ScDBData* pNewDBData = new ScDBData( STR_DB_LOCAL_NONAME, aScRange.aStart.Tab(),
+ aScRange.aStart.Col(), aScRange.aStart.Row(),
+ aScRange.aEnd.Col(), aScRange.aEnd.Row() );
+ rDoc.SetAnonymousDBData( aScRange.aStart.Tab() , pNewDBData );
+ ScDocShell* pDocSh = static_cast< ScDocShell* >(rDoc.GetDocumentShell());
+ ScDatabaseRangeObj* pDBRangeObj = new ScDatabaseRangeObj( pDocSh, aScRange.aStart.Tab() );
+ xDatabaseRange.set( pDBRangeObj );
}
catch( Exception& )
{