From 01893617e21ac7e7fee0a16056e8a77f135e92ca Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Tue, 1 Dec 2009 08:53:35 +0000 Subject: CWS-TOOLING: integrate CWS dba32j 2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error 2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error 2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5) 2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line 2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present) 2009-11-14 20:47:41 +0100 fs r277504 : spelling 2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent 2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game 2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this) 2009-11-11 13:49:11 +0100 fs r277452 : #i106816# 2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally 2009-11-11 12:15:34 +0100 fs r277449 : update ignore list 2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location 2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location 2009-11-06 16:23:12 +0100 fs r277393 : #i106643# 2009-11-03 23:20:29 +0100 fs r277328 : #i106574# reverted the recent fix for issue #i105235#, and implemented a better one. 2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well --- basic/source/classes/eventatt.cxx | 71 +++++++------ connectivity/inc/connectivity/FValue.hxx | 12 +++ connectivity/source/commontools/FValue.cxx | 154 ++++++++++++++++++++++++----- desktop/source/app/app.cxx | 7 ++ 4 files changed, 181 insertions(+), 63 deletions(-) diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 7776b57829..b0c8f4b3c3 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -95,53 +95,48 @@ Any sbxToUnoValue( SbxVariable* pVar ); Reference< frame::XModel > getModelFromBasic( SbxObject* pBasic ) { - Reference< frame::XModel > xModel; - - SbxObject* basicChosen = pBasic; - - if ( basicChosen == NULL) + OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" ); + if ( !pBasic ) + return NULL; + + // look for the ThisComponent variable, first in the parent (which + // might be the document's Basic), then in the parent's parent (which might be + // the application Basic) + const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ); + SbxVariable* pThisComponent = NULL; + + SbxObject* pLookup = pBasic->GetParent(); + while ( pLookup && !pThisComponent ) { - OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" ); - return xModel; + pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT ); + pLookup = pLookup->GetParent(); } - SbxObject* p = pBasic; - SbxObject* pParent = p->GetParent(); - SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL; - - if( pParentParent ) + if ( !pThisComponent ) { - basicChosen = pParentParent; + OSL_TRACE("Failed to get ThisComponent"); + // the application Basic, at the latest, should have this variable + return NULL; } - else if( pParent ) + + Any aThisComponent( sbxToUnoValue( pThisComponent ) ); + Reference< frame::XModel > xModel( aThisComponent, UNO_QUERY ); + if ( !xModel.is() ) { - basicChosen = pParent; + // it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller. + Reference< frame::XController > xController( aThisComponent, UNO_QUERY ); + if ( xController.is() ) + xModel = xController->getModel(); } + if ( !xModel.is() ) + return NULL; - Any aModel; - SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT ); +#if OSL_DEBUG_LEVEL > 0 + OSL_TRACE("Have model ThisComponent points to url %s", + ::rtl::OUStringToOString( xModel->getURL(), + RTL_TEXTENCODING_ASCII_US ).pData->buffer ); +#endif - if ( pCompVar ) - { - aModel = sbxToUnoValue( pCompVar ); - if ( sal_False == ( aModel >>= xModel ) || - !xModel.is() ) - { - OSL_TRACE("Failed to extract model from thisComponent "); - return xModel; - } - else - { - OSL_TRACE("Have model ThisComponent points to url %s", - ::rtl::OUStringToOString( xModel->getURL(), - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - - } - } - else - { - OSL_TRACE("Failed to get ThisComponent"); - } return xModel; } diff --git a/connectivity/inc/connectivity/FValue.hxx b/connectivity/inc/connectivity/FValue.hxx index 6fdbae4389..8bcfa0eaed 100644 --- a/connectivity/inc/connectivity/FValue.hxx +++ b/connectivity/inc/connectivity/FValue.hxx @@ -44,9 +44,15 @@ #include #include #include +#include namespace connectivity { + namespace detail + { + class IValueSource; + } + class OOO_DLLPUBLIC_DBTOOLS ORowSetValue { union @@ -361,6 +367,12 @@ namespace connectivity const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow); void fill(const ::com::sun::star::uno::Any& _rValue); + + void fill( const sal_Int32 _nType, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn ); + + private: + void impl_fill( const sal_Int32 _nType, sal_Bool _bNullable, const detail::IValueSource& _rValueSource ); }; /// ORowSetValueDecorator decorates a ORowSetValue so the value is "refcounted" diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 37e91d22c8..3068acde8b 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -40,13 +40,16 @@ #include #include -using namespace connectivity; -using namespace dbtools; +using namespace ::dbtools; using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::io; +namespace connectivity +{ + namespace { static sal_Bool isStorageCompatible(sal_Int32 _eType1, sal_Int32 _eType2) { @@ -1809,6 +1812,107 @@ void ORowSetValue::setSigned(sal_Bool _bMod) } } } + +// ----------------------------------------------------------------------------- +namespace detail +{ + class SAL_NO_VTABLE IValueSource + { + public: + virtual ::rtl::OUString getString() const = 0; + virtual sal_Bool getBoolean() const = 0; + virtual sal_Int8 getByte() const = 0; + virtual sal_Int16 getShort() const = 0; + virtual sal_Int32 getInt() const = 0; + virtual sal_Int64 getLong() const = 0; + virtual float getFloat() const = 0; + virtual double getDouble() const = 0; + virtual Date getDate() const = 0; + virtual Time getTime() const = 0; + virtual DateTime getTimestamp() const = 0; + virtual Sequence< sal_Int8 > getBytes() const = 0; + virtual Reference< XInputStream > getBinaryStream() const = 0; + virtual Reference< XInputStream > getCharacterStream() const = 0; + virtual sal_Bool wasNull() const = 0; + + virtual ~IValueSource() { } + }; + + class RowValue : public IValueSource + { + public: + RowValue( const Reference< XRow >& _xRow, const sal_Int32 _nPos ) + :m_xRow( _xRow ) + ,m_nPos( _nPos ) + { + } + + // IValueSource + virtual ::rtl::OUString getString() const { return m_xRow->getString( m_nPos ); }; + virtual sal_Bool getBoolean() const { return m_xRow->getBoolean( m_nPos ); }; + virtual sal_Int8 getByte() const { return m_xRow->getByte( m_nPos ); }; + virtual sal_Int16 getShort() const { return m_xRow->getShort( m_nPos ); } + virtual sal_Int32 getInt() const { return m_xRow->getInt( m_nPos ); } + virtual sal_Int64 getLong() const { return m_xRow->getLong( m_nPos ); } + virtual float getFloat() const { return m_xRow->getFloat( m_nPos ); }; + virtual double getDouble() const { return m_xRow->getDouble( m_nPos ); }; + virtual Date getDate() const { return m_xRow->getDate( m_nPos ); }; + virtual Time getTime() const { return m_xRow->getTime( m_nPos ); }; + virtual DateTime getTimestamp() const { return m_xRow->getTimestamp( m_nPos ); }; + virtual Sequence< sal_Int8 > getBytes() const { return m_xRow->getBytes( m_nPos ); }; + virtual Reference< XInputStream > getBinaryStream() const { return m_xRow->getBinaryStream( m_nPos ); }; + virtual Reference< XInputStream > getCharacterStream() const { return m_xRow->getCharacterStream( m_nPos ); }; + virtual sal_Bool wasNull() const { return m_xRow->wasNull( ); }; + + private: + const Reference< XRow > m_xRow; + const sal_Int32 m_nPos; + }; + + class ColumnValue : public IValueSource + { + public: + ColumnValue( const Reference< XColumn >& _rxColumn ) + :m_xColumn( _rxColumn ) + { + } + + // IValueSource + virtual ::rtl::OUString getString() const { return m_xColumn->getString(); }; + virtual sal_Bool getBoolean() const { return m_xColumn->getBoolean(); }; + virtual sal_Int8 getByte() const { return m_xColumn->getByte(); }; + virtual sal_Int16 getShort() const { return m_xColumn->getShort(); } + virtual sal_Int32 getInt() const { return m_xColumn->getInt(); } + virtual sal_Int64 getLong() const { return m_xColumn->getLong(); } + virtual float getFloat() const { return m_xColumn->getFloat(); }; + virtual double getDouble() const { return m_xColumn->getDouble(); }; + virtual Date getDate() const { return m_xColumn->getDate(); }; + virtual Time getTime() const { return m_xColumn->getTime(); }; + virtual DateTime getTimestamp() const { return m_xColumn->getTimestamp(); }; + virtual Sequence< sal_Int8 > getBytes() const { return m_xColumn->getBytes(); }; + virtual Reference< XInputStream > getBinaryStream() const { return m_xColumn->getBinaryStream(); }; + virtual Reference< XInputStream > getCharacterStream() const { return m_xColumn->getCharacterStream(); }; + virtual sal_Bool wasNull() const { return m_xColumn->wasNull( ); }; + + private: + const Reference< XColumn > m_xColumn; + }; +} + +// ----------------------------------------------------------------------------- +void ORowSetValue::fill( const sal_Int32 _nType, const Reference< XColumn >& _rxColumn ) +{ + detail::ColumnValue aColumnValue( _rxColumn ); + impl_fill( _nType, sal_True, aColumnValue ); +} + +// ----------------------------------------------------------------------------- +void ORowSetValue::fill( sal_Int32 _nPos, sal_Int32 _nType, sal_Bool _bNullable, const Reference< XRow>& _xRow ) +{ + detail::RowValue aRowValue( _xRow, _nPos ); + impl_fill( _nType, _bNullable, aRowValue ); +} + // ----------------------------------------------------------------------------- void ORowSetValue::fill(sal_Int32 _nPos, sal_Int32 _nType, @@ -1819,10 +1923,8 @@ void ORowSetValue::fill(sal_Int32 _nPos, } // ----------------------------------------------------------------------------- -void ORowSetValue::fill(sal_Int32 _nPos, - sal_Int32 _nType, - sal_Bool _bNullable, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow) +void ORowSetValue::impl_fill( const sal_Int32 _nType, sal_Bool _bNullable, const detail::IValueSource& _rValueSource ) + { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill (2)" ); sal_Bool bReadData = sal_True; @@ -1833,63 +1935,63 @@ void ORowSetValue::fill(sal_Int32 _nPos, case DataType::DECIMAL: case DataType::NUMERIC: case DataType::LONGVARCHAR: - (*this) = _xRow->getString(_nPos); + (*this) = _rValueSource.getString(); break; case DataType::BIGINT: if ( isSigned() ) - (*this) = _xRow->getLong(_nPos); + (*this) = _rValueSource.getLong(); else - (*this) = _xRow->getString(_nPos); + (*this) = _rValueSource.getString(); break; case DataType::FLOAT: - (*this) = _xRow->getFloat(_nPos); + (*this) = _rValueSource.getFloat(); break; case DataType::DOUBLE: case DataType::REAL: - (*this) = _xRow->getDouble(_nPos); + (*this) = _rValueSource.getDouble(); break; case DataType::DATE: - (*this) = _xRow->getDate(_nPos); + (*this) = _rValueSource.getDate(); break; case DataType::TIME: - (*this) = _xRow->getTime(_nPos); + (*this) = _rValueSource.getTime(); break; case DataType::TIMESTAMP: - (*this) = _xRow->getTimestamp(_nPos); + (*this) = _rValueSource.getTimestamp(); break; case DataType::BINARY: case DataType::VARBINARY: case DataType::LONGVARBINARY: - (*this) = _xRow->getBytes(_nPos); + (*this) = _rValueSource.getBytes(); break; case DataType::BIT: case DataType::BOOLEAN: - (*this) = _xRow->getBoolean(_nPos); + (*this) = _rValueSource.getBoolean(); break; case DataType::TINYINT: if ( isSigned() ) - (*this) = _xRow->getByte(_nPos); + (*this) = _rValueSource.getByte(); else - (*this) = _xRow->getShort(_nPos); + (*this) = _rValueSource.getShort(); break; case DataType::SMALLINT: if ( isSigned() ) - (*this) = _xRow->getShort(_nPos); + (*this) = _rValueSource.getShort(); else - (*this) = _xRow->getInt(_nPos); + (*this) = _rValueSource.getInt(); break; case DataType::INTEGER: if ( isSigned() ) - (*this) = _xRow->getInt(_nPos); + (*this) = _rValueSource.getInt(); else - (*this) = _xRow->getLong(_nPos); + (*this) = _rValueSource.getLong(); break; case DataType::CLOB: - (*this) = ::com::sun::star::uno::makeAny(_xRow->getCharacterStream(_nPos)); + (*this) = ::com::sun::star::uno::makeAny(_rValueSource.getCharacterStream()); setTypeKind(DataType::CLOB); break; case DataType::BLOB: - (*this) = ::com::sun::star::uno::makeAny(_xRow->getBinaryStream(_nPos)); + (*this) = ::com::sun::star::uno::makeAny(_rValueSource.getBinaryStream()); setTypeKind(DataType::BLOB); break; default: @@ -1897,7 +1999,7 @@ void ORowSetValue::fill(sal_Int32 _nPos, bReadData = false; break; } - if ( bReadData && _bNullable && _xRow->wasNull() ) + if ( bReadData && _bNullable && _rValueSource.wasNull() ) setNull(); setTypeKind(_nType); } @@ -2043,3 +2145,5 @@ void ORowSetValue::fill(const Any& _rValue) break; } } + +} // namespace connectivity diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 7f937bbd79..aadf6bc625 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1468,6 +1468,13 @@ void Desktop::Main() xContainerWindow = xBackingFrame->getContainerWindow(); if (xContainerWindow.is()) { + // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank" + // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior, + // otherwise documents loaded into this frame will later on miss functionality depending on the style. + Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" ); + pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT ); + SetSplashScreenProgress(75); Sequence< Any > lArgs(1); lArgs[0] <<= xContainerWindow; -- cgit v1.2.3