User: vg Date: 05/03/10 08:38:02 Modified: /dba/dbaccess/source/core/misc/ sdbcoretools.cxx
Log: INTEGRATION: CWS dba24 (1.5.28); FILE MERGED 2005/02/21 13:09:53 oj 1.5.28.3: RESYNC: (1.5-1.6); FILE MERGED 2005/02/18 12:25:29 oj 1.5.28.2: #i42460# changes for the separation of datasource and database document(model) 2005/02/10 16:56:39 fs 1.5.28.1: #i15113# +getDataSourceSetting File Changes: Directory: /dba/dbaccess/source/core/misc/ ========================================== File [changed]: sdbcoretools.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/misc/sdbcoretools.cxx?r1=1.6&r2=1.7 Delta lines: +47 -3 -------------------- --- sdbcoretools.cxx 17 Feb 2005 11:04:48 -0000 1.6 +++ sdbcoretools.cxx 10 Mar 2005 16:37:58 -0000 1.7 @@ -68,12 +68,18 @@ #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> #endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif #ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ #include <com/sun/star/container/XChild.hpp> #endif #ifndef _COM_SUN_STAR_UTIL_XMODIFIABLE_HPP_ #include <com/sun/star/util/XModifiable.hpp> #endif +#ifndef _COM_SUN_STAR_SDB_XDOCUMENTDATASOURCE_HPP_ +#include <com/sun/star/sdb/XDocumentDataSource.hpp> +#endif #ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" #endif @@ -87,6 +93,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::util; using namespace ::com::sun::star::sdbc; + using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; @@ -94,7 +101,11 @@ // ------------------------------------------------------------------------- void notifyDataSourceModified(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject,sal_Bool _bModified) { - Reference< XModifiable > xModi( getDataSource( _rxObject ), UNO_QUERY ); + Reference< XInterface > xDs = getDataSource( _rxObject ); + Reference<XDocumentDataSource> xDocumentDataSource(xDs,UNO_QUERY); + if ( xDocumentDataSource.is() ) + xDs = xDocumentDataSource->getDatabaseDocument(); + Reference< XModifiable > xModi( xDs, UNO_QUERY ); if ( xModi.is() ) xModi->setModified(_bModified); } @@ -111,6 +122,39 @@ xParent.set(xChild.is() ? xChild->getParent() : Reference< XInterface >(),UNO_QUERY); } return xReturn; + } + + // ------------------------------------------------------------------------- + bool getDataSourceSetting( const Reference< XInterface >& _rxDataSource, const sal_Char* _pAsciiSettingsName, + Any& /* [out] */ _rSettingsValue ) + { + bool bIsPresent = false; + try + { + Reference< XPropertySet > xDataSource( _rxDataSource, UNO_QUERY ); + OSL_ENSURE( xDataSource.is(), "getDataSourceSetting: invalid data source object!" ); + if ( !xDataSource.is() ) + return false; + + Sequence< PropertyValue > aSettings; + OSL_VERIFY( xDataSource->getPropertyValue( PROPERTY_INFO ) >>= aSettings ); + const PropertyValue* pSetting = aSettings.getConstArray(); + const PropertyValue* pSettingEnd = aSettings.getConstArray() + aSettings.getLength(); + for ( ; pSetting != pSettingEnd; ++pSetting ) + { + if ( pSetting->Name.equalsAscii( _pAsciiSettingsName ) ) + { + _rSettingsValue = pSetting->Value; + bIsPresent = true; + break; + } + } + } + catch( const Exception& ) + { + OSL_ENSURE( sal_False, "getDataSourceSetting: caught an exception!" ); + } + return bIsPresent; } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
