diff options
-rw-r--r-- | sc/source/ui/docshell/dbdocimp.cxx | 48 | ||||
-rw-r--r-- | sc/source/ui/inc/dbdocfun.hxx | 7 |
2 files changed, 51 insertions, 4 deletions
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 4f57f96d0a87..88e7cec62946 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbdocimp.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: nn $ $Date: 2000-10-26 19:08:47 $ + * last change: $Author: nn $ $Date: 2000-11-10 19:04:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,7 @@ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> #include "dbdocfun.hxx" #include "docsh.hxx" @@ -103,6 +104,49 @@ using namespace com::sun::star; // ----------------------------------------------------------------- +// static +void ScDBDocFunc::ShowInBeamer( const ScImportParam& rParam, SfxViewFrame* pFrame ) +{ + if (!pFrame) + return; + + uno::Reference<frame::XFrame> xFrame = pFrame->GetFrame()->GetFrameInterface(); + uno::Reference<frame::XDispatchProvider> xDP(xFrame, uno::UNO_QUERY); + util::URL aURL; + aURL.Complete = rtl::OUString::createFromAscii(".component:DB/DataSourceBrowser"); + uno::Reference<frame::XDispatch> xD = xDP->queryDispatch(aURL, + rtl::OUString::createFromAscii("_beamer"), + 0x0C); + if (xD.is()) + { + uno::Sequence<beans::PropertyValue> aProperties; + + if (rParam.bImport) // called for a range with imported data? + { + sal_Int32 nType = rParam.bSql ? sdb::CommandType::COMMAND : + ( (rParam.nType == ScDbQuery) ? sdb::CommandType::QUERY : + sdb::CommandType::TABLE ); + + aProperties.realloc(3); + beans::PropertyValue* pProperties = aProperties.getArray(); + pProperties[0].Name = rtl::OUString::createFromAscii( SC_DBPROP_DATASOURCENAME ); + pProperties[0].Value <<= rtl::OUString( rParam.aDBName ); + pProperties[1].Name = rtl::OUString::createFromAscii( SC_DBPROP_COMMAND ); + pProperties[1].Value <<= rtl::OUString( rParam.aStatement ); + pProperties[2].Name = rtl::OUString::createFromAscii( SC_DBPROP_COMMANDTYPE ); + pProperties[2].Value <<= nType; + } + //! else address book? + + xD->dispatch(aURL, aProperties); + } + else + DBG_ERROR("no dispatcher for the database URL!"); +} + + +// ----------------------------------------------------------------- + BOOL ScDBDocFunc::DoImport( USHORT nTab, const ScImportParam& rParam, const SbaSelectionList* pSelection, BOOL bRecord, BOOL bAddrInsert ) diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx index 6daabeb4254e..b571de46cca1 100644 --- a/sc/source/ui/inc/dbdocfun.hxx +++ b/sc/source/ui/inc/dbdocfun.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dbdocfun.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:58 $ + * last change: $Author: nn $ $Date: 2000-11-10 19:02:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,6 +73,7 @@ struct ScQueryParam; struct ScSortParam; struct ScSubTotalParam; +class SfxViewFrame; class SbaSelectionList; class ScDBData; class ScDocShell; @@ -100,6 +101,8 @@ public: const SbaSelectionList* pSelection, BOOL bRecord, BOOL bAddrInsert = FALSE ); + static void ShowInBeamer( const ScImportParam& rParam, SfxViewFrame* pFrame ); + BOOL Sort( USHORT nTab, const ScSortParam& rSortParam, BOOL bRecord, BOOL bPaint, BOOL bApi ); |