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.cxx197
1 files changed, 92 insertions, 105 deletions
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 2a3fdd428ade..0da24c5a3f9a 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -122,9 +123,9 @@
#include <svx/algitem.hxx>
#include <svx/dataaccessdescriptor.hxx>
#include <svx/databaseregistrationui.hxx>
-#include <svx/gridctrl.hxx>
#include <toolkit/unohlp.hxx>
#include <tools/diagnose_ex.h>
+#include <osl/diagnose.h>
#include <tools/multisel.hxx>
#include <tools/urlobj.hxx>
#include <unotools/confignode.hxx>
@@ -207,19 +208,19 @@ void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, const ::
// -------------------------------------------------------------------------
::rtl::OUString SbaTableQueryBrowser::getImplementationName_Static() throw(RuntimeException)
{
- return ::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.ODatasourceBrowser");
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbu.ODatasourceBrowser"));
}
//-------------------------------------------------------------------------
::comphelper::StringSequence SbaTableQueryBrowser::getSupportedServiceNames_Static() throw(RuntimeException)
{
::comphelper::StringSequence aSupported(1);
- aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.DataSourceBrowser");
+ aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DataSourceBrowser"));
return aSupported;
}
//-------------------------------------------------------------------------
Reference< XInterface > SAL_CALL SbaTableQueryBrowser::Create(const Reference<XMultiServiceFactory >& _rxFactory)
{
- ::vos::OGuard aGuard(Application::GetSolarMutex());
+ SolarMutexGuard aGuard;
return *(new SbaTableQueryBrowser(_rxFactory));
}
@@ -250,7 +251,7 @@ SbaTableQueryBrowser::~SbaTableQueryBrowser()
DBG_DTOR(SbaTableQueryBrowser,NULL);
if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
{
- OSL_ENSURE(0,"Please check who doesn't dispose this component!");
+ OSL_FAIL("Please check who doesn't dispose this component!");
// increment ref count to prevent double call of Dtor
osl_incrementInterlockedCount( &m_refCount );
dispose();
@@ -316,7 +317,7 @@ Sequence< sal_Int8 > SAL_CALL SbaTableQueryBrowser::getImplementationId( ) thro
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::disposing()
{
- ::vos::OGuard aGuard(Application::GetSolarMutex());
+ SolarMutexGuard aGuard;
// doin' a lot of VCL stuff here -> lock the SolarMutex
// kiss our listeners goodbye
@@ -370,12 +371,12 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
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_THROW );
+ m_xCollator = Reference< XCollator >( getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.Collator")) ), UNO_QUERY_THROW );
m_xCollator->loadDefaultCollator( Application::GetSettings().GetLocale(), 0 );
}
- catch(Exception&)
+ catch(const Exception&)
{
- DBG_ERROR("SbaTableQueryBrowser::Construct: could not create (or start listening at) the database context!");
+ OSL_FAIL("SbaTableQueryBrowser::Construct: could not create (or start listening at) the database context!");
}
// some help ids
if (getBrowserView() && getBrowserView()->getVclControl())
@@ -744,7 +745,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
case DataType::BIT:
case DataType::BOOLEAN:
{
- aCurrentModelType = ::rtl::OUString::createFromAscii("CheckBox");
+ aCurrentModelType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CheckBox"));
aInitialValues.push_back( NamedValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VisualEffect" ) ), makeAny( VisualEffect::FLAT ) ) );
sDefaultProperty = PROPERTY_DEFAULTSTATE;
@@ -766,7 +767,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
- aCurrentModelType = ::rtl::OUString::createFromAscii("TextField");
+ aCurrentModelType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextField"));
sDefaultProperty = PROPERTY_DEFAULTTEXT;
break;
@@ -775,12 +776,12 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
bFormattedIsNumeric = sal_False;
// NO break!
default:
- aCurrentModelType = ::rtl::OUString::createFromAscii("FormattedField");
+ aCurrentModelType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FormattedField"));
sDefaultProperty = PROPERTY_EFFECTIVEDEFAULT;
if ( xSupplier.is() )
- aInitialValues.push_back( NamedValue( ::rtl::OUString::createFromAscii( "FormatsSupplier" ), makeAny( xSupplier ) ) );
- aInitialValues.push_back( NamedValue( ::rtl::OUString::createFromAscii( "TreatAsNumber" ), makeAny( (sal_Bool)bFormattedIsNumeric ) ) );
+ aInitialValues.push_back( NamedValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier")), makeAny( xSupplier ) ) );
+ aInitialValues.push_back( NamedValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber")), makeAny( (sal_Bool)bFormattedIsNumeric ) ) );
aCopyProperties.push_back( PROPERTY_FORMATKEY );
break;
}
@@ -858,7 +859,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
}
}
}
- catch(Exception&)
+ catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
return sal_False;
@@ -1007,7 +1008,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw(
// -----------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::suspend(sal_Bool bSuspend) throw( RuntimeException )
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
if ( getView() && getView()->IsInModalMode() )
return sal_False;
@@ -1041,7 +1042,7 @@ void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEv
{
if ( _rEvent.FeatureURL.Complete == aLoop->second.aURL.Complete)
{
- DBG_ASSERT( xSource.get() == aLoop->second.xDispatcher.get(), "SbaTableQueryBrowser::statusChanged: inconsistent!" );
+ OSL_ENSURE( xSource.get() == aLoop->second.xDispatcher.get(), "SbaTableQueryBrowser::statusChanged: inconsistent!" );
// update the enabled state
aLoop->second.bEnabled = _rEvent.IsEnabled;
@@ -1079,7 +1080,7 @@ void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEv
}
}
- DBG_ASSERT(aLoop != m_aExternalFeatures.end(), "SbaTableQueryBrowser::statusChanged: don't know who sent this!");
+ OSL_ENSURE(aLoop != m_aExternalFeatures.end(), "SbaTableQueryBrowser::statusChanged: don't know who sent this!");
}
// -------------------------------------------------------------------------
@@ -1092,7 +1093,7 @@ void SbaTableQueryBrowser::checkDocumentDataSource()
if (!bKnownDocDataSource)
{
if (NULL != pDataSourceEntry)
- { // at least the data source is know
+ { // at least the data source is known
if (NULL != pContainerEntry)
bKnownDocDataSource = sal_True; // assume we know it.
// TODO: should we expand the object container? This may be too expensive just for checking ....
@@ -1143,7 +1144,6 @@ namespace
if ( aURL.GetProtocol() != INET_PROT_NOT_VALID )
{
_rDisplayName = aURL.getBase(INetURLObject::LAST_SEGMENT,true,INetURLObject::DECODE_WITH_CHARSET);
- // _rDisplayName = aURL.getName(INetURLObject::LAST_SEGMENT,true,INetURLObject::DECODE_WITH_CHARSET);
_rUniqueId = aURL.GetMainURL( INetURLObject::NO_DECODE );
return true;
}
@@ -1173,11 +1173,11 @@ namespace
// -------------------------------------------------------------------------
String SbaTableQueryBrowser::getDataSourceAcessor( SvLBoxEntry* _pDataSourceEntry ) const
{
- DBG_ASSERT( _pDataSourceEntry, "SbaTableQueryBrowser::getDataSourceAcessor: invalid entry!" );
+ OSL_ENSURE( _pDataSourceEntry, "SbaTableQueryBrowser::getDataSourceAcessor: invalid entry!" );
DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( _pDataSourceEntry->GetUserData() );
- DBG_ASSERT( pData, "SbaTableQueryBrowser::getDataSourceAcessor: invalid entry data!" );
- DBG_ASSERT( pData->eType == etDatasource, "SbaTableQueryBrowser::getDataSourceAcessor: entry does not denote a data source!" );
+ OSL_ENSURE( pData, "SbaTableQueryBrowser::getDataSourceAcessor: invalid entry data!" );
+ OSL_ENSURE( pData->eType == etDatasource, "SbaTableQueryBrowser::getDataSourceAcessor: entry does not denote a data source!" );
return pData->sAccessor.Len() ? pData->sAccessor : GetEntryText( _pDataSourceEntry );
}
@@ -1198,7 +1198,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS
String sDisplayName, sDataSourceId;
bool bIsDataSourceURL = getDataSourceDisplayName_isURL( _rDataSource, sDisplayName, sDataSourceId );
// the display name may differ from the URL for readability reasons
- // #i33699# - 2004-09-24 - fs@openoffice.org
+ // #i33699#
FilterByEntryDataId aFilter( sDataSourceId );
SvLBoxEntry* pDataSource = m_pTreeView->getListBox().GetEntryPosByName( sDisplayName, NULL, &aFilter );
@@ -1210,7 +1210,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS
// add new entries to the list box model
implAddDatasource( _rDataSource, _rxConnection );
pDataSource = m_pTreeView->getListBox().GetEntryPosByName( sDisplayName, NULL, &aFilter );
- DBG_ASSERT( pDataSource, "SbaTableQueryBrowser::getObjectEntry: hmm - did not find it again!" );
+ OSL_ENSURE( pDataSource, "SbaTableQueryBrowser::getObjectEntry: hmm - did not find it again!" );
}
}
if (_ppDataSourceEntry)
@@ -1280,13 +1280,12 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS
}
}
}
- catch(Exception&)
+ catch(const Exception&)
{
- DBG_ERROR("SbaTableQueryBrowser::populateTree: could not fill the tree");
+ OSL_FAIL("SbaTableQueryBrowser::populateTree: could not fill the tree");
}
}
}
- // m_pTreeView->getListBox().Expand(pCommandType);
}
while ( nIndex >= 0 );
}
@@ -1314,7 +1313,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::svx::ODataAccessDescri
void SbaTableQueryBrowser::connectExternalDispatches()
{
Reference< XDispatchProvider > xProvider( getFrame(), UNO_QUERY );
- DBG_ASSERT(xProvider.is(), "SbaTableQueryBrowser::connectExternalDispatches: no DispatchProvider !");
+ OSL_ENSURE(xProvider.is(), "SbaTableQueryBrowser::connectExternalDispatches: no DispatchProvider !");
if (xProvider.is())
{
if ( m_aExternalFeatures.empty() )
@@ -1332,7 +1331,7 @@ void SbaTableQueryBrowser::connectExternalDispatches()
ID_BROWSER_INSERTCONTENT
};
- for ( size_t i=0; i < sizeof( pURLs ) / sizeof( pURLs[0] ); ++i )
+ for ( size_t i=0; i < SAL_N_ELEMENTS( pURLs ); ++i )
{
URL aURL;
aURL.Complete = ::rtl::OUString::createFromAscii( pURLs[i] );
@@ -1348,12 +1347,12 @@ void SbaTableQueryBrowser::connectExternalDispatches()
)
{
feature->second.xDispatcher = xProvider->queryDispatch(
- feature->second.aURL, ::rtl::OUString::createFromAscii("_parent"), FrameSearchFlag::PARENT
+ feature->second.aURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_parent")), FrameSearchFlag::PARENT
);
if ( feature->second.xDispatcher.get() == static_cast< XDispatch* >( this ) )
{
- OSL_ENSURE( sal_False, "SbaTableQueryBrowser::connectExternalDispatches: this should not happen anymore!" );
+ OSL_FAIL( "SbaTableQueryBrowser::connectExternalDispatches: this should not happen anymore!" );
// (nowadays, the URLs aren't in our SupportedFeatures list anymore, so we should
// not supply a dispatcher for this)
feature->second.xDispatcher.clear();
@@ -1445,7 +1444,7 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const ::com::sun::star::lang::Eve
DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pDSLoop->GetUserData());
if ( pData && pData->xConnection == xCon )
{
- // we set the conenction to null to avoid a second disposing of the connection
+ // we set the connection to null to avoid a second disposing of the connection
pData->xConnection.clear();
closeConnection(pDSLoop,sal_False);
break;
@@ -1477,7 +1476,7 @@ void SbaTableQueryBrowser::implRemoveStatusListeners()
}
catch (Exception&)
{
- DBG_ERROR("SbaTableQueryBrowser::implRemoveStatusListeners: could not remove a status listener!");
+ OSL_FAIL("SbaTableQueryBrowser::implRemoveStatusListeners: could not remove a status listener!");
}
}
}
@@ -1487,7 +1486,7 @@ void SbaTableQueryBrowser::implRemoveStatusListeners()
// -------------------------------------------------------------------------
sal_Bool SAL_CALL SbaTableQueryBrowser::select( const Any& _rSelection ) throw (IllegalArgumentException, RuntimeException)
{
- ::vos::OGuard aGuard(Application::GetSolarMutex());
+ SolarMutexGuard aGuard;
// doin' a lot of VCL stuff here -> lock the SolarMutex
Sequence< PropertyValue > aDescriptorSequence;
@@ -1502,7 +1501,7 @@ sal_Bool SAL_CALL SbaTableQueryBrowser::select( const Any& _rSelection ) throw (
}
catch(const Exception&)
{
- OSL_ENSURE(sal_False, "SbaTableQueryBrowser::select: could not extract the descriptor!");
+ OSL_FAIL("SbaTableQueryBrowser::select: could not extract the descriptor!");
}
// check the precense of the props we need
@@ -1565,7 +1564,7 @@ void SbaTableQueryBrowser::attachFrame(const Reference< ::com::sun::star::frame:
Reference< XFrame > xCurrentFrame( getFrame() );
if ( xCurrentFrame.is() )
{
- m_xCurrentFrameParent = xCurrentFrame->findFrame(::rtl::OUString::createFromAscii("_parent"),FrameSearchFlag::PARENT);
+ m_xCurrentFrameParent = xCurrentFrame->findFrame(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_parent")),FrameSearchFlag::PARENT);
if ( m_xCurrentFrameParent.is() )
m_xCurrentFrameParent->addFrameActionListener((::com::sun::star::frame::XFrameActionListener*)this);
@@ -1822,7 +1821,6 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
aReturn.bEnabled = aReturn.bEnabled && getBrowserView()->getVclControl()->GetSelectRowCount();
// disabled for native queries which are not saved within the database
- // 67706 - 23.08.99 - FS
Reference< XPropertySet > xDataSource(getRowSet(), UNO_QUERY);
try
{
@@ -1836,7 +1834,7 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
}
catch(DisposedException&)
{
- OSL_ENSURE(sal_False, "SbaTableQueryBrowser::GetState: object already disposed!");
+ OSL_FAIL("SbaTableQueryBrowser::GetState: object already disposed!");
}
catch( const Exception& )
{
@@ -1859,7 +1857,7 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
case CommandType::COMMAND:
sTitle = String(ModuleRes(STR_QRY_TITLE)); break;
default:
- DBG_ASSERT(sal_False, "SbaTableQueryBrowser::GetState: unknown command type!");
+ OSL_FAIL("SbaTableQueryBrowser::GetState: unknown command type!");
}
::rtl::OUString aName;
xProp->getPropertyValue(PROPERTY_COMMAND) >>= aName;
@@ -1887,7 +1885,7 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
{
aReturn.bEnabled = m_aCurrentFrame.isActive();
break;
- } // if ( getBrowserView()->getVclControl()->GetSelectRowCount() )
+ }
else
aReturn.bEnabled = pControl->canCopyCellText(pControl->GetCurRow(), pControl->GetCurColumnId());
break;
@@ -2012,7 +2010,7 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
if ( !pGrid->IsAllSelected() )
{ // transfer the selected rows only if not all rows are selected
// (all rows means the whole table)
- // i3832 - 03.04.2002 - fs@openoffice.org
+ // #i3832#
if (pSelection != NULL)
{
aSelection.realloc(pSelection->GetSelectCount());
@@ -2035,11 +2033,11 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
}
catch(DisposedException&)
{
- OSL_ENSURE(0,"Object already disposed!");
+ OSL_FAIL("Object already disposed!");
}
- catch(Exception&)
+ catch(const Exception&)
{
- DBG_ERROR("SbaTableQueryBrowser::Execute(ID_BROWSER_?): could not clone the cursor!");
+ OSL_FAIL("SbaTableQueryBrowser::Execute(ID_BROWSER_?): could not clone the cursor!");
}
Reference<XPropertySet> xProp(getRowSet(),UNO_QUERY);
@@ -2108,7 +2106,7 @@ void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDb
String& _rQueryName, Image& _rQueryImage, String& _rTableName, Image& _rTableImage,
const SharedConnection& _rxConnection)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
// initialize the names/images if necessary
if (!_rQueryName.Len())
_rQueryName = String(ModuleRes(RID_STR_QUERIES_CONTAINER));
@@ -2117,16 +2115,16 @@ void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDb
ImageProvider aImageProvider;
if (!_rQueryImage)
- _rQueryImage = aImageProvider.getFolderImage( DatabaseObject::QUERY, isHiContrast() );
+ _rQueryImage = aImageProvider.getFolderImage( DatabaseObject::QUERY );
if (!_rTableImage)
- _rTableImage = aImageProvider.getFolderImage( DatabaseObject::TABLE, isHiContrast() );
+ _rTableImage = aImageProvider.getFolderImage( DatabaseObject::TABLE );
if (!_rDbImage)
- _rDbImage = aImageProvider.getDatabaseImage( isHiContrast() );
+ _rDbImage = aImageProvider.getDatabaseImage();
// add the entry for the data source
// special handling for data sources denoted by URLs - we do not want to display this ugly URL, do we?
- // #i33699# - 2004-09-24 - fs@openoffice.org
+ // #i33699#
String sDSDisplayName, sDataSourceId;
getDataSourceDisplayName_isURL( _rDbName, sDSDisplayName, sDataSourceId );
@@ -2203,9 +2201,9 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce
}
}
}
- catch(Exception&)
+ catch(const Exception&)
{
- DBG_ERROR("SbaTableQueryBrowser::populateTree: could not fill the tree");
+ OSL_FAIL("SbaTableQueryBrowser::populateTree: could not fill the tree");
}
}
@@ -2214,15 +2212,13 @@ SvLBoxEntry* SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const
{
::std::auto_ptr< ImageProvider > pImageProvider( getImageProviderFor( _pParent ) );
- Image aImage, aImageHC;
- pImageProvider->getImages( _rName, getDatabaseObjectType( _eEntryType ), aImage, aImageHC );
+ Image aImage;
+ pImageProvider->getImages( _rName, getDatabaseObjectType( _eEntryType ), aImage );
SvLBoxEntry* pNewEntry = m_pTreeView->getListBox().InsertEntry( _rName, _pParent, _eEntryType == etQueryContainer , LIST_APPEND, _pUserData );
- m_pTreeView->getListBox().SetExpandedEntryBmp( pNewEntry, aImage, BMP_COLOR_NORMAL );
- m_pTreeView->getListBox().SetCollapsedEntryBmp( pNewEntry, aImage, BMP_COLOR_NORMAL );
- m_pTreeView->getListBox().SetExpandedEntryBmp( pNewEntry, aImageHC, BMP_COLOR_HIGHCONTRAST );
- m_pTreeView->getListBox().SetCollapsedEntryBmp( pNewEntry, aImageHC, BMP_COLOR_HIGHCONTRAST );
+ m_pTreeView->getListBox().SetExpandedEntryBmp( pNewEntry, aImage );
+ m_pTreeView->getListBox().SetCollapsedEntryBmp( pNewEntry, aImage );
return pNewEntry;
}
@@ -2304,7 +2300,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
if(e.TargetException >>= aSql)
aInfo = aSql;
else
- OSL_ENSURE(sal_False, "SbaTableQueryBrowser::OnExpandEntry: something strange happended!");
+ OSL_FAIL("SbaTableQueryBrowser::OnExpandEntry: something strange happended!");
}
catch( const Exception& )
{
@@ -2315,7 +2311,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
}
else
return 0L;
- // 0 indicates that an error occured
+ // 0 indicates that an error occurred
}
else
{ // we have to expand the queries or bookmarks
@@ -2332,7 +2328,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry )
{
- DBG_ASSERT(_pEntry, "SbaTableQueryBrowser::ensureEntryObject: invalid argument!");
+ OSL_ENSURE(_pEntry, "SbaTableQueryBrowser::ensureEntryObject: invalid argument!");
if (!_pEntry)
return sal_False;
@@ -2394,7 +2390,7 @@ sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry )
bSuccess = pEntryData->xContainer.is();
}
else {
- DBG_ERROR("SbaTableQueryBrowser::ensureEntryObject: no XQueryDefinitionsSupplier interface!");
+ OSL_FAIL("SbaTableQueryBrowser::ensureEntryObject: no XQueryDefinitionsSupplier interface!");
}
}
catch( const Exception& )
@@ -2406,7 +2402,7 @@ sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry )
break;
default:
- DBG_ERROR("SbaTableQueryBrowser::ensureEntryObject: ooops ... missing some implementation here!");
+ OSL_FAIL("SbaTableQueryBrowser::ensureEntryObject: ooops ... missing some implementation here!");
// TODO ...
break;
}
@@ -2503,7 +2499,7 @@ sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSou
DBG_UNHANDLED_EXCEPTION();
}
}
- catch(Exception&)
+ catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -2777,12 +2773,12 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
if(e.TargetException >>= aSql)
showError(SQLExceptionInfo(aSql));
else
- OSL_ENSURE(sal_False, "SbaTableQueryBrowser::implSelect: something strange happended!");
+ OSL_FAIL("SbaTableQueryBrowser::implSelect: something strange happended!");
// reset the values
xRowSetProps->setPropertyValue(PROPERTY_DATASOURCENAME,Any());
xRowSetProps->setPropertyValue(PROPERTY_ACTIVE_CONNECTION,Any());
}
- catch(Exception&)
+ catch(const Exception&)
{
// reset the values
xRowSetProps->setPropertyValue(PROPERTY_DATASOURCENAME,Any());
@@ -2819,7 +2815,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAc
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
// first search for a definition container where we can insert this element
@@ -2864,7 +2860,7 @@ sal_Bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(const String& _sName,
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
- ::vos::OGuard aSolarGuard(Application::GetSolarMutex());
+ SolarMutexGuard aSolarGuard;
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
// get the top-level representing the removed data source
@@ -2917,7 +2913,7 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
- ::vos::OGuard aSolarGuard(Application::GetSolarMutex());
+ SolarMutexGuard aSolarGuard;
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
SvLBoxEntry* pContainer = getEntryFromContainer(xNames);
@@ -2978,7 +2974,7 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve
}
else if (xNames.get() == m_xDatabaseContext.get())
{ // a datasource has been replaced in the context
- DBG_ERROR("SbaTableQueryBrowser::elementReplaced: no support for replaced data sources!");
+ OSL_FAIL("SbaTableQueryBrowser::elementReplaced: no support for replaced data sources!");
// very suspicious: the database context should not allow to replace data source, only to register
// and revoke them
}
@@ -3017,8 +3013,8 @@ void SbaTableQueryBrowser::impl_releaseConnection( SharedConnection& _rxConnecti
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::disposeConnection( SvLBoxEntry* _pDSEntry )
{
- DBG_ASSERT( _pDSEntry, "SbaTableQueryBrowser::disposeConnection: invalid entry (NULL)!" );
- DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::disposeConnection: invalid entry (not top-level)!" );
+ OSL_ENSURE( _pDSEntry, "SbaTableQueryBrowser::disposeConnection: invalid entry (NULL)!" );
+ OSL_ENSURE( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::disposeConnection: invalid entry (not top-level)!" );
if ( _pDSEntry )
{
@@ -3031,8 +3027,8 @@ void SbaTableQueryBrowser::disposeConnection( SvLBoxEntry* _pDSEntry )
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::closeConnection(SvLBoxEntry* _pDSEntry,sal_Bool _bDisposeConnection)
{
- DBG_ASSERT(_pDSEntry, "SbaTableQueryBrowser::closeConnection: invalid entry (NULL)!");
- DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!");
+ OSL_ENSURE(_pDSEntry, "SbaTableQueryBrowser::closeConnection: invalid entry (NULL)!");
+ OSL_ENSURE( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!");
// if one of the entries of the given DS is displayed currently, unload the form
if (m_pCurrentlyDisplayed && (m_pTreeView->getListBox().GetRootLevelParent(m_pCurrentlyDisplayed) == _pDSEntry))
@@ -3116,11 +3112,11 @@ void SbaTableQueryBrowser::unloadAndCleanup( sal_Bool _bDisposeConnection )
if(e.TargetException >>= aSql)
showError(SQLExceptionInfo(aSql));
else
- OSL_ENSURE(sal_False, "SbaTableQueryBrowser::unloadAndCleanup: something strange happended!");
+ OSL_FAIL("SbaTableQueryBrowser::unloadAndCleanup: something strange happended!");
}
- catch(Exception&)
+ catch(const Exception&)
{
- OSL_ENSURE(sal_False, "SbaTableQueryBrowser::unloadAndCleanup: could not reset the form");
+ OSL_FAIL("SbaTableQueryBrowser::unloadAndCleanup: could not reset the form");
}
}
@@ -3154,7 +3150,7 @@ namespace
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::impl_initialize()
{
- ::vos::OGuard aGuard(Application::GetSolarMutex());
+ SolarMutexGuard aGuard;
// doin' a lot of VCL stuff here -> lock the SolarMutex
// first initialize the parent
@@ -3229,7 +3225,7 @@ void SbaTableQueryBrowser::impl_initialize()
if ( xFormMultiSet.is() )
xFormMultiSet->setPropertyValues(aProperties, aValues);
}
- catch(Exception)
+ catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -3281,7 +3277,7 @@ void SbaTableQueryBrowser::impl_initialize()
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "SbaTableQueryBrowser::impl_initialize: a connection parent which does not have a 'Name'!??" );
+ OSL_FAIL( "SbaTableQueryBrowser::impl_initialize: a connection parent which does not have a 'Name'!??" );
}
}
}
@@ -3318,7 +3314,7 @@ void SbaTableQueryBrowser::impl_initialize()
}
catch(const Exception&)
{
- OSL_ENSURE(sal_False, "SbaTableQueryBrowser::impl_initialize: could not set the update related names!");
+ OSL_FAIL("SbaTableQueryBrowser::impl_initialize: could not set the update related names!");
}
}
@@ -3397,7 +3393,7 @@ sal_Bool SbaTableQueryBrowser::getExistentConnectionFor( SvLBoxEntry* _pAnyEntry
return _rConnection.is();
}
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 0
// -----------------------------------------------------------------------------
bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvLBoxEntry* _pEntry ) const
{
@@ -3408,7 +3404,7 @@ bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvLBoxEntry* _pEntry ) const
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::ensureConnection( SvLBoxEntry* _pDSEntry, void* pDSData, SharedConnection& _rConnection )
{
- DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::ensureConnection: this entry does not denote a data source!" );
+ OSL_ENSURE( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::ensureConnection: this entry does not denote a data source!" );
if(_pDSEntry)
{
DBTreeListUserData* pTreeListData = static_cast<DBTreeListUserData*>(pDSData);
@@ -3447,7 +3443,7 @@ IMPL_LINK( SbaTableQueryBrowser, OnTreeEntryCompare, const SvSortData*, _pSortDa
{
SvLBoxEntry* pLHS = static_cast<SvLBoxEntry*>(_pSortData->pLeft);
SvLBoxEntry* pRHS = static_cast<SvLBoxEntry*>(_pSortData->pRight);
- DBG_ASSERT(pLHS && pRHS, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid tree entries!");
+ OSL_ENSURE(pLHS && pRHS, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid tree entries!");
// we want the table entry and the end so we have to do a check
if (isContainer(pRHS))
@@ -3477,13 +3473,13 @@ IMPL_LINK( SbaTableQueryBrowser, OnTreeEntryCompare, const SvSortData*, _pSortDa
if ( ( eLeft == etQueryContainer ) && ( eRight == etTableContainer ) )
return COMPARE_LESS;
- OSL_ENSURE( false, "SbaTableQueryBrowser::OnTreeEntryCompare: unexpected case!" );
+ OSL_FAIL( "SbaTableQueryBrowser::OnTreeEntryCompare: unexpected case!" );
return COMPARE_EQUAL;
}
SvLBoxString* pLeftTextItem = static_cast<SvLBoxString*>(pLHS->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
SvLBoxString* pRightTextItem = static_cast<SvLBoxString*>(pRHS->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- DBG_ASSERT(pLeftTextItem && pRightTextItem, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid text items!");
+ OSL_ENSURE(pLeftTextItem && pRightTextItem, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid text items!");
String sLeftText = pLeftTextItem->GetText();
String sRightText = pRightTextItem->GetText();
@@ -3496,7 +3492,7 @@ IMPL_LINK( SbaTableQueryBrowser, OnTreeEntryCompare, const SvSortData*, _pSortDa
{
nCompareResult = m_xCollator->compareString(sLeftText, sRightText);
}
- catch(Exception&)
+ catch(const Exception&)
{
}
}
@@ -3633,7 +3629,7 @@ Any SbaTableQueryBrowser::getCurrentSelection( Control& _rControl ) const
break;
default:
- OSL_ENSURE( false, "SbaTableQueryBrowser::getCurrentSelection: invalid (unexpected) object type!" );
+ OSL_FAIL( "SbaTableQueryBrowser::getCurrentSelection: invalid (unexpected) object type!" );
break;
}
@@ -3648,7 +3644,7 @@ sal_Bool SbaTableQueryBrowser::implGetQuerySignature( ::rtl::OUString& _rCommand
try
{
- // ontain the dss (data source signature) of the form
+ // contain the dss (data source signature) of the form
::rtl::OUString sDataSourceName;
::rtl::OUString sCommand;
sal_Int32 nCommandType = CommandType::COMMAND;
@@ -3718,14 +3714,6 @@ void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _
}
}
// -----------------------------------------------------------------------------
-sal_Bool SbaTableQueryBrowser::isHiContrast() const
-{
- sal_Bool bRet = sal_False;
- if ( m_pTreeView )
- bRet = m_pTreeView->getListBox().GetSettings().GetStyleSettings().GetHighContrastMode();
- return bRet;
-}
-// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
{
if ( m_bShowMenu )
@@ -3762,7 +3750,7 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
sTitle = aURL.getBase(INetURLObject::LAST_SEGMENT,true,INetURLObject::DECODE_WITH_CHARSET);
if ( sName.getLength() )
{
- sName += ::rtl::OUString::createFromAscii(" - ");
+ sName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - "));
sName += sTitle;
sTitle = sName;
}
@@ -3803,7 +3791,6 @@ void SbaTableQueryBrowser::postReloadForm()
{
InitializeGridModel(getFormComponent());
LoadFinished(sal_True);
- //updateTitle();
}
//------------------------------------------------------------------------------
@@ -3849,7 +3836,7 @@ void SAL_CALL SbaTableQueryBrowser::releaseContextMenuInterceptor( const Referen
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::registeredDatabaseLocation( const DatabaseRegistrationEvent& _Event ) throw (RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
implAddDatasource( _Event.Name, SharedConnection() );
}
@@ -3886,13 +3873,12 @@ void SbaTableQueryBrowser::impl_cleanupDataSourceEntry( const String& _rDataSour
SvTreeEntryList* pList = m_pTreeModel->GetChildList( pDataSourceEntry );
if ( pList )
{
- SvLBoxEntry* pEntryLoop = static_cast<SvLBoxEntry*>( pList->First() );
- while ( pEntryLoop )
+ for ( size_t i = 0, n = pList->size(); i < n; ++i )
{
+ SvLBoxEntry* pEntryLoop = static_cast<SvLBoxEntry*>((*pList)[ i ]);
DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( pEntryLoop->GetUserData() );
pEntryLoop->SetUserData( NULL );
delete pData;
- pEntryLoop = static_cast< SvLBoxEntry* >( pList->Next() );
}
}
@@ -3906,7 +3892,7 @@ void SbaTableQueryBrowser::impl_cleanupDataSourceEntry( const String& _rDataSour
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::revokedDatabaseLocation( const DatabaseRegistrationEvent& _Event ) throw (RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
impl_cleanupDataSourceEntry( _Event.Name );
@@ -3917,7 +3903,7 @@ void SAL_CALL SbaTableQueryBrowser::revokedDatabaseLocation( const DatabaseRegis
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::changedDatabaseLocation( const DatabaseRegistrationEvent& _Event ) throw (RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
// 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
@@ -3931,3 +3917,4 @@ void SAL_CALL SbaTableQueryBrowser::changedDatabaseLocation( const DatabaseRegis
// .........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */