summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/browser/unodatbr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/browser/unodatbr.cxx')
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx307
1 files changed, 120 insertions, 187 deletions
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 3e37fe1fc75a..b63383e47c0e 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -77,6 +77,7 @@
#include <com/sun/star/sdb/SQLContext.hpp>
#include <com/sun/star/sdb/XBookmarksSupplier.hpp>
#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
#include <com/sun/star/sdb/XParametersSupplier.hpp>
#include <com/sun/star/sdb/XQueriesSupplier.hpp>
@@ -109,6 +110,7 @@
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <sfx2/app.hxx>
@@ -197,25 +199,21 @@ void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, const ::
//-------------------------------------------------------------------------
::rtl::OUString SAL_CALL SbaTableQueryBrowser::getImplementationName() throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImplementationName" );
return getImplementationName_Static();
}
//-------------------------------------------------------------------------
::comphelper::StringSequence SAL_CALL SbaTableQueryBrowser::getSupportedServiceNames() throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getSupportedServiceNames" );
return getSupportedServiceNames_Static();
}
// -------------------------------------------------------------------------
::rtl::OUString SbaTableQueryBrowser::getImplementationName_Static() throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImplementationName_Static" );
return ::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.ODatasourceBrowser");
}
//-------------------------------------------------------------------------
::comphelper::StringSequence SbaTableQueryBrowser::getSupportedServiceNames_Static() throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getSupportedServiceNames_Static" );
::comphelper::StringSequence aSupported(1);
aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.DataSourceBrowser");
return aSupported;
@@ -223,7 +221,6 @@ void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, const ::
//-------------------------------------------------------------------------
Reference< XInterface > SAL_CALL SbaTableQueryBrowser::Create(const Reference<XMultiServiceFactory >& _rxFactory)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::Create" );
::vos::OGuard aGuard(Application::GetSolarMutex());
return *(new SbaTableQueryBrowser(_rxFactory));
}
@@ -246,7 +243,6 @@ SbaTableQueryBrowser::SbaTableQueryBrowser(const Reference< XMultiServiceFactory
,m_bInSuspend(sal_False)
,m_bEnableBrowser(sal_True)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::SbaTableQueryBrowser" );
DBG_CTOR(SbaTableQueryBrowser,NULL);
}
@@ -266,7 +262,6 @@ SbaTableQueryBrowser::~SbaTableQueryBrowser()
//------------------------------------------------------------------------------
Any SAL_CALL SbaTableQueryBrowser::queryInterface(const Type& _rType) throw (RuntimeException)
{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::queryInterface" );
if ( _rType.equals( XScriptInvocationContext::static_type() ) )
{
OSL_PRECOND( !!m_aDocScriptSupport, "SbaTableQueryBrowser::queryInterface: did not initialize this, yet!" );
@@ -284,7 +279,6 @@ Any SAL_CALL SbaTableQueryBrowser::queryInterface(const Type& _rType) throw (Run
//------------------------------------------------------------------------------
Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes( ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getTypes" );
Sequence< Type > aTypes( ::comphelper::concatSequences(
SbaXDataBrowserController::getTypes(),
SbaTableQueryBrowser_Base::getTypes()
@@ -308,7 +302,6 @@ Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes( ) throw (RuntimeExcep
//------------------------------------------------------------------------------
Sequence< sal_Int8 > SAL_CALL SbaTableQueryBrowser::getImplementationId( ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImplementationId" );
static ::cppu::OImplementationId * pId = 0;
if (! pId)
{
@@ -325,7 +318,6 @@ Sequence< sal_Int8 > SAL_CALL SbaTableQueryBrowser::getImplementationId( ) thro
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::disposing()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::disposing" );
::vos::OGuard aGuard(Application::GetSolarMutex());
// doin' a lot of VCL stuff here -> lock the SolarMutex
@@ -350,9 +342,15 @@ void SAL_CALL SbaTableQueryBrowser::disposing()
implRemoveStatusListeners();
// remove the container listener from the database context
- Reference< XContainer > xDatasourceContainer(m_xDatabaseContext, UNO_QUERY);
- if (xDatasourceContainer.is())
- xDatasourceContainer->removeContainerListener(this);
+ try
+ {
+ Reference< XDatabaseRegistrations > xDatabaseRegistrations( m_xDatabaseContext, UNO_QUERY_THROW );
+ xDatabaseRegistrations->removeDatabaseRegistrationsListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
// check out from all the objects we are listening
// the frame
@@ -364,23 +362,17 @@ void SAL_CALL SbaTableQueryBrowser::disposing()
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::Construct" );
- if (!SbaXDataBrowserController::Construct(pParent))
+ if ( !SbaXDataBrowserController::Construct( pParent ) )
return sal_False;
try
{
- Reference< XContainer > xDatasourceContainer(m_xDatabaseContext, UNO_QUERY);
- if (xDatasourceContainer.is())
- xDatasourceContainer->addContainerListener(this);
- else {
- DBG_ERROR("SbaTableQueryBrowser::Construct: the DatabaseContext should allow us to be a listener!");
- }
+ Reference< XDatabaseRegistrations > xDatabaseRegistrations( m_xDatabaseContext, UNO_QUERY_THROW );
+ xDatabaseRegistrations->addDatabaseRegistrationsListener( this );
// the collator for the string compares
- m_xCollator = Reference< XCollator >(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.i18n.Collator")), UNO_QUERY);
- if (m_xCollator.is())
- m_xCollator->loadDefaultCollator(Application::GetSettings().GetLocale(), 0);
+ m_xCollator = Reference< XCollator >( getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.i18n.Collator" ) ), UNO_QUERY_THROW );
+ m_xCollator->loadDefaultCollator( Application::GetSettings().GetLocale(), 0 );
}
catch(Exception&)
{
@@ -433,7 +425,6 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
// -------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star::sdbc::XRowSet > & _rxForm)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::InitializeForm" );
if(!m_pCurrentlyDisplayed)
return sal_True;
@@ -490,7 +481,6 @@ sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star:
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::initializePreviewMode()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::initializePreviewMode" );
if ( getBrowserView() && getBrowserView()->getVclControl() )
{
getBrowserView()->getVclControl()->AlwaysEnableInput( FALSE );
@@ -509,7 +499,6 @@ void SbaTableQueryBrowser::initializePreviewMode()
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::star::form::XFormComponent > & xGrid)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::InitializeGridModel" );
try
{
Reference< ::com::sun::star::form::XGridColumnFactory > xColFactory(xGrid, UNO_QUERY);
@@ -633,6 +622,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
break;
case DataType::LONGVARCHAR:
+ case DataType::CLOB:
aInitialValues.push_back( NamedValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), makeAny( (sal_Bool)sal_True ) ) );
// NO break!
case DataType::BINARY:
@@ -750,7 +740,6 @@ Reference<XPropertySet> getColumnHelper(SvLBoxEntry* _pCurrentlyDisplayed,const
// -----------------------------------------------------------------------
void SbaTableQueryBrowser::transferChangedControlProperty(const ::rtl::OUString& _rProperty, const Any& _rNewValue)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::transferChangedControlProperty" );
if(m_pCurrentlyDisplayed)
{
DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData());
@@ -764,7 +753,6 @@ void SbaTableQueryBrowser::transferChangedControlProperty(const ::rtl::OUString&
// -----------------------------------------------------------------------
void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::propertyChange" );
SbaXDataBrowserController::propertyChange(evt);
try
@@ -873,7 +861,6 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw(
// -----------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::suspend(sal_Bool bSuspend) throw( RuntimeException )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::suspend" );
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::MutexGuard aGuard( getMutex() );
if ( getView() && getView()->IsInModalMode() )
@@ -898,7 +885,6 @@ sal_Bool SbaTableQueryBrowser::suspend(sal_Bool bSuspend) throw( RuntimeExceptio
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEvent ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::statusChanged" );
// search the external dispatcher causing this call
Reference< XDispatch > xSource(_rEvent.Source, UNO_QUERY);
ExternalFeaturesMap::iterator aLoop;
@@ -953,7 +939,6 @@ void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEv
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::checkDocumentDataSource()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::checkDocumentDataSource" );
SvLBoxEntry* pDataSourceEntry = NULL;
SvLBoxEntry* pContainerEntry = NULL;
SvLBoxEntry* pObjectEntry = getObjectEntry( m_aDocumentDataSource, &pDataSourceEntry, &pContainerEntry, sal_False );
@@ -991,7 +976,6 @@ void SbaTableQueryBrowser::checkDocumentDataSource()
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::extractDescriptorProps(const ::svx::ODataAccessDescriptor& _rDescriptor, ::rtl::OUString& _rDataSource, ::rtl::OUString& _rCommand, sal_Int32& _rCommandType, sal_Bool& _rEscapeProcessing)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::extractDescriptorProps" );
_rDataSource = _rDescriptor.getDataSource();
if ( _rDescriptor.has(daCommand) )
_rDescriptor[daCommand] >>= _rCommand;
@@ -1043,7 +1027,6 @@ namespace
// -------------------------------------------------------------------------
String SbaTableQueryBrowser::getDataSourceAcessor( SvLBoxEntry* _pDataSourceEntry ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getDataSourceAcessor" );
DBG_ASSERT( _pDataSourceEntry, "SbaTableQueryBrowser::getDataSourceAcessor: invalid entry!" );
DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( _pDataSourceEntry->GetUserData() );
@@ -1057,7 +1040,6 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS
SvLBoxEntry** _ppDataSourceEntry, SvLBoxEntry** _ppContainerEntry, sal_Bool _bExpandAncestors,
const SharedConnection& _rxConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getObjectEntry" );
if (_ppDataSourceEntry)
*_ppDataSourceEntry = NULL;
if (_ppContainerEntry)
@@ -1080,9 +1062,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS
{
// special case, the data source is a URL
// add new entries to the list box model
- Image a, b, c; // not interested in reusing them
- String e, f;
- implAddDatasource( _rDataSource, a, e, b, f, c, _rxConnection );
+ implAddDatasource( _rDataSource, _rxConnection );
pDataSource = m_pTreeView->getListBox().GetEntryPosByName( sDisplayName, NULL, &aFilter );
DBG_ASSERT( pDataSource, "SbaTableQueryBrowser::getObjectEntry: hmm - did not find it again!" );
}
@@ -1132,7 +1112,6 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::svx::ODataAccessDescri
SvLBoxEntry** _ppDataSourceEntry, SvLBoxEntry** _ppContainerEntry,
sal_Bool _bExpandAncestors)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getObjectEntry" );
// extract the props from the descriptor
::rtl::OUString sDataSource;
::rtl::OUString sCommand;
@@ -1146,7 +1125,6 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::svx::ODataAccessDescri
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::connectExternalDispatches()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::connectExternalDispatches" );
Reference< XDispatchProvider > xProvider( getFrame(), UNO_QUERY );
DBG_ASSERT(xProvider.is(), "SbaTableQueryBrowser::connectExternalDispatches: no DispatchProvider !");
if (xProvider.is())
@@ -1213,7 +1191,6 @@ void SbaTableQueryBrowser::connectExternalDispatches()
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implCheckExternalSlot" );
if ( !m_xMainToolbar.is() )
return;
@@ -1236,7 +1213,6 @@ void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId )
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::disposing( const EventObject& _rSource ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::disposing" );
// our frame ?
Reference< ::com::sun::star::frame::XFrame > xSourceFrame(_rSource.Source, UNO_QUERY);
if (m_xCurrentFrameParent.is() && (xSourceFrame == m_xCurrentFrameParent))
@@ -1299,7 +1275,6 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const EventObject& _rSource ) thr
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::implRemoveStatusListeners()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implRemoveStatusListeners" );
// clear all old dispatches
for ( ExternalFeaturesMap::const_iterator aLoop = m_aExternalFeatures.begin();
aLoop != m_aExternalFeatures.end();
@@ -1324,7 +1299,6 @@ void SbaTableQueryBrowser::implRemoveStatusListeners()
// -------------------------------------------------------------------------
sal_Bool SAL_CALL SbaTableQueryBrowser::select( const Any& _rSelection ) throw (IllegalArgumentException, RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::select" );
::vos::OGuard aGuard(Application::GetSolarMutex());
// doin' a lot of VCL stuff here -> lock the SolarMutex
@@ -1354,7 +1328,6 @@ sal_Bool SAL_CALL SbaTableQueryBrowser::select( const Any& _rSelection ) throw (
// -------------------------------------------------------------------------
Any SAL_CALL SbaTableQueryBrowser::getSelection( ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getSelection" );
Any aReturn;
try
@@ -1382,21 +1355,18 @@ Any SAL_CALL SbaTableQueryBrowser::getSelection( ) throw (RuntimeException)
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::addSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::addSelectionChangeListener" );
m_aSelectionListeners.addInterface(_rxListener);
}
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::removeSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::removeSelectionChangeListener" );
m_aSelectionListeners.removeInterface(_rxListener);
}
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::attachFrame(const Reference< ::com::sun::star::frame::XFrame > & _xFrame) throw( RuntimeException )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::attachFrame" );
implRemoveStatusListeners();
if (m_xCurrentFrameParent.is())
@@ -1441,7 +1411,6 @@ void SbaTableQueryBrowser::attachFrame(const Reference< ::com::sun::star::frame:
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::addModelListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::addModelListeners" );
SbaXDataBrowserController::addModelListeners(_xGridControlModel);
Reference< XPropertySet > xSourceSet(_xGridControlModel, UNO_QUERY);
if (xSourceSet.is())
@@ -1459,7 +1428,6 @@ void SbaTableQueryBrowser::addModelListeners(const Reference< ::com::sun::star::
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::removeModelListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::removeModelListeners" );
SbaXDataBrowserController::removeModelListeners(_xGridControlModel);
Reference< XPropertySet > xSourceSet(_xGridControlModel, UNO_QUERY);
if (xSourceSet.is())
@@ -1475,7 +1443,6 @@ void SbaTableQueryBrowser::removeModelListeners(const Reference< ::com::sun::sta
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::RowChanged()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::RowChanged" );
if(getBrowserView())
{
SbaGridControl* pControl = getBrowserView()->getVclControl();
@@ -1488,7 +1455,6 @@ void SbaTableQueryBrowser::RowChanged()
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::ColumnChanged()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ColumnChanged" );
if(getBrowserView())
{
SbaGridControl* pControl = getBrowserView()->getVclControl();
@@ -1500,7 +1466,6 @@ void SbaTableQueryBrowser::ColumnChanged()
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::AddColumnListener(const Reference< XPropertySet > & xCol)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::AddColumnListener" );
SbaXDataBrowserController::AddColumnListener(xCol);
SafeAddPropertyListener(xCol, PROPERTY_WIDTH, static_cast<XPropertyChangeListener*>(this));
SafeAddPropertyListener(xCol, PROPERTY_HIDDEN, static_cast<XPropertyChangeListener*>(this));
@@ -1511,7 +1476,6 @@ void SbaTableQueryBrowser::AddColumnListener(const Reference< XPropertySet > & x
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::RemoveColumnListener(const Reference< XPropertySet > & xCol)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::RemoveColumnListener" );
SbaXDataBrowserController::RemoveColumnListener(xCol);
SafeRemovePropertyListener(xCol, PROPERTY_WIDTH, static_cast<XPropertyChangeListener*>(this));
SafeRemovePropertyListener(xCol, PROPERTY_HIDDEN, static_cast<XPropertyChangeListener*>(this));
@@ -1522,7 +1486,6 @@ void SbaTableQueryBrowser::RemoveColumnListener(const Reference< XPropertySet >
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::criticalFail()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::criticalFail" );
SbaXDataBrowserController::criticalFail();
unloadAndCleanup( sal_False );
}
@@ -1530,7 +1493,6 @@ void SbaTableQueryBrowser::criticalFail()
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::LoadFinished(sal_Bool _bWasSynch)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::LoadFinished" );
SbaXDataBrowserController::LoadFinished(_bWasSynch);
m_sQueryCommand = ::rtl::OUString();
@@ -1552,7 +1514,6 @@ void SbaTableQueryBrowser::LoadFinished(sal_Bool _bWasSynch)
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::getExternalSlotState( sal_uInt16 _nId ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getExternalSlotState" );
sal_Bool bEnabled = sal_False;
ExternalFeaturesMap::const_iterator aPos = m_aExternalFeatures.find( _nId );
if ( ( m_aExternalFeatures.end() != aPos ) && aPos->second.xDispatcher.is() )
@@ -1563,7 +1524,6 @@ sal_Bool SbaTableQueryBrowser::getExternalSlotState( sal_uInt16 _nId ) const
//------------------------------------------------------------------------------
FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::GetState" );
FeatureState aReturn;
// (disabled automatically)
@@ -1765,7 +1725,6 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue >& aArgs)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::Execute" );
switch (nId)
{
default:
@@ -1951,12 +1910,20 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
break;
}
}
+
+// -------------------------------------------------------------------------
+void SbaTableQueryBrowser::implAddDatasource( const String& _rDataSourceName, const SharedConnection& _rxConnection )
+{
+ Image a, b, c;
+ String d, e;
+ implAddDatasource( _rDataSourceName, a, d, b, e, c, _rxConnection );
+}
+
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDbImage,
String& _rQueryName, Image& _rQueryImage, String& _rTableName, Image& _rTableImage,
const SharedConnection& _rxConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implAddDatasource" );
vos::OGuard aGuard( Application::GetSolarMutex() );
// initialize the names/images if necessary
if (!_rQueryName.Len())
@@ -2010,7 +1977,6 @@ void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDb
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::initializeTreeModel()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::initializeTreeModel" );
if (m_xDatabaseContext.is())
{
Image aDBImage, aQueriesImage, aTablesImage;
@@ -2029,7 +1995,6 @@ sal_Bool SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xName
SvLBoxEntry* _pParent,
EntryType _eEntryType)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::populateTree" );
DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(_pParent->GetUserData());
if(pData) // don't ask if the nameaccess is already set see OnExpandEntry views and tables
pData->xContainer = _xNameAccess;
@@ -2060,7 +2025,6 @@ sal_Bool SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xName
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const String& _rName, void* _pUserData, EntryType _eEntryType )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implAppendEntry" );
::std::auto_ptr< ImageProvider > pImageProvider( getImageProviderFor( _pParent ) );
Image aImage, aImageHC;
@@ -2077,7 +2041,6 @@ void SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const String&
//------------------------------------------------------------------------------
IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::OnExpandEntry" );
if (_pParent->HasChilds())
// nothing to to ...
return 1L;
@@ -2180,7 +2143,6 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ensureEntryObject" );
DBG_ASSERT(_pEntry, "SbaTableQueryBrowser::ensureEntryObject: invalid argument!");
if (!_pEntry)
return sal_False;
@@ -2240,7 +2202,6 @@ sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry )
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _rDescriptor,sal_Bool _bSelectDirect)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implSelect(_rDescriptor,_bSelectDirect)" );
// extract the props
::rtl::OUString sDataSource;
::rtl::OUString sCommand;
@@ -2256,7 +2217,6 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _r
sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rCommand,
const sal_Int32 _nCommandType, const sal_Bool _bEscapeProcessing, const SharedConnection& _rxConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implLoadAnything" );
Reference<XPropertySet> xProp(getRowSet(),UNO_QUERY);
if(xProp.is())
{
@@ -2274,8 +2234,6 @@ sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSou
xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, ::cppu::bool2any(_bEscapeProcessing));
if ( m_bPreview )
{
- // this be undone by the grid control in DbGridControl::RecalcRows
- // xProp->setPropertyValue(PROPERTY_FETCHSIZE, makeAny(sal_Int32(20)));
xProp->setPropertyValue(PROPERTY_FETCHDIRECTION, makeAny(FetchDirection::FORWARD));
}
@@ -2310,21 +2268,24 @@ sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSou
InvalidateAll();
return bSuccess;
}
- catch(SQLException& e)
+ catch( const SQLException& e )
{
- showError(SQLExceptionInfo(e));
+ Any aException( ::cppu::getCaughtException() );
+ showError( SQLExceptionInfo( aException ) );
}
- catch(WrappedTargetException& e)
+ catch( const WrappedTargetException& e )
{
SQLException aSql;
- if(e.TargetException >>= aSql)
- showError(SQLExceptionInfo(aSql));
+ if ( e.TargetException.isExtractableTo( ::cppu::UnoType< SQLException >::get() ) )
+ showError( SQLExceptionInfo( e.TargetException ) );
else
- OSL_ENSURE(sal_False, "SbaTableQueryBrowser::implLoadAnything: something strange happended!");
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
catch(Exception&)
{
- OSL_ENSURE(sal_False, "SbaTableQueryBrowser::implLoadAnything: something strange happended!");
+ DBG_UNHANDLED_EXCEPTION();
}
}
@@ -2338,7 +2299,6 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::rtl::OUString& _rDataSourceNam
const SharedConnection& _rxConnection
,sal_Bool _bSelectDirect)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implSelect(_rDataSourceName,_rCommand,...)" );
if (_rDataSourceName.getLength() && _rCommand.getLength() && (-1 != _nCommandType))
{
SvLBoxEntry* pDataSource = NULL;
@@ -2387,7 +2347,6 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectionChange, void*, /*NOINTERESTEDIN*/)
//------------------------------------------------------------------------------
bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implSelect(_pEntry)" );
if ( !_pEntry )
return false;
@@ -2581,7 +2540,6 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
// -----------------------------------------------------------------------------
SvLBoxEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAccess>& _rxNameAccess)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getEntryFromContainer" );
DBTreeListBox& rListBox = m_pTreeView->getListBox();
SvLBoxEntry* pContainer = NULL;
SvLBoxEntry* pDSLoop = rListBox.FirstChild(NULL);
@@ -2606,7 +2564,6 @@ SvLBoxEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAc
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::elementInserted" );
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
@@ -2638,24 +2595,12 @@ void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEve
}
implAppendEntry( pEntry, ::comphelper::getString( _rEvent.Accessor ), pNewData, pNewData->eType );
}
- else if (xNames.get() == m_xDatabaseContext.get())
- { // a new datasource has been added to the context
- // the name of the new ds
- ::rtl::OUString sNewDS;
- _rEvent.Accessor >>= sNewDS;
-
- // add new entries to the list box model
- Image a, b, c; // not interested in reusing them
- String e, f;
- implAddDatasource( sNewDS, a, e, b, f, c, SharedConnection() );
- }
else
SbaXDataBrowserController::elementInserted(_rEvent);
}
// -------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(const String& _sName,SvLBoxEntry* _pContainer)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::isCurrentlyDisplayedChanged" );
return m_pCurrentlyDisplayed
&& getEntryType(m_pCurrentlyDisplayed) == getChildType(_pContainer)
&& m_pTreeView->getListBox().GetParent(m_pCurrentlyDisplayed) == _pContainer
@@ -2664,7 +2609,6 @@ sal_Bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(const String& _sName,
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::elementRemoved" );
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
@@ -2711,62 +2655,6 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
// maybe the object which is part of the document data source has been removed
checkDocumentDataSource();
}
- else if (xNames.get() == m_xDatabaseContext.get())
- { // a datasource has been removed from the context
-
- // the name
- ::rtl::OUString sNewDS;
- _rEvent.Accessor >>= sNewDS;
- String sNewDatasource = sNewDS;
-
- // get the top-level representing the removed data source
- SvLBoxEntry* pDSLoop = m_pTreeView->getListBox().FirstChild(NULL);
- while (pDSLoop)
- {
- if (m_pTreeView->getListBox().GetEntryText(pDSLoop) == sNewDatasource)
- break;
-
- pDSLoop = m_pTreeView->getListBox().NextSibling(pDSLoop);
- }
-
- if (pDSLoop)
- {
- if (isSelected(pDSLoop))
- { // a table or query belonging to the deleted data source is currently beeing displayed.
- OSL_ENSURE(m_pTreeView->getListBox().GetRootLevelParent(m_pCurrentlyDisplayed) == pDSLoop, "SbaTableQueryBrowser::elementRemoved: inconsistence (1)!");
- unloadAndCleanup( sal_True );
- }
- else
- OSL_ENSURE(
- (NULL == m_pCurrentlyDisplayed)
- || (m_pTreeView->getListBox().GetRootLevelParent(m_pCurrentlyDisplayed) != pDSLoop), "SbaTableQueryBrowser::elementRemoved: inconsistence (2)!");
-
- // look for user data to delete
- SvTreeEntryList* pList = m_pTreeModel->GetChildList(pDSLoop);
- if(pList)
- {
- SvLBoxEntry* pEntryLoop = static_cast<SvLBoxEntry*>(pList->First());
- while (pEntryLoop)
- {
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pEntryLoop->GetUserData());
- pEntryLoop->SetUserData(NULL);
- delete pData;
- pEntryLoop = static_cast<SvLBoxEntry*>(pList->Next());
- }
- }
- // remove the entry. This should remove all children, too.
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pDSLoop->GetUserData());
- pDSLoop->SetUserData(NULL);
- delete pData;
- m_pTreeModel->Remove(pDSLoop);
- }
- else {
- DBG_ERROR("SbaTableQueryBrowser::elementRemoved: unknown datasource name!");
- }
-
- // maybe the object which is part of the document data source has been removed
- checkDocumentDataSource();
- }
else
SbaXDataBrowserController::elementRemoved(_rEvent);
}
@@ -2774,7 +2662,6 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::elementReplaced" );
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
@@ -2847,7 +2734,6 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::impl_releaseConnection( SharedConnection& _rxConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::impl_releaseConnection" );
// remove as event listener
Reference< XComponent > xComponent( _rxConnection, UNO_QUERY );
if ( xComponent.is() )
@@ -2876,7 +2762,6 @@ void SbaTableQueryBrowser::impl_releaseConnection( SharedConnection& _rxConnecti
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::disposeConnection( SvLBoxEntry* _pDSEntry )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::disposeConnection" );
DBG_ASSERT( _pDSEntry, "SbaTableQueryBrowser::disposeConnection: invalid entry (NULL)!" );
DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::disposeConnection: invalid entry (not top-level)!" );
@@ -2891,7 +2776,6 @@ void SbaTableQueryBrowser::disposeConnection( SvLBoxEntry* _pDSEntry )
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::closeConnection(SvLBoxEntry* _pDSEntry,sal_Bool _bDisposeConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::closeConnection" );
DBG_ASSERT(_pDSEntry, "SbaTableQueryBrowser::closeConnection: invalid entry (NULL)!");
DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!");
@@ -2928,7 +2812,6 @@ void SbaTableQueryBrowser::closeConnection(SvLBoxEntry* _pDSEntry,sal_Bool _bDis
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::unloadAndCleanup( sal_Bool _bDisposeConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::unloadAndCleanup" );
if (!m_pCurrentlyDisplayed)
// nothing to do
return;
@@ -3016,7 +2899,6 @@ namespace
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::impl_initialize()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::impl_initialize" );
::vos::OGuard aGuard(Application::GetSolarMutex());
// doin' a lot of VCL stuff here -> lock the SolarMutex
@@ -3150,12 +3032,7 @@ void SbaTableQueryBrowser::impl_initialize()
}
}
- Image aDBImage, aQueriesImage, aTablesImage;
- String sQueriesName, sTablesName;
-
- implAddDatasource( sInitialDataSourceName,
- aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage, xConnection
- );
+ implAddDatasource( sInitialDataSourceName, xConnection );
m_pTreeView->getListBox().Expand( m_pTreeView->getListBox().First() );
}
else
@@ -3196,14 +3073,12 @@ void SbaTableQueryBrowser::impl_initialize()
// -------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::haveExplorer() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::haveExplorer" );
return m_pTreeView && m_pTreeView->IsVisible();
}
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::hideExplorer()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::hideExplorer" );
if (!haveExplorer())
return;
if (!getBrowserView())
@@ -3219,7 +3094,6 @@ void SbaTableQueryBrowser::hideExplorer()
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::showExplorer()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::showExplorer" );
if (haveExplorer())
return;
@@ -3236,7 +3110,6 @@ void SbaTableQueryBrowser::showExplorer()
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedConnection& _rConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ensureConnection" );
SvLBoxEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent(_pAnyEntry);
DBTreeListUserData* pDSData =
pDSEntry
@@ -3249,7 +3122,6 @@ sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedC
// -----------------------------------------------------------------------------
::std::auto_ptr< ImageProvider > SbaTableQueryBrowser::getImageProviderFor( SvLBoxEntry* _pAnyEntry )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImageProviderFor" );
::std::auto_ptr< ImageProvider > pImageProvider( new ImageProvider );
SharedConnection xConnection;
if ( getExistentConnectionFor( _pAnyEntry, xConnection ) )
@@ -3260,7 +3132,6 @@ sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedC
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::getExistentConnectionFor( SvLBoxEntry* _pAnyEntry, SharedConnection& _rConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getExistentConnectionFor" );
SvLBoxEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent( _pAnyEntry );
DBTreeListUserData* pDSData =
pDSEntry
@@ -3275,7 +3146,6 @@ sal_Bool SbaTableQueryBrowser::getExistentConnectionFor( SvLBoxEntry* _pAnyEntry
// -----------------------------------------------------------------------------
bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvLBoxEntry* _pEntry ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::impl_isDataSourceEntry" );
return m_pTreeModel->GetRootLevelParent( _pEntry ) == _pEntry;
}
#endif
@@ -3283,7 +3153,6 @@ bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvLBoxEntry* _pEntry ) const
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::ensureConnection( SvLBoxEntry* _pDSEntry, void* pDSData, SharedConnection& _rConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ensureConnection" );
DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::ensureConnection: this entry does not denote a data source!" );
if(_pDSEntry)
{
@@ -3386,7 +3255,6 @@ IMPL_LINK( SbaTableQueryBrowser, OnTreeEntryCompare, const SvSortData*, _pSortDa
// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::implAdministrate( SvLBoxEntry* _pApplyTo )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implAdministrate" );
OSL_PRECOND( _pApplyTo, "SbaTableQueryBrowser::implAdministrate: illegal entry!" );
if ( !_pApplyTo )
return;
@@ -3444,7 +3312,6 @@ void SbaTableQueryBrowser::implAdministrate( SvLBoxEntry* _pApplyTo )
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::requestQuickHelp( const SvLBoxEntry* _pEntry, String& _rText ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::requestQuickHelp" );
const DBTreeListUserData* pData = static_cast< const DBTreeListUserData* >( _pEntry->GetUserData() );
if ( ( pData->eType == etDatasource ) && pData->sAccessor.Len() )
{
@@ -3457,7 +3324,6 @@ sal_Bool SbaTableQueryBrowser::requestQuickHelp( const SvLBoxEntry* _pEntry, Str
// -----------------------------------------------------------------------------
PopupMenu* SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getContextMenu" );
OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
"SbaTableQueryBrowser::getContextMenu: where does this come from?" );
if ( &m_pTreeView->getListBox() != &_rControl )
@@ -3469,21 +3335,18 @@ PopupMenu* SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
// -----------------------------------------------------------------------------
IController& SbaTableQueryBrowser::getCommandController()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getCommandController" );
return *this;
}
// -----------------------------------------------------------------------------
::cppu::OInterfaceContainerHelper* SbaTableQueryBrowser::getContextMenuInterceptors()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getContextMenuInterceptors" );
return &m_aContextMenuInterceptors;
}
// -----------------------------------------------------------------------------
Any SbaTableQueryBrowser::getCurrentSelection( Control& _rControl ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getCurrentSelection" );
OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
"SbaTableQueryBrowser::getCurrentSelection: where does this come from?" );
@@ -3525,7 +3388,6 @@ Any SbaTableQueryBrowser::getCurrentSelection( Control& _rControl ) const
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::implGetQuerySignature( ::rtl::OUString& _rCommand, sal_Bool& _bEscapeProcessing )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implGetQuerySignature" );
_rCommand = ::rtl::OUString();
_bEscapeProcessing = sal_False;
@@ -3574,7 +3436,6 @@ sal_Bool SbaTableQueryBrowser::implGetQuerySignature( ::rtl::OUString& _rCommand
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::frameAction(const ::com::sun::star::frame::FrameActionEvent& aEvent) throw( RuntimeException )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::frameAction" );
if (aEvent.Frame == m_xCurrentFrameParent)
{
if(aEvent.Action == FrameAction_COMPONENT_DETACHING)
@@ -3589,7 +3450,6 @@ void SbaTableQueryBrowser::frameAction(const ::com::sun::star::frame::FrameActio
// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _xColContainer)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::clearGridColumns" );
// first we have to clear the grid
Sequence< ::rtl::OUString > aNames = _xColContainer->getElementNames();
const ::rtl::OUString* pIter = aNames.getConstArray();
@@ -3605,7 +3465,6 @@ void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::isHiContrast() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::isHiContrast" );
sal_Bool bRet = sal_False;
if ( m_pTreeView )
bRet = m_pTreeView->getListBox().GetSettings().GetStyleSettings().GetHighContrastMode();
@@ -3614,7 +3473,6 @@ sal_Bool SbaTableQueryBrowser::isHiContrast() const
// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::loadMenu" );
if ( m_bShowMenu )
{
OGenericUnoController::loadMenu(_xFrame);
@@ -3636,7 +3494,6 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
// -----------------------------------------------------------------------------
::rtl::OUString SbaTableQueryBrowser::getPrivateTitle() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getPrivateTitle" );
::rtl::OUString sTitle;
if ( m_pCurrentlyDisplayed )
{
@@ -3661,7 +3518,6 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::preReloadForm()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::preReloadForm" );
sal_Bool bIni = sal_False;
if ( !m_pCurrentlyDisplayed )
{
@@ -3690,7 +3546,6 @@ sal_Bool SbaTableQueryBrowser::preReloadForm()
// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::postReloadForm()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::postReloadForm" );
InitializeGridModel(getFormComponent());
LoadFinished(sal_True);
//updateTitle();
@@ -3699,7 +3554,6 @@ void SbaTableQueryBrowser::postReloadForm()
//------------------------------------------------------------------------------
Reference< XEmbeddedScripts > SAL_CALL SbaTableQueryBrowser::getScriptContainer() throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getScriptContainer" );
// update our database document
Reference< XModel > xDocument;
try
@@ -3726,7 +3580,6 @@ Reference< XEmbeddedScripts > SAL_CALL SbaTableQueryBrowser::getScriptContainer(
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::registerContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::registerContextMenuInterceptor" );
if ( _Interceptor.is() )
m_aContextMenuInterceptors.addInterface( _Interceptor );
}
@@ -3734,10 +3587,90 @@ void SAL_CALL SbaTableQueryBrowser::registerContextMenuInterceptor( const Refere
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::releaseContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::releaseContextMenuInterceptor" );
- m_aContextMenuInterceptors.removeInterface( _Interceptor );
+ if ( _Interceptor.is() )
+ m_aContextMenuInterceptors.removeInterface( _Interceptor );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL SbaTableQueryBrowser::registeredDatabaseLocation( const DatabaseRegistrationEvent& _Event ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ implAddDatasource( _Event.Name, SharedConnection() );
}
+//------------------------------------------------------------------------------
+void SbaTableQueryBrowser::impl_cleanupDataSourceEntry( const String& _rDataSourceName )
+{
+ // get the top-level representing the removed data source
+ SvLBoxEntry* pDataSourceEntry = m_pTreeView->getListBox().FirstChild( NULL );
+ while ( pDataSourceEntry )
+ {
+ if ( m_pTreeView->getListBox().GetEntryText( pDataSourceEntry ) == _rDataSourceName )
+ break;
+
+ pDataSourceEntry = m_pTreeView->getListBox().NextSibling( pDataSourceEntry );
+ }
+
+ OSL_ENSURE( pDataSourceEntry, "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: do not know this data source!" );
+ if ( !pDataSourceEntry )
+ return;
+
+ if ( isSelected( pDataSourceEntry ) )
+ { // a table or query belonging to the deleted data source is currently beeing displayed.
+ OSL_ENSURE( m_pTreeView->getListBox().GetRootLevelParent( m_pCurrentlyDisplayed ) == pDataSourceEntry,
+ "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: inconsistence (1)!" );
+ unloadAndCleanup( sal_True );
+ }
+ else
+ OSL_ENSURE(
+ ( NULL == m_pCurrentlyDisplayed )
+ || ( m_pTreeView->getListBox().GetRootLevelParent( m_pCurrentlyDisplayed ) != pDataSourceEntry ),
+ "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: inconsistence (2)!");
+
+ // delete any user data of the child entries of the to-be-removed entry
+ SvTreeEntryList* pList = m_pTreeModel->GetChildList( pDataSourceEntry );
+ if ( pList )
+ {
+ SvLBoxEntry* pEntryLoop = static_cast<SvLBoxEntry*>( pList->First() );
+ while ( pEntryLoop )
+ {
+ DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( pEntryLoop->GetUserData() );
+ pEntryLoop->SetUserData( NULL );
+ delete pData;
+ pEntryLoop = static_cast< SvLBoxEntry* >( pList->Next() );
+ }
+ }
+
+ // remove the entry
+ DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( pDataSourceEntry->GetUserData() );
+ pDataSourceEntry->SetUserData( NULL );
+ delete pData;
+ m_pTreeModel->Remove( pDataSourceEntry );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL SbaTableQueryBrowser::revokedDatabaseLocation( const DatabaseRegistrationEvent& _Event ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ impl_cleanupDataSourceEntry( _Event.Name );
+
+ // maybe the object which is part of the document data source has been removed
+ checkDocumentDataSource();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL SbaTableQueryBrowser::changedDatabaseLocation( const DatabaseRegistrationEvent& _Event ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ // in case the data source was expanded, and connected, we need to clean it up
+ // for simplicity, just do as if the data source were completely removed and re-added
+ impl_cleanupDataSourceEntry( _Event.Name );
+ implAddDatasource( _Event.Name, SharedConnection() );
+}
+
+
// .........................................................................
} // namespace dbaui
// .........................................................................