diff options
Diffstat (limited to 'dbaccess/source/ui/browser/unodatbr.cxx')
-rw-r--r-- | dbaccess/source/ui/browser/unodatbr.cxx | 413 |
1 files changed, 200 insertions, 213 deletions
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 92c94934a..ea256fc39 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -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,19 +371,19 @@ 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()) { // create controls and set sizes - const long nFrameWidth = getBrowserView()->LogicToPixel( ::Size( 3, 0 ), MAP_APPFONT ).Width(); + const long nFrameWidth = getBrowserView()->LogicToPixel( ::Size( 3, 0 ), MAP_APPFONT ).Width(); m_pSplitter = new Splitter(getBrowserView(),WB_HSCROLL); m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) ); @@ -525,7 +526,7 @@ void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow() // as column name, "NOT_EQUAL" as operator, and "!= <value>" as value, effectively duplicating the // information about the operator, and beding all clients to manually remove the "!=" from the value // string. - // So, what really would be handy, is some + // So, what really would be handy, is some // XNormalizedFilter getNormalizedFilter(); // with // interface XDisjunctiveFilterExpression @@ -659,38 +660,38 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun:: Any* pValueIter = aValues.getArray(); if ( m_bPreview ) { - *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AlwaysShowCursor")); - *pValueIter++ <<= sal_False; - *pStringIter++ = PROPERTY_BORDER; - *pValueIter++ <<= sal_Int16(0); + *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AlwaysShowCursor")); + *pValueIter++ <<= sal_False; + *pStringIter++ = PROPERTY_BORDER; + *pValueIter++ <<= sal_Int16(0); } - *pStringIter++ = PROPERTY_FONT; - *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_FONT); - *pStringIter++ = PROPERTY_TEXTEMPHASIS; - *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_TEXTEMPHASIS); - *pStringIter++ = PROPERTY_TEXTRELIEF; - *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_TEXTRELIEF); + *pStringIter++ = PROPERTY_FONT; + *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_FONT); + *pStringIter++ = PROPERTY_TEXTEMPHASIS; + *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_TEXTEMPHASIS); + *pStringIter++ = PROPERTY_TEXTRELIEF; + *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_TEXTRELIEF); if ( m_bPreview ) { - *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasNavigationBar")); - *pValueIter++ <<= sal_False; - *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasRecordMarker")); - *pValueIter++ <<= sal_False; + *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasNavigationBar")); + *pValueIter++ <<= sal_False; + *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasRecordMarker")); + *pValueIter++ <<= sal_False; } - *pStringIter++ = PROPERTY_ROW_HEIGHT; - *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_ROW_HEIGHT); + *pStringIter++ = PROPERTY_ROW_HEIGHT; + *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_ROW_HEIGHT); if ( m_bPreview ) { - *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Tabstop")); - *pValueIter++ <<= sal_False; + *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Tabstop")); + *pValueIter++ <<= sal_False; } - *pStringIter++ = PROPERTY_TEXTCOLOR; - *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_TEXTCOLOR); - *pStringIter++ = PROPERTY_TEXTLINECOLOR; - *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_TEXTLINECOLOR); + *pStringIter++ = PROPERTY_TEXTCOLOR; + *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_TEXTCOLOR); + *pStringIter++ = PROPERTY_TEXTLINECOLOR; + *pValueIter++ = pData->xObjectProperties->getPropertyValue(PROPERTY_TEXTLINECOLOR); - Reference< XMultiPropertySet > xFormMultiSet(xGrid, UNO_QUERY); + Reference< XMultiPropertySet > xFormMultiSet(xGrid, UNO_QUERY); xFormMultiSet->setPropertyValues(aProperties, aValues); } @@ -711,10 +712,10 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun:: // insert the column into the gridcontrol so that we see something :-) ::rtl::OUString aCurrentModelType; Reference<XColumnsSupplier> xSupCols(getRowSet(),UNO_QUERY); - Reference<XNameAccess> xColumns = xSupCols->getColumns(); - Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); - const ::rtl::OUString* pIter = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aNames.getLength(); + Reference<XNameAccess> xColumns = xSupCols->getColumns(); + Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); + const ::rtl::OUString* pIter = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aNames.getLength(); ::rtl::OUString sDefaultProperty; Reference< XPropertySet > xColumn; @@ -732,7 +733,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun:: continue; // use the result set column's type to determine the type of grid column to create - sal_Bool bFormattedIsNumeric = sal_True; + sal_Bool bFormattedIsNumeric = sal_True; sal_Int32 nType = ::comphelper::getINT32( xColumn->getPropertyValue( PROPERTY_TYPE ) ); ::std::vector< NamedValue > aInitialValues; @@ -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; } @@ -825,7 +826,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun:: aDescription >>= sTemp; if ( !sTemp.getLength() ) xColumn->getPropertyValue( PROPERTY_DESCRIPTION ) >>= sTemp; - + aDescription <<= sTemp; aInitialValues.push_back( NamedValue( PROPERTY_HELPTEXT, aDescription ) ); @@ -858,7 +859,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun:: } } } - catch(Exception&) + catch(const Exception&) { DBG_UNHANDLED_EXCEPTION(); return sal_False; @@ -910,7 +911,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw( // one of the many properties which require us to update the definition ? // a column's width ? else if (evt.PropertyName.equals(PROPERTY_WIDTH)) - { // a column width has changed -> update the model + { // a column width has changed -> update the model // (the update of the view is done elsewhere) Reference<XPropertySet> xProp = getColumnHelper(m_pCurrentlyDisplayed,xSource); if(xProp.is()) @@ -957,8 +958,8 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw( } // a column's format ? - else if ( (evt.PropertyName.equals(PROPERTY_FORMATKEY)) - && (TypeClass_LONG == evt.NewValue.getValueTypeClass()) + else if ( (evt.PropertyName.equals(PROPERTY_FORMATKEY)) + && (TypeClass_LONG == evt.NewValue.getValueTypeClass()) ) { // update the model (means the definition object) @@ -984,15 +985,15 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw( } } - else if ( evt.PropertyName.equals(PROPERTY_FONT) // the font ? - || evt.PropertyName.equals(PROPERTY_TEXTCOLOR) // the text color ? - || evt.PropertyName.equals(PROPERTY_FILTER) // the filter ? - || evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE) // the having clause ? - || evt.PropertyName.equals(PROPERTY_ORDER) // the sort ? - || evt.PropertyName.equals(PROPERTY_APPLYFILTER) // the appliance of the filter ? - || evt.PropertyName.equals(PROPERTY_TEXTLINECOLOR) // the text line color ? - || evt.PropertyName.equals(PROPERTY_TEXTEMPHASIS) // the text emphasis ? - || evt.PropertyName.equals(PROPERTY_TEXTRELIEF) // the text relief ? + else if ( evt.PropertyName.equals(PROPERTY_FONT) // the font ? + || evt.PropertyName.equals(PROPERTY_TEXTCOLOR) // the text color ? + || evt.PropertyName.equals(PROPERTY_FILTER) // the filter ? + || evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE) // the having clause ? + || evt.PropertyName.equals(PROPERTY_ORDER) // the sort ? + || evt.PropertyName.equals(PROPERTY_APPLYFILTER) // the appliance of the filter ? + || evt.PropertyName.equals(PROPERTY_TEXTLINECOLOR) // the text line color ? + || evt.PropertyName.equals(PROPERTY_TEXTEMPHASIS) // the text emphasis ? + || evt.PropertyName.equals(PROPERTY_TEXTRELIEF) // the text relief ? ) { transferChangedControlProperty(evt.PropertyName, evt.NewValue); @@ -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,14 +1093,14 @@ 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 .... else { if ((NULL == pObjectEntry) && m_aDocumentDataSource.has(daCommandType) && m_aDocumentDataSource.has(daCommand)) - { // maybe we have a command to be displayed ? + { // maybe we have a command to be displayed ? sal_Int32 nCommandType = CommandType::TABLE; m_aDocumentDataSource[daCommandType] >>= nCommandType; @@ -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 ); } @@ -1313,8 +1312,8 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::svx::ODataAccessDescri // ------------------------------------------------------------------------- void SbaTableQueryBrowser::connectExternalDispatches() { - Reference< XDispatchProvider > xProvider( getFrame(), UNO_QUERY ); - DBG_ASSERT(xProvider.is(), "SbaTableQueryBrowser::connectExternalDispatches: no DispatchProvider !"); + Reference< XDispatchProvider > xProvider( getFrame(), UNO_QUERY ); + 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(); @@ -1436,7 +1435,7 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const ::com::sun::star::lang::Eve { Reference<XConnection> xCon(_rSource.Source, UNO_QUERY); if ( xCon.is() && m_pTreeView ) - { // our connection is in dispose so we have to find the entry equal with this connection + { // our connection is in dispose so we have to find the entry equal with this connection // and close it what means to collapse the entry // get the top-level representing the removed data source SvLBoxEntry* pDSLoop = m_pTreeView->getListBox().FirstChild(NULL); @@ -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); @@ -1689,7 +1688,7 @@ void SbaTableQueryBrowser::LoadFinished(sal_Bool _bWasSynch) if (isValid() && !loadingCancelled()) { // did we load a query? - sal_Bool bTemporary; // needed because we m_bQueryEscapeProcessing is only one bit wide (and we want to pass it by reference) + sal_Bool bTemporary; // needed because we m_bQueryEscapeProcessing is only one bit wide (and we want to pass it by reference) if ( implGetQuerySignature( m_sQueryCommand, bTemporary ) ) m_bQueryEscapeProcessing = bTemporary; } @@ -1755,8 +1754,8 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const SvLBoxEntry* pDataSourceEntry = m_pTreeView->getListBox().GetRootLevelParent( pCurrentEntry ); DBTreeListUserData* pDSData = pDataSourceEntry - ? static_cast< DBTreeListUserData* >( pDataSourceEntry->GetUserData() ) - : NULL; + ? static_cast< DBTreeListUserData* >( pDataSourceEntry->GetUserData() ) + : NULL; if ( nId == ID_TREE_CLOSE_CONN ) { @@ -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; @@ -1875,7 +1873,7 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const case ID_BROWSER_COLATTRSET: case ID_BROWSER_COLWIDTH: aReturn.bEnabled = getBrowserView() && getBrowserView()->getVclControl() && isValid() && isValidCursor(); - // aReturn.bEnabled &= getDefinition() && !getDefinition()->GetDatabase()->IsReadOnly(); + // aReturn.bEnabled &= getDefinition() && !getDefinition()->GetDatabase()->IsReadOnly(); break; case ID_BROWSER_COPY: @@ -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; @@ -2010,9 +2008,9 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue MultiSelection* pSelection = (MultiSelection*)pGrid->GetSelection(); Sequence< Any > aSelection; if ( !pGrid->IsAllSelected() ) - { // transfer the selected rows only if not all rows are selected + { // 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); @@ -2051,14 +2049,14 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue xProp->getPropertyValue(PROPERTY_DATASOURCENAME) >>= sDataSourceName; aDescriptor.setDataSource(sDataSourceName); - aDescriptor[daCommand] = xProp->getPropertyValue(PROPERTY_COMMAND); - aDescriptor[daCommandType] = xProp->getPropertyValue(PROPERTY_COMMAND_TYPE); - aDescriptor[daConnection] = xProp->getPropertyValue(PROPERTY_ACTIVE_CONNECTION); - aDescriptor[daCursor] <<= xCursorClone; + aDescriptor[daCommand] = xProp->getPropertyValue(PROPERTY_COMMAND); + aDescriptor[daCommandType] = xProp->getPropertyValue(PROPERTY_COMMAND_TYPE); + aDescriptor[daConnection] = xProp->getPropertyValue(PROPERTY_ACTIVE_CONNECTION); + aDescriptor[daCursor] <<= xCursorClone; if ( aSelection.getLength() ) { - aDescriptor[daSelection] <<= aSelection; - aDescriptor[daBookmarkSelection] <<= sal_False; + aDescriptor[daSelection] <<= aSelection; + aDescriptor[daBookmarkSelection] <<= sal_False; // these are selection indicies // before we change this, all clients have to be adjusted // so that they recognize the new BookmarkSelection property! @@ -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 ); @@ -2168,8 +2166,8 @@ void SbaTableQueryBrowser::initializeTreeModel() // fill the model with the names of the registered datasources Sequence< ::rtl::OUString > aDatasources = m_xDatabaseContext->getElementNames(); - const ::rtl::OUString* pIter = aDatasources.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aDatasources.getLength(); + const ::rtl::OUString* pIter = aDatasources.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aDatasources.getLength(); for (; pIter != pEnd; ++pIter) implAddDatasource( *pIter, aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage, SharedConnection() ); } @@ -2186,8 +2184,8 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce try { Sequence< ::rtl::OUString > aNames = _xNameAccess->getElementNames(); - const ::rtl::OUString* pIter = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aNames.getLength(); + const ::rtl::OUString* pIter = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aNames.getLength(); for (; pIter != pEnd; ++pIter) { if( !m_pTreeView->getListBox().GetEntryPosByName(*pIter,_pParent)) @@ -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,10 +2311,10 @@ 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 + { // we have to expand the queries or bookmarks if (ensureEntryObject(_pParent)) { DBTreeListUserData* pParentData = static_cast< DBTreeListUserData* >( _pParent->GetUserData() ); @@ -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; @@ -2373,7 +2369,7 @@ sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry ) { DBG_UNHANDLED_EXCEPTION(); } - + bSuccess = pEntryData->xContainer.is(); } else @@ -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; } @@ -2434,7 +2430,7 @@ sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSou try { Reference<XPropertySet> xProp( getRowSet(), UNO_QUERY_THROW ); - Reference< XLoadable > xLoadable( xProp, UNO_QUERY_THROW ); + Reference< XLoadable > xLoadable( xProp, UNO_QUERY_THROW ); // the values allowing the RowSet to re-execute xProp->setPropertyValue(PROPERTY_DATASOURCENAME, makeAny(_rDataSourceName)); if(_rxConnection.is()) @@ -2503,7 +2499,7 @@ sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSou DBG_UNHANDLED_EXCEPTION(); } } - catch(Exception&) + catch(const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -2545,7 +2541,7 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::rtl::OUString& _rDataSourceNam else if (!pCommandType) { if ( m_pCurrentlyDisplayed ) - { // tell the old entry (if any) it has been deselected + { // tell the old entry (if any) it has been deselected selectPath(m_pCurrentlyDisplayed, sal_False); m_pCurrentlyDisplayed = NULL; } @@ -2611,7 +2607,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) sal_Int32 nOldType = 0; xRowSetProps->getPropertyValue(PROPERTY_COMMAND_TYPE) >>= nOldType; Reference<XConnection> xOldConnection(xRowSetProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY); - + // the name of the table or query SvLBoxString* pString = (SvLBoxString*)_pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING); OSL_ENSURE(pString,"There must be a string item!"); @@ -2631,16 +2627,16 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) } ::rtl::OUString aName = sNameBuffer.makeStringAndClear(); - sal_Int32 nCommandType = ( etTableContainer == pContainerData->eType) - ? CommandType::TABLE - : CommandType::QUERY; + sal_Int32 nCommandType = ( etTableContainer == pContainerData->eType) + ? CommandType::TABLE + : CommandType::QUERY; // check if need to rebuild the rowset sal_Bool bRebuild = ( xOldConnection != pConData->xConnection ) || ( nOldType != nCommandType ) || ( aName != aOldName ); - Reference< ::com::sun::star::form::XLoadable > xLoadable = getLoadable(); + Reference< ::com::sun::star::form::XLoadable > xLoadable = getLoadable(); bRebuild |= !xLoadable->isLoaded(); bool bSuccess = true; if ( bRebuild ) @@ -2760,7 +2756,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) String sDataSourceName( getDataSourceAcessor( pConnection ) ); bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, bEscapeProcessing, pConData->xConnection ); if ( !bSuccess ) - { // clean up + { // clean up criticalFail(); } } @@ -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()); @@ -2800,18 +2796,18 @@ SvLBoxEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAc SvLBoxEntry* pDSLoop = rListBox.FirstChild(NULL); while (pDSLoop) { - pContainer = rListBox.GetEntry(pDSLoop, CONTAINER_QUERIES); + pContainer = rListBox.GetEntry(pDSLoop, CONTAINER_QUERIES); DBTreeListUserData* pQueriesData = static_cast<DBTreeListUserData*>(pContainer->GetUserData()); if ( pQueriesData && pQueriesData->xContainer == _rxNameAccess ) break; - pContainer = rListBox.GetEntry(pDSLoop, CONTAINER_TABLES); + pContainer = rListBox.GetEntry(pDSLoop, CONTAINER_TABLES); DBTreeListUserData* pTablesData = static_cast<DBTreeListUserData*>(pContainer->GetUserData()); if ( pTablesData && pTablesData->xContainer == _rxNameAccess ) break; - pDSLoop = rListBox.NextSibling(pDSLoop); - pContainer = NULL; + pDSLoop = rListBox.NextSibling(pDSLoop); + pContainer = NULL; } return pContainer; } @@ -2819,13 +2815,13 @@ 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 SvLBoxEntry* pEntry = getEntryFromContainer(xNames); - if(pEntry) // found one + if(pEntry) // found one { // insert the new entry into the tree DBTreeListUserData* pContainerData = static_cast<DBTreeListUserData*>(pEntry->GetUserData()); @@ -2857,14 +2853,14 @@ void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEve sal_Bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(const String& _sName,SvLBoxEntry* _pContainer) { return m_pCurrentlyDisplayed - && getEntryType(m_pCurrentlyDisplayed) == getChildType(_pContainer) - && m_pTreeView->getListBox().GetParent(m_pCurrentlyDisplayed) == _pContainer - && m_pTreeView->getListBox().GetEntryText(m_pCurrentlyDisplayed) == _sName; + && getEntryType(m_pCurrentlyDisplayed) == getChildType(_pContainer) + && m_pTreeView->getListBox().GetParent(m_pCurrentlyDisplayed) == _pContainer + && m_pTreeView->getListBox().GetEntryText(m_pCurrentlyDisplayed) == _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 @@ -2875,7 +2871,7 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven String aName = ::comphelper::getString(_rEvent.Accessor).getStr(); if ( isCurrentlyDisplayedChanged( aName, pContainer) ) - { // the element displayed currently has been replaced + { // the element displayed currently has been replaced // we need to remember the old value SvLBoxEntry* pTemp = m_pCurrentlyDisplayed; @@ -2917,16 +2913,16 @@ 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); if ( pContainer ) - { // a table or query as been replaced + { // a table or query as been replaced String aName = ::comphelper::getString(_rEvent.Accessor).getStr(); if ( isCurrentlyDisplayedChanged( aName, pContainer) ) - { // the element displayed currently has been replaced + { // the element displayed currently has been replaced // we need to remember the old value SvLBoxEntry* pTemp = m_pCurrentlyDisplayed; @@ -2977,8 +2973,8 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve checkDocumentDataSource(); } 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!"); + { // a datasource has been replaced in the context + 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 @@ -3212,24 +3208,24 @@ void SbaTableQueryBrowser::impl_initialize() ::rtl::OUString* pStringIter = aProperties.getArray(); Any* pValueIter = aValues.getArray(); - *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AlwaysShowCursor")); - *pValueIter++ <<= sal_False; - *pStringIter++ = PROPERTY_BORDER; - *pValueIter++ <<= sal_Int16(0); + *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AlwaysShowCursor")); + *pValueIter++ <<= sal_False; + *pStringIter++ = PROPERTY_BORDER; + *pValueIter++ <<= sal_Int16(0); - *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasNavigationBar")); - *pValueIter++ <<= sal_False; - *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasRecordMarker")); - *pValueIter++ <<= sal_False; + *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasNavigationBar")); + *pValueIter++ <<= sal_False; + *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasRecordMarker")); + *pValueIter++ <<= sal_False; - *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Tabstop")); - *pValueIter++ <<= sal_False; + *pStringIter++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Tabstop")); + *pValueIter++ <<= sal_False; - Reference< XMultiPropertySet > xFormMultiSet(getFormComponent(), UNO_QUERY); + Reference< XMultiPropertySet > xFormMultiSet(getFormComponent(), UNO_QUERY); 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!"); } } @@ -3368,8 +3364,8 @@ sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedC SvLBoxEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent(_pAnyEntry); DBTreeListUserData* pDSData = pDSEntry - ? static_cast<DBTreeListUserData*>(pDSEntry->GetUserData()) - : NULL; + ? static_cast<DBTreeListUserData*>(pDSEntry->GetUserData()) + : NULL; return ensureConnection( pDSEntry, pDSData, _rConnection ); } @@ -3390,14 +3386,14 @@ sal_Bool SbaTableQueryBrowser::getExistentConnectionFor( SvLBoxEntry* _pAnyEntry SvLBoxEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent( _pAnyEntry ); DBTreeListUserData* pDSData = pDSEntry - ? static_cast< DBTreeListUserData* >( pDSEntry->GetUserData() ) - : NULL; + ? static_cast< DBTreeListUserData* >( pDSEntry->GetUserData() ) + : NULL; if ( pDSData ) _rConnection = pDSData->xConnection; 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,18 +3473,18 @@ 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(); - sal_Int32 nCompareResult = 0; // equal by default + sal_Int32 nCompareResult = 0; // equal by default if (m_xCollator.is()) { @@ -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,15 +3644,15 @@ 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; + sal_Int32 nCommandType = CommandType::COMMAND; Reference< XPropertySet > xRowsetProps( getRowSet(), UNO_QUERY ); ODataAccessDescriptor aDesc( xRowsetProps ); sDataSourceName = aDesc.getDataSource(); - aDesc[ daCommand ] >>= sCommand; - aDesc[ daCommandType ] >>= nCommandType; + aDesc[ daCommand ] >>= sCommand; + aDesc[ daCommandType ] >>= nCommandType; // do we need to do anything? if ( CommandType::QUERY != nCommandType ) @@ -3707,8 +3703,8 @@ void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _ { // first we have to clear the grid Sequence< ::rtl::OUString > aNames = _xColContainer->getElementNames(); - const ::rtl::OUString* pIter = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aNames.getLength(); + const ::rtl::OUString* pIter = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aNames.getLength(); Reference< XInterface > xColumn; for (; pIter != pEnd;++pIter) { @@ -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() ); } @@ -3871,7 +3858,7 @@ void SbaTableQueryBrowser::impl_cleanupDataSourceEntry( const String& _rDataSour return; if ( isSelected( pDataSourceEntry ) ) - { // a table or query belonging to the deleted data source is currently beeing displayed. + { // 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 ); @@ -3879,20 +3866,19 @@ void SbaTableQueryBrowser::impl_cleanupDataSourceEntry( const String& _rDataSour else OSL_ENSURE( ( NULL == m_pCurrentlyDisplayed ) - || ( m_pTreeView->getListBox().GetRootLevelParent( m_pCurrentlyDisplayed ) != pDataSourceEntry ), + || ( 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 ) + 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 @@ -3927,7 +3913,8 @@ void SAL_CALL SbaTableQueryBrowser::changedDatabaseLocation( const DatabaseRegis // ......................................................................... -} // namespace dbaui +} // namespace dbaui // ......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |