Kaydet (Commit) ccce242c authored tarafından Daniel Bankston's avatar Daniel Bankston Kaydeden (comit) Kohei Yoshida

Convert xlsx unnamed database range import to direct sc

Will evaluate later if further conversion is useful here

Change-Id: I6af5296b95075066335783e371d87be15f09f112
üst 5d906574
...@@ -494,7 +494,7 @@ public: ...@@ -494,7 +494,7 @@ public:
}; };
class ScDatabaseRangeObj : public cppu::WeakImplHelper6< class SC_DLLPUBLIC ScDatabaseRangeObj : public cppu::WeakImplHelper6<
com::sun::star::sheet::XDatabaseRange, com::sun::star::sheet::XDatabaseRange,
com::sun::star::util::XRefreshable, com::sun::star::util::XRefreshable,
com::sun::star::container::XNamed, com::sun::star::container::XNamed,
......
...@@ -76,6 +76,10 @@ ...@@ -76,6 +76,10 @@
#include "rangenam.hxx" #include "rangenam.hxx"
#include "tokenarray.hxx" #include "tokenarray.hxx"
#include "tokenuno.hxx" #include "tokenuno.hxx"
#include "convuno.hxx"
#include "dbdata.hxx"
#include "datauno.hxx"
#include "globalnames.hxx"
#include "formulabuffer.hxx" #include "formulabuffer.hxx"
namespace oox { namespace oox {
...@@ -464,12 +468,20 @@ Reference< XDatabaseRange > WorkbookGlobals::createUnnamedDatabaseRangeObject( c ...@@ -464,12 +468,20 @@ Reference< XDatabaseRange > WorkbookGlobals::createUnnamedDatabaseRangeObject( c
// create database range and insert it into the Calc document // create database range and insert it into the Calc document
Reference< XDatabaseRange > xDatabaseRange; Reference< XDatabaseRange > xDatabaseRange;
PropertySet aDocProps( mxDoc );
Reference< XUnnamedDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_UnnamedDatabaseRanges ), UNO_QUERY_THROW );
if( bValidRange ) try if( bValidRange ) try
{ {
xDatabaseRanges->setByTable( aDestRange ); ScDocument& rDoc = getScDocument();
xDatabaseRange.set( xDatabaseRanges->getByTable( aDestRange.Sheet ), UNO_QUERY ); 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& ) catch( Exception& )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment