Kaydet (Commit) b381734a authored tarafından Frank Schönheit's avatar Frank Schönheit

+ have-/hide-/show-/toggleExplorer

üst 397dfdfd
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: unodatbr.cxx,v $ * $RCSfile: unodatbr.cxx,v $
* *
* $Revision: 1.12 $ * $Revision: 1.13 $
* *
* last change: $Author: oj $ $Date: 2000-12-07 11:40:07 $ * last change: $Author: fs $ $Date: 2000-12-08 21:16:38 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -84,6 +84,9 @@ ...@@ -84,6 +84,9 @@
#ifndef _SV_MSGBOX_HXX //autogen #ifndef _SV_MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#endif #endif
#ifndef _CPPUHELPER_EXTRACT_HXX_
#include <cppuhelper/extract.hxx>
#endif
#ifndef _SFXDISPATCH_HXX //autogen #ifndef _SFXDISPATCH_HXX //autogen
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
...@@ -227,7 +230,12 @@ ...@@ -227,7 +230,12 @@
#ifndef DBAUI_DBTREELISTBOX_HXX #ifndef DBAUI_DBTREELISTBOX_HXX
#include "dbtreelistbox.hxx" #include "dbtreelistbox.hxx"
#endif #endif
#ifndef _DBA_DBACCESS_HELPID_HRC_
#include "dbaccess_helpid.hrc" #include "dbaccess_helpid.hrc"
#endif
#ifndef _SV_WAITOBJ_HXX
#include <vcl/waitobj.hxx>
#endif
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdb;
...@@ -371,7 +379,7 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent) ...@@ -371,7 +379,7 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) ); m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
m_pSplitter->Show(); m_pSplitter->Show();
m_pTreeView = new DBTreeView(getContent(), WB_TABSTOP); m_pTreeView = new DBTreeView(getContent(), m_xMultiServiceFacatory, WB_TABSTOP);
m_pTreeView->Show(); m_pTreeView->Show();
m_pTreeView->SetPreExpandHandler(LINK(this, SbaTableQueryBrowser, OnExpandEntry)); m_pTreeView->SetPreExpandHandler(LINK(this, SbaTableQueryBrowser, OnExpandEntry));
m_pTreeView->SetHelpId(HID_CTL_TREEVIEW); m_pTreeView->SetHelpId(HID_CTL_TREEVIEW);
...@@ -394,6 +402,8 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent) ...@@ -394,6 +402,8 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
getContent()->SetUniqueId(UID_CTL_CONTENT); getContent()->SetUniqueId(UID_CTL_CONTENT);
if (getContent()->getVclControl()->GetHeaderBar()) if (getContent()->getVclControl()->GetHeaderBar())
getContent()->getVclControl()->GetHeaderBar()->SetHelpId(HID_DATABROWSE_HEADER); getContent()->getVclControl()->GetHeaderBar()->SetHelpId(HID_DATABROWSE_HEADER);
InvalidateFeature(ID_BROWSER_EXPLORER);
} }
return sal_True; return sal_True;
...@@ -1013,6 +1023,7 @@ void SbaTableQueryBrowser::AddSupportedFeatures() ...@@ -1013,6 +1023,7 @@ void SbaTableQueryBrowser::AddSupportedFeatures()
m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DataSourceBrowser/FormLetter")] = ID_BROWSER_FORMLETTER; m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DataSourceBrowser/FormLetter")] = ID_BROWSER_FORMLETTER;
m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DataSourceBrowser/InsertColumns")] = ID_BROWSER_INSERTCOLUMNS; m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DataSourceBrowser/InsertColumns")] = ID_BROWSER_INSERTCOLUMNS;
m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DataSourceBrowser/InsertContent")] = ID_BROWSER_INSERTCONTENT; m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DataSourceBrowser/InsertContent")] = ID_BROWSER_INSERTCONTENT;
m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DataSourceBrowser/ToggleExplorer")] = ID_BROWSER_EXPLORER;
// TODO reenable our own code if we really have a handling for the formslots // TODO reenable our own code if we really have a handling for the formslots
// ControllerFeature( ::rtl::OUString::createFromAscii("private:FormSlot/moveToFirst"), SID_FM_RECORD_FIRST ), // ControllerFeature( ::rtl::OUString::createFromAscii("private:FormSlot/moveToFirst"), SID_FM_RECORD_FIRST ),
...@@ -1029,6 +1040,13 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) ...@@ -1029,6 +1040,13 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId)
FeatureState aReturn; FeatureState aReturn;
// (disabled automatically) // (disabled automatically)
if (ID_BROWSER_EXPLORER == nId)
{ // this slot is available even if no form is loaded
aReturn.bEnabled = sal_True;
aReturn.aState = ::cppu::bool2any(haveExplorer());
return aReturn;
}
try try
{ {
// no chance without a view // no chance without a view
...@@ -1142,6 +1160,10 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId) ...@@ -1142,6 +1160,10 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId)
{ {
switch (nId) switch (nId)
{ {
case ID_BROWSER_EXPLORER:
toggleExplorer();
break;
case ID_BROWSER_EDITDOC: case ID_BROWSER_EDITDOC:
SbaXDataBrowserController::Execute(nId); SbaXDataBrowserController::Execute(nId);
break; break;
...@@ -1301,13 +1323,22 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent) ...@@ -1301,13 +1323,22 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
SvLBoxString* pString = static_cast<SvLBoxString*>(pFirstParent->GetFirstItem(SV_ITEM_ID_DBTEXTITEM)); SvLBoxString* pString = static_cast<SvLBoxString*>(pFirstParent->GetFirstItem(SV_ITEM_ID_DBTEXTITEM));
OSL_ENSHURE(pString,"SbaTableQueryBrowser::OnExpandEntry: No string item!"); OSL_ENSHURE(pString,"SbaTableQueryBrowser::OnExpandEntry: No string item!");
String aName(pString->GetText()); String aName(pString->GetText());
Any aValue(m_xDatabaseContext->getByName(aName)); Any aValue;
try { aValue = m_xDatabaseContext->getByName(aName); }
catch(Exception&) { }
if(pData->bTable) if(pData->bTable)
{ {
Reference<XPropertySet> xProp; Reference<XPropertySet> xProp;
aValue >>= xProp; aValue >>= xProp;
::rtl::OUString sPwd, sUser; ::rtl::OUString sPwd, sUser;
sal_Bool bPwdReq = sal_False; sal_Bool bPwdReq = sal_False;
if (!xProp.is())
{
OSL_ENSURE(sal_False, "SbaTableQueryBrowser::OnExpandEntry: could not retrieve the data source object!");
return 0; // indicates an error
}
try try
{ {
xProp->getPropertyValue(PROPERTY_PASSWORD) >>= sPwd; xProp->getPropertyValue(PROPERTY_PASSWORD) >>= sPwd;
...@@ -1322,6 +1353,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent) ...@@ -1322,6 +1353,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
SQLExceptionInfo aInfo; SQLExceptionInfo aInfo;
try try
{ {
WaitObject aWaitCursor(getContent());
Reference<XConnection> xConnection; // supports the service sdb::connection Reference<XConnection> xConnection; // supports the service sdb::connection
if(bPwdReq && !sPwd.getLength()) if(bPwdReq && !sPwd.getLength())
...@@ -1335,14 +1367,9 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent) ...@@ -1335,14 +1367,9 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
{ // instantiate the default SDB interaction handler { // instantiate the default SDB interaction handler
Reference< XInteractionHandler > xHandler(m_xMultiServiceFacatory->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY); Reference< XInteractionHandler > xHandler(m_xMultiServiceFacatory->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY);
if (!xHandler.is()) if (!xHandler.is())
{
ShowServiceNotAvailableError(getContent(), String(SERVICE_SDB_INTERACTION_HANDLER), sal_True); ShowServiceNotAvailableError(getContent(), String(SERVICE_SDB_INTERACTION_HANDLER), sal_True);
// TODO: a real parent!
}
else else
{
xConnection = xConnectionCompletion->connectWithCompletion(xHandler); xConnection = xConnectionCompletion->connectWithCompletion(xHandler);
}
} }
} }
else else
...@@ -1437,6 +1464,8 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectEntry, SvLBoxEntry*, _pEntry) ...@@ -1437,6 +1464,8 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectEntry, SvLBoxEntry*, _pEntry)
if(bRebuild) if(bRebuild)
{ {
WaitObject aWaitCursor(getContent());
// tell the old entry it has been deselected // tell the old entry it has been deselected
SvLBoxEntry* pEntry = m_pCurrentlyDisplayed; SvLBoxEntry* pEntry = m_pCurrentlyDisplayed;
while (pEntry) while (pEntry)
...@@ -1541,6 +1570,43 @@ void SAL_CALL SbaTableQueryBrowser::initialize( const Sequence< Any >& aArgument ...@@ -1541,6 +1570,43 @@ void SAL_CALL SbaTableQueryBrowser::initialize( const Sequence< Any >& aArgument
} }
} }
// -------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::haveExplorer() const
{
return m_pTreeView && m_pTreeView->IsVisible();
}
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::hideExplorer()
{
if (!haveExplorer())
return;
if (!getContent())
return;
m_pTreeView->Hide();
m_pSplitter->Hide();
getContent()->Resize();
InvalidateFeature(ID_BROWSER_EXPLORER);
}
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::showExplorer()
{
if (haveExplorer())
return;
if (!getContent())
return;
m_pTreeView->Show();
m_pSplitter->Show();
getContent()->Resize();
InvalidateFeature(ID_BROWSER_EXPLORER);
}
// ......................................................................... // .........................................................................
} // namespace dbaui } // namespace dbaui
// ......................................................................... // .........................................................................
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: unodatbr.hxx,v $ * $RCSfile: unodatbr.hxx,v $
* *
* $Revision: 1.7 $ * $Revision: 1.8 $
* *
* last change: $Author: oj $ $Date: 2000-11-23 10:46:21 $ * last change: $Author: fs $ $Date: 2000-12-08 21:13:50 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -176,6 +176,12 @@ namespace dbaui ...@@ -176,6 +176,12 @@ namespace dbaui
virtual void Execute(sal_uInt16 nId); virtual void Execute(sal_uInt16 nId);
String getURL() const; String getURL() const;
sal_Bool haveExplorer() const;
void hideExplorer();
void showExplorer();
void toggleExplorer() { if (haveExplorer()) hideExplorer(); else showExplorer(); }
private: private:
// check the state of the external slot given, update any UI elements if necessary // check the state of the external slot given, update any UI elements if necessary
void implCheckExternalSlot(sal_Int32 _nId); void implCheckExternalSlot(sal_Int32 _nId);
......
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