diff options
author | Ocke Janssen <oj@openoffice.org> | 2000-11-23 09:46:21 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2000-11-23 09:46:21 +0000 |
commit | 1aeb9d7c869d458b244b2e7605ea0e383879f7fa (patch) | |
tree | 15ad8b80b539e95381cb8e25714973126fe3a8d3 /dbaccess/source/ui/browser | |
parent | 428e9a50248650d5fedf4759aae1b523645fd355 (diff) |
#80227# display a datasource when given
Diffstat (limited to 'dbaccess/source/ui/browser')
-rw-r--r-- | dbaccess/source/ui/browser/brwctrlr.cxx | 37 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dbloader.cxx | 19 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dbtreeview.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dbtreeview.hxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/unodatbr.cxx | 49 |
5 files changed, 92 insertions, 25 deletions
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 1cd2db590500..dc1d6bfefa48 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: brwctrlr.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: fs $ $Date: 2000-11-14 14:22:04 $ + * last change: $Author: oj $ $Date: 2000-11-23 10:45:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -617,25 +617,36 @@ void SAL_CALL SbaXDataBrowserController::initialize( const Sequence< Any >& aArg Reference< ::com::sun::star::awt::XWindow > xParent; Reference< ::com::sun::star::frame::XFrame > xFrame; + PropertyValue aValue; const Any* pBegin = aArguments.getConstArray(); const Any* pEnd = pBegin + aArguments.getLength(); + + ::rtl::OUString aFrameName = ::rtl::OUString::createFromAscii("Frame"); for(;pBegin != pEnd;++pBegin) { - if((*pBegin >>= xFrame) && xFrame.is()) + if((*pBegin >>= aValue) && aValue.Name == aFrameName) { - xParent = xFrame->getContainerWindow(); - VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(xParent); - Window* pParentWin = pParentComponent ? pParentComponent->GetWindow() : NULL; - if (!pParentWin) + if((aValue.Value >>= xFrame) && xFrame.is()) { - throw Exception(::rtl::OUString::createFromAscii("Parent window is null"),*this); - } + xParent = xFrame->getContainerWindow(); + VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(xParent); + Window* pParentWin = pParentComponent ? pParentComponent->GetWindow() : NULL; + if (!pParentWin) + { + throw Exception(::rtl::OUString::createFromAscii("Parent window is null"),*this); + } - if(xFrame.is() && Construct(pParentWin)) + if(xFrame.is() && Construct(pParentWin)) + { + xFrame->setComponent(getContent()->GetWindowPeer(), this); + attachFrame(xFrame); + pParentComponent->setVisible(sal_True); + } + break; // no more needed here + } + else { - xFrame->setComponent(getContent()->GetWindowPeer(), this); - attachFrame(xFrame); - pParentComponent->setVisible(sal_True); + OSL_ENSHURE(0,"SbaXDataBrowserController::initialize: Frame is null!"); } } } diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index c4d254c47968..f317684ae0ac 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbloader.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: fs $ $Date: 2000-11-08 09:27:29 $ + * last change: $Author: oj $ $Date: 2000-11-23 10:45:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -249,8 +249,19 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: try { Reference<XInitialization > xIni(xController,UNO_QUERY); - Sequence< Any> aArgs(1); - aArgs[0] <<= rFrame; + PropertyValue aFrame(::rtl::OUString::createFromAscii("Frame"),0,makeAny(rFrame),PropertyState_DIRECT_VALUE); + Sequence< Any > aArgs(m_aArgs.getLength()+1); + + Any* pBegin = aArgs.getArray(); + Any* pEnd = pBegin + aArgs.getLength(); + *pBegin <<= aFrame; + const PropertyValue* pIter = m_aArgs.getConstArray(); + const PropertyValue* pIterEnd = pIter + m_aArgs.getLength(); + for(++pBegin;pBegin != pEnd;++pBegin) + { + *pBegin <<= *pIter; + } + xIni->initialize(aArgs); } catch(Exception&) diff --git a/dbaccess/source/ui/browser/dbtreeview.cxx b/dbaccess/source/ui/browser/dbtreeview.cxx index 63727097b217..840abec0e3b4 100644 --- a/dbaccess/source/ui/browser/dbtreeview.cxx +++ b/dbaccess/source/ui/browser/dbtreeview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbtreeview.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: fs $ $Date: 2000-11-10 13:53:55 $ + * last change: $Author: oj $ $Date: 2000-11-23 10:45:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -141,7 +141,7 @@ void DBTreeView::setModel(DBTreeListModel* _pTreeModel) } // ------------------------------------------------------------------------- -SvTreeListBox* DBTreeView::getListBox() const +DBTreeListBox* DBTreeView::getListBox() const { return m_pTreeListBox; } diff --git a/dbaccess/source/ui/browser/dbtreeview.hxx b/dbaccess/source/ui/browser/dbtreeview.hxx index 38b3a5fca09f..53057dec712f 100644 --- a/dbaccess/source/ui/browser/dbtreeview.hxx +++ b/dbaccess/source/ui/browser/dbtreeview.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dbtreeview.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2000-11-09 07:36:15 $ + * last change: $Author: oj $ $Date: 2000-11-23 10:45:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,7 +99,7 @@ namespace dbaui void setModel(DBTreeListModel* _pTreeModel); void setSelectHdl(const Link& _rHdl); - SvTreeListBox* getListBox() const; + DBTreeListBox* getListBox() const; }; } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index b04c1d7c56c0..5890e40acd31 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unodatbr.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: fs $ $Date: 2000-11-10 14:29:10 $ + * last change: $Author: oj $ $Date: 2000-11-23 10:45:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -224,6 +224,9 @@ #ifndef _VCL_STDTEXT_HXX #include <vcl/stdtext.hxx> #endif +#ifndef DBAUI_DBTREELISTBOX_HXX +#include "dbtreelistbox.hxx" +#endif using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdb; @@ -1504,6 +1507,48 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectEntry, SvLBoxEntry*, _pEntry) return 0L; } // ------------------------------------------------------------------------- +void SAL_CALL SbaTableQueryBrowser::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException) +{ + // first initialize the parent + SbaXDataBrowserController::initialize( aArguments ); + + PropertyValue aValue; + const Any* pBegin = aArguments.getConstArray(); + const Any* pEnd = pBegin + aArguments.getLength(); + + m_nDefaultCommandType = -1; + for(;pBegin != pEnd;++pBegin) + { + if((*pBegin >>= aValue) && aValue.Name == PROPERTY_DATASOURCENAME) + aValue.Value >>= m_sDefaultDataSourceName; + else if(aValue.Name == PROPERTY_COMMANDTYPE) + aValue.Value >>= m_nDefaultCommandType; + else if(aValue.Name == PROPERTY_COMMAND) + aValue.Value >>= m_sDefaultCommand; + } + + if(m_sDefaultDataSourceName.getLength() && m_sDefaultCommand.getLength() && m_nDefaultCommandType != -1) + { + SvLBoxEntry* pDataSource = m_pTreeView->getListBox()->GetEntryPosByName(m_sDefaultDataSourceName,NULL); + if(pDataSource) + { + m_pTreeView->getListBox()->Expand(pDataSource); + SvLBoxEntry* pCommandType = NULL; + if(CommandType::TABLE == m_nDefaultCommandType) + pCommandType = m_pTreeView->getListBox()->GetModel()->GetEntry(pDataSource,1); + else if(CommandType::QUERY == m_nDefaultCommandType) + pCommandType = m_pTreeView->getListBox()->GetModel()->GetEntry(pDataSource,0); + if(pCommandType) + { + // we need to expand the command + m_pTreeView->getListBox()->Expand(pCommandType); + SvLBoxEntry* pCommand = m_pTreeView->getListBox()->GetEntryPosByName(m_sDefaultCommand,pCommandType); + if(pCommand) + m_pTreeView->getListBox()->Select(pCommand); + } + } + } +} // ......................................................................... } // namespace dbaui |