summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-11-28 02:40:30 +0100
committerEike Rathke <erack@redhat.com>2011-11-28 15:25:31 +0100
commit7e8eb75aea745146d7d12df70c4f5ca8f3648ed3 (patch)
tree725e2588b0eeeb1a3c7e22d26c294d9f59e1d2cc /sc/source
parent6b0c4cd205ee5134765955024cd727f1a23f2c24 (diff)
dr78: #i116426# use ODataAccessDescriptor for database import parameters, support bookmarks for selection
# HG changeset patch # User Niklas Nebel <nn@openoffice.org> # Date 1294842009 -3600 # Node ID e25621ed7fd31753eea52ee5ff3f0a6d170db9a9 # Parent 5ea5624904a5aa39bb40ce197c80a0a41f40b873
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/app/typemap.cxx1
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx37
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx158
-rw-r--r--sc/source/ui/docshell/docsh4.cxx52
-rw-r--r--sc/source/ui/docshell/docsh5.cxx4
-rw-r--r--sc/source/ui/inc/dbdocfun.hxx19
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx3
-rw-r--r--sc/source/ui/unoobj/datauno.cxx3
-rw-r--r--sc/source/ui/view/dbfunc.cxx3
-rw-r--r--sc/source/ui/view/viewfun5.cxx23
10 files changed, 115 insertions, 188 deletions
diff --git a/sc/source/ui/app/typemap.cxx b/sc/source/ui/app/typemap.cxx
index e250fec93ae2..1d4c3a05698a 100644
--- a/sc/source/ui/app/typemap.cxx
+++ b/sc/source/ui/app/typemap.cxx
@@ -124,6 +124,7 @@
#include <svl/aeitem.hxx>
#include <avmedia/mediaitem.hxx>
+#include <sfx2/frame.hxx>
#include "attrib.hxx"
#define SvxDrawToolItem SfxAllEnumItem
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 623ecce9fc77..0461d2b35686 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -34,8 +34,9 @@
#include <sfx2/app.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/waitobj.hxx>
+#include <svx/dataaccessdescriptor.hxx>
-#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
#include "dbdocfun.hxx"
#include "sc.hrc"
@@ -60,6 +61,8 @@
#include "queryentry.hxx"
#include "markdata.hxx"
+using namespace ::com::sun::star;
+
// -----------------------------------------------------------------
bool ScDBDocFunc::AddDBRange( const ::rtl::OUString& rName, const ScRange& rRange, sal_Bool /* bApi */ )
@@ -1450,15 +1453,11 @@ sal_Bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pN
//==================================================================
//
-// Datenbank-Import...
+// database import
-void ScDBDocFunc::UpdateImport( const String& rTarget, const String& rDBName,
- const String& rTableName, const String& rStatement, bool bNative,
- sal_uInt8 nType, const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XResultSet >& xResultSet,
- const std::vector<sal_Int32> *pSelection )
+void ScDBDocFunc::UpdateImport( const String& rTarget, const svx::ODataAccessDescriptor& rDescriptor )
{
- // Target ist jetzt einfach der Bereichsname
+ // rTarget is the name of a database range
ScDocument* pDoc = rDocShell.GetDocument();
ScDBCollection& rDBColl = *pDoc->GetDBCollection();
@@ -1479,15 +1478,21 @@ void ScDBDocFunc::UpdateImport( const String& rTarget, const String& rDBName,
ScImportParam aImportParam;
pData->GetImportParam( aImportParam );
- bool bSql = (rStatement.Len() != 0);
-
- aImportParam.aDBName = rDBName;
- aImportParam.bSql = bSql;
- aImportParam.aStatement = bSql ? rStatement : rTableName;
- aImportParam.bNative = bNative;
- aImportParam.nType = nType;
+ rtl::OUString sDBName;
+ rtl::OUString sDBTable;
+ sal_Int32 nCommandType = 0;
+ rDescriptor[svx::daDataSource] >>= sDBName;
+ rDescriptor[svx::daCommand] >>= sDBTable;
+ rDescriptor[svx::daCommandType] >>= nCommandType;
+
+ aImportParam.aDBName = sDBName;
+ aImportParam.bSql = ( nCommandType == sdb::CommandType::COMMAND );
+ aImportParam.aStatement = sDBTable;
+ aImportParam.bNative = false;
+ aImportParam.nType = static_cast<sal_uInt8>( ( nCommandType == sdb::CommandType::QUERY ) ? ScDbQuery : ScDbTable );
aImportParam.bImport = true;
- bool bContinue = DoImport( nTab, aImportParam, xResultSet, pSelection, sal_True );
+
+ bool bContinue = DoImport( nTab, aImportParam, &rDescriptor, true );
// DB-Operationen wiederholen
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 5ccd9ef258c7..829d36e5beb3 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
@@ -63,6 +64,7 @@
#include "dbdocutl.hxx"
#include "editable.hxx"
#include "hints.hxx"
+#include "miscuno.hxx"
#include "chgtrack.hxx"
using namespace com::sun::star;
@@ -119,99 +121,22 @@ void ScDBDocFunc::ShowInBeamer( const ScImportParam& rParam, SfxViewFrame* pFram
bool ScDBDocFunc::DoImportUno( const ScAddress& rPos,
const uno::Sequence<beans::PropertyValue>& aArgs )
{
- bool bDone = false;
+ svx::ODataAccessDescriptor aDesc( aArgs ); // includes selection and result set
- ScImportParam aImParam;
- aImParam.nCol1 = aImParam.nCol2 = rPos.Col();
- aImParam.nRow1 = aImParam.nRow2 = rPos.Row();
- aImParam.bImport = true;
+ // create database range
+ ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP );
+ DBG_ASSERT(pDBData, "can't create DB data");
+ String sTarget = pDBData->GetName();
- uno::Reference<sdbc::XResultSet> xResSet;
- uno::Sequence<uno::Any> aSelection;
-
- rtl::OUString aStrVal;
- const beans::PropertyValue* pPropArray = aArgs.getConstArray();
- long nPropCount = aArgs.getLength();
- long i;
- for (i = 0; i < nPropCount; i++)
- {
- const beans::PropertyValue& rProp = pPropArray[i];
- String aPropName = rProp.Name;
-
- if ( aPropName.EqualsAscii( SC_DBPROP_DATASOURCENAME ))
- {
- if ( rProp.Value >>= aStrVal )
- aImParam.aDBName = aStrVal;
- }
- else if ( aPropName.EqualsAscii( SC_DBPROP_COMMAND ))
- {
- if ( rProp.Value >>= aStrVal )
- aImParam.aStatement = aStrVal;
- }
- else if ( aPropName.EqualsAscii( SC_DBPROP_COMMANDTYPE ))
- {
- sal_Int32 nType = 0;
- if ( rProp.Value >>= nType )
- {
- aImParam.bSql = ( nType == sdb::CommandType::COMMAND );
- aImParam.nType = sal::static_int_cast<sal_uInt8>( ( nType == sdb::CommandType::QUERY ) ? ScDbQuery : ScDbTable );
- // nType is ignored if bSql is set
- }
- }
- else if ( aPropName.EqualsAscii( SC_DBPROP_SELECTION ))
- {
- rProp.Value >>= aSelection;
- }
- else if ( aPropName.EqualsAscii( SC_DBPROP_CURSOR ))
- {
- rProp.Value >>= xResSet;
- }
- }
-
- std::vector<sal_Int32> aList;
- long nSelLen = aSelection.getLength();
- for (i = 0; i < nSelLen; i++)
- {
- sal_Int32 nEntry = 0;
- if ( aSelection[i] >>= nEntry )
- aList.push_back( nEntry );
- }
-
- bool bAddrInsert = false; //!???
- if ( bAddrInsert )
- {
- bDone = DoImport( rPos.Tab(), aImParam, xResSet, &aList, sal_True, bAddrInsert );
- }
- else
- {
- // create database range
- //! merge this with SID_SBA_IMPORT execute in docsh4.cxx
-
- ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP );
- OSL_ENSURE(pDBData, "can't create DB data");
- String sTarget = pDBData->GetName();
-
- //! change UpdateImport to use only one of rTableName, rStatement
-
- String aTableName, aStatement;
- if ( aImParam.bSql )
- aStatement = aImParam.aStatement;
- else
- aTableName = aImParam.aStatement;
+ UpdateImport( sTarget, aDesc );
- UpdateImport( sTarget, aImParam.aDBName, aTableName, aStatement,
- aImParam.bNative, aImParam.nType, xResSet, &aList );
- bDone = true;
- }
-
- return bDone;
+ return true;
}
// -----------------------------------------------------------------
bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
- const uno::Reference< sdbc::XResultSet >& xResultSet,
- const std::vector<sal_Int32> *pSelection, bool bRecord, bool bAddrInsert )
+ const svx::ODataAccessDescriptor* pDescriptor, bool bRecord, bool bAddrInsert )
{
ScDocument* pDoc = rDocShell.GetDocument();
ScChangeTrack *pChangeTrack = NULL;
@@ -251,17 +176,34 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
sal_Bool bDoSelection = false;
sal_Bool bRealSelection = false; // sal_True if not everything is selected
- sal_uLong nListPos = 0;
- sal_uLong nRowsRead = 0;
- sal_uLong nListCount = 0;
+ sal_Bool bBookmarkSelection = sal_False;
+ sal_Int32 nListPos = 0;
+ sal_Int32 nRowsRead = 0;
+ sal_Int32 nListCount = 0;
- // -1 is special
- if ( !pSelection->empty() && (*pSelection)[0] != -1 )
+ uno::Sequence<uno::Any> aSelection;
+ if ( pDescriptor && pDescriptor->has(svx::daSelection) )
{
- bDoSelection = sal_True;
- nListCount = pSelection->size();
+ (*pDescriptor)[svx::daSelection] >>= aSelection;
+ nListCount = aSelection.getLength();
+ if ( nListCount > 0 )
+ {
+ bDoSelection = true;
+ if ( pDescriptor->has(svx::daBookmarkSelection) )
+ bBookmarkSelection = ScUnoHelpFunctions::GetBoolFromAny( (*pDescriptor)[svx::daBookmarkSelection] );
+ if ( bBookmarkSelection )
+ {
+ // From bookmarks, there's no way to detect if all records are selected.
+ // Rely on base to pass no selection in that case.
+ bRealSelection = true;
+ }
+ }
}
+ uno::Reference<sdbc::XResultSet> xResultSet;
+ if ( pDescriptor && pDescriptor->has(svx::daCursor) )
+ xResultSet.set((*pDescriptor)[svx::daCursor], uno::UNO_QUERY);
+
// ImportDoc - also used for Redo
ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO );
pImportDoc->InitUndo( pDoc, nTab, nTab );
@@ -345,6 +287,17 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
//! error message
}
+ uno::Reference<sdbcx::XRowLocate> xLocate;
+ if ( bBookmarkSelection )
+ {
+ xLocate.set( xRowSet, uno::UNO_QUERY );
+ if ( !xLocate.is() )
+ {
+ DBG_ERRORFILE("can't get XRowLocate");
+ bDoSelection = bRealSelection = bBookmarkSelection = sal_False;
+ }
+ }
+
uno::Reference<sdbc::XRow> xRow( xRowSet, uno::UNO_QUERY );
if ( nColCount > 0 && xRow.is() )
{
@@ -388,16 +341,25 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
{
if (nListPos < nListCount)
{
- sal_uInt32 nNextRow = (*pSelection)[nListPos];
- if ( nRowsRead+1 < nNextRow )
- bRealSelection = sal_True;
- bEnd = !xRowSet->absolute(nRowsRead = nNextRow);
+ if ( bBookmarkSelection )
+ {
+ bEnd = !xLocate->moveToBookmark(aSelection[nListPos]);
+ }
+ else // use record numbers
+ {
+ sal_Int32 nNextRow = 0;
+ aSelection[nListPos] >>= nNextRow;
+ if ( nRowsRead+1 < nNextRow )
+ bRealSelection = true;
+ bEnd = !xRowSet->absolute(nRowsRead = nNextRow);
+ }
++nListPos;
}
else
{
- bRealSelection = xRowSet->next();
- bEnd = sal_True; // more data available but not used
+ if ( !bBookmarkSelection && xRowSet->next() )
+ bRealSelection = true; // more data available but not used
+ bEnd = true;
}
}
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 39fae9cf7b5c..1fbaa783f502 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -30,7 +30,7 @@
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
-
+
using namespace ::com::sun::star;
@@ -56,6 +56,7 @@ using namespace ::com::sun::star;
#include <vcl/msgbox.hxx>
#include <vcl/waitobj.hxx>
#include <tools/multisel.hxx>
+#include <svx/dataaccessdescriptor.hxx>
#include <svx/drawitem.hxx>
#include <svx/fmview.hxx>
#include <svx/pageitem.hxx>
@@ -193,19 +194,21 @@ void ScDocShell::Execute( SfxRequest& rReq )
}
break;
-
- // SID_SBA_QRY_CHANGETARGET gibts nicht mehr - auch in idl raus
-
case SID_SBA_IMPORT:
{
if (pReqArgs)
{
- const sal_Unicode cSbaSep = 11; // Trennzeichen
-
const SfxPoolItem* pItem;
- String sSbaData, sTarget;
- if ( pReqArgs->GetItemState( nSlot, sal_True, &pItem ) == SFX_ITEM_SET )
- sSbaData = ((const SfxStringItem*)pItem)->GetValue();
+ svx::ODataAccessDescriptor aDesc;
+ if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SFX_ITEM_SET )
+ {
+ uno::Any aAny = static_cast<const SfxUsrAnyItem*>(pItem)->GetValue();
+ uno::Sequence<beans::PropertyValue> aProperties;
+ if ( aAny >>= aProperties )
+ aDesc.initializeFrom( aProperties );
+ }
+
+ String sTarget;
if ( pReqArgs->GetItemState( FN_PARAM_1, sal_True, &pItem ) == SFX_ITEM_SET )
sTarget = ((const SfxStringItem*)pItem)->GetValue();
@@ -213,33 +216,6 @@ void ScDocShell::Execute( SfxRequest& rReq )
if ( pReqArgs->GetItemState( FN_PARAM_2, sal_True, &pItem ) == SFX_ITEM_SET )
bIsNewArea = ((const SfxBoolItem*)pItem)->GetValue();
- ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XResultSet > xResultSet;
- if ( pReqArgs->GetItemState( FN_PARAM_3, false, &pItem ) == SFX_ITEM_SET && pItem )
- xResultSet.set(((const SfxUsrAnyItem*)pItem)->GetValue(),::com::sun::star::uno::UNO_QUERY);
-
- String sDBName = sSbaData.GetToken(0,cSbaSep); // Datenbankname
- String sDBTable = sSbaData.GetToken(1,cSbaSep); // Tabellen- oder Query-Name
- String sTabFlag = sSbaData.GetToken(2,cSbaSep);
- String sDBSql = sSbaData.GetToken(3,cSbaSep); // SQL im Klartext
-
- sal_uInt8 nType = ScDbTable; // "0" oder "1"
- if ( sTabFlag.EqualsAscii("0") ) // "0" = Query, "1" = Table (Default)
- nType = ScDbQuery;
-
- std::vector<sal_Int32> aSelectionList;
- xub_StrLen nCount = sSbaData.GetTokenCount(cSbaSep);
-
- for (xub_StrLen i = 4; i < nCount; i++)
- {
- String aSelItem = sSbaData.GetToken(i,cSbaSep);
- if (aSelItem.Len())
- {
- sal_uInt32 nValue = aSelItem.ToInt32();
- aSelectionList.push_back(nValue);
- }
- }
-
// bei Bedarf neuen Datenbankbereich anlegen
bool bMakeArea = false;
if (bIsNewArea)
@@ -279,9 +255,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
if (bDo)
{
- ScDBDocFunc(*this).UpdateImport( sTarget, sDBName,
- sDBTable, sDBSql, true, nType, xResultSet,
- &aSelectionList );
+ ScDBDocFunc(*this).UpdateImport( sTarget, aDesc );
rReq.Done();
// UpdateImport aktualisiert auch die internen Operationen
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 28948b9fc160..d0535614cdd4 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -40,7 +40,6 @@
#include <sfx2/bindings.hxx>
#include <svl/smplhint.hxx>
-#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
// INCLUDE ---------------------------------------------------------------
@@ -1014,8 +1013,7 @@ IMPL_LINK( ScDocShell, RefreshDBDataHdl, ScRefreshTimer*, pRefreshTimer )
{
ScRange aRange;
pDBData->GetArea( aRange );
- Reference< ::com::sun::star::sdbc::XResultSet> xResultSet;
- bContinue = aFunc.DoImport( aRange.aStart.Tab(), aImportParam, xResultSet, NULL, true, false ); //! Api-Flag as parameter
+ bContinue = aFunc.DoImport( aRange.aStart.Tab(), aImportParam, NULL, true, false ); //! Api-Flag as parameter
// internal operations (sort, query, subtotal) only if no error
if (bContinue)
{
diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx
index ac0ed5865437..83996ccb3517 100644
--- a/sc/source/ui/inc/dbdocfun.hxx
+++ b/sc/source/ui/inc/dbdocfun.hxx
@@ -41,7 +41,6 @@ struct ScSortParam;
struct ScSubTotalParam;
class SfxViewFrame;
-class SbaSelectionList;
class ScDBData;
class ScDocShell;
class ScAddress;
@@ -52,11 +51,12 @@ namespace com { namespace sun { namespace star {
namespace beans {
struct PropertyValue;
}
- namespace sdbc {
- class XResultSet;
- }
} } }
+namespace svx {
+ class ODataAccessDescriptor;
+}
+
class ScDBDocFunc
{
friend class ScDBFunc;
@@ -68,16 +68,11 @@ public:
ScDBDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {}
~ScDBDocFunc() {}
- void UpdateImport( const String& rTarget, const String& rDBName,
- const String& rTableName, const String& rStatement,
- bool bNative, sal_uInt8 nType,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::sdbc::XResultSet >& xResultSet,
- const std::vector<sal_Int32> *pSelection );
+ void UpdateImport( const String& rTarget, const svx::ODataAccessDescriptor& rDescriptor );
bool DoImport( SCTAB nTab, const ScImportParam& rParam,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& xResultSet,
- const std::vector<sal_Int32> *pSelection, bool bRecord,
+ const svx::ODataAccessDescriptor* pDescriptor, // used for selection and existing ResultSet
+ bool bRecord,
bool bAddrInsert = false );
bool DoImportUno( const ScAddress& rPos,
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 4c21708ecf28..fc90a3aca28e 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5911,12 +5911,11 @@ void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue
aParam.nRow2 = aRange.aEnd.Row();
//! TODO: could we get passed a valid result set by any means?
- uno::Reference< sdbc::XResultSet > xResultSet;
pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein
- aFunc.DoImport( nTab, aParam, xResultSet, NULL, sal_True, false ); //! Api-Flag als Parameter
+ aFunc.DoImport( nTab, aParam, NULL, true ); //! Api-Flag as parameter
}
}
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 3172d26ffec3..5b10f132a311 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1850,8 +1850,7 @@ void SAL_CALL ScDatabaseRangeObj::refresh() throw(uno::RuntimeException)
SCCOL nDummyCol;
SCROW nDummyRow;
pData->GetArea( nTab, nDummyCol,nDummyRow,nDummyCol,nDummyRow );
- uno::Reference< sdbc::XResultSet > xResultSet;
- bContinue = aFunc.DoImport( nTab, aImportParam, xResultSet, NULL, sal_True, false ); //! Api-Flag als Parameter
+ bContinue = aFunc.DoImport( nTab, aImportParam, NULL, true ); //! Api-Flag as parameter
}
// interne Operationen (sort, query, subtotal) nur, wenn kein Fehler
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index b401465c819a..5979ea078a44 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -517,8 +517,7 @@ sal_Bool ScDBFunc::ImportData( const ScImportParam& rParam, sal_Bool bRecord )
}
ScDBDocFunc aDBDocFunc( *GetViewData()->GetDocShell() );
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet;
- return aDBDocFunc.DoImport( GetViewData()->GetTabNo(), rParam, xResultSet, NULL, bRecord );
+ return aDBDocFunc.DoImport( GetViewData()->GetTabNo(), rParam, NULL, bRecord );
}
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 89f00c896e57..eae13290a649 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -373,10 +373,15 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
{
// import of database data into table
- String sDataDesc;
- if ( aDataHelper.GetString( nFormatId, sDataDesc ) )
+ const DataFlavorExVector& rVector = aDataHelper.GetDataFlavorExVector();
+ if ( svx::ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) )
{
- SfxStringItem aDataDesc(SID_SBA_IMPORT, sDataDesc);
+ // transport the whole ODataAccessDescriptor as slot parameter
+ svx::ODataAccessDescriptor aDesc = svx::ODataAccessObjectTransferable::extractObjectDescriptor(aDataHelper);
+ uno::Any aDescAny;
+ uno::Sequence<beans::PropertyValue> aProperties = aDesc.createPropertyValueSequence();
+ aDescAny <<= aProperties;
+ SfxUsrAnyItem aDataDesc(SID_SBA_IMPORT, aDescAny);
ScDocShell* pDocSh = GetViewData()->GetDocShell();
SCTAB nTab = GetViewData()->GetTabNo();
@@ -400,20 +405,10 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
sal_Bool bAreaIsNew = !pDBData;
SfxBoolItem aAreaNew(FN_PARAM_2, bAreaIsNew);
- ::svx::ODataAccessDescriptor aDesc;
- DataFlavorExVector& rVector = aDataHelper.GetDataFlavorExVector();
- ::std::auto_ptr<SfxUsrAnyItem> pCursorItem;
- if ( ::svx::ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) )
- {
- aDesc = ::svx::ODataAccessObjectTransferable::extractObjectDescriptor(aDataHelper);
- if ( aDesc.has(::svx::daCursor) )
- pCursorItem.reset(new SfxUsrAnyItem(FN_PARAM_3, aDesc[::svx::daCursor]));
- }
-
// asynchronous, to avoid doing the whole import in drop handler
SfxDispatcher& rDisp = GetViewData()->GetDispatcher();
rDisp.Execute(SID_SBA_IMPORT, SFX_CALLMODE_ASYNCHRON,
- &aDataDesc, &aTarget, &aAreaNew, pCursorItem.get(), (void*)0 );
+ &aDataDesc, &aTarget, &aAreaNew, (void*)0 );
bRet = sal_True;
}