From ea3215d15e4db95865a9fc975105400b68ca5b56 Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Thu, 12 Feb 2009 14:21:15 +0000 Subject: [PATCH 002/117] reduce call to resiltset meta data --- connectivity/inc/connectivity/FValue.hxx | 12 + connectivity/source/commontools/FValue.cxx | 145 +- .../source/drivers/jdbc/DatabaseMetaData.cxx | 75 +- connectivity/source/drivers/jdbc/Object.cxx | 7 +- .../source/drivers/jdbc/ResultSet.cxx | 1169 +++++++++++------ .../source/drivers/jdbc/ResultSetMetaData.cxx | 369 ++++-- connectivity/source/drivers/jdbc/makefile.mk | 2 +- connectivity/source/inc/java/lang/Object.hxx | 5 +- .../source/inc/java/sql/ResultSetMetaData.hxx | 1 + 9 files changed, 1161 insertions(+), 624 deletions(-) diff --git a/connectivity/inc/connectivity/FValue.hxx b/connectivity/inc/connectivity/FValue.hxx index afb9af2c7b20..0821b680277d 100644 --- a/connectivity/inc/connectivity/FValue.hxx +++ b/connectivity/inc/connectivity/FValue.hxx @@ -344,6 +344,18 @@ namespace connectivity sal_Int32 _nType, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow); + /** + fetches a single value out of the row + @param _nPos the current column position + @param _nType the type of the current column + @param _bNullable if true then it will be checked if the result could be NULL, otherwise not. + @param _xRow the row where to fetch the data from + */ + void fill(sal_Int32 _nPos, + sal_Int32 _nType, + sal_Bool _bNullable, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow); + void fill(const ::com::sun::star::uno::Any& _rValue); }; diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 2823c2b43489..893b1a38d35a 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -36,6 +36,7 @@ #include "connectivity/CommonTools.hxx" #include #include +#include using namespace connectivity; using namespace dbtools; @@ -47,10 +48,12 @@ using namespace ::com::sun::star::io; namespace { static sal_Bool isStorageCompatible(sal_Int32 _eType1, sal_Int32 _eType2) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::isStorageCompatible" ); sal_Bool bIsCompatible = sal_True; if (_eType1 != _eType2) { + RTL_LOGFILE_CONTEXT_TRACE( aLogger, "ORowSetValue::isStorageCompatible _eType1 != _eType2" ); switch (_eType1) { case DataType::CHAR: @@ -196,65 +199,65 @@ namespace tracing // ----------------------------------------------------------------------------- void ORowSetValue::setTypeKind(sal_Int32 _eType) { - if (!m_bNull) - if (!isStorageCompatible(_eType, m_eTypeKind)) + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setTypeKind" ); + if ( !m_bNull && !isStorageCompatible(_eType, m_eTypeKind) ) + { + switch(_eType) { - switch(_eType) - { - case DataType::VARCHAR: - case DataType::CHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - case DataType::LONGVARCHAR: - (*this) = getString(); - break; - case DataType::BIGINT: - (*this) = getLong(); - break; + case DataType::VARCHAR: + case DataType::CHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::LONGVARCHAR: + (*this) = getString(); + break; + case DataType::BIGINT: + (*this) = getLong(); + break; - case DataType::FLOAT: - (*this) = getFloat(); - break; - case DataType::DOUBLE: - case DataType::REAL: - (*this) = getDouble(); - break; - case DataType::TINYINT: - (*this) = getInt8(); - break; - case DataType::SMALLINT: - (*this) = getInt16(); - break; - case DataType::INTEGER: - (*this) = getInt32(); - break; - case DataType::BIT: - case DataType::BOOLEAN: - (*this) = getBool(); - break; - case DataType::DATE: - (*this) = getDate(); - break; - case DataType::TIME: - (*this) = getTime(); - break; - case DataType::TIMESTAMP: - (*this) = getDateTime(); - break; - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - (*this) = getSequence(); - break; - case DataType::BLOB: - case DataType::CLOB: - case DataType::OBJECT: - (*this) = getAny(); - break; - default: - OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); - } + case DataType::FLOAT: + (*this) = getFloat(); + break; + case DataType::DOUBLE: + case DataType::REAL: + (*this) = getDouble(); + break; + case DataType::TINYINT: + (*this) = getInt8(); + break; + case DataType::SMALLINT: + (*this) = getInt16(); + break; + case DataType::INTEGER: + (*this) = getInt32(); + break; + case DataType::BIT: + case DataType::BOOLEAN: + (*this) = getBool(); + break; + case DataType::DATE: + (*this) = getDate(); + break; + case DataType::TIME: + (*this) = getTime(); + break; + case DataType::TIMESTAMP: + (*this) = getDateTime(); + break; + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + (*this) = getSequence(); + break; + case DataType::BLOB: + case DataType::CLOB: + case DataType::OBJECT: + (*this) = getAny(); + break; + default: + OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); } + } m_eTypeKind = _eType; } @@ -262,6 +265,7 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType) // ----------------------------------------------------------------------------- void ORowSetValue::free() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::free" ); if(!m_bNull) { switch(m_eTypeKind) @@ -348,7 +352,7 @@ ORowSetValue& ORowSetValue::operator=(const ORowSetValue& _rRH) if(&_rRH == this) return *this; - if ( m_eTypeKind != _rRH.m_eTypeKind || _rRH.m_bNull || m_bSigned != _rRH.m_bSigned) + if ( m_eTypeKind != _rRH.m_eTypeKind || (_rRH.m_bNull && !m_bNull) || m_bSigned != _rRH.m_bSigned) free(); m_bBound = _rRH.m_bBound; @@ -848,6 +852,7 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const // ------------------------------------------------------------------------- Any ORowSetValue::makeAny() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::makeAny" ); Any rValue; if(isBound() && !isNull()) { @@ -939,6 +944,7 @@ Any ORowSetValue::makeAny() const // ------------------------------------------------------------------------- ::rtl::OUString ORowSetValue::getString( ) const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getString" ); ::rtl::OUString aRet; if(!m_bNull) { @@ -1014,6 +1020,7 @@ Any ORowSetValue::makeAny() const // ------------------------------------------------------------------------- sal_Bool ORowSetValue::getBool() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getBool" ); sal_Bool bRet = sal_False; if(!m_bNull) { @@ -1084,6 +1091,7 @@ sal_Bool ORowSetValue::getBool() const // ------------------------------------------------------------------------- sal_Int8 ORowSetValue::getInt8() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt8" ); sal_Int8 nRet = 0; @@ -1148,6 +1156,7 @@ sal_Int8 ORowSetValue::getInt8() const // ------------------------------------------------------------------------- sal_Int16 ORowSetValue::getInt16() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt16" ); sal_Int16 nRet = 0; @@ -1212,6 +1221,7 @@ sal_Int16 ORowSetValue::getInt16() const // ------------------------------------------------------------------------- sal_Int32 ORowSetValue::getInt32() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt32" ); sal_Int32 nRet = 0; if(!m_bNull) { @@ -1276,6 +1286,7 @@ sal_Int32 ORowSetValue::getInt32() const // ------------------------------------------------------------------------- sal_Int64 ORowSetValue::getLong() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getLong" ); sal_Int64 nRet = 0; if(!m_bNull) { @@ -1340,6 +1351,7 @@ sal_Int64 ORowSetValue::getLong() const // ------------------------------------------------------------------------- float ORowSetValue::getFloat() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getFloat" ); float nRet = 0; if(!m_bNull) { @@ -1408,6 +1420,7 @@ float ORowSetValue::getFloat() const // ------------------------------------------------------------------------- double ORowSetValue::getDouble() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDouble" ); double nRet = 0; @@ -1478,6 +1491,7 @@ double ORowSetValue::getDouble() const // ------------------------------------------------------------------------- void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setFromDouble" ); free(); m_bNull = sal_False; @@ -1564,6 +1578,7 @@ void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) // ----------------------------------------------------------------------------- Sequence ORowSetValue::getSequence() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getSequence" ); Sequence aSeq; if (!m_bNull) { @@ -1605,6 +1620,7 @@ Sequence ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::Date ORowSetValue::getDate() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDate" ); ::com::sun::star::util::Date aValue; if(!m_bNull) { @@ -1643,6 +1659,7 @@ Sequence ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::Time ORowSetValue::getTime() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getTime" ); ::com::sun::star::util::Time aValue; if(!m_bNull) { @@ -1680,6 +1697,7 @@ Sequence ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::DateTime ORowSetValue::getDateTime() const { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDateTime" ); ::com::sun::star::util::DateTime aValue; if(!m_bNull) { @@ -1726,6 +1744,7 @@ Sequence ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- void ORowSetValue::setSigned(sal_Bool _bMod) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setSigned" ); if ( m_bSigned != _bMod ) { m_bSigned = _bMod; @@ -1792,6 +1811,15 @@ void ORowSetValue::fill(sal_Int32 _nPos, sal_Int32 _nType, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); + fill(_nPos,_nType,sal_True,_xRow); +} +void ORowSetValue::fill(sal_Int32 _nPos, + sal_Int32 _nType, + sal_Bool _bNullable, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); sal_Bool bReadData = sal_True; switch(_nType) { @@ -1863,13 +1891,14 @@ void ORowSetValue::fill(sal_Int32 _nPos, bReadData = sal_False; break; } - if ( bReadData && _xRow->wasNull() ) + if ( bReadData && _bNullable && _xRow->wasNull() ) setNull(); setTypeKind(_nType); } // ----------------------------------------------------------------------------- void ORowSetValue::fill(const Any& _rValue) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); switch (_rValue.getValueType().getTypeClass()) { case TypeClass_VOID: diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index fff580ef7c38..a5986ea8c288 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -142,7 +142,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // Java-Call absetzen static jmethodID mID = NULL; @@ -351,7 +351,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo( jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // Java-Call absetzen static jmethodID mID = NULL; @@ -395,7 +395,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // Java-Call absetzen static jmethodID mID = NULL; @@ -515,7 +515,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference( jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // Java-Call absetzen static jmethodID mID = NULL; @@ -565,15 +565,18 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* _pMethod SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callBooleanMethod: no Java enviroment anymore!" ); - if ( t.pEnv ) + { // obtain method ID if ( !_inout_MethodID ) + { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()Z" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethod:: unknown method id!" ); + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethod:: unknown method id!" ); + if ( !_inout_MethodID ) + throw SQLException(); + } // if ( !_inout_MethodID ) // call method - if ( _inout_MethodID ) { out = t.pEnv->CallBooleanMethod( object, _inout_MethodID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -593,15 +596,18 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* _pMethod SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callStringMethod: no Java enviroment anymore!" ); - if( t.pEnv ) + { // obtain method ID if ( !_inout_MethodID ) + { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()Ljava/lang/String;" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callStringMethod: unknown method id!" ); - + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callStringMethod: unknown method id!" ); + if ( !_inout_MethodID ) + throw SQLException(); + } // call method - if ( _inout_MethodID ) + { jstring out = (jstring)t.pEnv->CallObjectMethod( object, _inout_MethodID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -629,15 +635,19 @@ sal_Int32 java_sql_DatabaseMetaData::impl_callIntMethod( const char* _pMethodNam SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callIntMethod: no Java enviroment anymore!" ); - if( t.pEnv ) + { // obtain method ID if ( !_inout_MethodID ) + { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()I" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callIntMethod: unknown method id!" ); + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callIntMethod: unknown method id!" ); + if ( !_inout_MethodID ) + throw SQLException(); + } // call method - if ( _inout_MethodID ) + { out = t.pEnv->CallIntMethod( object, _inout_MethodID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -656,15 +666,18 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg( const char jboolean out( sal_False ); SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg: no Java enviroment anymore!" ); - if ( t.pEnv ) + { // obtain method ID if ( !_inout_MethodID ) + { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "(I)Z" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg: unknown method id!" ); - + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg: unknown method id!" ); + if ( !_inout_MethodID ) + throw SQLException(); + } // call method - if ( _inout_MethodID ) + { out = t.pEnv->CallBooleanMethod( object, _inout_MethodID, _nArgument ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -684,15 +697,19 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethod( con SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callResultSetMethod: no Java enviroment anymore!" ); - if ( t.pEnv ) + { // obtain method ID if ( !_inout_MethodID ) + { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()Ljava/sql/ResultSet;" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethod: unknown method id!" ); + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethod: unknown method id!" ); + if ( !_inout_MethodID ) + throw SQLException(); + } // call method - if ( _inout_MethodID ) + { out = t.pEnv->CallObjectMethod( object, _inout_MethodID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -731,18 +748,22 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithS SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: no Java enviroment anymore!" ); - if ( t.pEnv ) + { const char* pSignature = _pOptionalAdditionalString ? "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;" : "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; // obtain method ID if ( !_inout_MethodID ) + { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, pSignature ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: unknown method id!" ); + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: unknown method id!" ); + if ( !_inout_MethodID ) + throw SQLException(); + } // call method - if ( _inout_MethodID ) + { jvalue args[4]; // convert parameters @@ -1105,7 +1126,7 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType jboolean out( sal_False ); SDBThreadAttach t; - if ( t.pEnv ) + { static jmethodID mID = NULL; if ( !mID ) @@ -1453,7 +1474,7 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_I jboolean out( sal_False ); SDBThreadAttach t; - if ( t.pEnv ) + { static jmethodID mID = NULL; if ( !mID ) @@ -1537,7 +1558,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs( { jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I;)Ljava/sql/ResultSet;"; diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx index 6e550134a90c..7c8df15fa4e9 100644 --- a/connectivity/source/drivers/jdbc/Object.cxx +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -45,7 +45,7 @@ #include #include "resource/jdbc_log.hrc" - +#include #include #include @@ -81,27 +81,32 @@ SDBThreadAttach::SDBThreadAttach() : m_aGuard(java_lang_Object::getVM()) , pEnv(NULL) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "SDBThreadAttach::SDBThreadAttach" ); pEnv = m_aGuard.getEnvironment(); OSL_ENSURE(pEnv,"Environment is nULL!"); } // ----------------------------------------------------------------------------- SDBThreadAttach::~SDBThreadAttach() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "SDBThreadAttach::~SDBThreadAttach" ); } // ----------------------------------------------------------------------------- oslInterlockedCount& getJavaVMRefCount() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "getJavaVMRefCount" ); static oslInterlockedCount s_nRefCount = 0; return s_nRefCount; } // ----------------------------------------------------------------------------- void SDBThreadAttach::addRef() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "SDBThreadAttach::addRef" ); osl_incrementInterlockedCount(&getJavaVMRefCount()); } // ----------------------------------------------------------------------------- void SDBThreadAttach::releaseRef() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "SDBThreadAttach::releaseRef" ); osl_decrementInterlockedCount(&getJavaVMRefCount()); if ( getJavaVMRefCount() == 0 ) { diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index 4c46666d16e8..241674f936ae 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -85,6 +85,7 @@ java_sql_ResultSet::java_sql_ResultSet( JNIEnv * pEnv, jobject myObj, const java osl_incrementInterlockedCount(&m_refCount); if ( pStmt ) m_xStatement = *pStmt; + osl_decrementInterlockedCount(&m_refCount); } // ----------------------------------------------------------------------------- @@ -133,19 +134,24 @@ void java_sql_ResultSet::disposing(void) if( object ) { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "close"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "close"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + clearObject(*t.pEnv); } } //t.pEnv @@ -176,16 +182,21 @@ sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& column RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::findColumn" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)I"; - static const char * cMethodName = "findColumn"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(Ljava/lang/String;)I"; + static const char * cMethodName = "findColumn"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + // Parameter konvertieren jstring str = convertwchar_tToJavaString(t.pEnv,columnName); out = t.pEnv->CallIntMethod( object, mID, str ); @@ -193,7 +204,7 @@ sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& column t.pEnv->DeleteLocalRef(str); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return (sal_Int32)out; } @@ -205,20 +216,25 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBinaryStream" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/io/InputStream;"; - static const char * cMethodName = "getBinaryStream"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/io/InputStream;"; + static const char * cMethodName = "getBinaryStream"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); @@ -229,20 +245,25 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCharacterStream" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/io/InputStream;"; - static const char * cMethodName = "getCharacterStream"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/io/InputStream;"; + static const char * cMethodName = "getCharacterStream"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); @@ -254,20 +275,25 @@ sal_Bool SAL_CALL java_sql_ResultSet::getBoolean( sal_Int32 columnIndex ) throw( RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBoolean" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "getBoolean"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "getBoolean"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv return out; } @@ -278,20 +304,25 @@ sal_Int8 SAL_CALL java_sql_ResultSet::getByte( sal_Int32 columnIndex ) throw(SQL RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getByte" ); jbyte out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)B"; - static const char * cMethodName = "getByte"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)B"; + static const char * cMethodName = "getByte"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallByteMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv return out; } @@ -302,15 +333,20 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBytes" ); Sequence< sal_Int8 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { - static const char * cSignature = "(I)[B"; - static const char * cMethodName = "getBytes"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)[B"; + static const char * cMethodName = "getBytes"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); if (out) @@ -321,7 +357,7 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde t.pEnv->DeleteLocalRef(out); } // und aufraeumen - } //mID + } //t.pEnv return aSeq; } @@ -332,20 +368,25 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDate" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Date;"; - static const char * cMethodName = "getDate"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/sql/Date;"; + static const char * cMethodName = "getDate"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast (java_sql_Date( t.pEnv, out )) : ::com::sun::star::util::Date(); @@ -357,20 +398,25 @@ double SAL_CALL java_sql_ResultSet::getDouble( sal_Int32 columnIndex ) throw(SQL RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDouble" ); jdouble out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)D"; - static const char * cMethodName = "getDouble"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)D"; + static const char * cMethodName = "getDouble"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallDoubleMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv return out; } @@ -381,20 +427,25 @@ float SAL_CALL java_sql_ResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLEx RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFloat" ); jfloat out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)F"; - static const char * cMethodName = "getFloat"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)F"; + static const char * cMethodName = "getFloat"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallFloatMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv return out; } @@ -405,20 +456,25 @@ sal_Int32 SAL_CALL java_sql_ResultSet::getInt( sal_Int32 columnIndex ) throw(SQL RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInt" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getInt"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getInt"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallIntMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv return (sal_Int32)out; } @@ -429,19 +485,24 @@ sal_Int32 SAL_CALL java_sql_ResultSet::getRow( ) throw(SQLException, RuntimeExc RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRow" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()I"; + static const char * cMethodName = "getRow"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallIntMethod( object, mID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv return (sal_Int32)out; } @@ -452,19 +513,24 @@ sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getLong" ); jlong out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)J"; - static const char * cMethodName = "getLong"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)J"; + static const char * cMethodName = "getLong"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallLongMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv return out; } @@ -475,20 +541,24 @@ sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMetaData" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/ResultSetMetaData;"; - static const char * cMethodName = "getMetaData"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallObjectMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + { + static const char * cSignature = "()Ljava/sql/ResultSetMetaData;"; + static const char * cMethodName = "getMetaData"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); } + + out = t.pEnv->CallObjectMethod( object, mID ); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } return out==0 ? 0 : new java_sql_ResultSetMetaData( t.pEnv, out, m_aLogger,*m_pConnection ); @@ -499,19 +569,24 @@ Reference< XArray > SAL_CALL java_sql_ResultSet::getArray( sal_Int32 columnIndex RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getArray" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Array;"; - static const char * cMethodName = "getArray"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/sql/Array;"; + static const char * cMethodName = "getArray"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); @@ -523,19 +598,24 @@ Reference< XClob > SAL_CALL java_sql_ResultSet::getClob( sal_Int32 columnIndex ) RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getClob" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Clob;"; - static const char * cMethodName = "getClob"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/sql/Clob;"; + static const char * cMethodName = "getClob"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); @@ -546,19 +626,24 @@ Reference< XBlob > SAL_CALL java_sql_ResultSet::getBlob( sal_Int32 columnIndex ) RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBlob" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Blob;"; - static const char * cMethodName = "getBlob"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/sql/Blob;"; + static const char * cMethodName = "getBlob"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); @@ -570,19 +655,24 @@ Reference< XRef > SAL_CALL java_sql_ResultSet::getRef( sal_Int32 columnIndex ) t RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRef" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Ref;"; - static const char * cMethodName = "getRef"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/sql/Ref;"; + static const char * cMethodName = "getRef"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); @@ -594,24 +684,29 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getObject" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { jvalue args[2]; // Parameter konvertieren args[0].i = (sal_Int32)columnIndex; args[1].l = convertTypeMapToJavaMap(t.pEnv,typeMap); // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/Object;"; - static const char * cMethodName = "getObject"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/lang/Object;"; + static const char * cMethodName = "getObject"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethodA( object, mID, args); t.pEnv->DeleteLocalRef((jstring)args[1].l); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? Any() : Any();//new java_lang_Object( t.pEnv, out ); @@ -623,19 +718,24 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getShort" ); jshort out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)S"; - static const char * cMethodName = "getShort"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)S"; + static const char * cMethodName = "getShort"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallShortMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv return (sal_Int16)out; } @@ -647,20 +747,22 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getString" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getString"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); - // und aufraeumen - } //mID + { + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getString"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if ( !mID ) + throw SQLException(); + } + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + aStr = JavaString2String(t.pEnv,out); } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return aStr; @@ -673,20 +775,25 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTime" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Time;"; - static const char * cMethodName = "getTime"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/sql/Time;"; + static const char * cMethodName = "getTime"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast (java_sql_Time( t.pEnv, out )) : ::com::sun::star::util::Time(); @@ -699,19 +806,24 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTimestamp" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/sql/Timestamp;"; - static const char * cMethodName = "getTimestamp"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Ljava/sql/Timestamp;"; + static const char * cMethodName = "getTimestamp"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast (java_sql_Timestamp( t.pEnv, out )) : ::com::sun::star::util::DateTime(); @@ -723,20 +835,25 @@ sal_Bool SAL_CALL java_sql_ResultSet::isAfterLast( ) throw(SQLException, Runtim RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isAfterLast" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isAfterLast"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "isAfterLast"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -746,20 +863,25 @@ sal_Bool SAL_CALL java_sql_ResultSet::isFirst( ) throw(SQLException, RuntimeExc RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isFirst" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isFirst"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "isFirst"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -769,20 +891,25 @@ sal_Bool SAL_CALL java_sql_ResultSet::isLast( ) throw(SQLException, RuntimeExce RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isLast" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isLast"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "isLast"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -791,20 +918,25 @@ void SAL_CALL java_sql_ResultSet::beforeFirst( ) throw(SQLException, RuntimeExc { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::beforeFirst" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "isBeforeFirst"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "isBeforeFirst"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv } // ------------------------------------------------------------------------- @@ -812,20 +944,25 @@ void SAL_CALL java_sql_ResultSet::afterLast( ) throw(SQLException, RuntimeExcep { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::afterLast" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "afterLast"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "afterLast"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv } // ------------------------------------------------------------------------- @@ -842,19 +979,24 @@ sal_Bool SAL_CALL java_sql_ResultSet::first( ) throw(SQLException, RuntimeExcep RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::first" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "first"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "first"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -865,19 +1007,24 @@ sal_Bool SAL_CALL java_sql_ResultSet::last( ) throw(SQLException, RuntimeExcept RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::last" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "last"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "last"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -887,19 +1034,24 @@ sal_Bool SAL_CALL java_sql_ResultSet::absolute( sal_Int32 row ) throw(SQLExcepti RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::absolute" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "absolute"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "absolute"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID,row); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -909,19 +1061,24 @@ sal_Bool SAL_CALL java_sql_ResultSet::relative( sal_Int32 row ) throw(SQLExcepti RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::relative" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "relative"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "relative"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID,row); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -931,20 +1088,25 @@ sal_Bool SAL_CALL java_sql_ResultSet::previous( ) throw(SQLException, RuntimeEx RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::previous" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "previous"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "previous"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -961,19 +1123,24 @@ sal_Bool SAL_CALL java_sql_ResultSet::rowDeleted( ) throw(SQLException, Runtime RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowDeleted" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "rowDeleted"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "rowDeleted"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -983,19 +1150,24 @@ sal_Bool SAL_CALL java_sql_ResultSet::rowInserted( ) throw(SQLException, Runtim RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowInserted" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "rowInserted"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "rowInserted"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -1005,19 +1177,24 @@ sal_Bool SAL_CALL java_sql_ResultSet::rowUpdated( ) throw(SQLException, Runtime RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowUpdated" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "rowUpdated"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "rowUpdated"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -1028,19 +1205,24 @@ sal_Bool SAL_CALL java_sql_ResultSet::isBeforeFirst( ) throw(SQLException, Runt RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isBeforeFirst" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "isBeforeFirst"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "isBeforeFirst"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -1051,20 +1233,25 @@ sal_Bool SAL_CALL java_sql_ResultSet::next( ) throw(SQLException, RuntimeExcept RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::next" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "next"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "next"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -1075,19 +1262,24 @@ sal_Bool SAL_CALL java_sql_ResultSet::wasNull( ) throw(SQLException, RuntimeExc RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::wasNull" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Z"; - static const char * cMethodName = "wasNull"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Z"; + static const char * cMethodName = "wasNull"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv return out; } @@ -1097,19 +1289,24 @@ void SAL_CALL java_sql_ResultSet::cancel( ) throw(::com::sun::star::uno::Runtim { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancel" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "cancel"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "cancel"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv } // ------------------------------------------------------------------------- @@ -1118,19 +1315,23 @@ void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::clearWarnings" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "clearWarnings"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "clearWarnings"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1139,19 +1340,24 @@ void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getWarnings" ); jobject out(NULL); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/sql/SQLWarning;"; - static const char * cMethodName = "getWarnings"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Ljava/sql/SQLWarning;"; + static const char * cMethodName = "getWarnings"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallObjectMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! if( out ) @@ -1170,19 +1376,23 @@ void SAL_CALL java_sql_ResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQ { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::insertRow" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "insertRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "insertRow"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1190,19 +1400,23 @@ void SAL_CALL java_sql_ResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQ { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateRow" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "updateRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "updateRow"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1210,19 +1424,23 @@ void SAL_CALL java_sql_ResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQ { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::deleteRow" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "deleteRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "deleteRow"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1231,19 +1449,23 @@ void SAL_CALL java_sql_ResultSet::cancelRowUpdates( ) throw(::com::sun::star::s { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancelRowUpdates" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "cancelRowUpdates"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "cancelRowUpdates"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1252,19 +1474,23 @@ void SAL_CALL java_sql_ResultSet::moveToInsertRow( ) throw(::com::sun::star::sd { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToInsertRow" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "moveToInsertRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "moveToInsertRow"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1273,19 +1499,23 @@ void SAL_CALL java_sql_ResultSet::moveToCurrentRow( ) throw(::com::sun::star::s { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToCurrentRow" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "moveToCurrentRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "moveToCurrentRow"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1294,19 +1524,23 @@ void SAL_CALL java_sql_ResultSet::updateNull( sal_Int32 columnIndex ) throw(::co { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNull" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "updateNull"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)V"; + static const char * cMethodName = "updateNull"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1315,19 +1549,23 @@ void SAL_CALL java_sql_ResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBoolean" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(IZ)V"; - static const char * cMethodName = "updateBoolean"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(IZ)V"; + static const char * cMethodName = "updateBoolean"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1335,19 +1573,23 @@ void SAL_CALL java_sql_ResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateByte" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(IB)V"; - static const char * cMethodName = "updateByte"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(IB)V"; + static const char * cMethodName = "updateByte"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1356,19 +1598,23 @@ void SAL_CALL java_sql_ResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateShort" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(IS)V"; - static const char * cMethodName = "updateShort"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(IS)V"; + static const char * cMethodName = "updateShort"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1376,19 +1622,23 @@ void SAL_CALL java_sql_ResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateInt" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(II)V"; - static const char * cMethodName = "updateInt"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(II)V"; + static const char * cMethodName = "updateInt"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1396,19 +1646,23 @@ void SAL_CALL java_sql_ResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateLong" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(IJ)V"; - static const char * cMethodName = "updateLong"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(IJ)V"; + static const char * cMethodName = "updateLong"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1418,19 +1672,23 @@ void SAL_CALL java_sql_ResultSet::updateFloat( sal_Int32 columnIndex, float x ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateFloat" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(IF)V"; - static const char * cMethodName = "updateFloat"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(IF)V"; + static const char * cMethodName = "updateFloat"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1439,19 +1697,23 @@ void SAL_CALL java_sql_ResultSet::updateDouble( sal_Int32 columnIndex, double x { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDouble" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(ID)V"; - static const char * cMethodName = "updateDouble"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(ID)V"; + static const char * cMethodName = "updateDouble"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } } } // ------------------------------------------------------------------------- @@ -1460,17 +1722,22 @@ void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::r { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateString" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/lang/String;)V"; - static const char * cMethodName = "updateString"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(ILjava/lang/String;)V"; + static const char * cMethodName = "updateString"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { // Parameter konvertieren jstring str = convertwchar_tToJavaString(t.pEnv,x); @@ -1486,16 +1753,21 @@ void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::co { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBytes" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I[B)V"; - static const char * cMethodName = "updateBytes"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I[B)V"; + static const char * cMethodName = "updateBytes"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jbyteArray aArray = t.pEnv->NewByteArray(x.getLength()); t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray()); @@ -1512,17 +1784,22 @@ void SAL_CALL java_sql_ResultSet::updateDate( sal_Int32 columnIndex, const ::com { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDate" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/sql/Date;)V"; - static const char * cMethodName = "updateDate"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(ILjava/sql/Date;)V"; + static const char * cMethodName = "updateDate"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jvalue args[1]; // Parameter konvertieren @@ -1539,16 +1816,21 @@ void SAL_CALL java_sql_ResultSet::updateTime( sal_Int32 columnIndex, const ::com { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTime" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/sql/Time;)V"; - static const char * cMethodName = "updateTime"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(ILjava/sql/Time;)V"; + static const char * cMethodName = "updateTime"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jvalue args[1]; // Parameter konvertieren @@ -1565,16 +1847,21 @@ void SAL_CALL java_sql_ResultSet::updateTimestamp( sal_Int32 columnIndex, const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTimestamp" ); SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(I;Ljava/sql/Timestamp;)V"; - static const char * cMethodName = "updateTimestamp"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I;Ljava/sql/Timestamp;)V"; + static const char * cMethodName = "updateTimestamp"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jvalue args[1]; java_sql_Timestamp aD(x); @@ -1621,17 +1908,22 @@ void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, co try { SDBThreadAttach t; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "(ILjava/lang/Object;I)V"; - static const char * cMethodName = "updateObject"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(ILjava/lang/Object;I)V"; + static const char * cMethodName = "updateObject"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { // Parameter konvertieren double nTemp = 0.0; @@ -1659,20 +1951,25 @@ sal_Int32 java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun:: RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetConcurrency" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getConcurrency"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()I"; + static const char * cMethodName = "getConcurrency"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallIntMethod( object, mID); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - } //mID + } //t.pEnv return (sal_Int32)out; } @@ -1683,20 +1980,25 @@ sal_Int32 java_sql_ResultSet::getResultSetType() const throw(::com::sun::star::s RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetType" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getType"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()I"; + static const char * cMethodName = "getType"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallIntMethod( object, mID); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - } //mID + } //t.pEnv return (sal_Int32)out; } @@ -1706,20 +2008,25 @@ sal_Int32 java_sql_ResultSet::getFetchDirection() const throw(::com::sun::star:: RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchDirection" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getFetchDirection"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()I"; + static const char * cMethodName = "getFetchDirection"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallIntMethod( object, mID); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - } //mID + } //t.pEnv return (sal_Int32)out; } @@ -1729,20 +2036,25 @@ sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc: RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchSize" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getFetchSize"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()I"; + static const char * cMethodName = "getFetchSize"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallIntMethod( object, mID); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - } //mID + } //t.pEnv return (sal_Int32)out; } @@ -1752,20 +2064,24 @@ sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc: RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCursorName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getCursorName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()Ljava/lang/String;"; + static const char * cMethodName = "getCursorName"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *const_cast< java_sql_ResultSet* >( this ) ); aStr = JavaString2String(t.pEnv,out); - } } return aStr; @@ -1776,20 +2092,25 @@ void java_sql_ResultSet::setFetchDirection(sal_Int32 _par0) throw(::com::sun::st { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchDirection" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setFetchDirection"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)V"; + static const char * cMethodName = "setFetchDirection"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,_par0); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - } //mID + } //t.pEnv } @@ -1798,19 +2119,24 @@ void SAL_CALL java_sql_ResultSet::refreshRow( ) throw(SQLException, RuntimeExce { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::refreshRow" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ) + { // temporaere Variable initialisieren - static const char * cSignature = "()V"; - static const char * cMethodName = "refreshRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "()V"; + static const char * cMethodName = "refreshRow"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID + } //t.pEnv } //------------------------------------------------------------------------------ @@ -1818,19 +2144,24 @@ void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::s { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchSize" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setFetchSize"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)V"; + static const char * cMethodName = "setFetchSize"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + t.pEnv->CallVoidMethod( object, mID,_par0); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - } //mID + } //t.pEnv } diff --git a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx index 12bc7a3b1c3b..7bb97b6c925e 100644 --- a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx +++ b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx @@ -33,6 +33,8 @@ #include "java/sql/ResultSetMetaData.hxx" #include "java/sql/Connection.hxx" #include "java/tools.hxx" +#include + using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -40,6 +42,8 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; + +#define NULLABLE_UNDEFINED 99 //************************************************************** //************ Class: java.sql.ResultSetMetaData //************************************************************** @@ -49,7 +53,9 @@ java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject m :java_lang_Object( pEnv, myObj ) ,m_aLogger( _rResultSetLogger ) ,m_pConnection( &_rCon ) + ,m_nColumnCount(-1) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::java_sql_ResultSetMetaData" ); SDBThreadAttach::addRef(); } java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData() @@ -59,6 +65,7 @@ java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData() jclass java_sql_ResultSetMetaData::getMyClass() { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getMyClass" ); // die Klasse muss nur einmal geholt werden, daher statisch if( !theClass ){ SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); @@ -74,6 +81,7 @@ jclass java_sql_ResultSetMetaData::getMyClass() void java_sql_ResultSetMetaData::saveClassRef( jclass pClass ) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::saveClassRef" ); if( pClass==0 ) return; // der uebergebe Klassen-Handle ist schon global, daher einfach speichern @@ -83,18 +91,24 @@ void java_sql_ResultSetMetaData::saveClassRef( jclass pClass ) sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnDisplaySize" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getColumnDisplaySize"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getColumnDisplaySize"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { out = t.pEnv->CallIntMethod( object, mID,column); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //mID @@ -105,18 +119,24 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 c sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnType" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getColumnType"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getColumnType"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { out = t.pEnv->CallIntMethod( object, mID,column); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //mID @@ -127,39 +147,54 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) { - jint out(0); - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnCount" ); + if ( m_nColumnCount == -1 ) + { + SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); + { + + // temporaere Variable initialisieren + // Java-Call absetzen + static jmethodID mID = NULL; + if ( !mID ) + { + static const char * cSignature = "()I"; + static const char * cMethodName = "getColumnCount"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { + m_nColumnCount = t.pEnv->CallIntMethod( object, mID); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } //mID + } //t.pEnv + } // if ( m_nColumnCount == -1 ) + return m_nColumnCount; - // temporaere Variable initialisieren - static const char * cSignature = "()I"; - static const char * cMethodName = "getColumnCount"; - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ - out = t.pEnv->CallIntMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - return (sal_Int32)out; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCaseSensitive" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isCaseSensitive"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isCaseSensitive"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -169,17 +204,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getSchemaName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getSchemaName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getSchemaName"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -194,17 +235,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getColumnName"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -218,17 +265,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getTableName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getTableName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getTableName"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -242,17 +295,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getCatalogName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getCatalogName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getCatalogName"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -266,17 +325,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnTypeName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnTypeName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getColumnTypeName"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -290,17 +355,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnLabel" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnLabel"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getColumnLabel"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -314,17 +385,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnServiceName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnClassName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getColumnClassName"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -339,19 +416,25 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCurrency" ); if ( m_pConnection->isIgnoreCurrencyEnabled() ) return sal_False; jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isCurrency"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isCurrency"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -362,17 +445,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) thr sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isAutoIncrement" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isAutoIncrement"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isAutoIncrement"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID, column); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -384,17 +473,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSigned" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isSigned"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ) + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isSigned"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + out = t.pEnv->CallBooleanMethod( object, mID, column); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -404,17 +499,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getPrecision" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getPrecision"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getPrecision"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { out = t.pEnv->CallIntMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -425,17 +526,23 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getScale" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getScale"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getScale"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { out = t.pEnv->CallIntMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -446,17 +553,23 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) thro // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isNullable" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)I"; - static const char * cMethodName = "isNullable"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)I"; + static const char * cMethodName = "isNullable"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { out = t.pEnv->CallIntMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -468,17 +581,23 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) th sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSearchable" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isSearchable"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isSearchable"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -490,17 +609,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) t sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isReadOnly" ); jboolean out(sal_False); SDBThreadAttach t; - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isReadOnly"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isReadOnly"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -512,17 +637,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) thr sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isDefinitelyWritable" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isDefinitelyWritable"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isDefinitelyWritable"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -533,17 +664,23 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 co // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isWritable" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - if( t.pEnv ){ + { // temporaere Variable initialisieren - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isWritable"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if( mID ){ + { + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isWritable"; + + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if ( !mID ) + throw SQLException(); + } + { out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk index 58287b0bf86a..77cb92f49c0e 100644 --- a/connectivity/source/drivers/jdbc/makefile.mk +++ b/connectivity/source/drivers/jdbc/makefile.mk @@ -105,7 +105,7 @@ SHL1IMPLIB= i$(JDBC_TARGET) SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp +# DEF1EXPORTFILE= exports.dxp .ENDIF # SOLAR_JAVA diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx index a0485d6289bd..3f8dcc425eae 100644 --- a/connectivity/source/inc/java/lang/Object.hxx +++ b/connectivity/source/inc/java/lang/Object.hxx @@ -65,6 +65,7 @@ namespace connectivity { jvmaccess::VirtualMachine::AttachGuard m_aGuard; SDBThreadAttach(SDBThreadAttach&); + SDBThreadAttach& operator= (SDBThreadAttach&); public: SDBThreadAttach(); ~SDBThreadAttach(); @@ -86,8 +87,8 @@ namespace connectivity class java_lang_Object { // Zuweisungsoperator und Copy Konstruktor sind verboten - java_lang_Object& operator = (java_lang_Object&) { return *this;}; - java_lang_Object(java_lang_Object&) {}; + java_lang_Object& operator= (java_lang_Object&); + java_lang_Object(java_lang_Object&); static jclass getMyClass(); // nur zum Zerstoeren des C++ Pointers in vom JSbxObject diff --git a/connectivity/source/inc/java/sql/ResultSetMetaData.hxx b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx index 43db1d1ff115..1b46e86c75d0 100644 --- a/connectivity/source/inc/java/sql/ResultSetMetaData.hxx +++ b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx @@ -47,6 +47,7 @@ namespace connectivity protected: java::sql::ConnectionLog m_aLogger; java_sql_Connection* m_pConnection; + sal_Int32 m_nColumnCount; // statische Daten fuer die Klasse static jclass theClass; From e87505c8b639172a1ab7bbecd920ac652f763d93 Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Fri, 13 Feb 2009 06:02:11 +0000 Subject: [PATCH 003/117] remove faulty commit on tag --- connectivity/inc/connectivity/FValue.hxx | 12 - connectivity/source/commontools/FValue.cxx | 145 +- .../source/drivers/jdbc/DatabaseMetaData.cxx | 75 +- connectivity/source/drivers/jdbc/Object.cxx | 7 +- .../source/drivers/jdbc/ResultSet.cxx | 1169 ++++++----------- .../source/drivers/jdbc/ResultSetMetaData.cxx | 369 ++---- connectivity/source/drivers/jdbc/makefile.mk | 2 +- connectivity/source/inc/java/lang/Object.hxx | 5 +- .../source/inc/java/sql/ResultSetMetaData.hxx | 1 - 9 files changed, 624 insertions(+), 1161 deletions(-) diff --git a/connectivity/inc/connectivity/FValue.hxx b/connectivity/inc/connectivity/FValue.hxx index 0821b680277d..afb9af2c7b20 100644 --- a/connectivity/inc/connectivity/FValue.hxx +++ b/connectivity/inc/connectivity/FValue.hxx @@ -344,18 +344,6 @@ namespace connectivity sal_Int32 _nType, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow); - /** - fetches a single value out of the row - @param _nPos the current column position - @param _nType the type of the current column - @param _bNullable if true then it will be checked if the result could be NULL, otherwise not. - @param _xRow the row where to fetch the data from - */ - void fill(sal_Int32 _nPos, - sal_Int32 _nType, - sal_Bool _bNullable, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow); - void fill(const ::com::sun::star::uno::Any& _rValue); }; diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 893b1a38d35a..2823c2b43489 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -36,7 +36,6 @@ #include "connectivity/CommonTools.hxx" #include #include -#include using namespace connectivity; using namespace dbtools; @@ -48,12 +47,10 @@ using namespace ::com::sun::star::io; namespace { static sal_Bool isStorageCompatible(sal_Int32 _eType1, sal_Int32 _eType2) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::isStorageCompatible" ); sal_Bool bIsCompatible = sal_True; if (_eType1 != _eType2) { - RTL_LOGFILE_CONTEXT_TRACE( aLogger, "ORowSetValue::isStorageCompatible _eType1 != _eType2" ); switch (_eType1) { case DataType::CHAR: @@ -199,65 +196,65 @@ namespace tracing // ----------------------------------------------------------------------------- void ORowSetValue::setTypeKind(sal_Int32 _eType) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setTypeKind" ); - if ( !m_bNull && !isStorageCompatible(_eType, m_eTypeKind) ) - { - switch(_eType) + if (!m_bNull) + if (!isStorageCompatible(_eType, m_eTypeKind)) { - case DataType::VARCHAR: - case DataType::CHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - case DataType::LONGVARCHAR: - (*this) = getString(); - break; - case DataType::BIGINT: - (*this) = getLong(); - break; + switch(_eType) + { + case DataType::VARCHAR: + case DataType::CHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::LONGVARCHAR: + (*this) = getString(); + break; + case DataType::BIGINT: + (*this) = getLong(); + break; - case DataType::FLOAT: - (*this) = getFloat(); - break; - case DataType::DOUBLE: - case DataType::REAL: - (*this) = getDouble(); - break; - case DataType::TINYINT: - (*this) = getInt8(); - break; - case DataType::SMALLINT: - (*this) = getInt16(); - break; - case DataType::INTEGER: - (*this) = getInt32(); - break; - case DataType::BIT: - case DataType::BOOLEAN: - (*this) = getBool(); - break; - case DataType::DATE: - (*this) = getDate(); - break; - case DataType::TIME: - (*this) = getTime(); - break; - case DataType::TIMESTAMP: - (*this) = getDateTime(); - break; - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - (*this) = getSequence(); - break; - case DataType::BLOB: - case DataType::CLOB: - case DataType::OBJECT: - (*this) = getAny(); - break; - default: - OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); + case DataType::FLOAT: + (*this) = getFloat(); + break; + case DataType::DOUBLE: + case DataType::REAL: + (*this) = getDouble(); + break; + case DataType::TINYINT: + (*this) = getInt8(); + break; + case DataType::SMALLINT: + (*this) = getInt16(); + break; + case DataType::INTEGER: + (*this) = getInt32(); + break; + case DataType::BIT: + case DataType::BOOLEAN: + (*this) = getBool(); + break; + case DataType::DATE: + (*this) = getDate(); + break; + case DataType::TIME: + (*this) = getTime(); + break; + case DataType::TIMESTAMP: + (*this) = getDateTime(); + break; + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + (*this) = getSequence(); + break; + case DataType::BLOB: + case DataType::CLOB: + case DataType::OBJECT: + (*this) = getAny(); + break; + default: + OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); + } } - } m_eTypeKind = _eType; } @@ -265,7 +262,6 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType) // ----------------------------------------------------------------------------- void ORowSetValue::free() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::free" ); if(!m_bNull) { switch(m_eTypeKind) @@ -352,7 +348,7 @@ ORowSetValue& ORowSetValue::operator=(const ORowSetValue& _rRH) if(&_rRH == this) return *this; - if ( m_eTypeKind != _rRH.m_eTypeKind || (_rRH.m_bNull && !m_bNull) || m_bSigned != _rRH.m_bSigned) + if ( m_eTypeKind != _rRH.m_eTypeKind || _rRH.m_bNull || m_bSigned != _rRH.m_bSigned) free(); m_bBound = _rRH.m_bBound; @@ -852,7 +848,6 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const // ------------------------------------------------------------------------- Any ORowSetValue::makeAny() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::makeAny" ); Any rValue; if(isBound() && !isNull()) { @@ -944,7 +939,6 @@ Any ORowSetValue::makeAny() const // ------------------------------------------------------------------------- ::rtl::OUString ORowSetValue::getString( ) const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getString" ); ::rtl::OUString aRet; if(!m_bNull) { @@ -1020,7 +1014,6 @@ Any ORowSetValue::makeAny() const // ------------------------------------------------------------------------- sal_Bool ORowSetValue::getBool() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getBool" ); sal_Bool bRet = sal_False; if(!m_bNull) { @@ -1091,7 +1084,6 @@ sal_Bool ORowSetValue::getBool() const // ------------------------------------------------------------------------- sal_Int8 ORowSetValue::getInt8() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt8" ); sal_Int8 nRet = 0; @@ -1156,7 +1148,6 @@ sal_Int8 ORowSetValue::getInt8() const // ------------------------------------------------------------------------- sal_Int16 ORowSetValue::getInt16() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt16" ); sal_Int16 nRet = 0; @@ -1221,7 +1212,6 @@ sal_Int16 ORowSetValue::getInt16() const // ------------------------------------------------------------------------- sal_Int32 ORowSetValue::getInt32() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt32" ); sal_Int32 nRet = 0; if(!m_bNull) { @@ -1286,7 +1276,6 @@ sal_Int32 ORowSetValue::getInt32() const // ------------------------------------------------------------------------- sal_Int64 ORowSetValue::getLong() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getLong" ); sal_Int64 nRet = 0; if(!m_bNull) { @@ -1351,7 +1340,6 @@ sal_Int64 ORowSetValue::getLong() const // ------------------------------------------------------------------------- float ORowSetValue::getFloat() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getFloat" ); float nRet = 0; if(!m_bNull) { @@ -1420,7 +1408,6 @@ float ORowSetValue::getFloat() const // ------------------------------------------------------------------------- double ORowSetValue::getDouble() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDouble" ); double nRet = 0; @@ -1491,7 +1478,6 @@ double ORowSetValue::getDouble() const // ------------------------------------------------------------------------- void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setFromDouble" ); free(); m_bNull = sal_False; @@ -1578,7 +1564,6 @@ void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) // ----------------------------------------------------------------------------- Sequence ORowSetValue::getSequence() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getSequence" ); Sequence aSeq; if (!m_bNull) { @@ -1620,7 +1605,6 @@ Sequence ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::Date ORowSetValue::getDate() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDate" ); ::com::sun::star::util::Date aValue; if(!m_bNull) { @@ -1659,7 +1643,6 @@ Sequence ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::Time ORowSetValue::getTime() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getTime" ); ::com::sun::star::util::Time aValue; if(!m_bNull) { @@ -1697,7 +1680,6 @@ Sequence ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::DateTime ORowSetValue::getDateTime() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDateTime" ); ::com::sun::star::util::DateTime aValue; if(!m_bNull) { @@ -1744,7 +1726,6 @@ Sequence ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- void ORowSetValue::setSigned(sal_Bool _bMod) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setSigned" ); if ( m_bSigned != _bMod ) { m_bSigned = _bMod; @@ -1811,15 +1792,6 @@ void ORowSetValue::fill(sal_Int32 _nPos, sal_Int32 _nType, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); - fill(_nPos,_nType,sal_True,_xRow); -} -void ORowSetValue::fill(sal_Int32 _nPos, - sal_Int32 _nType, - sal_Bool _bNullable, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); sal_Bool bReadData = sal_True; switch(_nType) { @@ -1891,14 +1863,13 @@ void ORowSetValue::fill(sal_Int32 _nPos, bReadData = sal_False; break; } - if ( bReadData && _bNullable && _xRow->wasNull() ) + if ( bReadData && _xRow->wasNull() ) setNull(); setTypeKind(_nType); } // ----------------------------------------------------------------------------- void ORowSetValue::fill(const Any& _rValue) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); switch (_rValue.getValueType().getTypeClass()) { case TypeClass_VOID: diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index a5986ea8c288..fff580ef7c38 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -142,7 +142,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // Java-Call absetzen static jmethodID mID = NULL; @@ -351,7 +351,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo( jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // Java-Call absetzen static jmethodID mID = NULL; @@ -395,7 +395,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // Java-Call absetzen static jmethodID mID = NULL; @@ -515,7 +515,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference( jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // Java-Call absetzen static jmethodID mID = NULL; @@ -565,18 +565,15 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* _pMethod SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callBooleanMethod: no Java enviroment anymore!" ); - + if ( t.pEnv ) { // obtain method ID if ( !_inout_MethodID ) - { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()Z" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethod:: unknown method id!" ); - if ( !_inout_MethodID ) - throw SQLException(); - } // if ( !_inout_MethodID ) + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethod:: unknown method id!" ); // call method + if ( _inout_MethodID ) { out = t.pEnv->CallBooleanMethod( object, _inout_MethodID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -596,18 +593,15 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* _pMethod SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callStringMethod: no Java enviroment anymore!" ); - + if( t.pEnv ) { // obtain method ID if ( !_inout_MethodID ) - { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()Ljava/lang/String;" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callStringMethod: unknown method id!" ); - if ( !_inout_MethodID ) - throw SQLException(); - } - // call method + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callStringMethod: unknown method id!" ); + // call method + if ( _inout_MethodID ) { jstring out = (jstring)t.pEnv->CallObjectMethod( object, _inout_MethodID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -635,19 +629,15 @@ sal_Int32 java_sql_DatabaseMetaData::impl_callIntMethod( const char* _pMethodNam SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callIntMethod: no Java enviroment anymore!" ); - + if( t.pEnv ) { // obtain method ID if ( !_inout_MethodID ) - { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()I" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callIntMethod: unknown method id!" ); - if ( !_inout_MethodID ) - throw SQLException(); - } + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callIntMethod: unknown method id!" ); // call method - + if ( _inout_MethodID ) { out = t.pEnv->CallIntMethod( object, _inout_MethodID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -666,18 +656,15 @@ sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg( const char jboolean out( sal_False ); SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg: no Java enviroment anymore!" ); - + if ( t.pEnv ) { // obtain method ID if ( !_inout_MethodID ) - { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "(I)Z" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg: unknown method id!" ); - if ( !_inout_MethodID ) - throw SQLException(); - } - // call method + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg: unknown method id!" ); + // call method + if ( _inout_MethodID ) { out = t.pEnv->CallBooleanMethod( object, _inout_MethodID, _nArgument ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -697,19 +684,15 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethod( con SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callResultSetMethod: no Java enviroment anymore!" ); - + if ( t.pEnv ) { // obtain method ID if ( !_inout_MethodID ) - { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, "()Ljava/sql/ResultSet;" ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethod: unknown method id!" ); - if ( !_inout_MethodID ) - throw SQLException(); - } + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethod: unknown method id!" ); // call method - + if ( _inout_MethodID ) { out = t.pEnv->CallObjectMethod( object, _inout_MethodID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -748,22 +731,18 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithS SDBThreadAttach t; OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: no Java enviroment anymore!" ); - + if ( t.pEnv ) { const char* pSignature = _pOptionalAdditionalString ? "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;" : "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; // obtain method ID if ( !_inout_MethodID ) - { _inout_MethodID = t.pEnv->GetMethodID( getMyClass(), _pMethodName, pSignature ); - OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: unknown method id!" ); - if ( !_inout_MethodID ) - throw SQLException(); - } + OSL_ENSURE( _inout_MethodID, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: unknown method id!" ); // call method - + if ( _inout_MethodID ) { jvalue args[4]; // convert parameters @@ -1126,7 +1105,7 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType jboolean out( sal_False ); SDBThreadAttach t; - + if ( t.pEnv ) { static jmethodID mID = NULL; if ( !mID ) @@ -1474,7 +1453,7 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_I jboolean out( sal_False ); SDBThreadAttach t; - + if ( t.pEnv ) { static jmethodID mID = NULL; if ( !mID ) @@ -1558,7 +1537,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs( { jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I;)Ljava/sql/ResultSet;"; diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx index 7c8df15fa4e9..6e550134a90c 100644 --- a/connectivity/source/drivers/jdbc/Object.cxx +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -45,7 +45,7 @@ #include #include "resource/jdbc_log.hrc" -#include + #include #include @@ -81,32 +81,27 @@ SDBThreadAttach::SDBThreadAttach() : m_aGuard(java_lang_Object::getVM()) , pEnv(NULL) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "SDBThreadAttach::SDBThreadAttach" ); pEnv = m_aGuard.getEnvironment(); OSL_ENSURE(pEnv,"Environment is nULL!"); } // ----------------------------------------------------------------------------- SDBThreadAttach::~SDBThreadAttach() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "SDBThreadAttach::~SDBThreadAttach" ); } // ----------------------------------------------------------------------------- oslInterlockedCount& getJavaVMRefCount() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "getJavaVMRefCount" ); static oslInterlockedCount s_nRefCount = 0; return s_nRefCount; } // ----------------------------------------------------------------------------- void SDBThreadAttach::addRef() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "SDBThreadAttach::addRef" ); osl_incrementInterlockedCount(&getJavaVMRefCount()); } // ----------------------------------------------------------------------------- void SDBThreadAttach::releaseRef() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "SDBThreadAttach::releaseRef" ); osl_decrementInterlockedCount(&getJavaVMRefCount()); if ( getJavaVMRefCount() == 0 ) { diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index 241674f936ae..4c46666d16e8 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -85,7 +85,6 @@ java_sql_ResultSet::java_sql_ResultSet( JNIEnv * pEnv, jobject myObj, const java osl_incrementInterlockedCount(&m_refCount); if ( pStmt ) m_xStatement = *pStmt; - osl_decrementInterlockedCount(&m_refCount); } // ----------------------------------------------------------------------------- @@ -134,24 +133,19 @@ void java_sql_ResultSet::disposing(void) if( object ) { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "close"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "close"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID clearObject(*t.pEnv); } } //t.pEnv @@ -182,21 +176,16 @@ sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& column RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::findColumn" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(Ljava/lang/String;)I"; + static const char * cMethodName = "findColumn"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(Ljava/lang/String;)I"; - static const char * cMethodName = "findColumn"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ // Parameter konvertieren jstring str = convertwchar_tToJavaString(t.pEnv,columnName); out = t.pEnv->CallIntMethod( object, mID, str ); @@ -204,7 +193,7 @@ sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& column t.pEnv->DeleteLocalRef(str); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return (sal_Int32)out; } @@ -216,25 +205,20 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBinaryStream" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/io/InputStream;"; + static const char * cMethodName = "getBinaryStream"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/io/InputStream;"; - static const char * cMethodName = "getBinaryStream"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); @@ -245,25 +229,20 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCharacterStream" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/io/InputStream;"; + static const char * cMethodName = "getCharacterStream"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/io/InputStream;"; - static const char * cMethodName = "getCharacterStream"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); @@ -275,25 +254,20 @@ sal_Bool SAL_CALL java_sql_ResultSet::getBoolean( sal_Int32 columnIndex ) throw( RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBoolean" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "getBoolean"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "getBoolean"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv return out; } @@ -304,25 +278,20 @@ sal_Int8 SAL_CALL java_sql_ResultSet::getByte( sal_Int32 columnIndex ) throw(SQL RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getByte" ); jbyte out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)B"; + static const char * cMethodName = "getByte"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)B"; - static const char * cMethodName = "getByte"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallByteMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv return out; } @@ -333,20 +302,15 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBytes" ); Sequence< sal_Int8 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { + static const char * cSignature = "(I)[B"; + static const char * cMethodName = "getBytes"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)[B"; - static const char * cMethodName = "getBytes"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); if (out) @@ -357,7 +321,7 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde t.pEnv->DeleteLocalRef(out); } // und aufraeumen - + } //mID } //t.pEnv return aSeq; } @@ -368,25 +332,20 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDate" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/sql/Date;"; + static const char * cMethodName = "getDate"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/sql/Date;"; - static const char * cMethodName = "getDate"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast (java_sql_Date( t.pEnv, out )) : ::com::sun::star::util::Date(); @@ -398,25 +357,20 @@ double SAL_CALL java_sql_ResultSet::getDouble( sal_Int32 columnIndex ) throw(SQL RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDouble" ); jdouble out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)D"; + static const char * cMethodName = "getDouble"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)D"; - static const char * cMethodName = "getDouble"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallDoubleMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv return out; } @@ -427,25 +381,20 @@ float SAL_CALL java_sql_ResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLEx RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFloat" ); jfloat out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)F"; + static const char * cMethodName = "getFloat"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)F"; - static const char * cMethodName = "getFloat"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallFloatMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv return out; } @@ -456,25 +405,20 @@ sal_Int32 SAL_CALL java_sql_ResultSet::getInt( sal_Int32 columnIndex ) throw(SQL RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInt" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getInt"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getInt"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv return (sal_Int32)out; } @@ -485,24 +429,19 @@ sal_Int32 SAL_CALL java_sql_ResultSet::getRow( ) throw(SQLException, RuntimeExc RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRow" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "()I"; + static const char * cMethodName = "getRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()I"; - static const char * cMethodName = "getRow"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv return (sal_Int32)out; } @@ -513,24 +452,19 @@ sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getLong" ); jlong out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)J"; + static const char * cMethodName = "getLong"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)J"; - static const char * cMethodName = "getLong"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallLongMethod( object, mID, columnIndex ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv return out; } @@ -541,24 +475,20 @@ sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMetaData" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Ljava/sql/ResultSetMetaData;"; + static const char * cMethodName = "getMetaData"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Ljava/sql/ResultSetMetaData;"; - static const char * cMethodName = "getMetaData"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID ); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } - - out = t.pEnv->CallObjectMethod( object, mID ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } return out==0 ? 0 : new java_sql_ResultSetMetaData( t.pEnv, out, m_aLogger,*m_pConnection ); @@ -569,24 +499,19 @@ Reference< XArray > SAL_CALL java_sql_ResultSet::getArray( sal_Int32 columnIndex RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getArray" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/sql/Array;"; + static const char * cMethodName = "getArray"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/sql/Array;"; - static const char * cMethodName = "getArray"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); @@ -598,24 +523,19 @@ Reference< XClob > SAL_CALL java_sql_ResultSet::getClob( sal_Int32 columnIndex ) RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getClob" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/sql/Clob;"; + static const char * cMethodName = "getClob"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/sql/Clob;"; - static const char * cMethodName = "getClob"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); @@ -626,24 +546,19 @@ Reference< XBlob > SAL_CALL java_sql_ResultSet::getBlob( sal_Int32 columnIndex ) RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBlob" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/sql/Blob;"; + static const char * cMethodName = "getBlob"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/sql/Blob;"; - static const char * cMethodName = "getBlob"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); @@ -655,24 +570,19 @@ Reference< XRef > SAL_CALL java_sql_ResultSet::getRef( sal_Int32 columnIndex ) t RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRef" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/sql/Ref;"; + static const char * cMethodName = "getRef"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/sql/Ref;"; - static const char * cMethodName = "getRef"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); @@ -684,29 +594,24 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getObject" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ jvalue args[2]; // Parameter konvertieren args[0].i = (sal_Int32)columnIndex; args[1].l = convertTypeMapToJavaMap(t.pEnv,typeMap); // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/lang/Object;"; + static const char * cMethodName = "getObject"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/lang/Object;"; - static const char * cMethodName = "getObject"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethodA( object, mID, args); t.pEnv->DeleteLocalRef((jstring)args[1].l); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out==0 ? Any() : Any();//new java_lang_Object( t.pEnv, out ); @@ -718,24 +623,19 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getShort" ); jshort out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)S"; + static const char * cMethodName = "getShort"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)S"; - static const char * cMethodName = "getShort"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallShortMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv return (sal_Int16)out; } @@ -747,22 +647,20 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getString" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getString"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getString"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); - if ( !mID ) - throw SQLException(); - } - jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - aStr = JavaString2String(t.pEnv,out); + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return aStr; @@ -775,25 +673,20 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTime" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/sql/Time;"; + static const char * cMethodName = "getTime"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/sql/Time;"; - static const char * cMethodName = "getTime"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast (java_sql_Time( t.pEnv, out )) : ::com::sun::star::util::Time(); @@ -806,24 +699,19 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTimestamp" ); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/sql/Timestamp;"; + static const char * cMethodName = "getTimestamp"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/sql/Timestamp;"; - static const char * cMethodName = "getTimestamp"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID, columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! return out ? static_cast (java_sql_Timestamp( t.pEnv, out )) : ::com::sun::star::util::DateTime(); @@ -835,25 +723,20 @@ sal_Bool SAL_CALL java_sql_ResultSet::isAfterLast( ) throw(SQLException, Runtim RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isAfterLast" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "isAfterLast"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "isAfterLast"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -863,25 +746,20 @@ sal_Bool SAL_CALL java_sql_ResultSet::isFirst( ) throw(SQLException, RuntimeExc RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isFirst" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "isFirst"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "isFirst"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -891,25 +769,20 @@ sal_Bool SAL_CALL java_sql_ResultSet::isLast( ) throw(SQLException, RuntimeExce RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isLast" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "isLast"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "isLast"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -918,25 +791,20 @@ void SAL_CALL java_sql_ResultSet::beforeFirst( ) throw(SQLException, RuntimeExc { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::beforeFirst" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "isBeforeFirst"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "isBeforeFirst"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv } // ------------------------------------------------------------------------- @@ -944,25 +812,20 @@ void SAL_CALL java_sql_ResultSet::afterLast( ) throw(SQLException, RuntimeExcep { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::afterLast" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "afterLast"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "afterLast"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv } // ------------------------------------------------------------------------- @@ -979,24 +842,19 @@ sal_Bool SAL_CALL java_sql_ResultSet::first( ) throw(SQLException, RuntimeExcep RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::first" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "first"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "first"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1007,24 +865,19 @@ sal_Bool SAL_CALL java_sql_ResultSet::last( ) throw(SQLException, RuntimeExcept RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::last" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "last"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "last"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1034,24 +887,19 @@ sal_Bool SAL_CALL java_sql_ResultSet::absolute( sal_Int32 row ) throw(SQLExcepti RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::absolute" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "absolute"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "absolute"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID,row); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1061,24 +909,19 @@ sal_Bool SAL_CALL java_sql_ResultSet::relative( sal_Int32 row ) throw(SQLExcepti RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::relative" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "relative"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "relative"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID,row); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1088,25 +931,20 @@ sal_Bool SAL_CALL java_sql_ResultSet::previous( ) throw(SQLException, RuntimeEx RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::previous" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "previous"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "previous"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1123,24 +961,19 @@ sal_Bool SAL_CALL java_sql_ResultSet::rowDeleted( ) throw(SQLException, Runtime RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowDeleted" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "rowDeleted"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "rowDeleted"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1150,24 +983,19 @@ sal_Bool SAL_CALL java_sql_ResultSet::rowInserted( ) throw(SQLException, Runtim RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowInserted" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "rowInserted"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "rowInserted"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1177,24 +1005,19 @@ sal_Bool SAL_CALL java_sql_ResultSet::rowUpdated( ) throw(SQLException, Runtime RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowUpdated" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "rowUpdated"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "rowUpdated"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1205,24 +1028,19 @@ sal_Bool SAL_CALL java_sql_ResultSet::isBeforeFirst( ) throw(SQLException, Runt RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isBeforeFirst" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "isBeforeFirst"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "isBeforeFirst"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1233,25 +1051,20 @@ sal_Bool SAL_CALL java_sql_ResultSet::next( ) throw(SQLException, RuntimeExcept RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::next" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "next"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "next"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1262,24 +1075,19 @@ sal_Bool SAL_CALL java_sql_ResultSet::wasNull( ) throw(SQLException, RuntimeExc RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::wasNull" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Z"; + static const char * cMethodName = "wasNull"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Z"; - static const char * cMethodName = "wasNull"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv return out; } @@ -1289,24 +1097,19 @@ void SAL_CALL java_sql_ResultSet::cancel( ) throw(::com::sun::star::uno::Runtim { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancel" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "cancel"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "cancel"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv } // ------------------------------------------------------------------------- @@ -1315,23 +1118,19 @@ void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::clearWarnings" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "clearWarnings"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "clearWarnings"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1340,24 +1139,19 @@ void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getWarnings" ); jobject out(NULL); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Ljava/sql/SQLWarning;"; + static const char * cMethodName = "getWarnings"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Ljava/sql/SQLWarning;"; - static const char * cMethodName = "getWarnings"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallObjectMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! if( out ) @@ -1376,23 +1170,19 @@ void SAL_CALL java_sql_ResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQ { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::insertRow" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "insertRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "insertRow"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1400,23 +1190,19 @@ void SAL_CALL java_sql_ResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQ { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateRow" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "updateRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "updateRow"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1424,23 +1210,19 @@ void SAL_CALL java_sql_ResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQ { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::deleteRow" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "deleteRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "deleteRow"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1449,23 +1231,19 @@ void SAL_CALL java_sql_ResultSet::cancelRowUpdates( ) throw(::com::sun::star::s { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancelRowUpdates" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "cancelRowUpdates"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "cancelRowUpdates"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1474,23 +1252,19 @@ void SAL_CALL java_sql_ResultSet::moveToInsertRow( ) throw(::com::sun::star::sd { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToInsertRow" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "moveToInsertRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "moveToInsertRow"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1499,23 +1273,19 @@ void SAL_CALL java_sql_ResultSet::moveToCurrentRow( ) throw(::com::sun::star::s { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToCurrentRow" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "moveToCurrentRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "moveToCurrentRow"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1524,23 +1294,19 @@ void SAL_CALL java_sql_ResultSet::updateNull( sal_Int32 columnIndex ) throw(::co { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNull" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I)V"; + static const char * cMethodName = "updateNull"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)V"; - static const char * cMethodName = "updateNull"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,columnIndex); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1549,23 +1315,19 @@ void SAL_CALL java_sql_ResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBoolean" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(IZ)V"; + static const char * cMethodName = "updateBoolean"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(IZ)V"; - static const char * cMethodName = "updateBoolean"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1573,23 +1335,19 @@ void SAL_CALL java_sql_ResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateByte" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(IB)V"; + static const char * cMethodName = "updateByte"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(IB)V"; - static const char * cMethodName = "updateByte"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1598,23 +1356,19 @@ void SAL_CALL java_sql_ResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateShort" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(IS)V"; + static const char * cMethodName = "updateShort"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(IS)V"; - static const char * cMethodName = "updateShort"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1622,23 +1376,19 @@ void SAL_CALL java_sql_ResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateInt" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(II)V"; + static const char * cMethodName = "updateInt"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(II)V"; - static const char * cMethodName = "updateInt"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1646,23 +1396,19 @@ void SAL_CALL java_sql_ResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateLong" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(IJ)V"; + static const char * cMethodName = "updateLong"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(IJ)V"; - static const char * cMethodName = "updateLong"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1672,23 +1418,19 @@ void SAL_CALL java_sql_ResultSet::updateFloat( sal_Int32 columnIndex, float x ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateFloat" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(IF)V"; + static const char * cMethodName = "updateFloat"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(IF)V"; - static const char * cMethodName = "updateFloat"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1697,23 +1439,19 @@ void SAL_CALL java_sql_ResultSet::updateDouble( sal_Int32 columnIndex, double x { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDouble" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(ID)V"; + static const char * cMethodName = "updateDouble"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(ID)V"; - static const char * cMethodName = "updateDouble"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,columnIndex,x); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } } } // ------------------------------------------------------------------------- @@ -1722,22 +1460,17 @@ void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::r { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateString" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(ILjava/lang/String;)V"; + static const char * cMethodName = "updateString"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(ILjava/lang/String;)V"; - static const char * cMethodName = "updateString"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { // Parameter konvertieren jstring str = convertwchar_tToJavaString(t.pEnv,x); @@ -1753,21 +1486,16 @@ void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::co { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBytes" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I[B)V"; + static const char * cMethodName = "updateBytes"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I[B)V"; - static const char * cMethodName = "updateBytes"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jbyteArray aArray = t.pEnv->NewByteArray(x.getLength()); t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray()); @@ -1784,22 +1512,17 @@ void SAL_CALL java_sql_ResultSet::updateDate( sal_Int32 columnIndex, const ::com { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDate" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(ILjava/sql/Date;)V"; + static const char * cMethodName = "updateDate"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(ILjava/sql/Date;)V"; - static const char * cMethodName = "updateDate"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jvalue args[1]; // Parameter konvertieren @@ -1816,21 +1539,16 @@ void SAL_CALL java_sql_ResultSet::updateTime( sal_Int32 columnIndex, const ::com { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTime" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(ILjava/sql/Time;)V"; + static const char * cMethodName = "updateTime"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(ILjava/sql/Time;)V"; - static const char * cMethodName = "updateTime"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jvalue args[1]; // Parameter konvertieren @@ -1847,21 +1565,16 @@ void SAL_CALL java_sql_ResultSet::updateTimestamp( sal_Int32 columnIndex, const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTimestamp" ); SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(I;Ljava/sql/Timestamp;)V"; + static const char * cMethodName = "updateTimestamp"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I;Ljava/sql/Timestamp;)V"; - static const char * cMethodName = "updateTimestamp"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jvalue args[1]; java_sql_Timestamp aD(x); @@ -1908,22 +1621,17 @@ void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, co try { SDBThreadAttach t; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "(ILjava/lang/Object;I)V"; + static const char * cMethodName = "updateObject"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(ILjava/lang/Object;I)V"; - static const char * cMethodName = "updateObject"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { // Parameter konvertieren double nTemp = 0.0; @@ -1951,25 +1659,20 @@ sal_Int32 java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun:: RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetConcurrency" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "()I"; + static const char * cMethodName = "getConcurrency"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()I"; - static const char * cMethodName = "getConcurrency"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - + } //mID } //t.pEnv return (sal_Int32)out; } @@ -1980,25 +1683,20 @@ sal_Int32 java_sql_ResultSet::getResultSetType() const throw(::com::sun::star::s RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetType" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "()I"; + static const char * cMethodName = "getType"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()I"; - static const char * cMethodName = "getType"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - + } //mID } //t.pEnv return (sal_Int32)out; } @@ -2008,25 +1706,20 @@ sal_Int32 java_sql_ResultSet::getFetchDirection() const throw(::com::sun::star:: RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchDirection" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "()I"; + static const char * cMethodName = "getFetchDirection"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()I"; - static const char * cMethodName = "getFetchDirection"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - + } //mID } //t.pEnv return (sal_Int32)out; } @@ -2036,25 +1729,20 @@ sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc: RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchSize" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "()I"; + static const char * cMethodName = "getFetchSize"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()I"; - static const char * cMethodName = "getFetchSize"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - + } //mID } //t.pEnv return (sal_Int32)out; } @@ -2064,24 +1752,20 @@ sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc: RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCursorName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()Ljava/lang/String;"; + static const char * cMethodName = "getCursorName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()Ljava/lang/String;"; - static const char * cMethodName = "getCursorName"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *const_cast< java_sql_ResultSet* >( this ) ); aStr = JavaString2String(t.pEnv,out); + } } return aStr; @@ -2092,25 +1776,20 @@ void java_sql_ResultSet::setFetchDirection(sal_Int32 _par0) throw(::com::sun::st { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchDirection" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)V"; + static const char * cMethodName = "setFetchDirection"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setFetchDirection"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,_par0); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - + } //mID } //t.pEnv } @@ -2119,24 +1798,19 @@ void SAL_CALL java_sql_ResultSet::refreshRow( ) throw(SQLException, RuntimeExce { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::refreshRow" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - + if( t.pEnv ) { // temporaere Variable initialisieren + static const char * cSignature = "()V"; + static const char * cMethodName = "refreshRow"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "()V"; - static const char * cMethodName = "refreshRow"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - + } //mID } //t.pEnv } //------------------------------------------------------------------------------ @@ -2144,24 +1818,19 @@ void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::s { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchSize" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)V"; + static const char * cMethodName = "setFetchSize"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)V"; - static const char * cMethodName = "setFetchSize"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ t.pEnv->CallVoidMethod( object, mID,_par0); // special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured isExceptionOccured(t.pEnv,sal_True); - + } //mID } //t.pEnv } diff --git a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx index 7bb97b6c925e..12bc7a3b1c3b 100644 --- a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx +++ b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx @@ -33,8 +33,6 @@ #include "java/sql/ResultSetMetaData.hxx" #include "java/sql/Connection.hxx" #include "java/tools.hxx" -#include - using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -42,8 +40,6 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; - -#define NULLABLE_UNDEFINED 99 //************************************************************** //************ Class: java.sql.ResultSetMetaData //************************************************************** @@ -53,9 +49,7 @@ java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject m :java_lang_Object( pEnv, myObj ) ,m_aLogger( _rResultSetLogger ) ,m_pConnection( &_rCon ) - ,m_nColumnCount(-1) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::java_sql_ResultSetMetaData" ); SDBThreadAttach::addRef(); } java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData() @@ -65,7 +59,6 @@ java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData() jclass java_sql_ResultSetMetaData::getMyClass() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getMyClass" ); // die Klasse muss nur einmal geholt werden, daher statisch if( !theClass ){ SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); @@ -81,7 +74,6 @@ jclass java_sql_ResultSetMetaData::getMyClass() void java_sql_ResultSetMetaData::saveClassRef( jclass pClass ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::saveClassRef" ); if( pClass==0 ) return; // der uebergebe Klassen-Handle ist schon global, daher einfach speichern @@ -91,24 +83,18 @@ void java_sql_ResultSetMetaData::saveClassRef( jclass pClass ) sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnDisplaySize" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getColumnDisplaySize"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getColumnDisplaySize"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID,column); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //mID @@ -119,24 +105,18 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 c sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnType" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getColumnType"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getColumnType"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID,column); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //mID @@ -147,54 +127,39 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnCount" ); - if ( m_nColumnCount == -1 ) - { - SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { - - // temporaere Variable initialisieren - // Java-Call absetzen - static jmethodID mID = NULL; - if ( !mID ) - { - static const char * cSignature = "()I"; - static const char * cMethodName = "getColumnCount"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { - m_nColumnCount = t.pEnv->CallIntMethod( object, mID); - ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - } //mID - } //t.pEnv - } // if ( m_nColumnCount == -1 ) - return m_nColumnCount; + jint out(0); + SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + static const char * cSignature = "()I"; + static const char * cMethodName = "getColumnCount"; + // Java-Call absetzen + static jmethodID mID = NULL; + if ( !mID ) + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); + } //mID + } //t.pEnv + return (sal_Int32)out; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCaseSensitive" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isCaseSensitive"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isCaseSensitive"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -204,23 +169,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getSchemaName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getSchemaName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getSchemaName"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -235,23 +194,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getColumnName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnName"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -265,23 +218,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getTableName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getTableName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getTableName"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -295,23 +242,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getCatalogName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getCatalogName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getCatalogName"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -325,23 +266,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnTypeName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getColumnTypeName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnTypeName"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -355,23 +290,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnLabel" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getColumnLabel"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnLabel"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -385,23 +314,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnServiceName" ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Ljava/lang/String;"; + static const char * cMethodName = "getColumnClassName"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Ljava/lang/String;"; - static const char * cMethodName = "getColumnClassName"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) { jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -416,25 +339,19 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCurrency" ); if ( m_pConnection->isIgnoreCurrencyEnabled() ) return sal_False; jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isCurrency"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isCurrency"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -445,23 +362,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) thr sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isAutoIncrement" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isAutoIncrement"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isAutoIncrement"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) out = t.pEnv->CallBooleanMethod( object, mID, column); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -473,23 +384,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSigned" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isSigned"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isSigned"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ) out = t.pEnv->CallBooleanMethod( object, mID, column); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -499,23 +404,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getPrecision" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getPrecision"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getPrecision"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -526,23 +425,17 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getScale" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)I"; + static const char * cMethodName = "getScale"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)I"; - static const char * cMethodName = "getScale"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -553,23 +446,17 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) thro // ------------------------------------------------------------------------- sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isNullable" ); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)I"; + static const char * cMethodName = "isNullable"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)I"; - static const char * cMethodName = "isNullable"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallIntMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -581,23 +468,17 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) th sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSearchable" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isSearchable"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isSearchable"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -609,23 +490,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) t sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isReadOnly" ); jboolean out(sal_False); SDBThreadAttach t; - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isReadOnly"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isReadOnly"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -637,23 +512,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) thr sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isDefinitelyWritable" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isDefinitelyWritable"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isDefinitelyWritable"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen @@ -664,23 +533,17 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 co // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isWritable" ); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { + if( t.pEnv ){ // temporaere Variable initialisieren + static const char * cSignature = "(I)Z"; + static const char * cMethodName = "isWritable"; // Java-Call absetzen static jmethodID mID = NULL; if ( !mID ) - { - static const char * cSignature = "(I)Z"; - static const char * cMethodName = "isWritable"; - - mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); - if ( !mID ) - throw SQLException(); - } - { + mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); + if( mID ){ out = t.pEnv->CallBooleanMethod( object, mID, column ); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); // und aufraeumen diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk index 77cb92f49c0e..58287b0bf86a 100644 --- a/connectivity/source/drivers/jdbc/makefile.mk +++ b/connectivity/source/drivers/jdbc/makefile.mk @@ -105,7 +105,7 @@ SHL1IMPLIB= i$(JDBC_TARGET) SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) -# DEF1EXPORTFILE= exports.dxp +DEF1EXPORTFILE= exports.dxp .ENDIF # SOLAR_JAVA diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx index 3f8dcc425eae..a0485d6289bd 100644 --- a/connectivity/source/inc/java/lang/Object.hxx +++ b/connectivity/source/inc/java/lang/Object.hxx @@ -65,7 +65,6 @@ namespace connectivity { jvmaccess::VirtualMachine::AttachGuard m_aGuard; SDBThreadAttach(SDBThreadAttach&); - SDBThreadAttach& operator= (SDBThreadAttach&); public: SDBThreadAttach(); ~SDBThreadAttach(); @@ -87,8 +86,8 @@ namespace connectivity class java_lang_Object { // Zuweisungsoperator und Copy Konstruktor sind verboten - java_lang_Object& operator= (java_lang_Object&); - java_lang_Object(java_lang_Object&); + java_lang_Object& operator = (java_lang_Object&) { return *this;}; + java_lang_Object(java_lang_Object&) {}; static jclass getMyClass(); // nur zum Zerstoeren des C++ Pointers in vom JSbxObject diff --git a/connectivity/source/inc/java/sql/ResultSetMetaData.hxx b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx index 1b46e86c75d0..43db1d1ff115 100644 --- a/connectivity/source/inc/java/sql/ResultSetMetaData.hxx +++ b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx @@ -47,7 +47,6 @@ namespace connectivity protected: java::sql::ConnectionLog m_aLogger; java_sql_Connection* m_pConnection; - sal_Int32 m_nColumnCount; // statische Daten fuer die Klasse static jclass theClass; From 48adcca2a1e5eb132932f3400d8c54e9ba594993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Mon, 14 Sep 2009 12:24:04 +0000 Subject: [PATCH 010/117] #cr6875455^# pass the SdrModel's reference device to UnoControlModels --- svx/source/form/fmobj.cxx | 84 ++++++++++++++++++++++++--------------- svx/source/inc/fmobj.hxx | 8 +++- 2 files changed, 60 insertions(+), 32 deletions(-) diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index f2773b7350fa..95b0e151e078 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -81,6 +81,10 @@ FmFormObj::FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType) ,m_pLastKnownRefDevice ( NULL ) { DBG_CTOR(FmFormObj, NULL); + + // normally, this is done in SetUnoControlModel, but if the call happened in the base class ctor, + // then our incarnation of it was not called (since we were not constructed at this time). + impl_checkRefDevice_nothrow( true ); } //------------------------------------------------------------------ @@ -123,6 +127,43 @@ void FmFormObj::ClearObjEnv() m_nPos = -1; } +//------------------------------------------------------------------ +void FmFormObj::impl_checkRefDevice_nothrow( bool _force ) +{ + const FmFormModel* pFormModel = PTR_CAST( FmFormModel, GetModel() ); + OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL; + + if ( ( m_pLastKnownRefDevice == pCurrentRefDevice ) && !_force ) + return; + + Reference< XControlModel > xControlModel( GetUnoControlModel() ); + if ( !xControlModel.is() ) + return; + + m_pLastKnownRefDevice = pCurrentRefDevice; + if ( m_pLastKnownRefDevice == NULL ) + return; + + try + { + Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY_THROW ); + Reference< XPropertySetInfo > xPropertyInfo( xModelProps->getPropertySetInfo(), UNO_SET_THROW ); + + static const ::rtl::OUString sRefDevicePropName( RTL_CONSTASCII_USTRINGPARAM( "ReferenceDevice" ) ); + if ( xPropertyInfo->hasPropertyByName( sRefDevicePropName ) ) + { + VCLXDevice* pUnoRefDevice = new VCLXDevice; + pUnoRefDevice->SetOutputDevice( m_pLastKnownRefDevice ); + Reference< XDevice > xRefDevice( pUnoRefDevice ); + xModelProps->setPropertyValue( sRefDevicePropName, makeAny( xRefDevice ) ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + //------------------------------------------------------------------ void FmFormObj::impl_isolateControlModel_nothrow() { @@ -360,38 +401,10 @@ SdrObject* FmFormObj::Clone() const } //------------------------------------------------------------------ -void FmFormObj::ReformatText() +void FmFormObj::NbcReformatText() { - const FmFormModel* pFormModel = PTR_CAST( FmFormModel, GetModel() ); - OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL; - - if ( m_pLastKnownRefDevice != pCurrentRefDevice ) - { - m_pLastKnownRefDevice = pCurrentRefDevice; - - try - { - Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY ); - Reference< XPropertySetInfo > xPropertyInfo; - if ( xModelProps.is() ) - xPropertyInfo = xModelProps->getPropertySetInfo(); - - const ::rtl::OUString sRefDevicePropName( RTL_CONSTASCII_USTRINGPARAM( "ReferenceDevice" ) ); - if ( xPropertyInfo.is() && xPropertyInfo->hasPropertyByName( sRefDevicePropName ) ) - { - VCLXDevice* pUnoRefDevice = new VCLXDevice; - pUnoRefDevice->SetOutputDevice( m_pLastKnownRefDevice ); - Reference< XDevice > xRefDevice( pUnoRefDevice ); - xModelProps->setPropertyValue( sRefDevicePropName, makeAny( xRefDevice ) ); - } - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "FmFormObj::ReformatText: caught an exception!" ); - } - } - - SdrUnoObj::ReformatText(); + impl_checkRefDevice_nothrow( false ); + SdrUnoObj::NbcReformatText(); } //------------------------------------------------------------------ @@ -563,6 +576,13 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > return Reference< XInterface > (xDestContainer, UNO_QUERY); } +//------------------------------------------------------------------ +void FmFormObj::SetModel( SdrModel* _pNewModel ) +{ + SdrUnoObj::SetModel( _pNewModel ); + impl_checkRefDevice_nothrow(); +} + //------------------------------------------------------------------ FmFormObj* FmFormObj::GetFormObject( SdrObject* _pSdrObject ) { @@ -595,6 +615,8 @@ void FmFormObj::SetUnoControlModel( const Reference< com::sun::star::awt::XContr SdrUnoObj::SetUnoControlModel( _rxModel ); // TODO: call something like formObjectInserted at the form page, to tell it the new model + + impl_checkRefDevice_nothrow( true ); } //------------------------------------------------------------------ diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx index 4099f241b72a..25f792ed7417 100644 --- a/svx/source/inc/fmobj.hxx +++ b/svx/source/inc/fmobj.hxx @@ -86,12 +86,14 @@ public: virtual sal_uInt32 GetObjInventor() const; virtual sal_uInt16 GetObjIdentifier() const; - virtual void ReformatText(); + virtual void NbcReformatText(); virtual SdrObject* Clone() const; // #116235# virtual SdrObject* Clone(SdrPage* pPage, SdrModel* pModel) const; virtual void operator= (const SdrObject& rObj); + virtual void SetModel(SdrModel* pNewModel); + virtual void clonedFrom(const FmFormObj* _pSource); static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> ensureModelEnv(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> _rTopLevelDestContainer); @@ -124,6 +126,10 @@ private: its parent. */ void impl_isolateControlModel_nothrow(); + + /** forwards the reference device of our SdrModel to the control model + */ + void impl_checkRefDevice_nothrow( bool _force = false ); }; From 4cea79ccdfde2c25b376ca46fdcbe3e91e2405ec Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 18 Sep 2009 15:24:22 +0000 Subject: [PATCH 012/117] initial commit of code reorg, existing files that are modified --- basic/inc/basic/basmgr.hxx | 2 + basic/inc/basic/sbstar.hxx | 9 ++++ basic/source/basmgr/basmgr.cxx | 10 +++++ basic/source/classes/sb.cxx | 42 +++++++++++++++++++ basic/source/classes/sbxmod.cxx | 34 +++++++++++++++ basic/source/runtime/step2.cxx | 53 +----------------------- oovbaapi/genconstidl/makefile.mk | 6 +-- oovbaapi/ooo/vba/XCommandBar.idl | 3 ++ oovbaapi/ooo/vba/XCommandBarControl.idl | 2 + oovbaapi/ooo/vba/excel/XApplication.idl | 14 ++----- oovbaapi/ooo/vba/excel/XDialog.idl | 7 +--- oovbaapi/ooo/vba/excel/XDialogs.idl | 11 +---- oovbaapi/ooo/vba/excel/XFont.idl | 13 ------ oovbaapi/ooo/vba/excel/XPageSetup.idl | 9 +--- oovbaapi/ooo/vba/excel/XTextFrame.idl | 14 +------ oovbaapi/ooo/vba/excel/XWindow.idl | 9 +--- oovbaapi/ooo/vba/excel/XWorkbook.idl | 17 ++------ oovbaapi/ooo/vba/excel/XWorkbooks.idl | 3 +- oovbaapi/ooo/vba/excel/XWorksheet.idl | 3 ++ oovbaapi/ooo/vba/excel/makefile.mk | 7 +++- oovbaapi/ooo/vba/makefile.mk | 17 +++++++- oovbaapi/ooo/vba/msforms/XControl.idl | 1 + oovbaapi/ooo/vba/msforms/XShape.idl | 17 +++----- oovbaapi/ooo/vba/msforms/XShapeRange.idl | 16 +++++++ oovbaapi/ooo/vba/msforms/XShapes.idl | 1 + oovbaapi/ooo/vba/msforms/makefile.mk | 1 + oovbaapi/prj/build.lst | 3 +- oovbaapi/util/makefile.mk | 1 + sfx2/inc/sfx2/objsh.hxx | 2 + sfx2/source/doc/objcont.cxx | 46 ++++++++++---------- sfx2/source/doc/objserv.cxx | 16 +++++++ sfx2/source/doc/objxtor.cxx | 31 ++++++++++++++ svx/prj/d.lst | 1 + svx/source/msfilter/makefile.mk | 6 ++- 34 files changed, 250 insertions(+), 177 deletions(-) diff --git a/basic/inc/basic/basmgr.hxx b/basic/inc/basic/basmgr.hxx index 277bf6b9c34e..159bd6f78de9 100644 --- a/basic/inc/basic/basmgr.hxx +++ b/basic/inc/basic/basmgr.hxx @@ -231,6 +231,8 @@ public: ::com::sun::star::uno::Any SetGlobalUNOConstant( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Any& _rValue ); + /** retrieves a global constant in the basic library, referring to some UNO object, returns true if a value is found ( value is in aOut ) false otherwise. */ + bool GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ); /** determines whether there are password-protected modules whose size exceedes the legacy module size @param _out_rModuleNames diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx index 3ec0803eb4a9..1278972135f9 100644 --- a/basic/inc/basic/sbstar.hxx +++ b/basic/inc/basic/sbstar.hxx @@ -74,6 +74,11 @@ class StarBASIC : public SbxObject BOOL bDocBasic; BasicLibInfo* pLibInfo; // Info block for basic manager SbLanguageMode eLanguageMode; // LanguageMode of the basic object + BOOL bQuit; + + SbxObjectRef pVBAGlobals; + SbxObject* getVBAGlobals( ); + protected: BOOL CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen ); private: @@ -196,6 +201,10 @@ public: SbxObjectRef getRTL( void ) { return pRtl; } BOOL IsDocBasic() { return bDocBasic; } + SbxVariable* VBAFind( const String& rName, SbxClassType t ); + bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ); + void QuitAndExitApplication(); + BOOL IsQuitApplication() { return bQuit; }; }; #ifndef __SB_SBSTARBASICREF_HXX diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 8cf8a674ec2f..2620852370b1 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -47,6 +47,7 @@ #include #include +#include #include "basrid.hxx" #include "sbintern.hxx" #include @@ -1767,6 +1768,15 @@ BasicError* BasicManager::GetNextError() DBG_CHKTHIS( BasicManager, 0 ); return pErrorMgr->GetNextError(); } +bool BasicManager::GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ) +{ + bool bRes = false; + StarBASIC* pStandardLib = GetStdLib(); + OSL_PRECOND( pStandardLib, "BasicManager::SetGlobalUNOConstant: no lib to insert into!" ); + if ( pStandardLib ) + bRes = pStandardLib->GetUNOConstant( _pAsciiName, aOut ); + return bRes; +} Any BasicManager::SetGlobalUNOConstant( const sal_Char* _pAsciiName, const Any& _rValue ) { diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 7ff7cb76c7c5..7436c8361da9 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -65,7 +65,29 @@ SV_IMPL_VARARR(SbTextPortions,SbTextPortion) TYPEINIT1(StarBASIC,SbxObject) #define RTLNAME "@SBRTL" +// i#i68894# +const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") ); +const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); + +SbxObject* StarBASIC::getVBAGlobals( ) +{ + if ( !pVBAGlobals ) + pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE ); + return pVBAGlobals; +} + +// i#i68894# +SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t ) +{ + if( rName == aThisComponent ) + return NULL; + // rename to init globals + if ( getVBAGlobals( ) ) + return pVBAGlobals->Find( rName, t ); + return NULL; + +} // Create array for conversion SFX <-> VB error code struct SFX_VB_ErrorItem { @@ -654,6 +676,8 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this ); // Search via StarBasic is always global SetFlag( SBX_GBLSEARCH ); + pVBAGlobals = NULL; + bQuit = FALSE; } // #51727 Override SetModified so that the modified state @@ -968,6 +992,12 @@ SbxVariable* StarBASIC::FindVarInCurrentScopy return pVar; } +void StarBASIC::QuitAndExitApplication() +{ + Stop(); + bQuit = TRUE; +} + void StarBASIC::Stop() { SbiInstance* p = pINST; @@ -1506,6 +1536,18 @@ BOOL StarBASIC::LoadOldModules( SvStream& ) return FALSE; } +bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ) +{ + bool bRes = false; + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); + SbUnoObject* pGlobs = dynamic_cast( Find( sVarName, SbxCLASS_DONTCARE ) ); + if ( pGlobs ) + { + aOut = pGlobs->getUnoAny(); + bRes = true; + } + return bRes; +} //======================================================================== // #118116 Implementation Collection object diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 2a61557457b7..889426d68d4c 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -69,6 +69,11 @@ #endif #include +#include +#include +#include +#include + using namespace ::com::sun::star; TYPEINIT1(SbModule,SbxObject) @@ -84,6 +89,35 @@ SV_IMPL_VARARR(SbiBreakpoints,USHORT) SV_IMPL_VARARR(HighlightPortions, HighlightPortion) +class AsyncQuitHandler +{ + AsyncQuitHandler() {} + AsyncQuitHandler( const AsyncQuitHandler&); +public: + static AsyncQuitHandler& instance() + { + static AsyncQuitHandler dInst; + return dInst; + } + + void QuitApplication() + { + uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + if ( xFactory.is() ) + { + uno::Reference< frame::XDesktop > xDeskTop( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ) ), uno::UNO_QUERY ); + if ( xDeskTop.is() ) + xDeskTop->terminate(); + } + } + DECL_LINK( OnAsyncQuit, void* ); +}; + +IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, pNull ) +{ + QuitApplication(); + return 0L; +} ///////////////////////////////////////////////////////////////////////////// diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index 413d3a6f4def..fb0b217b76c4 100644 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -56,57 +56,6 @@ using com::sun::star::uno::Reference; SbxVariable* getVBAConstant( const String& rName ); -const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") ); -const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); -// i#i68894# -SbxArray* getVBAGlobals( ) -{ - static SbxArrayRef pArray; - static bool isInitialised = false; - if ( isInitialised ) - return pArray; - Reference < XComponentContext > xCtx; - Reference < XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - xCtx.set( xProps->getPropertyValue( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), - UNO_QUERY_THROW ); - SbUnoObject dGlobs( String( RTL_CONSTASCII_USTRINGPARAM("ExcelGlobals") ), xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ) ); - - SbxVariable *vba = dGlobs.Find( String( RTL_CONSTASCII_USTRINGPARAM("getGlobals") ) , SbxCLASS_DONTCARE ); - - if ( vba ) - { - pArray = static_cast(vba->GetObject()); - isInitialised = true; - return pArray; - } - return NULL; -} - -// i#i68894# -SbxVariable* VBAFind( const String& rName, SbxClassType t ) -{ - if( rName == aThisComponent ) - return NULL; - - SbxArray *pVBAGlobals = getVBAGlobals( ); - for (USHORT i = 0; pVBAGlobals && i < pVBAGlobals->Count(); i++) - { - SbxVariable *pElem = pVBAGlobals->Get( i ); - if (!pElem || !pElem->IsObject()) - continue; - SbxObject *pVba = static_cast(pElem->GetObject()); - SbxVariable *pVbaVar = pVba ? pVba->Find( rName, t ) : NULL; - if( pVbaVar ) - { - return pVbaVar; - } - } - return NULL; - -} - // Suchen eines Elements // Die Bits im String-ID: // 0x8000 - Argv ist belegt @@ -191,7 +140,7 @@ SbxVariable* SbiRuntime::FindElement if ( bVBAEnabled ) { // Try Find in VBA symbols space - pElem = VBAFind( aName, SbxCLASS_DONTCARE ); + pElem = rBasic.VBAFind( aName, SbxCLASS_DONTCARE ); if ( pElem ) bSetName = false; // don't overwrite uno name else diff --git a/oovbaapi/genconstidl/makefile.mk b/oovbaapi/genconstidl/makefile.mk index 42219545c672..95397442c208 100644 --- a/oovbaapi/genconstidl/makefile.mk +++ b/oovbaapi/genconstidl/makefile.mk @@ -54,18 +54,16 @@ MYDONEFILES += $(foreach,i,$(MYSYMFILES) $(MISC)$/$(i:b).done) ALLTAR: GENIDL -GENIDL : $(MY_GEN_IDL_PATH) $(MYDONEFILES) +GENIDL : $(MYDONEFILES) GENRDB : GENIDL $(MYURDFILES) $(MISC)$/%.done : %.api + @@-$(MKDIR) $(MY_GEN_IDL_PATH) @echo Processing $? $(PERL) api-to-idl.pl $? $(MY_GEN_IDL_PATH) @$(TOUCH) $@ -$(MY_GEN_IDL_PATH) : - @@-$(MKDIR) $@ - CLEAN : @$(RM) $(MY_GEN_IDL_PATH)$/*.idl @$(RM) $(foreach,i,$(MYSYMFILES) $(MISC)$/$(i:b).done) diff --git a/oovbaapi/ooo/vba/XCommandBar.idl b/oovbaapi/ooo/vba/XCommandBar.idl index 7bf5c9dcf675..395dafcd5567 100644 --- a/oovbaapi/ooo/vba/XCommandBar.idl +++ b/oovbaapi/ooo/vba/XCommandBar.idl @@ -54,9 +54,12 @@ interface XCommandBar [attribute] string Name; [attribute] boolean Visible; + [attribute] boolean Enabled; void Delete() raises ( com::sun::star::script::BasicErrorException ); any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException ); + long Type() raises ( com::sun::star::script::BasicErrorException ); + any FindControl( [in] any Type, [in] any Id, [in] any Tag, [in] any Visible, [in] any Recursive ) raises ( com::sun::star::script::BasicErrorException ); }; }; }; diff --git a/oovbaapi/ooo/vba/XCommandBarControl.idl b/oovbaapi/ooo/vba/XCommandBarControl.idl index 44ec75e01729..b6da3a319d7f 100644 --- a/oovbaapi/ooo/vba/XCommandBarControl.idl +++ b/oovbaapi/ooo/vba/XCommandBarControl.idl @@ -54,6 +54,8 @@ interface XCommandBarControl [attribute] string Caption; [attribute] string OnAction; [attribute] boolean Visible; + [attribute, readonly] long Type; + [attribute] boolean Enabled; void Delete() raises ( com::sun::star::script::BasicErrorException ); any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException ); diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl index 47628b18a7f1..de6763ab242d 100644 --- a/oovbaapi/ooo/vba/excel/XApplication.idl +++ b/oovbaapi/ooo/vba/excel/XApplication.idl @@ -42,10 +42,6 @@ #include #endif -#ifndef __ooo_vba_XCommandBars_idl__ -#include -#endif - module ooo { module vba { module excel { interface XRange; @@ -56,10 +52,10 @@ interface XWorksheetFunction; interface XWindow; interface XWorksheet; -interface XApplication +interface XApplication : com::sun::star::uno::XInterface { - interface ::ooo::vba::XHelperInterface; +// interface ::ooo::vba::XHelperInterface; [attribute, readonly] any Selection; [attribute, readonly] XWorkbook ActiveWorkbook; @@ -74,14 +70,11 @@ interface XApplication // to determine this [attribute, readonly] XWorkbook ThisWorkbook; [attribute, readonly] string Name; - [attribute] boolean ScreenUpdating; - [attribute] boolean DisplayStatusBar; [attribute] boolean DisplayAlerts; [attribute] boolean DisplayFormulaBar; [attribute] any CutCopyMode; [attribute] any StatusBar; [attribute] long Cursor; - [attribute, readonly] string Version; void setDefaultFilePath([in] string DefaultFilePath) raises(com::sun::star::script::BasicErrorException); @@ -90,7 +83,7 @@ interface XApplication string LibraryPath() raises(com::sun::star::script::BasicErrorException); string TemplatesPath() raises(com::sun::star::script::BasicErrorException); string PathSeparator() raises(com::sun::star::script::BasicErrorException); - any CommandBars( [in] any aIndex ); + //any CommandBars( [in] any aIndex ); any Workbooks( [in] any aIndex ); any Worksheets( [in] any aIndex ); any Windows( [in] any aIndex ); @@ -110,6 +103,7 @@ interface XApplication raises(com::sun::star::script::BasicErrorException); void Volatile([in] any Volatile); void DoEvents(); + any Caller( [in] any aIndex ); }; }; }; }; diff --git a/oovbaapi/ooo/vba/excel/XDialog.idl b/oovbaapi/ooo/vba/excel/XDialog.idl index 5bfb18f69baf..8c24fe038c25 100644 --- a/oovbaapi/ooo/vba/excel/XDialog.idl +++ b/oovbaapi/ooo/vba/excel/XDialog.idl @@ -45,13 +45,8 @@ module ooo { module vba { module excel { //============================================================================= -interface XApplication; - -interface XDialog +interface XDialog : com::sun::star::uno::XInterface { - interface ::ooo::vba::XHelperInterface; - - void Show(); }; }; }; }; diff --git a/oovbaapi/ooo/vba/excel/XDialogs.idl b/oovbaapi/ooo/vba/excel/XDialogs.idl index 4b4493e9d2ff..346be87b91b4 100644 --- a/oovbaapi/ooo/vba/excel/XDialogs.idl +++ b/oovbaapi/ooo/vba/excel/XDialogs.idl @@ -33,9 +33,6 @@ #ifndef __com_sun_star_uno_XInterface_idl__ #include #endif -#ifndef __ooo_vba_XCollection_idl__ -#include -#endif #ifndef __ooo_vba_XHelperInterface_idl__ #include @@ -44,15 +41,9 @@ //============================================================================= module ooo { module vba { module excel { -interface XApplication; -//============================================================================= -//interface XDialogs : ::ooo::vba::XCollection -interface XDialogs +interface XDialogs : com::sun::star::uno::XInterface { - interface ::ooo::vba::XHelperInterface; - - [attribute, readonly] long Count; any Item( [in] any Index ); }; diff --git a/oovbaapi/ooo/vba/excel/XFont.idl b/oovbaapi/ooo/vba/excel/XFont.idl index 038e6b43a85c..f6da47052195 100644 --- a/oovbaapi/ooo/vba/excel/XFont.idl +++ b/oovbaapi/ooo/vba/excel/XFont.idl @@ -47,22 +47,9 @@ module ooo { module vba { module excel { interface XFont { - interface ::ooo::vba::XHelperInterface; - - [attribute] any Size; [attribute] any StandardFontSize; [attribute] any StandardFont; [attribute] any FontStyle; - [attribute] any ColorIndex; - [attribute] any Color; - [attribute] any Bold; - [attribute] any Underline; - [attribute] any Strikethrough; - [attribute] any Shadow; - [attribute] any Italic; - [attribute] any Subscript; - [attribute] any Superscript; - [attribute] any Name; [attribute] any OutlineFont; }; diff --git a/oovbaapi/ooo/vba/excel/XPageSetup.idl b/oovbaapi/ooo/vba/excel/XPageSetup.idl index b847e656dadb..335040dee224 100644 --- a/oovbaapi/ooo/vba/excel/XPageSetup.idl +++ b/oovbaapi/ooo/vba/excel/XPageSetup.idl @@ -45,20 +45,15 @@ module ooo { module vba { module excel { //============================================================================= -interface XPageSetup +interface XPageSetup : com::sun::star::uno::XInterface { - interface ::ooo::vba::XHelperInterface; +// interface ::ooo::vba::XHelperInterface; //Attributes [attribute] string PrintArea; - [attribute] double TopMargin; - [attribute] double BottomMargin; - [attribute] double RightMargin; - [attribute] double LeftMargin; [attribute] double HeaderMargin; [attribute] double FooterMargin; - [attribute] long Orientation; [attribute] any FitToPagesTall; [attribute] any FitToPagesWide; [attribute] any Zoom; diff --git a/oovbaapi/ooo/vba/excel/XTextFrame.idl b/oovbaapi/ooo/vba/excel/XTextFrame.idl index e0380217e609..201bc1860660 100644 --- a/oovbaapi/ooo/vba/excel/XTextFrame.idl +++ b/oovbaapi/ooo/vba/excel/XTextFrame.idl @@ -34,21 +34,9 @@ #include #endif -#ifndef __ooo_vba_excel_XCharacters_idl__ -#include -#endif - module ooo { module vba { module excel { -interface XTextFrame : ooo::vba::XHelperInterface +interface XTextFrame : com::sun::star::uno::XInterface { - [attribute] boolean AutoSize; - [attribute] float MarginBottom; - [attribute] float MarginTop; - [attribute] float MarginLeft; - [attribute] float MarginRight; - XCharacters Characters(); - /*I don't find it in msdn - Range TextRange();*/ }; }; }; }; #endif diff --git a/oovbaapi/ooo/vba/excel/XWindow.idl b/oovbaapi/ooo/vba/excel/XWindow.idl index b67810a764b3..63a8428c3491 100644 --- a/oovbaapi/ooo/vba/excel/XWindow.idl +++ b/oovbaapi/ooo/vba/excel/XWindow.idl @@ -46,10 +46,8 @@ module ooo { module vba { module excel { interface XRange; interface XWorksheet; interface XPane; -interface XWindow +interface XWindow : com::sun::star::uno::XInterface { - interface ::ooo::vba::XHelperInterface; - [attribute] any Caption; [attribute] boolean DisplayGridlines; [attribute] boolean DisplayHeadings; @@ -58,8 +56,6 @@ interface XWindow [attribute] boolean DisplayVerticalScrollBar; [attribute] boolean DisplayWorkbookTabs; [attribute] boolean FreezePanes; - [attribute] long Height; - [attribute] long Left; [attribute] boolean Split; [attribute] long SplitColumn; [attribute] double SplitHorizontal; @@ -67,10 +63,7 @@ interface XWindow [attribute] double SplitVertical; [attribute] any ScrollColumn; [attribute] any ScrollRow; - [attribute] long Top; [attribute] any View; - [attribute] boolean Visible; - [attribute] long Width; [attribute] any WindowState; [attribute] any Zoom; any SelectedSheets( [in] any aIndex ); diff --git a/oovbaapi/ooo/vba/excel/XWorkbook.idl b/oovbaapi/ooo/vba/excel/XWorkbook.idl index e05a6ccca493..bb043bfa6b29 100644 --- a/oovbaapi/ooo/vba/excel/XWorkbook.idl +++ b/oovbaapi/ooo/vba/excel/XWorkbook.idl @@ -48,31 +48,20 @@ interface XWorksheet; interface XWorksheets; interface XStyles; -interface XWorkbook +interface XWorkbook : com::sun::star::uno::XInterface { - interface ::ooo::vba::XHelperInterface; - - [attribute, readonly] string Name; - [attribute, readonly] string Path; - [attribute, readonly] string FullName; [attribute, readonly] boolean ProtectStructure; [attribute, readonly] XWorksheet ActiveSheet; - [attribute] boolean Saved; [attribute, readonly] string CodeName; + [attribute] boolean PrecisionAsDisplayed; any Worksheets([in] any sheet); any Styles([in] any Index ); any Sheets([in] any sheet); any Windows([in] any index ); - void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook); - void Protect( [in] any Password ); - void Unprotect( [in] any Password ); - void Save(); - void Activate(); void ResetColors() raises (com::sun::star::script::BasicErrorException); - + void Activate(); any Names( [in] any Index ); - any Colors([in] any Index) raises (com::sun::star::script::BasicErrorException); long FileFormat() raises (com::sun::star::script::BasicErrorException); void SaveCopyAs( [in] string Filename ); diff --git a/oovbaapi/ooo/vba/excel/XWorkbooks.idl b/oovbaapi/ooo/vba/excel/XWorkbooks.idl index a94747282200..685124922707 100644 --- a/oovbaapi/ooo/vba/excel/XWorkbooks.idl +++ b/oovbaapi/ooo/vba/excel/XWorkbooks.idl @@ -45,9 +45,8 @@ module ooo { module vba { module excel { //============================================================================= -interface XWorkbooks +interface XWorkbooks : com::sun::star::uno::XInterface { - interface ::ooo::vba::XCollection; any Add(); any Open([in] string Filename, [in] any UpdateLinks, [in] any ReadOnly, [in] any Format, [in] any Password, [in] any WriteResPassword, [in] any IgnoreReadOnlyRecommended, [in] any Origin, [in] any Delimiter, [in] any Editable, [in] any Notify, [in] any Converter, [in] any AddToMru); diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl index 743e6b8fe6a2..00cd109a8b70 100644 --- a/oovbaapi/ooo/vba/excel/XWorksheet.idl +++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl @@ -53,6 +53,7 @@ interface XRange; interface XOutline; interface XPageSetup; interface XHPageBreaks; +interface XVPageBreaks; interface XWorksheet { interface ::ooo::vba::XHelperInterface; @@ -70,6 +71,7 @@ interface XWorksheet [attribute, readonly] XWorksheet Previous; [attribute, readonly] string CodeName; [attribute, readonly] short Index; + [attribute] long EnableSelection; void Activate(); void Calculate( ); @@ -88,6 +90,7 @@ interface XWorksheet XOutline Outline(); XPageSetup PageSetup(); any HPageBreaks([in] any Index); + any VPageBreaks([in] any Index); any OLEObjects([in] any Index); void ShowDataForm(); any Shapes([in] any Index); diff --git a/oovbaapi/ooo/vba/excel/makefile.mk b/oovbaapi/ooo/vba/excel/makefile.mk index 764c073e6846..4ffa89f94ce1 100644 --- a/oovbaapi/ooo/vba/excel/makefile.mk +++ b/oovbaapi/ooo/vba/excel/makefile.mk @@ -46,7 +46,9 @@ dummy: # ------------------------------------------------------------------------ -IDLFILES= XApplication.idl\ +IDLFILES= XGlobals.idl\ + Globals.idl\ + XApplication.idl\ XComment.idl\ XComments.idl\ XRange.idl\ @@ -103,6 +105,9 @@ IDLFILES= XApplication.idl\ XPageBreak.idl \ XHPageBreak.idl \ XHPageBreaks.idl \ + XVPageBreak.idl \ + XVPageBreaks.idl \ + TextFrame.idl \ # ------------------------------------------------------------------ diff --git a/oovbaapi/ooo/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk index ee63d6373feb..093ea81d8d55 100644 --- a/oovbaapi/ooo/vba/makefile.mk +++ b/oovbaapi/ooo/vba/makefile.mk @@ -47,7 +47,6 @@ dummy: IDLFILES=\ XErrObject.idl \ - XGlobals.idl \ XCollection.idl\ XVBAToOOEventDescGen.idl\ XPropValue.idl\ @@ -57,7 +56,21 @@ IDLFILES=\ XCommandBarControls.idl\ XCommandBar.idl\ XCommandBars.idl\ - Globals.idl\ + XCommandBarPopup.idl\ + XCommandBarButton.idl\ + XControlProvider.idl\ + ControlProvider.idl\ + XApplicationBase.idl\ + XWindowBase.idl\ + XDocumentBase.idl\ + XDocumentsBase.idl\ + XGlobalsBase.idl\ + XDocumentProperty.idl\ + XDocumentProperties.idl\ + XFontBase.idl\ + XDialogsBase.idl\ + XDialogBase.idl\ + XPageSetupBase.idl \ # ------------------------------------------------------------------ diff --git a/oovbaapi/ooo/vba/msforms/XControl.idl b/oovbaapi/ooo/vba/msforms/XControl.idl index 75f9becd253c..8db43ffdccf2 100644 --- a/oovbaapi/ooo/vba/msforms/XControl.idl +++ b/oovbaapi/ooo/vba/msforms/XControl.idl @@ -61,6 +61,7 @@ interface XControl [attribute] double Left; [attribute] double Top; [attribute] string Name; + [attribute] string ControlTipText; }; //============================================================================= diff --git a/oovbaapi/ooo/vba/msforms/XShape.idl b/oovbaapi/ooo/vba/msforms/XShape.idl index e43726134680..45a37f23f47a 100644 --- a/oovbaapi/ooo/vba/msforms/XShape.idl +++ b/oovbaapi/ooo/vba/msforms/XShape.idl @@ -34,10 +34,6 @@ #include #endif -#ifndef __ooo_vba_excel_XTextFrame_idl__ -#include -#endif - #ifndef __ooo_vba_msforms_XLineFormat_idl__ #include #endif @@ -66,14 +62,13 @@ interface XShape : ooo::vba::XHelperInterface [attribute, readonly] XLineFormat Line; [attribute, readonly] XFillFormat Fill; [attribute, readonly] XPictureFormat PictureFormat; + [attribute] boolean LockAspectRatio; + [attribute] boolean LockAnchor; + [attribute] long RelativeHorizontalPosition; + [attribute] long RelativeVerticalPosition; - /* - using in word - [attribute] RelativeHorizontalPosition - [attribute] RelativeVerticalPosition - [attribute] XWrapFormat WrapFormat; - */ - ooo::vba::excel::XTextFrame TextFrame(); + any TextFrame(); + any WrapFormat(); void Delete(); void ZOrder( [in] long ZOrderCmd ); void IncrementRotation( [in] double Increment ); diff --git a/oovbaapi/ooo/vba/msforms/XShapeRange.idl b/oovbaapi/ooo/vba/msforms/XShapeRange.idl index e0ceb79f94bd..079406ac1e5f 100644 --- a/oovbaapi/ooo/vba/msforms/XShapeRange.idl +++ b/oovbaapi/ooo/vba/msforms/XShapeRange.idl @@ -44,9 +44,25 @@ module ooo { module vba { module msforms { +interface XLineFormat; +interface XFillFormat; interface XShapeRange { interface ooo::vba::XCollection; + + [attribute] double Height; + [attribute] double Width; + [attribute] double Left; + [attribute] double Top; + [attribute, readonly] XLineFormat Line; + [attribute, readonly] XFillFormat Fill; + [attribute] boolean LockAspectRatio; + [attribute] boolean LockAnchor; + [attribute] long RelativeHorizontalPosition; + [attribute] long RelativeVerticalPosition; + + any TextFrame(); + any WrapFormat(); void Select(); XShape Group(); void IncrementRotation( [in] double Increment ); diff --git a/oovbaapi/ooo/vba/msforms/XShapes.idl b/oovbaapi/ooo/vba/msforms/XShapes.idl index 3d49fbc0701b..1bb5dc2a0429 100644 --- a/oovbaapi/ooo/vba/msforms/XShapes.idl +++ b/oovbaapi/ooo/vba/msforms/XShapes.idl @@ -51,6 +51,7 @@ interface XShapes */ any AddLine( [in] long StartX, [in] long StartY, [in] long endX, [in] long endY ); any AddShape([in] long ShapeType, [in] long StartX, [in] long StartY, [in] long endX, [in] long endY ); + any AddTextbox([in] long Orientation, [in] long Left, [in] long Top, [in] long Width, [in] long Height ); }; }; }; }; diff --git a/oovbaapi/ooo/vba/msforms/makefile.mk b/oovbaapi/ooo/vba/msforms/makefile.mk index f6549931444b..012cc7b91a59 100644 --- a/oovbaapi/ooo/vba/msforms/makefile.mk +++ b/oovbaapi/ooo/vba/msforms/makefile.mk @@ -71,6 +71,7 @@ IDLFILES=\ XSpinButton.idl \ XImage.idl \ XControls.idl \ + XTextFrame.idl \ # ------------------------------------------------------------------ diff --git a/oovbaapi/prj/build.lst b/oovbaapi/prj/build.lst index bc34a4f376ff..e6d23a3bed91 100644 --- a/oovbaapi/prj/build.lst +++ b/oovbaapi/prj/build.lst @@ -4,5 +4,6 @@ ovba oovbaapi\genconstidl nmake - all ovba_genconstidl NULL ovba oovbaapi\ooo\vba\constants nmake - all ovba_constants ovba_genconstidl NULL ovba oovbaapi\ooo\vba nmake - all ovba_vba NULL ovba oovbaapi\ooo\vba\excel nmake - all ovba_excel NULL +ovba oovbaapi\ooo\vba\word nmake - all ovba_word NULL ovba oovbaapi\ooo\vba\msforms nmake - all ovba_msforms NULL -ovba oovbaapi\util nmake - all ovba_util ovba_vba ovba_excel ovba_msforms ovba_constants ovba_genconstidl NULL +ovba oovbaapi\util nmake - all ovba_util ovba_vba ovba_excel ovba_word ovba_msforms ovba_constants ovba_genconstidl NULL diff --git a/oovbaapi/util/makefile.mk b/oovbaapi/util/makefile.mk index 97e592a7c053..df7a331540c1 100644 --- a/oovbaapi/util/makefile.mk +++ b/oovbaapi/util/makefile.mk @@ -49,6 +49,7 @@ dummy: UNOIDLDBFILES= \ $(UCR)$/vba.db \ $(UCR)$/excel.db \ + $(UCR)$/word.db \ $(UCR)$/msforms.db \ $(UCR)$/constants.db diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 71f1729840c0..83662632a155 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -264,6 +264,7 @@ public: TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXDOCSH) + static const com::sun::star::uno::Sequence& getUnoTunnelId(); /* Stampit disable/enable cancel button for print jobs default = true = enable! */ void Stamp_SetPrintCancelState(sal_Bool bState); @@ -882,6 +883,7 @@ public: virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); SfxObjectShell* GetObjectShell() const { return pObjSh; } + }; #endif diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 866c7b029cb5..b94e59b910ff 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1471,31 +1471,35 @@ sal_Bool SfxObjectShell::IsHelpDocument() const void SfxObjectShell::ResetFromTemplate( const String& rTemplateName, const String& rFileName ) { - uno::Reference xDocProps(getDocProperties()); - xDocProps->setTemplateURL( ::rtl::OUString() ); - xDocProps->setTemplateName( ::rtl::OUString() ); - xDocProps->setTemplateDate( util::DateTime() ); - xDocProps->resetUserData( ::rtl::OUString() ); - - // TODO/REFACTOR: - // Title? - - if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) ) + // only care about reseting this data for openoffice formats otherwise + if ( IsOwnStorageFormat_Impl( *GetMedium()) ) { - String aFoundName; - if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( String(), rTemplateName, aFoundName ) ) + uno::Reference xDocProps(getDocProperties()); + xDocProps->setTemplateURL( ::rtl::OUString() ); + xDocProps->setTemplateName( ::rtl::OUString() ); + xDocProps->setTemplateDate( util::DateTime() ); + xDocProps->resetUserData( ::rtl::OUString() ); + + // TODO/REFACTOR: + // Title? + + if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) ) { - INetURLObject aObj( rFileName ); - xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) ); - xDocProps->setTemplateName( rTemplateName ); + String aFoundName; + if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( String(), rTemplateName, aFoundName ) ) + { + INetURLObject aObj( rFileName ); + xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) ); + xDocProps->setTemplateName( rTemplateName ); - ::DateTime now; - xDocProps->setTemplateDate( util::DateTime( - now.Get100Sec(), now.GetSec(), now.GetMin(), - now.GetHour(), now.GetDay(), now.GetMonth(), - now.GetYear() ) ); + ::DateTime now; + xDocProps->setTemplateDate( util::DateTime( + now.Get100Sec(), now.GetSec(), now.GetMin(), + now.GetHour(), now.GetDay(), now.GetMonth(), + now.GetYear() ) ); - SetQueryLoadTemplate( sal_True ); + SetQueryLoadTemplate( sal_True ); + } } } } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index a47fc1bf4747..3d4eedcadada 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1475,3 +1475,19 @@ void SfxObjectShell::SignScriptingContent() ImplSign( TRUE ); } +// static +const uno::Sequence& SfxObjectShell::getUnoTunnelId() +{ + static uno::Sequence * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 26ba76517d8c..5b1c6bdd3106 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -136,6 +136,33 @@ DBG_NAME(SfxObjectShell) extern svtools::AsynchronLink* pPendingCloser; static WeakReference< XInterface > s_xCurrentComponent; +void lcl_UpdateAppBasicDocVars( const Reference< XInterface >& _rxComponent, bool bClear = false ) +{ + BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); + if ( pAppMgr ) + { + uno::Reference< beans::XPropertySet > xProps( _rxComponent, uno::UNO_QUERY ); + if ( xProps.is() ) + { + try + { + beans::PropertyValue aProp; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisVBADocObj") ) ) >>= aProp; + rtl::OString sTmp( rtl::OUStringToOString( aProp.Name, RTL_TEXTENCODING_UTF8 ) ); + const char* pAscii = sTmp.getStr(); + if ( bClear ) + pAppMgr->SetGlobalUNOConstant( pAscii, uno::makeAny( uno::Reference< uno::XInterface >() ) ); + else + pAppMgr->SetGlobalUNOConstant( pAscii, aProp.Value ); + + } + catch( uno::Exception& e ) + { + } + } + } +} + //========================================================================= @@ -170,6 +197,7 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source ) { + lcl_UpdateAppBasicDocVars( SfxObjectShell::GetCurrentComponent(), true ); // remove ThisComponent reference from AppBasic SfxObjectShell::SetCurrentComponent( Reference< XInterface >() ); } @@ -1048,7 +1076,10 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); s_xCurrentComponent = _rxComponent; if ( pAppMgr ) + { + lcl_UpdateAppBasicDocVars( _rxComponent ); pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxComponent ) ); + } #if OSL_DEBUG_LEVEL > 0 const char* pComponentImplName = _rxComponent.get() ? typeid( *_rxComponent.get() ).name() : "void"; diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 7edc2fbc9c11..acbb689082ba 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -658,5 +658,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table ..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx ..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx +..\inc\svx\msvbahelper.hxx %_DEST%\inc%_EXT%\svx\msvbahelper.hxx ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.* diff --git a/svx/source/msfilter/makefile.mk b/svx/source/msfilter/makefile.mk index adbe8b104860..53eab95a5be8 100644 --- a/svx/source/msfilter/makefile.mk +++ b/svx/source/msfilter/makefile.mk @@ -54,7 +54,8 @@ LIB1OBJFILES= \ $(SLO)$/svxmsbas.obj \ $(SLO)$/msocximex.obj \ $(SLO)$/mscodec.obj \ - $(SLO)$/msfiltertracer.obj + $(SLO)$/msfiltertracer.obj \ + $(SLO)$/msvbahelper.obj\ LIB2TARGET= $(SLB)$/$(TARGET)-core.lib LIB2OBJFILES= \ @@ -70,7 +71,8 @@ EXCEPTIONSFILES= \ $(SLO)$/msocximex.obj \ $(SLO)$/msoleexp.obj \ $(SLO)$/svxmsbas.obj \ - $(SLO)$/msfiltertracer.obj + $(SLO)$/msfiltertracer.obj \ + $(SLO)$/msvbahelper.obj\ .INCLUDE : target.mk From d37c09f380fa6e24487231e5d70bfc8ecd8157d6 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 18 Sep 2009 15:35:47 +0000 Subject: [PATCH 013/117] new and removed files --- oovbaapi/ooo/vba/ControlProvider.idl | 54 + oovbaapi/ooo/vba/XApplicationBase.idl | 66 + oovbaapi/ooo/vba/XCommandBarButton.idl | 52 + oovbaapi/ooo/vba/XCommandBarPopup.idl | 52 + .../{XGlobals.idl => XControlProvider.idl} | 37 +- oovbaapi/ooo/vba/XDialogBase.idl | 58 + oovbaapi/ooo/vba/XDialogsBase.idl | 60 + oovbaapi/ooo/vba/XDocumentBase.idl | 67 + oovbaapi/ooo/vba/XDocumentProperties.idl | 71 + oovbaapi/ooo/vba/XDocumentProperty.idl | 106 ++ oovbaapi/ooo/vba/XDocumentsBase.idl | 55 + oovbaapi/ooo/vba/XFontBase.idl | 71 + oovbaapi/ooo/vba/XGlobalsBase.idl | 53 + oovbaapi/ooo/vba/XPageSetupBase.idl | 67 + oovbaapi/ooo/vba/XWindowBase.idl | 62 + oovbaapi/ooo/vba/{ => excel}/Globals.idl | 12 +- oovbaapi/ooo/vba/excel/TextFrame.idl | 53 + oovbaapi/ooo/vba/excel/XGlobals.idl | 86 ++ oovbaapi/ooo/vba/excel/XVPageBreak.idl | 54 + oovbaapi/ooo/vba/excel/XVPageBreaks.idl | 71 + oovbaapi/ooo/vba/msforms/XTextFrame.idl | 50 + oovbaapi/ooo/vba/word/XAddin.idl | 61 + oovbaapi/ooo/vba/word/XAddins.idl | 55 + oovbaapi/ooo/vba/word/XApplication.idl | 70 + oovbaapi/ooo/vba/word/XAutoTextEntries.idl | 55 + oovbaapi/ooo/vba/word/XAutoTextEntry.idl | 59 + oovbaapi/ooo/vba/word/XBookmark.idl | 61 + oovbaapi/ooo/vba/word/XBookmarks.idl | 61 + oovbaapi/ooo/vba/word/XBorder.idl | 59 + oovbaapi/ooo/vba/word/XBorders.idl | 59 + oovbaapi/ooo/vba/word/XDialog.idl | 55 + oovbaapi/ooo/vba/word/XDialogs.idl | 54 + oovbaapi/ooo/vba/word/XDocument.idl | 75 ++ oovbaapi/ooo/vba/word/XDocuments.idl | 58 + oovbaapi/ooo/vba/word/XField.idl | 52 + oovbaapi/ooo/vba/word/XFields.idl | 62 + oovbaapi/ooo/vba/word/XFind.idl | 87 ++ oovbaapi/ooo/vba/word/XFont.idl | 58 + oovbaapi/ooo/vba/word/XGlobals.idl | 62 + oovbaapi/ooo/vba/word/XHeaderFooter.idl | 59 + oovbaapi/ooo/vba/word/XOptions.idl | 68 + oovbaapi/ooo/vba/word/XPageSetup.idl | 63 + oovbaapi/ooo/vba/word/XPane.idl | 55 + oovbaapi/ooo/vba/word/XPanes.idl | 55 + oovbaapi/ooo/vba/word/XParagraph.idl | 55 + oovbaapi/ooo/vba/word/XParagraphFormat.idl | 70 + oovbaapi/ooo/vba/word/XParagraphs.idl | 55 + oovbaapi/ooo/vba/word/XRange.idl | 78 ++ oovbaapi/ooo/vba/word/XReplacement.idl | 54 + oovbaapi/ooo/vba/word/XSection.idl | 58 + oovbaapi/ooo/vba/word/XSections.idl | 57 + oovbaapi/ooo/vba/word/XSelection.idl | 89 ++ oovbaapi/ooo/vba/word/XStyle.idl | 58 + oovbaapi/ooo/vba/word/XStyles.idl | 55 + oovbaapi/ooo/vba/word/XSystem.idl | 56 + oovbaapi/ooo/vba/word/XTable.idl | 86 ++ oovbaapi/ooo/vba/word/XTables.idl | 79 ++ oovbaapi/ooo/vba/word/XTemplate.idl | 56 + oovbaapi/ooo/vba/word/XVariable.idl | 60 + oovbaapi/ooo/vba/word/XVariables.idl | 57 + oovbaapi/ooo/vba/word/XView.idl | 57 + oovbaapi/ooo/vba/word/XWindow.idl | 62 + oovbaapi/ooo/vba/word/XWrapFormat.idl | 48 + oovbaapi/ooo/vba/word/makefile.mk | 90 ++ svx/inc/svx/msvbahelper.hxx | 58 + svx/source/msfilter/msvbahelper.cxx | 383 ++++++ vbahelper/inc/vbahelper/helperdecl.hxx | 58 + .../inc/vbahelper/vbaapplicationbase.hxx | 64 + vbahelper/inc/vbahelper/vbacollectionimpl.hxx | 257 ++++ vbahelper/inc/vbahelper/vbadialogbase.hxx | 54 + vbahelper/inc/vbahelper/vbadialogsbase.hxx | 54 + vbahelper/inc/vbahelper/vbadllapi.h | 44 + vbahelper/inc/vbahelper/vbadocumentbase.hxx | 73 + vbahelper/inc/vbahelper/vbadocumentsbase.hxx | 69 + vbahelper/inc/vbahelper/vbafontbase.hxx | 99 ++ vbahelper/inc/vbahelper/vbaglobalbase.hxx | 53 + vbahelper/inc/vbahelper/vbahelper.hxx | 231 ++++ vbahelper/inc/vbahelper/vbahelper.hxx.orig | 228 ++++ .../inc/vbahelper/vbahelperinterface.hxx | 121 ++ vbahelper/inc/vbahelper/vbapagesetupbase.hxx | 70 + vbahelper/inc/vbahelper/vbapropvalue.hxx | 60 + vbahelper/inc/vbahelper/vbashape.hxx | 118 ++ vbahelper/inc/vbahelper/vbashaperange.hxx | 89 ++ vbahelper/inc/vbahelper/vbashapes.hxx | 84 ++ vbahelper/inc/vbahelper/vbatextframe.hxx | 70 + vbahelper/inc/vbahelper/vbawindowbase.hxx | 66 + vbahelper/prj/build.lst | 6 + vbahelper/prj/d.lst | 27 + vbahelper/source/msforms/makefile.mk | 78 ++ vbahelper/source/msforms/service.cxx | 83 ++ vbahelper/source/msforms/vbabutton.cxx | 74 + vbahelper/source/msforms/vbabutton.hxx | 51 + vbahelper/source/msforms/vbacheckbox.cxx | 112 ++ vbahelper/source/msforms/vbacheckbox.hxx | 61 + vbahelper/source/msforms/vbacombobox.cxx | 183 +++ vbahelper/source/msforms/vbacombobox.hxx | 80 ++ vbahelper/source/msforms/vbacontrol.cxx | 536 ++++++++ vbahelper/source/msforms/vbacontrol.cxx.orig | 520 +++++++ vbahelper/source/msforms/vbacontrol.hxx | 114 ++ vbahelper/source/msforms/vbacontrols.cxx | 232 ++++ vbahelper/source/msforms/vbacontrols.hxx | 62 + vbahelper/source/msforms/vbaframe.cxx | 93 ++ vbahelper/source/msforms/vbaframe.hxx | 58 + vbahelper/source/msforms/vbaimage.cxx | 59 + vbahelper/source/msforms/vbaimage.hxx | 48 + vbahelper/source/msforms/vbalabel.cxx | 88 ++ vbahelper/source/msforms/vbalabel.hxx | 56 + vbahelper/source/msforms/vbalistbox.cxx | 290 ++++ vbahelper/source/msforms/vbalistbox.hxx | 90 ++ .../source/msforms/vbalistcontrolhelper.cxx | 146 ++ .../source/msforms/vbalistcontrolhelper.hxx | 20 + vbahelper/source/msforms/vbamultipage.cxx | 132 ++ vbahelper/source/msforms/vbamultipage.hxx | 65 + vbahelper/source/msforms/vbapages.cxx | 80 ++ vbahelper/source/msforms/vbapages.hxx | 64 + vbahelper/source/msforms/vbaprogressbar.cxx | 78 ++ vbahelper/source/msforms/vbaprogressbar.hxx | 59 + vbahelper/source/msforms/vbaradiobutton.cxx | 107 ++ vbahelper/source/msforms/vbaradiobutton.hxx | 55 + vbahelper/source/msforms/vbascrollbar.cxx | 139 ++ vbahelper/source/msforms/vbascrollbar.hxx | 66 + vbahelper/source/msforms/vbaspinbutton.cxx | 109 ++ vbahelper/source/msforms/vbaspinbutton.hxx | 61 + vbahelper/source/msforms/vbatextbox.cxx | 137 ++ vbahelper/source/msforms/vbatextbox.hxx | 59 + vbahelper/source/msforms/vbatogglebutton.cxx | 108 ++ vbahelper/source/msforms/vbatogglebutton.hxx | 63 + vbahelper/source/msforms/vbauserform.cxx | 227 ++++ vbahelper/source/msforms/vbauserform.hxx | 77 ++ vbahelper/source/vbahelper/makefile.mk | 80 ++ .../source/vbahelper/vbaapplicationbase.cxx | 218 +++ vbahelper/source/vbahelper/vbacolorformat.cxx | 190 +++ vbahelper/source/vbahelper/vbacolorformat.hxx | 128 ++ vbahelper/source/vbahelper/vbacommandbar.cxx | 212 +++ vbahelper/source/vbahelper/vbacommandbar.hxx | 83 ++ .../source/vbahelper/vbacommandbarcontrol.cxx | 259 ++++ .../source/vbahelper/vbacommandbarcontrol.hxx | 122 ++ .../vbahelper/vbacommandbarcontrols.cxx | 256 ++++ .../vbahelper/vbacommandbarcontrols.hxx | 75 ++ .../source/vbahelper/vbacommandbarhelper.cxx | 282 ++++ .../source/vbahelper/vbacommandbarhelper.hxx | 110 ++ vbahelper/source/vbahelper/vbacommandbars.cxx | 238 ++++ vbahelper/source/vbahelper/vbacommandbars.hxx | 71 + vbahelper/source/vbahelper/vbadialogbase.cxx | 51 + vbahelper/source/vbahelper/vbadialogsbase.cxx | 47 + .../source/vbahelper/vbadocumentbase.cxx | 228 ++++ .../source/vbahelper/vbadocumentsbase.cxx | 305 +++++ vbahelper/source/vbahelper/vbafillformat.cxx | 202 +++ vbahelper/source/vbahelper/vbafillformat.hxx | 74 + vbahelper/source/vbahelper/vbafontbase.cxx | 309 +++++ vbahelper/source/vbahelper/vbaglobalbase.cxx | 126 ++ vbahelper/source/vbahelper/vbahelper.cxx | 1200 +++++++++++++++++ vbahelper/source/vbahelper/vbahelper.cxx.orig | 1128 ++++++++++++++++ vbahelper/source/vbahelper/vbahelper.cxx.rej | 45 + vbahelper/source/vbahelper/vbalineformat.cxx | 458 +++++++ vbahelper/source/vbahelper/vbalineformat.hxx | 85 ++ .../source/vbahelper/vbapagesetupbase.cxx | 325 +++++ .../source/vbahelper/vbapictureformat.cxx | 147 ++ .../source/vbahelper/vbapictureformat.hxx | 64 + vbahelper/source/vbahelper/vbapropvalue.cxx | 48 + vbahelper/source/vbahelper/vbashape.cxx | 676 ++++++++++ vbahelper/source/vbahelper/vbashaperange.cxx | 382 ++++++ vbahelper/source/vbahelper/vbashapes.cxx | 491 +++++++ vbahelper/source/vbahelper/vbatextframe.cxx | 169 +++ vbahelper/source/vbahelper/vbawindowbase.cxx | 180 +++ vbahelper/util/makefile.mk | 104 ++ vbahelper/util/msforms.map | 9 + 167 files changed, 20347 insertions(+), 26 deletions(-) create mode 100644 oovbaapi/ooo/vba/ControlProvider.idl create mode 100644 oovbaapi/ooo/vba/XApplicationBase.idl create mode 100644 oovbaapi/ooo/vba/XCommandBarButton.idl create mode 100644 oovbaapi/ooo/vba/XCommandBarPopup.idl rename oovbaapi/ooo/vba/{XGlobals.idl => XControlProvider.idl} (61%) create mode 100644 oovbaapi/ooo/vba/XDialogBase.idl create mode 100644 oovbaapi/ooo/vba/XDialogsBase.idl create mode 100644 oovbaapi/ooo/vba/XDocumentBase.idl create mode 100644 oovbaapi/ooo/vba/XDocumentProperties.idl create mode 100644 oovbaapi/ooo/vba/XDocumentProperty.idl create mode 100644 oovbaapi/ooo/vba/XDocumentsBase.idl create mode 100644 oovbaapi/ooo/vba/XFontBase.idl create mode 100644 oovbaapi/ooo/vba/XGlobalsBase.idl create mode 100644 oovbaapi/ooo/vba/XPageSetupBase.idl create mode 100644 oovbaapi/ooo/vba/XWindowBase.idl rename oovbaapi/ooo/vba/{ => excel}/Globals.idl (86%) create mode 100644 oovbaapi/ooo/vba/excel/TextFrame.idl create mode 100644 oovbaapi/ooo/vba/excel/XGlobals.idl create mode 100644 oovbaapi/ooo/vba/excel/XVPageBreak.idl create mode 100644 oovbaapi/ooo/vba/excel/XVPageBreaks.idl create mode 100644 oovbaapi/ooo/vba/msforms/XTextFrame.idl create mode 100644 oovbaapi/ooo/vba/word/XAddin.idl create mode 100644 oovbaapi/ooo/vba/word/XAddins.idl create mode 100644 oovbaapi/ooo/vba/word/XApplication.idl create mode 100644 oovbaapi/ooo/vba/word/XAutoTextEntries.idl create mode 100644 oovbaapi/ooo/vba/word/XAutoTextEntry.idl create mode 100644 oovbaapi/ooo/vba/word/XBookmark.idl create mode 100644 oovbaapi/ooo/vba/word/XBookmarks.idl create mode 100644 oovbaapi/ooo/vba/word/XBorder.idl create mode 100644 oovbaapi/ooo/vba/word/XBorders.idl create mode 100644 oovbaapi/ooo/vba/word/XDialog.idl create mode 100644 oovbaapi/ooo/vba/word/XDialogs.idl create mode 100644 oovbaapi/ooo/vba/word/XDocument.idl create mode 100644 oovbaapi/ooo/vba/word/XDocuments.idl create mode 100644 oovbaapi/ooo/vba/word/XField.idl create mode 100644 oovbaapi/ooo/vba/word/XFields.idl create mode 100644 oovbaapi/ooo/vba/word/XFind.idl create mode 100644 oovbaapi/ooo/vba/word/XFont.idl create mode 100644 oovbaapi/ooo/vba/word/XGlobals.idl create mode 100644 oovbaapi/ooo/vba/word/XHeaderFooter.idl create mode 100644 oovbaapi/ooo/vba/word/XOptions.idl create mode 100644 oovbaapi/ooo/vba/word/XPageSetup.idl create mode 100644 oovbaapi/ooo/vba/word/XPane.idl create mode 100644 oovbaapi/ooo/vba/word/XPanes.idl create mode 100644 oovbaapi/ooo/vba/word/XParagraph.idl create mode 100644 oovbaapi/ooo/vba/word/XParagraphFormat.idl create mode 100644 oovbaapi/ooo/vba/word/XParagraphs.idl create mode 100644 oovbaapi/ooo/vba/word/XRange.idl create mode 100644 oovbaapi/ooo/vba/word/XReplacement.idl create mode 100644 oovbaapi/ooo/vba/word/XSection.idl create mode 100644 oovbaapi/ooo/vba/word/XSections.idl create mode 100644 oovbaapi/ooo/vba/word/XSelection.idl create mode 100644 oovbaapi/ooo/vba/word/XStyle.idl create mode 100644 oovbaapi/ooo/vba/word/XStyles.idl create mode 100644 oovbaapi/ooo/vba/word/XSystem.idl create mode 100644 oovbaapi/ooo/vba/word/XTable.idl create mode 100644 oovbaapi/ooo/vba/word/XTables.idl create mode 100644 oovbaapi/ooo/vba/word/XTemplate.idl create mode 100644 oovbaapi/ooo/vba/word/XVariable.idl create mode 100644 oovbaapi/ooo/vba/word/XVariables.idl create mode 100644 oovbaapi/ooo/vba/word/XView.idl create mode 100644 oovbaapi/ooo/vba/word/XWindow.idl create mode 100644 oovbaapi/ooo/vba/word/XWrapFormat.idl create mode 100644 oovbaapi/ooo/vba/word/makefile.mk create mode 100644 svx/inc/svx/msvbahelper.hxx create mode 100644 svx/source/msfilter/msvbahelper.cxx create mode 100644 vbahelper/inc/vbahelper/helperdecl.hxx create mode 100644 vbahelper/inc/vbahelper/vbaapplicationbase.hxx create mode 100644 vbahelper/inc/vbahelper/vbacollectionimpl.hxx create mode 100644 vbahelper/inc/vbahelper/vbadialogbase.hxx create mode 100644 vbahelper/inc/vbahelper/vbadialogsbase.hxx create mode 100644 vbahelper/inc/vbahelper/vbadllapi.h create mode 100644 vbahelper/inc/vbahelper/vbadocumentbase.hxx create mode 100644 vbahelper/inc/vbahelper/vbadocumentsbase.hxx create mode 100644 vbahelper/inc/vbahelper/vbafontbase.hxx create mode 100644 vbahelper/inc/vbahelper/vbaglobalbase.hxx create mode 100644 vbahelper/inc/vbahelper/vbahelper.hxx create mode 100644 vbahelper/inc/vbahelper/vbahelper.hxx.orig create mode 100644 vbahelper/inc/vbahelper/vbahelperinterface.hxx create mode 100644 vbahelper/inc/vbahelper/vbapagesetupbase.hxx create mode 100644 vbahelper/inc/vbahelper/vbapropvalue.hxx create mode 100644 vbahelper/inc/vbahelper/vbashape.hxx create mode 100644 vbahelper/inc/vbahelper/vbashaperange.hxx create mode 100644 vbahelper/inc/vbahelper/vbashapes.hxx create mode 100644 vbahelper/inc/vbahelper/vbatextframe.hxx create mode 100644 vbahelper/inc/vbahelper/vbawindowbase.hxx create mode 100644 vbahelper/prj/build.lst create mode 100644 vbahelper/prj/d.lst create mode 100644 vbahelper/source/msforms/makefile.mk create mode 100644 vbahelper/source/msforms/service.cxx create mode 100644 vbahelper/source/msforms/vbabutton.cxx create mode 100644 vbahelper/source/msforms/vbabutton.hxx create mode 100644 vbahelper/source/msforms/vbacheckbox.cxx create mode 100644 vbahelper/source/msforms/vbacheckbox.hxx create mode 100644 vbahelper/source/msforms/vbacombobox.cxx create mode 100644 vbahelper/source/msforms/vbacombobox.hxx create mode 100644 vbahelper/source/msforms/vbacontrol.cxx create mode 100644 vbahelper/source/msforms/vbacontrol.cxx.orig create mode 100644 vbahelper/source/msforms/vbacontrol.hxx create mode 100644 vbahelper/source/msforms/vbacontrols.cxx create mode 100644 vbahelper/source/msforms/vbacontrols.hxx create mode 100644 vbahelper/source/msforms/vbaframe.cxx create mode 100644 vbahelper/source/msforms/vbaframe.hxx create mode 100644 vbahelper/source/msforms/vbaimage.cxx create mode 100644 vbahelper/source/msforms/vbaimage.hxx create mode 100644 vbahelper/source/msforms/vbalabel.cxx create mode 100644 vbahelper/source/msforms/vbalabel.hxx create mode 100644 vbahelper/source/msforms/vbalistbox.cxx create mode 100644 vbahelper/source/msforms/vbalistbox.hxx create mode 100644 vbahelper/source/msforms/vbalistcontrolhelper.cxx create mode 100644 vbahelper/source/msforms/vbalistcontrolhelper.hxx create mode 100644 vbahelper/source/msforms/vbamultipage.cxx create mode 100644 vbahelper/source/msforms/vbamultipage.hxx create mode 100644 vbahelper/source/msforms/vbapages.cxx create mode 100644 vbahelper/source/msforms/vbapages.hxx create mode 100644 vbahelper/source/msforms/vbaprogressbar.cxx create mode 100644 vbahelper/source/msforms/vbaprogressbar.hxx create mode 100644 vbahelper/source/msforms/vbaradiobutton.cxx create mode 100644 vbahelper/source/msforms/vbaradiobutton.hxx create mode 100644 vbahelper/source/msforms/vbascrollbar.cxx create mode 100644 vbahelper/source/msforms/vbascrollbar.hxx create mode 100644 vbahelper/source/msforms/vbaspinbutton.cxx create mode 100644 vbahelper/source/msforms/vbaspinbutton.hxx create mode 100644 vbahelper/source/msforms/vbatextbox.cxx create mode 100644 vbahelper/source/msforms/vbatextbox.hxx create mode 100644 vbahelper/source/msforms/vbatogglebutton.cxx create mode 100644 vbahelper/source/msforms/vbatogglebutton.hxx create mode 100644 vbahelper/source/msforms/vbauserform.cxx create mode 100644 vbahelper/source/msforms/vbauserform.hxx create mode 100644 vbahelper/source/vbahelper/makefile.mk create mode 100644 vbahelper/source/vbahelper/vbaapplicationbase.cxx create mode 100644 vbahelper/source/vbahelper/vbacolorformat.cxx create mode 100644 vbahelper/source/vbahelper/vbacolorformat.hxx create mode 100644 vbahelper/source/vbahelper/vbacommandbar.cxx create mode 100644 vbahelper/source/vbahelper/vbacommandbar.hxx create mode 100644 vbahelper/source/vbahelper/vbacommandbarcontrol.cxx create mode 100644 vbahelper/source/vbahelper/vbacommandbarcontrol.hxx create mode 100644 vbahelper/source/vbahelper/vbacommandbarcontrols.cxx create mode 100644 vbahelper/source/vbahelper/vbacommandbarcontrols.hxx create mode 100644 vbahelper/source/vbahelper/vbacommandbarhelper.cxx create mode 100644 vbahelper/source/vbahelper/vbacommandbarhelper.hxx create mode 100644 vbahelper/source/vbahelper/vbacommandbars.cxx create mode 100644 vbahelper/source/vbahelper/vbacommandbars.hxx create mode 100644 vbahelper/source/vbahelper/vbadialogbase.cxx create mode 100644 vbahelper/source/vbahelper/vbadialogsbase.cxx create mode 100644 vbahelper/source/vbahelper/vbadocumentbase.cxx create mode 100644 vbahelper/source/vbahelper/vbadocumentsbase.cxx create mode 100644 vbahelper/source/vbahelper/vbafillformat.cxx create mode 100644 vbahelper/source/vbahelper/vbafillformat.hxx create mode 100644 vbahelper/source/vbahelper/vbafontbase.cxx create mode 100644 vbahelper/source/vbahelper/vbaglobalbase.cxx create mode 100644 vbahelper/source/vbahelper/vbahelper.cxx create mode 100644 vbahelper/source/vbahelper/vbahelper.cxx.orig create mode 100644 vbahelper/source/vbahelper/vbahelper.cxx.rej create mode 100644 vbahelper/source/vbahelper/vbalineformat.cxx create mode 100644 vbahelper/source/vbahelper/vbalineformat.hxx create mode 100644 vbahelper/source/vbahelper/vbapagesetupbase.cxx create mode 100644 vbahelper/source/vbahelper/vbapictureformat.cxx create mode 100644 vbahelper/source/vbahelper/vbapictureformat.hxx create mode 100644 vbahelper/source/vbahelper/vbapropvalue.cxx create mode 100644 vbahelper/source/vbahelper/vbashape.cxx create mode 100644 vbahelper/source/vbahelper/vbashaperange.cxx create mode 100644 vbahelper/source/vbahelper/vbashapes.cxx create mode 100644 vbahelper/source/vbahelper/vbatextframe.cxx create mode 100644 vbahelper/source/vbahelper/vbawindowbase.cxx create mode 100644 vbahelper/util/makefile.mk create mode 100644 vbahelper/util/msforms.map diff --git a/oovbaapi/ooo/vba/ControlProvider.idl b/oovbaapi/ooo/vba/ControlProvider.idl new file mode 100644 index 000000000000..99743966d54e --- /dev/null +++ b/oovbaapi/ooo/vba/ControlProvider.idl @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XGlobals.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_ControlProvider_idl__ +#define __ooo_vba_ControlProvider_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __com_sun_star_frame_XModel_idl__ +#include +#endif + + +module ooo { module vba { + +interface XControlProvider; + +service ControlProvider +{ + interface ::ooo::vba::XControlProvider; +}; + +}; }; + +#endif + diff --git a/oovbaapi/ooo/vba/XApplicationBase.idl b/oovbaapi/ooo/vba/XApplicationBase.idl new file mode 100644 index 000000000000..229759cc6307 --- /dev/null +++ b/oovbaapi/ooo/vba/XApplicationBase.idl @@ -0,0 +1,66 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XApplicationBase_idl__ +#define __ooo_vba_XApplicationBase_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { +//============================================================================= + +interface XApplicationBase +{ + interface ::ooo::vba::XHelperInterface; + + [attribute] boolean ScreenUpdating; + [attribute] boolean DisplayStatusBar; + [attribute, readonly] string Version; + + void Quit(); + + any CommandBars( [in] any aIndex ); + void Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30); + float CentimetersToPoints([in] float Centimeters ); +}; + +}; }; + +#endif diff --git a/oovbaapi/ooo/vba/XCommandBarButton.idl b/oovbaapi/ooo/vba/XCommandBarButton.idl new file mode 100644 index 000000000000..56fc5d527f24 --- /dev/null +++ b/oovbaapi/ooo/vba/XCommandBarButton.idl @@ -0,0 +1,52 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XCommandBarButton_idl__ +#define __ooo_vba_XCommandBarButton_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif +//============================================================================= + +module ooo { module vba { +//============================================================================= + +interface XCommandBarButton: com::sun::star::uno::XInterface +{ +}; + +}; }; + +#endif diff --git a/oovbaapi/ooo/vba/XCommandBarPopup.idl b/oovbaapi/ooo/vba/XCommandBarPopup.idl new file mode 100644 index 000000000000..b91bc0e26dbd --- /dev/null +++ b/oovbaapi/ooo/vba/XCommandBarPopup.idl @@ -0,0 +1,52 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XCommandBarPopup_idl__ +#define __ooo_vba_XCommandBarPopup_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif +//============================================================================= + +module ooo { module vba { +//============================================================================= + +interface XCommandBarPopup: com::sun::star::uno::XInterface +{ +}; + +}; }; + +#endif diff --git a/oovbaapi/ooo/vba/XGlobals.idl b/oovbaapi/ooo/vba/XControlProvider.idl similarity index 61% rename from oovbaapi/ooo/vba/XGlobals.idl rename to oovbaapi/ooo/vba/XControlProvider.idl index 75d84f6cf89d..a2785022f8d8 100644 --- a/oovbaapi/ooo/vba/XGlobals.idl +++ b/oovbaapi/ooo/vba/XControlProvider.idl @@ -27,41 +27,38 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __ooo_vba_XGlobals_idl__ -#define __ooo_vba_XGlobals_idl__ +#ifndef __ooo_vba_XControlProvider_idl__ +#define __ooo_vba_XControlProvider_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include #endif -#ifndef __ooo_vba_excel_XApplication_idl__ -#include + +#ifndef __com_sun_star_frame_XModel_idl__ +#include #endif -#ifndef __ooo_vba_excel_XWorkbook_idl__ -#include + +#ifndef __com_sun_star_awt_XControl_idl__ +#include #endif -#ifndef __ooo_vba_excel_XWorksheet_idl__ -#include + +#ifndef __com_sun_star_drawing_XControlShape_idl__ +#include +#endif +#ifndef __ooo_vba_msforms_XControl_idl__ +#include #endif module ooo { module vba { -interface XGlobals: com::sun::star::uno::XInterface +interface XControlProvider { - // FIXME, need better way to expose globals - sequence< any > getGlobals(); + ::ooo::vba::msforms::XControl createControl( [in] ::com::sun::star::drawing::XControlShape xControl, [in] ::com::sun::star::frame::XModel xDocOwner ); + ::ooo::vba::msforms::XControl createUserformControl( [in] ::com::sun::star::awt::XControl xControl, [in] ::com::sun::star::awt::XControl xDialog, [in] ::com::sun::star::frame::XModel xDocOwner ); - [attribute, readonly] ooo::vba::excel::XApplication Application; - [attribute, readonly] ooo::vba::excel::XWorkbook ActiveWorkbook; - [attribute, readonly] ooo::vba::excel::XWorksheet ActiveSheet; - any WorkSheets( [in] any aIndex ); - any WorkBooks( [in] any aIndex ); - any Sheets( [in] any aIndex ); - any Range( [in] any Cell1, [in] any Cell2 ); - any Names( [in] any Index ); }; }; }; #endif - diff --git a/oovbaapi/ooo/vba/XDialogBase.idl b/oovbaapi/ooo/vba/XDialogBase.idl new file mode 100644 index 000000000000..7050892fe0b9 --- /dev/null +++ b/oovbaapi/ooo/vba/XDialogBase.idl @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XDialog.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_XDialog_idl__ +#define __ooo_vba_XDialog_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { + +//============================================================================= + +interface XDialogBase +{ + interface ::ooo::vba::XHelperInterface; + + void Show(); +}; + +}; }; + +#endif + diff --git a/oovbaapi/ooo/vba/XDialogsBase.idl b/oovbaapi/ooo/vba/XDialogsBase.idl new file mode 100644 index 000000000000..adc06ab58b09 --- /dev/null +++ b/oovbaapi/ooo/vba/XDialogsBase.idl @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XDialogs.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_XDialogs_idl__ +#define __ooo_vba_XDialogs_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +//============================================================================= + +module ooo { module vba { + +//interface XDialogs : ::ooo::vba::XCollection +interface XDialogsBase +{ + interface ::ooo::vba::XHelperInterface; + + [attribute, readonly] long Count; + any Item( [in] any Index ); +}; + +}; }; + +#endif + diff --git a/oovbaapi/ooo/vba/XDocumentBase.idl b/oovbaapi/ooo/vba/XDocumentBase.idl new file mode 100644 index 000000000000..efd4761ca10a --- /dev/null +++ b/oovbaapi/ooo/vba/XDocumentBase.idl @@ -0,0 +1,67 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XDocumentBase_idl__ +#define __ooo_vba_XDocumentBase_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { +//============================================================================= + +interface XDocumentBase +{ + interface ::ooo::vba::XHelperInterface; + + [attribute, readonly] string Name; + [attribute, readonly] string Path; + [attribute, readonly] string FullName; + [attribute] boolean Saved; + + void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook); + void Save(); + void Activate(); + void Protect( [in] any Password ); + void Unprotect( [in] any Password ); +}; + +}; }; + +#endif diff --git a/oovbaapi/ooo/vba/XDocumentProperties.idl b/oovbaapi/ooo/vba/XDocumentProperties.idl new file mode 100644 index 000000000000..c652fb95b9e8 --- /dev/null +++ b/oovbaapi/ooo/vba/XDocumentProperties.idl @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XDocument.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __ooo_vba_XDocumentProperties_idl__ +#define __ooo_vba_XDocumentProperties_idl__ + +#ifndef __com_sun_star_script_BasicErrorException_idl__ +#include +#endif +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + +module ooo { module vba { +interface XDocumentProperty; +interface XDocumentProperties +{ + interface XCollection; + /** Creates a new custom document property. + * You can only add a new document property to the custom DocumentProperties collection. Depending on value of + * boolean LinkSource, either (False) Value or (True) LinkSource must be provided. + * @param Name (Required String. The name of the property. + * @param LinkToContent Specifies whether the property is linked to the contents of the container document. If this argument is True, the LinkSource argument is required; if it's False, the value argument is required. + * @param Type The data type of the property. Can be one of the following MsoDocProperties constants: + * msoPropertyTypeBoolean, msoPropertyTypeDate, msoPropertyTypeFloat, msoPropertyTypeNumber, or msoPropertyTypeString. + * @param Value The value of the property, if it's not linked to the contents of the container document. + * The value is converted to match the data type specified by the type argument, if it can't be converted, an error occurs. + * If LinkToContent is True, the Value argument is ignored and the new document property is assigned a default value + * until the linked property values are updated by the container application (usually when the document is saved). + * @param LinkSource Ignored if LinkToContent is False. The source of the linked property. The container application determines + * what types of source linking you can use. + */ + XDocumentProperty Add([in] string Name, [in] boolean LinkToContent, [in] /* MsoDocProperties */ byte Type, [in] any Value, + [in] /*optional*/ any LinkSource) + raises (com::sun::star::script::BasicErrorException); +}; + +}; }; + +#endif + diff --git a/oovbaapi/ooo/vba/XDocumentProperty.idl b/oovbaapi/ooo/vba/XDocumentProperty.idl new file mode 100644 index 000000000000..efc1d1773978 --- /dev/null +++ b/oovbaapi/ooo/vba/XDocumentProperty.idl @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XDocument.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __ooo_vba_XDocumentProperty_idl__ +#define __ooo_vba_XDocumentProperty_idl__ + +#ifndef __com_sun_star_script_BasicErrorException_idl__ +#include +#endif +#ifndef __com_sun_star_script_XDefaultProperty_idl__ +#include +#endif +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { + +/** + * Specific built-in document property. Use CustomDocumentProperties(index), + * where index is the name or index number of the custom document property, + * to return a DocumentProperty object that represents a specific custom document property. + */ +interface XDocumentProperty +{ + + interface com::sun::star::script::XDefaultProperty; + interface ooo::vba::XHelperInterface; + + void Delete() + raises (com::sun::star::script::BasicErrorException); + + /** Required String. The name of the property. + */ + string getName() + raises (com::sun::star::script::BasicErrorException); + + void setName([in] string Name) + raises (com::sun::star::script::BasicErrorException); + + /** The data type of the property. + * Can be one of the following MsoDocProperties constants: + * msoPropertyTypeBoolean, msoPropertyTypeDate, msoPropertyTypeFloat, + * msoPropertyTypeNumber, or msoPropertyTypeString. + */ + byte getType() + raises (com::sun::star::script::BasicErrorException); + + void setType([in] byte Type) + raises (com::sun::star::script::BasicErrorException); + + /** If true, then LinkSource has a valid value. */ + boolean getLinkToContent() + raises (com::sun::star::script::BasicErrorException); + + void setLinkToContent([in] boolean LinkToContent) + raises (com::sun::star::script::BasicErrorException); + + /** If LinkToContent is false, then this contains the value of the property + * The data type of the value will match the Type property. + */ + any getValue() + raises (com::sun::star::script::BasicErrorException); + + void setValue([in] any Value) + raises (com::sun::star::script::BasicErrorException); + + /** If LinkToContent is false, then this contains the value of the property */ + string getLinkSource() + raises (com::sun::star::script::BasicErrorException); + + void setLinkSource([in] string LinkSource) + raises (com::sun::star::script::BasicErrorException); +}; + +}; }; + +#endif + diff --git a/oovbaapi/ooo/vba/XDocumentsBase.idl b/oovbaapi/ooo/vba/XDocumentsBase.idl new file mode 100644 index 000000000000..866e9b753a2e --- /dev/null +++ b/oovbaapi/ooo/vba/XDocumentsBase.idl @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XDocumentsBase.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_XDocumentsBase_idl__ +#define __ooo_vba_XDocumentsBase_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { + +//============================================================================= + +interface XDocumentsBase +{ + interface ::ooo::vba::XCollection; +}; + +}; }; + +#endif diff --git a/oovbaapi/ooo/vba/XFontBase.idl b/oovbaapi/ooo/vba/XFontBase.idl new file mode 100644 index 000000000000..2f21018682f0 --- /dev/null +++ b/oovbaapi/ooo/vba/XFontBase.idl @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XFont.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_XFont_idl__ +#define __ooo_vba_XFont_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif +#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +//============================================================================= + +module ooo { module vba { + +interface XFontBase +{ + interface ::ooo::vba::XHelperInterface; + + [attribute] any Size; + [attribute] any ColorIndex; + [attribute] any Color; + [attribute] any Bold; + [attribute] any Underline; + [attribute] any Strikethrough; + [attribute] any Shadow; + [attribute] any Italic; + [attribute] any Subscript; + [attribute] any Superscript; + [attribute] any Name; +}; + +//============================================================================= + +}; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/XGlobalsBase.idl b/oovbaapi/ooo/vba/XGlobalsBase.idl new file mode 100644 index 000000000000..158776afc9d9 --- /dev/null +++ b/oovbaapi/ooo/vba/XGlobalsBase.idl @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XGlobals.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_XGlobalsBase_idl__ +#define __ooo_vba_XGlobalsBase_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif +#ifndef __com_sun_star_lang_XMultiServiceFactory +#include +#endif +module ooo { module vba { +interface XGlobalsBase +{ + interface ::ooo::vba::XHelperInterface; + interface ::com::sun::star::lang::XMultiServiceFactory; +}; + +}; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/XPageSetupBase.idl b/oovbaapi/ooo/vba/XPageSetupBase.idl new file mode 100644 index 000000000000..3d9189abef3d --- /dev/null +++ b/oovbaapi/ooo/vba/XPageSetupBase.idl @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_XPageSetupBase_idl__ +#define __ooo_vba_XPageSetupBase_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +//============================================================================= + +module ooo { module vba { + +//============================================================================= + + +interface XPageSetupBase +{ + + interface ::ooo::vba::XHelperInterface; + + //Attributes + [attribute] double TopMargin; + [attribute] double BottomMargin; + [attribute] double RightMargin; + [attribute] double LeftMargin; + [attribute] long Orientation; +}; + +//============================================================================= + +}; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/XWindowBase.idl b/oovbaapi/ooo/vba/XWindowBase.idl new file mode 100644 index 000000000000..b17b9cf82b1f --- /dev/null +++ b/oovbaapi/ooo/vba/XWindowBase.idl @@ -0,0 +1,62 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XHelperWindow_idl__ +#define __ooo_vba_XHelperWindow_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { +//============================================================================= + +interface XWindowBase +{ + interface ::ooo::vba::XHelperInterface; + + [attribute] long Height; + [attribute] long Left; + [attribute] long Top; + [attribute] boolean Visible; + [attribute] long Width; +}; + +}; }; + +#endif diff --git a/oovbaapi/ooo/vba/Globals.idl b/oovbaapi/ooo/vba/excel/Globals.idl similarity index 86% rename from oovbaapi/ooo/vba/Globals.idl rename to oovbaapi/ooo/vba/excel/Globals.idl index e2ed5e3749da..49315f113087 100644 --- a/oovbaapi/ooo/vba/Globals.idl +++ b/oovbaapi/ooo/vba/excel/Globals.idl @@ -28,21 +28,21 @@ * ************************************************************************/ -#ifndef __ooo_vba_Globals_idl__ -#define __ooo_vba_Globals_idl__ +#ifndef __ooo_vba_excel_Globals_idl__ +#define __ooo_vba_excel_Globals_idl__ -#ifndef __ooo_vba_XGlobals_idl__ -#include +#ifndef __ooo_vba_excel_XGlobals_idl__ +#include #endif #include #include -module ooo { module vba { +module ooo { module vba { module excel { service Globals : XGlobals { }; -}; }; +}; }; }; #endif diff --git a/oovbaapi/ooo/vba/excel/TextFrame.idl b/oovbaapi/ooo/vba/excel/TextFrame.idl new file mode 100644 index 000000000000..2b6b5cd31ff4 --- /dev/null +++ b/oovbaapi/ooo/vba/excel/TextFrame.idl @@ -0,0 +1,53 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef __ooo_vba_excel_TextFrame_idl__ +#define __ooo_vba_excel_TextFrame_idl__ + +#ifndef __ooo_vba_excel_XTextFrame_idl__ +#include +#endif + +#include + +module ooo { module vba { module excel { +service TextFrame : XTextFrame +{ + //createTextFrame( [in] ::ooo::vba::XHelperInterface Parent, [in] ::com::sun::star::frame::XModel xModel ); +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/excel/XGlobals.idl b/oovbaapi/ooo/vba/excel/XGlobals.idl new file mode 100644 index 000000000000..200bd973d847 --- /dev/null +++ b/oovbaapi/ooo/vba/excel/XGlobals.idl @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XGlobals.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_excel_XGlobals_idl__ +#define __ooo_vba_excel_XGlobals_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif +#ifndef __com_sun_star_script_BasicErrorException_idl__ +#include +#endif +#ifndef __ooo_vba_excel_XWorkbook_idl__ +#include +#endif +#ifndef __ooo_vba_excel_XWorksheet_idl__ +#include +#endif +#ifndef __ooo_vba_XAssistant_idl__ +#include +#endif + +module ooo { module vba { module excel { +interface XRange; +interface XWindow; +interface XGlobals: com::sun::star::uno::XInterface +{ + [attribute, readonly] ooo::vba::excel::XWorkbook ActiveWorkbook; + [attribute, readonly] ooo::vba::excel::XWorksheet ActiveSheet; + [attribute, readonly] ooo::vba::excel::XWindow ActiveWindow; + [attribute, readonly] ooo::vba::excel::XRange ActiveCell; + [attribute, readonly] ooo::vba::XAssistant Assistant; + [attribute, readonly] any Selection; + [attribute, readonly] XWorkbook ThisWorkbook; + + void Calculate() raises(com::sun::star::script::BasicErrorException); + XRange Cells([in] any RowIndex, [in] any ColumnIndex); + XRange Columns([in] any aIndex); + any CommandBars( [in] any aIndex ); + any Evaluate( [in] string Name ); +XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30) + raises(com::sun::star::script::BasicErrorException); + any WorkSheets( [in] any aIndex ); + any WorkBooks( [in] any aIndex ); + any WorksheetFunction(); + any Windows( [in] any aIndex ); + any Sheets( [in] any aIndex ); + any Range( [in] any Cell1, [in] any Cell2 ); + XRange Rows([in] any aIndex); + any Names( [in] any Index ); + XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30) + raises(com::sun::star::script::BasicErrorException); + +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/excel/XVPageBreak.idl b/oovbaapi/ooo/vba/excel/XVPageBreak.idl new file mode 100644 index 000000000000..0802015f7844 --- /dev/null +++ b/oovbaapi/ooo/vba/excel/XVPageBreak.idl @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XVPageBreak.idl,v $ + * $Revision: 1.0 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_excel_XVPageBreak_idl__ +#define __ooo_vba_excel_XVPageBreak_idl__ + +#ifndef __ooo_vba_excel_XPageBreak_idl__ +#include +#endif + +//============================================================================= + +module ooo { module vba { module excel { + +//============================================================================= + +interface XVPageBreak +{ + interface ::ooo::vba::excel::XPageBreak; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/excel/XVPageBreaks.idl b/oovbaapi/ooo/vba/excel/XVPageBreaks.idl new file mode 100644 index 000000000000..279401c59356 --- /dev/null +++ b/oovbaapi/ooo/vba/excel/XVPageBreaks.idl @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XVPageBreaks.idl,v $ + * $Revision: 1.0 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_excel_XVPageBreaks_idl__ +#define __ooo_vba_excel_XVPageBreaks_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +#ifndef __com_sun_star_helper_script_BasicErrorException_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + +//============================================================================= + +module ooo { module vba { module excel { + +//============================================================================= + +//interface XVPageBreak; + +interface XVPageBreaks +{ + interface ooo::vba::XCollection; + + //Methods + any Add( [in] any Before ) raises( com::sun::star::script::BasicErrorException ); +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/msforms/XTextFrame.idl b/oovbaapi/ooo/vba/msforms/XTextFrame.idl new file mode 100644 index 000000000000..0015e0cc30f8 --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XTextFrame.idl @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XTextFrame.idl,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XTextFrame_idl__ +#define __ooo_vba_msforms_XTextFrame_idl__ + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module msforms { +interface XTextFrame : ooo::vba::XHelperInterface +{ + [attribute] boolean AutoSize; + [attribute] float MarginBottom; + [attribute] float MarginTop; + [attribute] float MarginLeft; + [attribute] float MarginRight; + any Characters(); + /*I don't find it in msdn + Range TextRange();*/ +}; +}; }; }; +#endif diff --git a/oovbaapi/ooo/vba/word/XAddin.idl b/oovbaapi/ooo/vba/word/XAddin.idl new file mode 100644 index 000000000000..0c3f21073873 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XAddin.idl @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XAddin_idl__ +#define __ooo_vba_word_XAddin_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +#ifndef __com_sun_star_container_XNamed_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XAddin +{ + interface ooo::vba::XHelperInterface; + interface ::com::sun::star::container::XNamed; + + [attribute, readonly] string Path; + [attribute, readonly] boolean Autoload; + [attribute] boolean Installed; +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XAddins.idl b/oovbaapi/ooo/vba/word/XAddins.idl new file mode 100644 index 000000000000..405fecbcdedf --- /dev/null +++ b/oovbaapi/ooo/vba/word/XAddins.idl @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XAddins_idl__ +#define __ooo_vba_word_XAddins_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XAddins +{ + interface ::ooo::vba::XCollection; +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/word/XApplication.idl b/oovbaapi/ooo/vba/word/XApplication.idl new file mode 100644 index 000000000000..8a48c30995c1 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XApplication.idl @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XApplication.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XApplication_idl__ +#define __ooo_vba_word_XApplication_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XDocument; +interface XWindow; +interface XSystem; +interface XOptions; +interface XSelection; +interface XApplication : com::sun::star::uno::XInterface +{ + [attribute, readonly] XDocument ActiveDocument; + [attribute, readonly] XWindow ActiveWindow; + [attribute, readonly] string Name; + [attribute, readonly] ooo::vba::word::XSystem System; + [attribute, readonly] ooo::vba::word::XOptions Options; + [attribute, readonly] ooo::vba::word::XSelection Selection; + [attribute] boolean DisplayAutoCompleteTips; + [attribute] long EnableCancelKey; + + any CommandBars( [in] any aIndex ); + any Documents( [in] any aIndex ); + any Addins( [in] any aIndex ); + any Dialogs( [in] any aIndex ); + float CentimetersToPoints([in] float Centimeters ); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XAutoTextEntries.idl b/oovbaapi/ooo/vba/word/XAutoTextEntries.idl new file mode 100644 index 000000000000..9491deffced8 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XAutoTextEntries.idl @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XAutoTextEntries_idl__ +#define __ooo_vba_word_XAutoTextEntries_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XAutoTextEntries +{ + interface ::ooo::vba::XCollection; +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/word/XAutoTextEntry.idl b/oovbaapi/ooo/vba/word/XAutoTextEntry.idl new file mode 100644 index 000000000000..d6e963c2daf9 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XAutoTextEntry.idl @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XAutoTextEntry_idl__ +#define __ooo_vba_word_XAutoTextEntry_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +#ifndef __com_sun_star_container_XNamed_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XRange; +interface XAutoTextEntry +{ + interface ooo::vba::XHelperInterface; + + XRange Insert([in] XRange Where, [in] /*Optional*/ any RichText); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XBookmark.idl b/oovbaapi/ooo/vba/word/XBookmark.idl new file mode 100644 index 000000000000..f22782eafe33 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XBookmark.idl @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XBookmark_idl__ +#define __ooo_vba_word_XBookmark_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +#ifndef __com_sun_star_container_XNamed_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XBookmark +{ + interface ooo::vba::XHelperInterface; + interface ::com::sun::star::container::XNamed; + + void Delete(); + void Select(); + any Range(); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XBookmarks.idl b/oovbaapi/ooo/vba/word/XBookmarks.idl new file mode 100644 index 000000000000..3ab1f5efae08 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XBookmarks.idl @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XBookmarks_idl__ +#define __ooo_vba_word_XBookmarks_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XBookmarks +{ + interface ::ooo::vba::XCollection; + + [attribute] long DefaultSorting; + [attribute] boolean ShowHidden; + + any Add( [in] string Name, [in] any Range ); + boolean Exists( [in] string Name ); +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/word/XBorder.idl b/oovbaapi/ooo/vba/word/XBorder.idl new file mode 100644 index 000000000000..5e562758fb58 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XBorder.idl @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XBorder.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XBorder_idl__ +#define __ooo_vba_word_XBorder_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif +//============================================================================= + +module ooo { module vba { module word { + + +//============================================================================= +interface XBorder +{ + interface ::ooo::vba::XHelperInterface; + + [attribute] any LineStyle; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XBorders.idl b/oovbaapi/ooo/vba/word/XBorders.idl new file mode 100644 index 000000000000..1e7da6ab1b80 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XBorders.idl @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XBorders.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XBorders_idl__ +#define __ooo_vba_word_XBorders_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= +interface XBorders +{ + interface ooo::vba::XCollection; + + [attribute] boolean Shadow; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XDialog.idl b/oovbaapi/ooo/vba/word/XDialog.idl new file mode 100644 index 000000000000..3cabc5863d83 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XDialog.idl @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XDialog.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XDialog_idl__ +#define __ooo_vba_word_XDialog_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XDialog : com::sun::star::uno::XInterface +{ +}; + +}; }; }; + +#endif + diff --git a/oovbaapi/ooo/vba/word/XDialogs.idl b/oovbaapi/ooo/vba/word/XDialogs.idl new file mode 100644 index 000000000000..8f84a6e1e382 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XDialogs.idl @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XDialogs.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XDialogs_idl__ +#define __ooo_vba_word_XDialogs_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +//============================================================================= + +module ooo { module vba { module word { + +interface XDialogs : com::sun::star::uno::XInterface +{ + + any Item( [in] any Index ); +}; + +}; }; }; + +#endif + diff --git a/oovbaapi/ooo/vba/word/XDocument.idl b/oovbaapi/ooo/vba/word/XDocument.idl new file mode 100644 index 000000000000..169cb3bc8e2a --- /dev/null +++ b/oovbaapi/ooo/vba/word/XDocument.idl @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XDocument.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XDocument_idl__ +#define __ooo_vba_word_XDocument_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_word_XRange_idl__ +#include +#endif + +#ifndef __com_sun_star_script_XInvocation_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XDocument : com::sun::star::script::XInvocation +{ + [attribute, readonly] XRange Content; + [attribute] any AttachedTemplate; + + XRange Range( [in] any Start, [in] any End ); + any BuiltInDocumentProperties( [in] any index ); + any CustomDocumentProperties( [in] any index ); + any Bookmarks( [in] any aIndex ); + any Variables( [in] any aIndex ); + any Paragraphs( [in] any aIndex ); + any Styles( [in] any aIndex ); + any Tables( [in] any aIndex ); + any Fields( [in] any aIndex ); + any Shapes([in] any Index); + any Sections([in] any Index); + void Activate(); + any PageSetup(); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XDocuments.idl b/oovbaapi/ooo/vba/word/XDocuments.idl new file mode 100644 index 000000000000..476209cf9318 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XDocuments.idl @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XDocuments_idl__ +#define __ooo_vba_word_XDocuments_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XDocuments : com::sun::star::uno::XInterface +{ + any Add([in] any Template, [in] any NewTemplate, [in] any DocumentType, [in] any Visible); + any Open([in] string Filename, [in] any ConfirmConversions, [in] any ReadOnly, [in] any AddToRecentFiles, [in] any PasswordDocument, [in] any PasswordTemplate, [in] any Revert, [in] any WritePasswordDocument, [in] any WritePasswordTemplate, [in] any Format, [in] any Encoding, [in] any Visible, [in] any OpenAndRepair, [in] any DocumentDirection, [in] any NoEncodingDialog, [in] any XMLTransform); + + void Close([in] any SaveChanges,[in] any OriginalFormat,[in] any RouteDocument); +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/word/XField.idl b/oovbaapi/ooo/vba/word/XField.idl new file mode 100644 index 000000000000..d475581f08ca --- /dev/null +++ b/oovbaapi/ooo/vba/word/XField.idl @@ -0,0 +1,52 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XField.idl,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2007/02/09 08:35:01 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef __ooo_vba_word_XField_idl__ +#define __ooo_vba_word_XField_idl__ + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif +module ooo { module vba { module word { + +interface XField +{ + interface ::ooo::vba::XHelperInterface; +}; + +}; }; }; + +#endif + diff --git a/oovbaapi/ooo/vba/word/XFields.idl b/oovbaapi/ooo/vba/word/XFields.idl new file mode 100644 index 000000000000..78266ace3fd7 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XFields.idl @@ -0,0 +1,62 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XFields.idl,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2007/02/09 08:45:13 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef __ooo_vba_word__XFields_idl__ +#define __ooo_vba_word__XFields_idl__ + +#ifndef __ooo_vba_HelperInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XRange; +interface XField; +interface XFields +{ + interface ooo::vba::XCollection; + + XField Add([in] XRange Range, [in] any Type, [in] any Text,[in] any PreserveFormatting); + long Update(); +}; + +}; }; }; + +#endif + diff --git a/oovbaapi/ooo/vba/word/XFind.idl b/oovbaapi/ooo/vba/word/XFind.idl new file mode 100644 index 000000000000..c386683e6931 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XFind.idl @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XFind_idl__ +#define __ooo_vba_word_XFind_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XFind +{ + interface ooo::vba::XHelperInterface; + + [attribute] string Text; + [attribute] any Replacement; + [attribute] boolean Forward; + [attribute] long Wrap; + [attribute] boolean Format; + [attribute] boolean MatchCase; + [attribute] boolean MatchWholeWord; + [attribute] boolean MatchWildcards; + [attribute] boolean MatchSoundsLike; + [attribute] boolean MatchAllWordForms; + [attribute] any Style; + + boolean Execute([in] /* string */ any FindText, + [in] /* boolean */ any MatchCase, + [in] /* boolean */ any MatchWholeWord, + [in] /* boolean */ any MatchWildcards, + [in] /* boolean */ any MatchSoundsLike, + [in] /* boolean */ any MatchAllWordForms, + [in] /* boolean */ any Forward, + [in] /* long */ any Wrap, + [in] /* boolean */ any Format, + [in] /* string */ any ReplaceWith, + [in] /* boolean */ any Replace, + [in] /* boolean */ any MatchKashida, + [in] /* boolean */ any MatchDiacritics, + [in] /* boolean */ any MatchAlefHamza, + [in] /* boolean */ any MatchControl, + [in] /* boolean */ any MatchPrefix, + [in] /* boolean */ any MatchSuffix, + [in] /* boolean */ any MatchPhrase, + [in] /* boolean */ any IgnoreSpace, + [in] /* boolean */ any IgnorePunct ); + void ClearFormatting(); + +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XFont.idl b/oovbaapi/ooo/vba/word/XFont.idl new file mode 100644 index 000000000000..2ca12a4364d5 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XFont.idl @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XFont.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XFont_idl__ +#define __ooo_vba_word_XFont_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif +#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +//============================================================================= + +module ooo { module vba { module word { + +interface XFont : com::sun::star::uno::XInterface +{ +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XGlobals.idl b/oovbaapi/ooo/vba/word/XGlobals.idl new file mode 100644 index 000000000000..2bfbe4dc2bb4 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XGlobals.idl @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XGlobals.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XGlobals_idl__ +#define __ooo_vba_word_XGlobals_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +module ooo { module vba { module word { +interface XDocument; +interface XWindow; +interface XSystem; +interface XOptions; +interface XSelection; +interface XGlobals : com::sun::star::uno::XInterface +{ + [attribute, readonly] XDocument ActiveDocument; + [attribute, readonly] XWindow ActiveWindow; + [attribute, readonly] string Name; + [attribute, readonly] ooo::vba::word::XSystem System; + [attribute, readonly] ooo::vba::word::XOptions Options; + [attribute, readonly] ooo::vba::word::XSelection Selection; + any CommandBars( [in] any aIndex ); + any Documents( [in] any aIndex ); + any Addins( [in] any aIndex ); + any Dialogs( [in] any aIndex ); + float CentimetersToPoints([in] float Centimeters ); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XHeaderFooter.idl b/oovbaapi/ooo/vba/word/XHeaderFooter.idl new file mode 100644 index 000000000000..ff518f27df50 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XHeaderFooter.idl @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XHeaderFooter_idl__ +#define __ooo_vba_word_XHeaderFooter_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XRange; +interface XHeaderFooter +{ + interface ooo::vba::XHelperInterface; + + [attribute, readonly] boolean IsHeader; + [attribute] boolean LinkToPrevious; + [attribute, readonly] XRange Range; + //[attribute, readonly] XShapers Shapes ; + any Shapes([in] any Index); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XOptions.idl b/oovbaapi/ooo/vba/word/XOptions.idl new file mode 100644 index 000000000000..483d0856a246 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XOptions.idl @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XOptions_idl__ +#define __ooo_vba_word_XOptions_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XOptions +{ + interface ooo::vba::XHelperInterface; + + [attribute] long DefaultBorderLineStyle; + [attribute] long DefaultBorderLineWidth; + [attribute] long DefaultBorderColorIndex; + [attribute] boolean ReplaceSelection; + [attribute] boolean MapPaperSize; + [attribute] boolean AutoFormatAsYouTypeApplyHeadings; + [attribute] boolean AutoFormatAsYouTypeApplyBulletedLists; + [attribute] boolean AutoFormatAsYouTypeApplyNumberedLists; + [attribute] boolean AutoFormatAsYouTypeFormatListItemBeginning; + [attribute] boolean AutoFormatAsYouTypeDefineStyles; + [attribute] boolean AutoFormatApplyHeadings; + [attribute] boolean AutoFormatApplyLists; + [attribute] boolean AutoFormatApplyBulletedLists; + + any DefaultFilePath( [in] long Path ); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XPageSetup.idl b/oovbaapi/ooo/vba/word/XPageSetup.idl new file mode 100644 index 000000000000..f5cb2d46a573 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XPageSetup.idl @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XPageSetup_idl__ +#define __ooo_vba_word_XPageSetup_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + + +interface XPageSetup : com::sun::star::uno::XInterface +{ + [attribute] double Gutter; + [attribute] double HeaderDistance; + [attribute] double FooterDistance; + [attribute] boolean DifferentFirstPageHeaderFooter; + [attribute] long SectionStart; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XPane.idl b/oovbaapi/ooo/vba/word/XPane.idl new file mode 100644 index 000000000000..da7afbbd296b --- /dev/null +++ b/oovbaapi/ooo/vba/word/XPane.idl @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XPane_idl__ +#define __ooo_vba_word_XPane_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XPane +{ + interface ooo::vba::XHelperInterface; + + any View(); + void Close(); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XPanes.idl b/oovbaapi/ooo/vba/word/XPanes.idl new file mode 100644 index 000000000000..0e638f642596 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XPanes.idl @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XPanes_idl__ +#define __ooo_vba_word_XPanes_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XPanes +{ + interface ::ooo::vba::XCollection; +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/word/XParagraph.idl b/oovbaapi/ooo/vba/word/XParagraph.idl new file mode 100644 index 000000000000..99a9414a1a14 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XParagraph.idl @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XParagraph_idl__ +#define __ooo_vba_word_XParagraph_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XRange; +interface XParagraph +{ + interface ooo::vba::XHelperInterface; + + [attribute, readonly] XRange Range; +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XParagraphFormat.idl b/oovbaapi/ooo/vba/word/XParagraphFormat.idl new file mode 100644 index 000000000000..bbeeda213ab7 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XParagraphFormat.idl @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XParagraphFormat_idl__ +#define __ooo_vba_word_XParagraphFormat_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + + +module ooo { module vba { module word { + +interface XParagraphFormat +{ + interface ooo::vba::XHelperInterface; + + [attribute] long Alignment; + [attribute] float FirstLineIndent; + [attribute] any KeepTogether; + [attribute] any KeepWithNext; + [attribute] any Hyphenation; + [attribute] float LineSpacing; + [attribute] long LineSpacingRule; + [attribute] any NoLineNumber; + [attribute] long OutlineLevel; + [attribute] any PageBreakBefore; + [attribute] float SpaceBefore; + [attribute] float SpaceAfter; + [attribute] float LeftIndent; + [attribute] float RightIndent; + [attribute] any TabStops; + [attribute] any WidowControl; +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XParagraphs.idl b/oovbaapi/ooo/vba/word/XParagraphs.idl new file mode 100644 index 000000000000..6ccbc02eacf0 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XParagraphs.idl @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XParagraphs_idl__ +#define __ooo_vba_word_XParagraphs_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XParagraphs +{ + interface ::ooo::vba::XCollection; +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/word/XRange.idl b/oovbaapi/ooo/vba/word/XRange.idl new file mode 100644 index 000000000000..e9e18c84092f --- /dev/null +++ b/oovbaapi/ooo/vba/word/XRange.idl @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XRange_idl__ +#define __ooo_vba_word_XRange_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __com_sun_star_text_XTextRange_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + + +module ooo { module vba { module word { + +interface XParagraphFormat; +interface XStyle; +interface XFont; +interface XRange +{ + interface ooo::vba::XHelperInterface; + + [attribute] string Text; + [attribute] XParagraphFormat ParagraphFormat; + [attribute] XStyle Style; + [attribute,readonly] ::com::sun::star::text::XTextRange XTextRange; + // Of course Font is NOT readonly, #FIXME #TODO + // readonly though will force an error attempting to write + [attribute, readonly] XFont Font; + [attribute] long LanguageID; + [attribute] long Start; + [attribute] long End; + + void InsertBreak( [in] any Type ); + void Select(); + void InsertParagraph(); + void InsertParagraphBefore(); + void InsertParagraphAfter(); + any PageSetup(); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XReplacement.idl b/oovbaapi/ooo/vba/word/XReplacement.idl new file mode 100644 index 000000000000..fdbf68532ea5 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XReplacement.idl @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XReplacement_idl__ +#define __ooo_vba_word_XReplacement_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XReplacement +{ + interface ooo::vba::XHelperInterface; + + [attribute] string Text; +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XSection.idl b/oovbaapi/ooo/vba/word/XSection.idl new file mode 100644 index 000000000000..de018dcf3239 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XSection.idl @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XSection_idl__ +#define __ooo_vba_word_XSection_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XSection +{ + interface ooo::vba::XHelperInterface; + + [attribute] boolean ProtectedForForms; + + any Headers(); + any Footers(); + any PageSetup(); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XSections.idl b/oovbaapi/ooo/vba/word/XSections.idl new file mode 100644 index 000000000000..c2c83ad7580e --- /dev/null +++ b/oovbaapi/ooo/vba/word/XSections.idl @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XSections_idl__ +#define __ooo_vba_word_XSections_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XSections +{ + interface ::ooo::vba::XCollection; + + any PageSetup(); +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/word/XSelection.idl b/oovbaapi/ooo/vba/word/XSelection.idl new file mode 100644 index 000000000000..d6261411eaa8 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XSelection.idl @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XSelection_idl__ +#define __ooo_vba_word_XSelection_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + + +module ooo { module vba { module word { + +interface XRange; +interface XParagraphFormat; +interface XFind; +interface XFont; +interface XStyle; +interface XHeaderFooter; +interface XSelection +{ + interface ooo::vba::XHelperInterface; + + [attribute] string Text; + [attribute, readonly] XRange Range; + [attribute] XParagraphFormat ParagraphFormat; + [attribute, readonly] XFind Find; + [attribute] XStyle Style; + [attribute, readonly] XFont Font; + [attribute, readonly] XHeaderFooter HeaderFooter; + [attribute] long LanguageID; + [attribute] long Start; + [attribute] long End; + + any Tables( [in] any aIndex ); + any Fields( [in] any aIndex ); + void TypeText( [in] string Text ); + void HomeKey( [in] any Unit, [in] any Extend ); + void EndKey( [in] any Unit, [in] any Extend ); + void Delete( [in] any Unit, [in] any Count ); + void MoveRight( [in] any Unit, [in] any Count, [in] any Extend ); + void MoveLeft( [in] any Unit, [in] any Count, [in] any Extend ); + void MoveDown( [in] any Unit, [in] any Count, [in] any Extend ); + void TypeParagraph(); + void InsertParagraph(); + void InsertParagraphBefore(); + void InsertParagraphAfter(); + void TypeBackspace(); + XRange GoTo( [in] any What, [in] any Which, [in] any Count, [in] any Name ); + any Information( [in] long Type ); + void InsertBreak( [in] any Type ); + any ShapeRange(); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XStyle.idl b/oovbaapi/ooo/vba/word/XStyle.idl new file mode 100644 index 000000000000..d8f735078373 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XStyle.idl @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XStyle_idl__ +#define __ooo_vba_word_XStyle_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XFont; +interface XStyle +{ + interface ooo::vba::XHelperInterface; + + [attribute] string Name; + [attribute] long LanguageID; + [attribute, readonly] long Type; + [attribute, readonly] XFont Font; +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XStyles.idl b/oovbaapi/ooo/vba/word/XStyles.idl new file mode 100644 index 000000000000..70a74aaec942 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XStyles.idl @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XStyles_idl__ +#define __ooo_vba_word_XStyles_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XStyles +{ + interface ::ooo::vba::XCollection; +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/word/XSystem.idl b/oovbaapi/ooo/vba/word/XSystem.idl new file mode 100644 index 000000000000..bc81081e9bc3 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XSystem.idl @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XSystem_idl__ +#define __ooo_vba_word_XSystem_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + + +module ooo { module vba { module word { + +interface XSystem +{ + interface ooo::vba::XHelperInterface; + + [attribute] long Cursor; + any PrivateProfileString( [in] string Filename, [in] string Section, [in] string Key ); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XTable.idl b/oovbaapi/ooo/vba/word/XTable.idl new file mode 100644 index 000000000000..9b38a6e5c525 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XTable.idl @@ -0,0 +1,86 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XTable.idl,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2007/02/09 08:35:01 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef __ooo_vba_word_XTable_idl__ +#define __ooo_vba_word_XTable_idl__ + +#ifndef __com_sun_star_script_BasicErrorException_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif +module ooo { module vba { module word { + +interface XRange; + +interface XTable +{ + interface ::ooo::vba::XHelperInterface; + [attribute, readonly ] string Name; // for debug only + + XRange Range() raises (com::sun::star::script::BasicErrorException); + + /** + select the table + */ + void Select() + raises (com::sun::star::script::BasicErrorException); + + /** + delete the table + */ + void Delete() + raises (com::sun::star::script::BasicErrorException); + + /** + convert the table to text + @param Separator the separator used for the text where cell separation was + @return XRange a range containing the text + @throw BasicErrorException when the conversion cannot be done + */ +/* + XRange ConvertToText([in] any Separator, [in] any NestedTables) + raises(com::sun::star::script::BasicErrorException); +*/ + any Borders( [in] any aIndex ); + +}; + +}; }; }; + +#endif + diff --git a/oovbaapi/ooo/vba/word/XTables.idl b/oovbaapi/ooo/vba/word/XTables.idl new file mode 100644 index 000000000000..f09f27fb78f0 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XTables.idl @@ -0,0 +1,79 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XTables.idl,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2007/02/09 08:45:13 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef __ooo_vba_word__XTables_idl__ +#define __ooo_vba_word__XTables_idl__ + +#ifndef __ooo_vba_HelperInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + +#ifndef __ooo_vba_word_XTable_idl__ +#include +#endif + +#ifndef __com_sun_star_script_BasicErrorException_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XRange; + +interface XTables +{ + interface ooo::vba::XCollection; + /** Creates a new Table, optionally with a name. +

Creates a new table at the current cursor position.

+ @param range + @returns + reference to the new table. + */ + XTable Add([in] XRange Range, [in] any NumRows, [in] any NumColumns, + /*optional*/ [in] any DefaultTableBehavior, + /*optional*/ [in] any AutoFitBehavior) + raises(com::sun::star::script::BasicErrorException); + + +}; + +}; }; }; + +#endif + diff --git a/oovbaapi/ooo/vba/word/XTemplate.idl b/oovbaapi/ooo/vba/word/XTemplate.idl new file mode 100644 index 000000000000..6cc76194d91a --- /dev/null +++ b/oovbaapi/ooo/vba/word/XTemplate.idl @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XTemplate_idl__ +#define __ooo_vba_word_XTemplate_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XTemplate +{ + interface ooo::vba::XHelperInterface; + + [attribute, readonly] string Name; + + any AutoTextEntries( [in] any aIndex ); +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XVariable.idl b/oovbaapi/ooo/vba/word/XVariable.idl new file mode 100644 index 000000000000..57328a55b40d --- /dev/null +++ b/oovbaapi/ooo/vba/word/XVariable.idl @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XVariable_idl__ +#define __ooo_vba_word_XVariable_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +#ifndef __com_sun_star_container_XNamed_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XVariable +{ + interface ooo::vba::XHelperInterface; + interface ::com::sun::star::container::XNamed; + + [attribute] any Value; + [attribute, readonly] long Index; +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XVariables.idl b/oovbaapi/ooo/vba/word/XVariables.idl new file mode 100644 index 000000000000..7d2587dacb80 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XVariables.idl @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XVariables_idl__ +#define __ooo_vba_word_XVariables_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include +#endif + + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= + +interface XVariables +{ + interface ::ooo::vba::XCollection; + + any Add( [in] string Name, [in] any Value ); +}; + +}; }; }; + +#endif diff --git a/oovbaapi/ooo/vba/word/XView.idl b/oovbaapi/ooo/vba/word/XView.idl new file mode 100644 index 000000000000..edc970fd93c4 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XView.idl @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XView_idl__ +#define __ooo_vba_word_XView_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { + +interface XView +{ + interface ooo::vba::XHelperInterface; + + [attribute] long SeekView; + [attribute] long SplitSpecial; + [attribute] boolean TableGridLines; + [attribute] long Type; +}; + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XWindow.idl b/oovbaapi/ooo/vba/word/XWindow.idl new file mode 100644 index 000000000000..90dcf12a7953 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XWindow.idl @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XWindow.idl,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XWindow_idl__ +#define __ooo_vba_word_XWindow_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +//============================================================================= + +module ooo { module vba { module word { + +//============================================================================= +//interface XPane; +interface XWindow : com::sun::star::uno::XInterface +{ + [attribute] any View; + void Activate(); + void Close([in] any SaveChanges, [in] any RouteDocument); + any Panes( [in] any aIndex ); // this is a fake api for it seems not support in Write + any ActivePane(); // this is a fake api for it seems not support in Write +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/word/XWrapFormat.idl b/oovbaapi/ooo/vba/word/XWrapFormat.idl new file mode 100644 index 000000000000..a3de520e2fd3 --- /dev/null +++ b/oovbaapi/ooo/vba/word/XWrapFormat.idl @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XWrapFormat.idl,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __ooo_vba_word_XWrapFormat_idl__ +#define __ooo_vba_word_XWrapFormat_idl__ + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include +#endif + +module ooo { module vba { module word { +interface XWrapFormat : ooo::vba::XHelperInterface +{ + [attribute] long Type; + [attribute] long Side; + [attribute] float DistanceTop; + [attribute] float DistanceBottom; + [attribute] float DistanceLeft; + [attribute] float DistanceRight; +}; +}; }; }; +#endif diff --git a/oovbaapi/ooo/vba/word/makefile.mk b/oovbaapi/ooo/vba/word/makefile.mk new file mode 100644 index 000000000000..a5b2e64e5737 --- /dev/null +++ b/oovbaapi/ooo/vba/word/makefile.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=..$/..$/.. + +PRJNAME=oovapi + +TARGET=word +PACKAGE=ooo$/vba$/Word + +# --- Settings ----------------------------------------------------- +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# ------------------------------------------------------------------------ + + +IDLFILES= XGlobals.idl\ + XApplication.idl \ + XDocument.idl \ + XWindow.idl \ + XSystem.idl \ + XRange.idl \ + XBookmark.idl \ + XBookmarks.idl \ + XVariable.idl \ + XVariables.idl \ + XView.idl \ + XPane.idl \ + XPanes.idl \ + XOptions.idl \ + XSelection.idl \ + XTemplate.idl \ + XParagraphFormat.idl \ + XAutoTextEntries.idl \ + XAutoTextEntry.idl \ + XParagraphs.idl \ + XParagraph.idl \ + XFind.idl \ + XReplacement.idl \ + XStyle.idl \ + XStyles.idl \ + XFont.idl \ + XTable.idl \ + XTables.idl \ + XField.idl \ + XFields.idl \ + XBorder.idl \ + XBorders.idl \ + XDocuments.idl \ + XHeaderFooter.idl \ + XAddins.idl \ + XAddin.idl \ + XDialogs.idl \ + XDialog.idl \ + XWrapFormat.idl \ + XPageSetup.idl \ + XSection.idl \ + XSections.idl \ + +# ------------------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/svx/inc/svx/msvbahelper.hxx b/svx/inc/svx/msvbahelper.hxx new file mode 100644 index 000000000000..b1db44237fa6 --- /dev/null +++ b/svx/inc/svx/msvbahelper.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _MSVBAHELPER_HXX +#define _MSVBAHELPER_HXX + +#include +#include "svx/svxdllapi.h" + +namespace ooo { namespace vba +{ + class SVX_DLLPUBLIC VBAMacroResolvedInfo + { + SfxObjectShell* mpDocContext; + bool mbFound; + String msResolvedMacro; + public: + VBAMacroResolvedInfo() : mpDocContext(NULL), mbFound( false ){} + void SetResolved( bool bRes ) { mbFound = bRes; } + bool IsResolved() { return mbFound; } + void SetMacroDocContext(SfxObjectShell* pShell ) { mpDocContext = pShell; } + SfxObjectShell* MacroDocContext() { return mpDocContext; } + String ResolvedMacro() { return msResolvedMacro; } + void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; } + }; + + SVX_DLLPUBLIC String makeMacroURL( const String& sMacroName ); + SVX_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false ); + SVX_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller ); +} } + +#endif diff --git a/svx/source/msfilter/msvbahelper.cxx b/svx/source/msfilter/msvbahelper.cxx new file mode 100644 index 000000000000..bd8eb9852169 --- /dev/null +++ b/svx/source/msfilter/msvbahelper.cxx @@ -0,0 +1,383 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::com::sun::star; + +const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:"); +const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document"); + +namespace ooo { namespace vba { + +String makeMacroURL( const String& sMacroName ) +{ + return sUrlPart0.concat( sMacroName ).concat( sUrlPart1 ) ; +} + +SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath ) +{ + SfxObjectShell* pFoundShell=NULL; + SfxObjectShell* pShell = SfxObjectShell::GetFirst(); + INetURLObject aObj; + aObj.SetURL( sMacroURLOrPath ); + bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; + rtl::OUString aURL; + if ( bIsURL ) + aURL = sMacroURLOrPath; + else + { + osl::FileBase::getFileURLFromSystemPath( sMacroURLOrPath, aURL ); + aObj.SetURL( aURL ); + } + OSL_TRACE("Trying to find shell for url %s", rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() ); + while ( pShell ) + { + + uno::Reference< frame::XModel > xModel = pShell->GetModel(); + // are we searching for a template? if so we have to cater for the + // fact that in openoffice a document opened from a template is always + // a new document :/ + if ( xModel.is() ) + { + OSL_TRACE("shell 0x%x has model with url %s and we look for %s", pShell + , rtl::OUStringToOString( xModel->getURL(), RTL_TEXTENCODING_UTF8 ).getStr() + , rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() + ); + if ( sMacroURLOrPath.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) ) + { + uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( xModel, uno::UNO_QUERY ); + if( xDocInfoSupp.is() ) + { + uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW ); + rtl::OUString sCurrName = xDocProps->getTemplateName(); + if( sMacroURLOrPath.lastIndexOf( sCurrName ) >= 0 ) + { + pFoundShell = pShell; + break; + } + } + } + else + { + if ( aURL.equals( xModel->getURL() ) ) + { + pFoundShell = pShell; + break; + } + } + } + pShell = SfxObjectShell::GetNext( *pShell ); + } + return pFoundShell; +} + +// sMod can be empty ( but we really need the library to search in ) +// if sMod is empty and a macro is found then sMod is updated +bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, const String& sMacro ) +{ + bool bFound = false; + if ( sLibrary.Len() && sMacro.Len() ) + { + OSL_TRACE("** Searching for %s.%s in library %s" + ,rtl::OUStringToOString( sMod, RTL_TEXTENCODING_UTF8 ).getStr() + ,rtl::OUStringToOString( sMacro, RTL_TEXTENCODING_UTF8 ).getStr() + ,rtl::OUStringToOString( sLibrary, RTL_TEXTENCODING_UTF8 ).getStr() ); + BasicManager* pBasicMgr = pShell-> GetBasicManager(); + if ( pBasicMgr ) + { + StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary ); + if ( !pBasic ) + { + USHORT nId = pBasicMgr->GetLibId( sLibrary ); + pBasicMgr->LoadLib( nId ); + pBasic = pBasicMgr->GetLib( sLibrary ); + } + if ( pBasic ) + { + if ( sMod.Len() ) // we wish to find the macro is a specific module + { + SbModule* pModule = pBasic->FindModule( sMod ); + if ( pModule ) + { + SbxArray* pMethods = pModule->GetMethods(); + if ( pMethods ) + { + SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) ); + if ( pMethod ) + bFound = true; + } + } + } + else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) ) + { + if( SbModule* pModule = pMethod->GetModule() ) + { + sMod = pModule->GetName(); + bFound = true; + } + } + } + } + } + return bFound; +} +void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModule, String& sProcedure ) +{ + sal_Int32 nMacroDot = sMacro.lastIndexOf( '.' ); + + if ( nMacroDot != -1 ) + { + sProcedure = sMacro.copy( nMacroDot + 1 ); + + sal_Int32 nContainerDot = sMacro.lastIndexOf( '.', nMacroDot - 1 ); + if ( nContainerDot != -1 ) + { + sModule = sMacro.copy( nContainerDot + 1, nMacroDot - nContainerDot - 1 ); + sContainer = sMacro.copy( 0, nContainerDot ); + } + else + sModule = sMacro.copy( 0, nMacroDot ); + } + else + sProcedure = sMacro; +} + +VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& MacroName, bool bSearchGlobalTemplates ) +{ + VBAMacroResolvedInfo aRes; + if ( !pShell ) + return aRes; + aRes.SetMacroDocContext( pShell ); + // parse the macro name + sal_Int32 nDocSepIndex = MacroName.indexOfAsciiL( "!", 1 ); + String sMacroUrl = MacroName; + + String sContainer; + String sModule; + String sProcedure; + + if( nDocSepIndex > 0 ) + { + // macro specified by document name + // find document shell for document name and call ourselves + // recursively + + // assume for now that the document name is *this* document + String sDocUrlOrPath = MacroName.copy( 0, nDocSepIndex ); + sMacroUrl = MacroName.copy( nDocSepIndex + 1 ); + OSL_TRACE("doc search, current shell is 0x%x", pShell ); + SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath ); + OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell ); + aRes = resolveVBAMacro( pFoundShell, sMacroUrl ); + } + else + { + // macro is contained in 'this' document ( or code imported from a template + // where that template is a global template or perhaps the template this + // document is created from ) + + // macro format = Container.Module.Procedure + parseMacro( MacroName, sContainer, sModule, sProcedure ); + uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY); + uno::Reference< container::XNameContainer > xPrjNameCache; + if ( xSF.is() ) + xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY ); + + std::vector< rtl::OUString > sSearchList; + + if ( sContainer.Len() > 0 ) + { + // get the Project associated with the Container + if ( xPrjNameCache.is() ) + { + if ( xPrjNameCache->hasByName( sContainer ) ) + { + rtl::OUString sProject; + xPrjNameCache->getByName( sContainer ) >>= sProject; + sContainer = sProject; + } + } + sSearchList.push_back( sContainer ); // First Lib to search + } + else + { + // Ok, if we have no Container specified then we need to search them in order, this document, template this document created from, global templates, + // get the name of Project/Library for 'this' document + rtl::OUString sThisProject; + BasicManager* pBasicMgr = pShell-> GetBasicManager(); + if ( pBasicMgr ) + { + if ( pBasicMgr->GetName().Len() ) + sThisProject = pBasicMgr->GetName(); + else // cater for the case where VBA is not enabled + sThisProject = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ); + } + sSearchList.push_back( sThisProject ); // First Lib to search + if ( xPrjNameCache.is() ) + { + // is this document created from a template? + uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( pShell->GetModel(), uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW ); + + rtl::OUString sCreatedFrom = xDocProps->getTemplateURL(); + if ( sCreatedFrom.getLength() ) + { + INetURLObject aObj; + aObj.SetURL( sCreatedFrom ); + bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; + rtl::OUString aURL; + if ( bIsURL ) + aURL = sCreatedFrom; + else + { + osl::FileBase::getFileURLFromSystemPath( sCreatedFrom, aURL ); + aObj.SetURL( aURL ); + } + sCreatedFrom = aObj.GetLastName(); + } + + sal_Int32 nIndex = sCreatedFrom.lastIndexOf( '.' ); + if ( nIndex != -1 ) + sCreatedFrom = sCreatedFrom.copy( 0, nIndex ); + + rtl::OUString sPrj; + if ( sCreatedFrom.getLength() && xPrjNameCache->hasByName( sCreatedFrom ) ) + { + xPrjNameCache->getByName( sCreatedFrom ) >>= sPrj; + // Make sure we don't double up with this project + if ( !sPrj.equals( sThisProject ) ) + sSearchList.push_back( sPrj ); + } + + // get list of global template Names + uno::Sequence< rtl::OUString > sTemplateNames = xPrjNameCache->getElementNames(); + sal_Int32 nLen = sTemplateNames.getLength(); + for ( sal_Int32 index = 0; ( bSearchGlobalTemplates && index < nLen ); ++index ) + { + + if ( !sCreatedFrom.equals( sTemplateNames[ index ] ) ) + { + if ( xPrjNameCache->hasByName( sTemplateNames[ index ] ) ) + { + xPrjNameCache->getByName( sTemplateNames[ index ] ) >>= sPrj; + // Make sure we don't double up with this project + if ( !sPrj.equals( sThisProject ) ) + sSearchList.push_back( sPrj ); + } + } + + } + } + } + std::vector< rtl::OUString >::iterator it_end = sSearchList.end(); + for ( std::vector< rtl::OUString >::iterator it = sSearchList.begin(); it != it_end; ++it ) + { + bool bRes = hasMacro( pShell, *it, sModule, sProcedure ); + if ( bRes ) + { + aRes.SetResolved( true ); + aRes.SetMacroDocContext( pShell ); + sContainer = *it; + break; + } + } + } + aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) ); + + return aRes; +} + +// Treat the args as possible inouts ( convertion at bottom of method ) +sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& /*aRet*/, const uno::Any& aCaller ) +{ + sal_Bool bRes = sal_False; + if ( !pShell ) + return bRes; + rtl::OUString sUrl = makeMacroURL( sMacroName ); + + uno::Sequence< sal_Int16 > aOutArgsIndex; + uno::Sequence< uno::Any > aOutArgs; + + try + { + uno::Reference< script::provider::XScriptProvider > xScriptProvider; + uno::Reference< script::provider::XScriptProviderSupplier > xSPS( pShell->GetModel(), uno::UNO_QUERY_THROW ); + + xScriptProvider.set( xSPS->getScriptProvider(), uno::UNO_QUERY_THROW ); + + uno::Reference< script::provider::XScript > xScript( xScriptProvider->getScript( sUrl ), uno::UNO_QUERY_THROW ); + + if ( aCaller.hasValue() ) + { + uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY ); + if ( xProps.is() ) + { + uno::Sequence< uno::Any > aCallerHack(1); + aCallerHack[ 0 ] = aCaller; + xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) ); + } + } + + + xScript->invoke( aArgs, aOutArgsIndex, aOutArgs ); + + sal_Int32 nLen = aOutArgs.getLength(); + // convert any out params to seem like they were inouts + if ( nLen ) + { + for ( sal_Int32 index=0; index < nLen; ++index ) + { + sal_Int32 nOutIndex = aOutArgsIndex[ index ]; + aArgs[ nOutIndex ] = aOutArgs[ index ]; + } + } + + bRes = sal_True; + } + catch ( uno::Exception& e ) + { + bRes = sal_False; + } + return bRes; +} +} } // vba // ooo diff --git a/vbahelper/inc/vbahelper/helperdecl.hxx b/vbahelper/inc/vbahelper/helperdecl.hxx new file mode 100644 index 000000000000..a570a0e56eb3 --- /dev/null +++ b/vbahelper/inc/vbahelper/helperdecl.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: helperdecl.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_SERV_DECL +#define OOVBAAPI_SERV_DECL +#include +#include + +namespace comphelper { +namespace service_decl { +template > +struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl, WithArgsT > +{ + typedef serviceimpl_base< detail::OwnServiceImpl, WithArgsT > baseT; + /** Default ctor. Implementation class without args, expecting + component context as single argument. + */ + vba_service_class_() : baseT() {} + template + /** Ctor to pass a post processing function/functor. + + @tpl PostProcessDefaultT let your compiler deduce this + @param postProcessFunc function/functor that gets the yet unacquired + ImplT_ pointer returning a + uno::Reference + */ + explicit vba_service_class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} +}; + +} // namespace service_decl +} // namespace comphelper +#endif diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx new file mode 100644 index 000000000000..547e4b2da97e --- /dev/null +++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaapplicationbase.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBA_APPLICATION_BASE_HXX +#define VBA_APPLICATION_BASE_HXX + +#include +#include +#include +#include + +typedef InheritedHelperInterfaceImpl1< ov::XApplicationBase > ApplicationBase_BASE; + +class VBAHELPER_DLLPUBLIC VbaApplicationBase : public ApplicationBase_BASE +{ +protected: + VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~VbaApplicationBase(); + + virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException) = 0; +public: + // XHelperInterface ( parent is itself ) + virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; } + + virtual sal_Bool SAL_CALL getScreenUpdating() throw (css::uno::RuntimeException); + virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException); + virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException); + virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Quit( ) throw (::com::sun::star::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; +#endif diff --git a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx new file mode 100644 index 000000000000..1c10f5f2c760 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx @@ -0,0 +1,257 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbacollectionimpl.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_VBA_COLLECTION_IMPL_HXX +#define OOVBAAPI_VBA_COLLECTION_IMPL_HXX + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "vbahelper/vbahelper.hxx" +#include "vbahelper/vbahelperinterface.hxx" + +#include + +typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE; + +class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE +{ +protected: + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::container::XEnumeration > m_xEnumeration; +public: + + EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ), m_xEnumeration( xEnumeration ) { } + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); } +}; + +// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces +// only requirement is the object needs to implement XName + + + +typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE; + +template< typename Ifc1 > +class VBAHELPER_DLLPUBLIC XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE +{ +public: +typedef std::vector< css::uno::Reference< Ifc1 > > XNamedVec; +private: + + class XNamedEnumerationHelper : public EnumerationHelper_BASE + { + XNamedVec mXNamedVec; + typename XNamedVec::iterator mIt; + public: + XNamedEnumerationHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), mIt( mXNamedVec.begin() ) {} + + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) + { + return ( mIt != mXNamedVec.end() ); + } + + virtual css::uno::Any SAL_CALL nextElement( ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException) + { + if ( hasMoreElements() ) + return css::uno::makeAny( *mIt++ ); + throw css::container::NoSuchElementException(); + } + }; + +protected: + XNamedVec mXNamedVec; + typename XNamedVec::iterator cachePos; +public: + XNamedObjectCollectionHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), cachePos(mXNamedVec.begin()) {} + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) throw (css::uno::RuntimeException) { return Ifc1::static_type(0); } + virtual ::sal_Bool SAL_CALL hasElements( ) throw (css::uno::RuntimeException) { return ( mXNamedVec.size() > 0 ); } + // XNameAcess + virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException) + { + if ( !hasByName(aName) ) + throw css::container::NoSuchElementException(); + return css::uno::makeAny( *cachePos ); + } + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (css::uno::RuntimeException) + { + css::uno::Sequence< rtl::OUString > sNames( mXNamedVec.size() ); + rtl::OUString* pString = sNames.getArray(); + typename XNamedVec::iterator it = mXNamedVec.begin(); + typename XNamedVec::iterator it_end = mXNamedVec.end(); + + for ( ; it != it_end; ++it, ++pString ) + { + css::uno::Reference< css::container::XNamed > xName( *it, css::uno::UNO_QUERY_THROW ); + *pString = xName->getName(); + } + return sNames; + } + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException) + { + cachePos = mXNamedVec.begin(); + typename XNamedVec::iterator it_end = mXNamedVec.end(); + for ( ; cachePos != it_end; ++cachePos ) + { + css::uno::Reference< css::container::XNamed > xName( *cachePos, css::uno::UNO_QUERY_THROW ); + if ( aName.equals( xName->getName() ) ) + break; + } + return ( cachePos != it_end ); + } + + // XElementAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException) { return mXNamedVec.size(); } + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException ) + { + if ( Index < 0 || Index >= getCount() ) + throw css::lang::IndexOutOfBoundsException(); + + return css::uno::makeAny( mXNamedVec[ Index ] ); + + } + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) throw (css::uno::RuntimeException) + { + return new XNamedEnumerationHelper( mXNamedVec ); + } +}; + +// including a HelperInterface implementation +template< typename Ifc1 > +class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 > +{ +typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase; +protected: + css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess; + css::uno::Reference< css::container::XNameAccess > m_xNameAccess; + + virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException) + { + if ( !m_xNameAccess.is() ) + throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() ); + + return createCollectionObject( m_xNameAccess->getByName( sIndex ) ); + } + + virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException) + { + if ( !m_xIndexAccess.is() ) + throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase numeric index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() ); + if ( nIndex <= 0 ) + { + throw css::lang::IndexOutOfBoundsException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "index is 0 or negative" ) ), + css::uno::Reference< css::uno::XInterface >() ); + } + // need to adjust for vba index ( for which first element is 1 ) + return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) ); + } +public: + ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); } + //XCollection + virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException) + { + return m_xIndexAccess->getCount(); + } + + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw (css::uno::RuntimeException) + { + if ( Index1.getValueTypeClass() != css::uno::TypeClass_STRING ) + { + sal_Int32 nIndex = 0; + + if ( ( Index1 >>= nIndex ) != sal_True ) + { + rtl::OUString message; + message = rtl::OUString::createFromAscii( + "Couldn't convert index to Int32"); + throw css::lang::IndexOutOfBoundsException( message, + css::uno::Reference< css::uno::XInterface >() ); + } + return getItemByIntIndex( nIndex ); + } + rtl::OUString aStringSheet; + + Index1 >>= aStringSheet; + return getItemByStringIndex( aStringSheet ); + } + // XDefaultMethod + ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (css::uno::RuntimeException) + { + const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") ); + return sName; + } + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0; + // XElementAccess + virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException) + { + return ( m_xIndexAccess->getCount() > 0 ); + } + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0; + +}; + +typedef ::cppu::WeakImplHelper1 XCollection_InterfacesBASE; + +typedef ScVbaCollectionBase< XCollection_InterfacesBASE > CollImplBase1; +// compatible with the old collections ( pre XHelperInterface base class ) ( some internal objects still use this ) +class VBAHELPER_DLLPUBLIC ScVbaCollectionBaseImpl : public CollImplBase1 +{ +public: + ScVbaCollectionBaseImpl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : CollImplBase1( xParent, xContext, xIndexAccess){} + +}; + +template // where Ifc must implement XCollectionTest +class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > +{ +typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1; + +public: + CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {} +}; + + +#endif //SC_VBA_COLLECTION_IMPL_HXX diff --git a/vbahelper/inc/vbahelper/vbadialogbase.hxx b/vbahelper/inc/vbahelper/vbadialogbase.hxx new file mode 100644 index 000000000000..80d76b029f7b --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadialogbase.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialog.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBA_DIALOG_BASE_HXX +#define VBA_DIALOG_BASE_HXX + +#include +#include +#include +#include + +typedef InheritedHelperInterfaceImpl1< ov::XDialogBase > VbaDialogBase_BASE; + +class VBAHELPER_DLLPUBLIC VbaDialogBase : public VbaDialogBase_BASE +{ +protected: + sal_Int32 mnIndex; + css::uno::Reference< css::frame::XModel > m_xModel; +public: + VbaDialogBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nIndex ):VbaDialogBase_BASE( xParent, xContext ), mnIndex( nIndex ), m_xModel( xModel ) {} + virtual ~VbaDialogBase() {} + + // Methods + virtual void SAL_CALL Show() throw (css::uno::RuntimeException); + virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ) = 0; +}; + +#endif /* VBA_DIALOG_BASE_HXX */ diff --git a/vbahelper/inc/vbahelper/vbadialogsbase.hxx b/vbahelper/inc/vbahelper/vbadialogsbase.hxx new file mode 100644 index 000000000000..96b74febb0d3 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadialogsbase.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialogs.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBA_DIALOGS_BASE_HXX +#define VBA_DIALOGS_BASE_HXX + +#include +#include +#include +#include +#include + +typedef InheritedHelperInterfaceImpl1< ov::XDialogsBase > VbaDialogsBase_BASE; + +class VBAHELPER_DLLPUBLIC VbaDialogsBase : public VbaDialogsBase_BASE +{ +protected: + css::uno::Reference< css::frame::XModel > m_xModel; +public: + VbaDialogsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ): VbaDialogsBase_BASE( xParent, xContext ), m_xModel( xModel ) {} + virtual ~VbaDialogsBase() {} + + // XCollection + virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); +}; + +#endif /* VBA_DIALOGS_BASE_HXX */ diff --git a/vbahelper/inc/vbahelper/vbadllapi.h b/vbahelper/inc/vbahelper/vbadllapi.h new file mode 100644 index 000000000000..5ba0717490e6 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadllapi.h @@ -0,0 +1,44 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: svldllapi.h,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_VBADLLAPI_H +#define INCLUDED_VBADLLAPI_H + +#include "sal/types.h" + +#if defined(VBAHELPER_DLLIMPLEMENTATION) +#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define VBAHELPER_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_SVLDLLAPI_H */ + diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx new file mode 100644 index 000000000000..064058aa80dd --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBA_DOCUMENTBASE_HXX +#define VBA_DOCUMENTBASE_HXX + +#include +#include +#include + +typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentBase > VbaDocumentBase_BASE; + +class VBAHELPER_DLLPUBLIC VbaDocumentBase : public VbaDocumentBase_BASE +{ +protected: + css::uno::Reference< css::frame::XModel > mxModel; +protected: + virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; } + VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext); +public: + VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, + css::uno::Reference< css::frame::XModel > xModel ); + VbaDocumentBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ); + virtual ~VbaDocumentBase() {} + + // Attributes + virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getFullName() throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getSaved() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException); + + // Methods + virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges, + const css::uno::Any &aFileName, + const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Save() throw (css::uno::RuntimeException); + virtual void SAL_CALL Activate() throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + +#endif /* VBA_DOCUMENTBASE_HXX */ diff --git a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx new file mode 100644 index 000000000000..59791f9b479e --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBA_WORKBOOKS_HXX +#define VBA_WORKBOOKS_HXX + + +#include +#include +#include + +typedef CollTestImplHelper< ooo::vba::XDocumentsBase > VbaDocumentsBase_BASE; + +class VBAHELPER_DLLPUBLIC VbaDocumentsBase : public VbaDocumentsBase_BASE +{ +public: + enum DOCUMENT_TYPE + { + WORD_DOCUMENT = 1, + EXCEL_DOCUMENT + }; + +private: + DOCUMENT_TYPE meDocType; + +public: + VbaDocumentsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, DOCUMENT_TYPE eDocType ) throw (css::uno::RuntimeException); + virtual ~VbaDocumentsBase() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0; + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0; + + // VbaDocumentsBase_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0; + + // XDocumentsBase + virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException); + virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); +}; + +#endif /* SC_VBA_WORKBOOKS_HXX */ diff --git a/vbahelper/inc/vbahelper/vbafontbase.hxx b/vbahelper/inc/vbahelper/vbafontbase.hxx new file mode 100644 index 000000000000..19ca49215b54 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbafontbase.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbafont.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBAHELPER_FONTBASE_HXX +#define VBAHELPER_FONTBASE_HXX + +#include + +#include +#include +#include + +// use local constants there is no need to expose these constants +// externally. Looking at the Format->Character dialog it seem that +// these may infact be even be calculated. Leave hardcoded for now +// #FIXEME #TBD investigate the code for dialog mentioned above + +// The font baseline is not specified. +const short NORMAL = 0; + +// specifies a superscripted. +const short SUPERSCRIPT = 33; + +// specifies a subscripted. +const short SUBSCRIPT = -33; + +// specifies a hight of superscripted font + const sal_Int8 SUPERSCRIPTHEIGHT = 58; + +// specifies a hight of subscripted font +const sal_Int8 SUBSCRIPTHEIGHT = 58; + +// specifies a hight of normal font +const short NORMALHEIGHT = 100; + +typedef InheritedHelperInterfaceImpl1< ov::XFontBase > VbaFontBase_BASE; + +class VBAHELPER_DLLPUBLIC VbaFontBase : public VbaFontBase_BASE +{ +protected: + css::uno::Reference< css::beans::XPropertySet > mxFont; + css::uno::Reference< css::container::XIndexAccess > mxPalette; +public: + VbaFontBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException ); + virtual ~VbaFontBase();// {} + + // Attributes + virtual css::uno::Any SAL_CALL getSize() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSize( const css::uno::Any& _size ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException); + virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException); + virtual void SAL_CALL setBold( const css::uno::Any& _bold ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getUnderline() throw (css::uno::RuntimeException) = 0; + virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException) = 0; + virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException); + virtual void SAL_CALL setStrikethrough( const css::uno::Any& _strikethrough ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException); + virtual void SAL_CALL setShadow( const css::uno::Any& _shadow ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException); + virtual void SAL_CALL setItalic( const css::uno::Any& _italic ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getSubscript() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSubscript( const css::uno::Any& _subscript ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getSuperscript() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSuperscript( const css::uno::Any& _superscript ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException); + virtual void SAL_CALL setName( const css::uno::Any& _name ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getColor() throw (css::uno::RuntimeException) ; + virtual void SAL_CALL setColor( const css::uno::Any& _color ) throw (css::uno::RuntimeException) ; +}; + +#endif + diff --git a/vbahelper/inc/vbahelper/vbaglobalbase.hxx b/vbahelper/inc/vbahelper/vbaglobalbase.hxx new file mode 100644 index 000000000000..76fa4600adf8 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbaglobalbase.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaapplicationbase.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBA_GLOBAL_BASE_HXX +#define VBA_GLOBAL_BASE_HXX + +#include "vbahelperinterface.hxx" +#include + +typedef InheritedHelperInterfaceImpl1< ov::XGlobalsBase > Globals_BASE; +class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE + +{ +protected: + + bool hasServiceName( const rtl::OUString& serviceName ); + void init( const css::uno::Sequence< css::beans::PropertyValue >& aInitArgs ); + +public: + VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName ); + virtual ~VbaGlobalsBase(){}; + // XMultiServiceFactory + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (css::uno::Exception, css::uno::RuntimeException); + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) throw (css::uno::Exception, css::uno::RuntimeException); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException); +}; +#endif diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx new file mode 100644 index 000000000000..67a68d82d318 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbahelper.hxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.hxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_VBA_HELPER_HXX +#define OOVBAAPI_VBA_HELPER_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#define VBAHELPER_DLLIMPLEMENTATION +#include +#include +namespace css = ::com::sun::star; + +namespace ooo +{ + namespace vba + { + template < class T > + css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true ) throw (css::lang::IllegalArgumentException) + { + if ( args.getLength() < ( nPos + 1) ) + throw css::lang::IllegalArgumentException(); + css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY ); + if ( !bCanBeNull && !aSomething.is() ) + throw css::lang::IllegalArgumentException(); + return aSomething; + } + VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException); + css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException); + + VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException); + + VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ; + VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ; + VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON ); + VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 ); + VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 ); + VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& ); + VBAHELPER_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& ); + // provide a NULL object that can be passed as variant so that + // the object when passed to IsNull will return true. aNULL + // contains an empty object reference + VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL(); + VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection ); + VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* ); + + VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException ); + VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic ) + VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& ); + VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite ); + VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException ); + VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName ); + VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue ); + +class VBAHELPER_DLLPUBLIC Millimeter +{ +//Factor to translate between points and hundredths of millimeters: +private: + static const double factor; + + double m_nMillimeter; + +public: + Millimeter(); + + Millimeter(double mm); + + void set(double mm); + void setInPoints(double points) ; + void setInHundredthsOfOneMillimeter(double hmm); + double get(); + double getInHundredthsOfOneMillimeter(); + double getInPoints(); + static sal_Int32 getInHundredthsOfOneMillimeter(double points); + static double getInPoints(int _hmm); +}; + +class VBAHELPER_DLLPUBLIC AbstractGeometryAttributes // probably should replace the ShapeHelper below +{ +public: + virtual ~AbstractGeometryAttributes() {} + virtual double getLeft() = 0; + virtual void setLeft( double ) = 0; + virtual double getTop() = 0; + virtual void setTop( double ) = 0; + virtual double getHeight() = 0; + virtual void setHeight( double ) = 0; + virtual double getWidth() = 0; + virtual void setWidth( double ) = 0; +}; + +namespace msforms { + class XShape; +} + +class VBAHELPER_DLLPUBLIC ShapeHelper +{ +protected: + css::uno::Reference< css::drawing::XShape > xShape; +public: + ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ); + + double getHeight(); + + void setHeight(double _fheight) throw ( css::script::BasicErrorException ); + + double getWidth(); + + void setWidth(double _fWidth) throw ( css::script::BasicErrorException ); + + double getLeft(); + + void setLeft(double _fLeft); + + double getTop(); + + void setTop(double _fTop); +}; + +class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes +{ + std::auto_ptr< ShapeHelper > m_pShapeHelper; +public: + ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ); + virtual double getLeft(); + virtual void setLeft( double nLeft ); + virtual double getTop(); + virtual void setTop( double nTop ); + virtual double getHeight(); + virtual void setHeight( double nHeight ); + virtual double getWidth(); + virtual void setWidth( double nWidth); +}; +#define VBA_LEFT "PositionX" +#define VBA_TOP "PositionY" +class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes +{ + + css::uno::Reference< css::beans::XPropertySet > mxModel; +public: + UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl ); + virtual double getLeft(); + virtual void setLeft( double nLeft ); + virtual double getTop(); + virtual void setTop( double nTop ); + virtual double getHeight(); + virtual void setHeight( double nHeight ); + virtual double getWidth(); + virtual void setWidth( double nWidth); +}; + +class VBAHELPER_DLLPUBLIC ContainerUtilities +{ + +public: + static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator); + static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix ); + + static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString ); +}; + +// really just a a place holder to ease the porting pain +class VBAHELPER_DLLPUBLIC DebugHelper +{ +public: + static void exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException ); + + static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ); + + static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException ); +}; + } // openoffice +} // org + +namespace ov = ooo::vba; + +#ifdef DEBUG +# define SC_VBA_FIXME(a) OSL_TRACE( a ) +# define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ )) +#else +# define SC_VBA_FIXME(a) +# define SC_VBA_STUB() +#endif + +#endif diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx.orig b/vbahelper/inc/vbahelper/vbahelper.hxx.orig new file mode 100644 index 000000000000..047019c214d0 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbahelper.hxx.orig @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.hxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_VBA_HELPER_HXX +#define OOVBAAPI_VBA_HELPER_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#define VBAHELPER_DLLIMPLEMENTATION +#include +#include +namespace css = ::com::sun::star; + +namespace ooo +{ + namespace vba + { + template < class T > + css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true ) throw (css::lang::IllegalArgumentException) + { + if ( args.getLength() < ( nPos + 1) ) + throw css::lang::IllegalArgumentException(); + css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY ); + if ( !bCanBeNull && !aSomething.is() ) + throw css::lang::IllegalArgumentException(); + return aSomething; + } + VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException); + css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc() throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc() throw (css::uno::RuntimeException); + + VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException); + + VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ; + VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ; + VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON ); + VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 ); + VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 ); + VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& ); + VBAHELPER_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& ); + // provide a NULL object that can be passed as variant so that + // the object when passed to IsNull will return true. aNULL + // contains an empty object reference + VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL(); + VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection ); + VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* ); + + VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException ); + VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic ) + VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& ); + VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite ); + +class VBAHELPER_DLLPUBLIC Millimeter +{ +//Factor to translate between points and hundredths of millimeters: +private: + static const double factor; + + double m_nMillimeter; + +public: + Millimeter(); + + Millimeter(double mm); + + void set(double mm); + void setInPoints(double points) ; + void setInHundredthsOfOneMillimeter(double hmm); + double get(); + double getInHundredthsOfOneMillimeter(); + double getInPoints(); + static sal_Int32 getInHundredthsOfOneMillimeter(double points); + static double getInPoints(int _hmm); +}; + +class VBAHELPER_DLLPUBLIC AbstractGeometryAttributes // probably should replace the ShapeHelper below +{ +public: + virtual ~AbstractGeometryAttributes() {} + virtual double getLeft() = 0; + virtual void setLeft( double ) = 0; + virtual double getTop() = 0; + virtual void setTop( double ) = 0; + virtual double getHeight() = 0; + virtual void setHeight( double ) = 0; + virtual double getWidth() = 0; + virtual void setWidth( double ) = 0; +}; + +namespace msforms { + class XShape; +} + +class VBAHELPER_DLLPUBLIC ShapeHelper +{ +protected: + css::uno::Reference< css::drawing::XShape > xShape; +public: + ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ); + + double getHeight(); + + void setHeight(double _fheight) throw ( css::script::BasicErrorException ); + + double getWidth(); + + void setWidth(double _fWidth) throw ( css::script::BasicErrorException ); + + double getLeft(); + + void setLeft(double _fLeft); + + double getTop(); + + void setTop(double _fTop); +}; + +class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes +{ + std::auto_ptr< ShapeHelper > m_pShapeHelper; +public: + ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ); + virtual double getLeft(); + virtual void setLeft( double nLeft ); + virtual double getTop(); + virtual void setTop( double nTop ); + virtual double getHeight(); + virtual void setHeight( double nHeight ); + virtual double getWidth(); + virtual void setWidth( double nWidth); +}; +#define VBA_LEFT "PositionX" +#define VBA_TOP "PositionY" +class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes +{ + + css::uno::Reference< css::beans::XPropertySet > mxModel; +public: + UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl ); + virtual double getLeft(); + virtual void setLeft( double nLeft ); + virtual double getTop(); + virtual void setTop( double nTop ); + virtual double getHeight(); + virtual void setHeight( double nHeight ); + virtual double getWidth(); + virtual void setWidth( double nWidth); +}; + +class VBAHELPER_DLLPUBLIC ContainerUtilities +{ + +public: + static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator); + static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix ); + + static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString ); +}; + +// really just a a place holder to ease the porting pain +class VBAHELPER_DLLPUBLIC DebugHelper +{ +public: + static void exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException ); + + static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ); + + static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException ); +}; + } // openoffice +} // org + +namespace ov = ooo::vba; + +#ifdef DEBUG +# define SC_VBA_FIXME(a) OSL_TRACE( a ) +# define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ )) +#else +# define SC_VBA_FIXME(a) +# define SC_VBA_STUB() +#endif + +#endif diff --git a/vbahelper/inc/vbahelper/vbahelperinterface.hxx b/vbahelper/inc/vbahelper/vbahelperinterface.hxx new file mode 100644 index 000000000000..709bc06f19dc --- /dev/null +++ b/vbahelper/inc/vbahelper/vbahelperinterface.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelperinterface.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_VBA_HELPERINTERFACE_HXX +#define OOVBAAPI_VBA_HELPERINTERFACE_HXX + +#include +#include +#include +#include + +// use this class when you have an a object like +// interface XAnInterface which contains XHelperInterface in its inheritance hierarchy +// interface XAnInterface +// { +// interface XHelperInterface; +// [attribute, string] name; +// } +// or +// interface XAnInterface : XHelperInterface; +// { +// [attribute, string] name; +// } +// +// then this class can provide a default implementation of XHelperInterface, +// you can use it like this +// typedef InheritedHelperInterfaceImpl< XAnInterface > > AnInterfaceImpl_BASE; +// class AnInterfaceImpl : public AnInterfaceImpl_BASE +// { +// public: +// AnInterface( const Reference< HelperInterface >& xParent ) : AnInterfaceImpl_BASE( xParent ) {} +// // implement XAnInterface methods only, no need to implement the XHelperInterface +// // methods +// virtual void setName( const OUString& ); +// virtual OUString getName(); +// } +// +const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) ); + +template< typename Ifc1 > +class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl : public Ifc1 +{ +protected: + css::uno::WeakReference< ov::XHelperInterface > mxParent; + css::uno::Reference< css::uno::XComponentContext > mxContext; +public: + InheritedHelperInterfaceImpl() {} + InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {} + virtual rtl::OUString& getServiceImplName() = 0; + virtual css::uno::Sequence getServiceNames() = 0; + + // XHelperInterface Methods + virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException) + { + return 0x53756E4F; + } + virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return mxParent; } + + virtual css::uno::Any SAL_CALL Application( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { + // The application could certainly be passed around in the context - seems + // to make sense + css::uno::Reference< css::container::XNameAccess > xNameAccess( mxContext, css::uno::UNO_QUERY_THROW ); + return xNameAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application" ) ) ); + } + + + // XServiceInfo Methods + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) { return getServiceImplName(); } + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException) + { + css::uno::Sequence< rtl::OUString > sServices = getSupportedServiceNames(); + const rtl::OUString* pStart = sServices.getConstArray(); + const rtl::OUString* pEnd = pStart + sServices.getLength(); + for ( ; pStart != pEnd ; ++pStart ) + if ( (*pStart).equals( ServiceName ) ) + return sal_True; + return sal_False; + } + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException) + { + css::uno::Sequence< rtl::OUString > aNames = getServiceNames();; + return aNames; + } + }; + +template< typename Ifc1 > +class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > + +{ +typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base; +public: + InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {} + +}; +#endif diff --git a/vbahelper/inc/vbahelper/vbapagesetupbase.hxx b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx new file mode 100644 index 000000000000..d2ad5582ee80 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBA_PAGESETUPBASE_HXX +#define VBA_PAGESETUPBASE_HXX + +#include +#include +#include +#include +#include + +typedef InheritedHelperInterfaceImpl1< ooo::vba::XPageSetupBase > VbaPageSetupBase_BASE; + +class VBAHELPER_DLLPUBLIC VbaPageSetupBase : public VbaPageSetupBase_BASE +{ +protected: + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::beans::XPropertySet > mxPageProps; + sal_Int32 mnOrientLandscape; + sal_Int32 mnOrientPortrait; + + VbaPageSetupBase( const css::uno::Reference< ov::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException); +public: + virtual ~VbaPageSetupBase(){} + + // Attribute + virtual double SAL_CALL getTopMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTopMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getBottomMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setBottomMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getRightMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRightMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getLeftMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLeftMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getHeaderMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setHeaderMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getFooterMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setFooterMargin( double margin ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getOrientation() throw (css::uno::RuntimeException); + virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException); +}; +#endif diff --git a/vbahelper/inc/vbahelper/vbapropvalue.hxx b/vbahelper/inc/vbahelper/vbapropvalue.hxx new file mode 100644 index 000000000000..c2d2ed2aa039 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbapropvalue.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbapropvalue.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_PROPVALULE_HXX +#define SC_VBA_PROPVALULE_HXX +#include +#include + +#include + +typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE; + +class VBAHELPER_DLLPUBLIC PropListener +{ +public: + virtual void setValueEvent( const css::uno::Any& value ) = 0; + virtual css::uno::Any getValueEvent() = 0; +}; + + +class VBAHELPER_DLLPUBLIC ScVbaPropValue : public PropValueImpl_BASE +{ + PropListener* m_pListener; +public: + ScVbaPropValue( PropListener* pListener ); + + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + + rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + +}; +#endif //SC_VBA_PROPVALULE_HXX diff --git a/vbahelper/inc/vbahelper/vbashape.hxx b/vbahelper/inc/vbahelper/vbashape.hxx new file mode 100644 index 000000000000..64fdaef8fcf7 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbashape.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbashape.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_SHAPE_HXX +#define SC_VBA_SHAPE_HXX + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape; + +typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE; + +class VBAHELPER_DLLPUBLIC ScVbaShape : public ScVbaShape_BASE +{ +private: +protected: + std::auto_ptr< ov::ShapeHelper > m_pShapeHelper; + css::uno::Reference< css::drawing::XShape > m_xShape; + css::uno::Reference< css::drawing::XShapes > m_xShapes; + css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; + sal_Int32 m_nType; + css::uno::Reference< css::frame::XModel > m_xModel; + css::uno::Any m_aRange; + virtual void addListeners(); + virtual void removeShapeListener() throw( css::uno::RuntimeException ); + virtual void removeShapesListener() throw( css::uno::RuntimeException ); + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +public: + ScVbaShape( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XShapes >& xShapes, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nType ) throw ( css::lang::IllegalArgumentException ); + ScVbaShape( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::lang::IllegalArgumentException ); + virtual ~ScVbaShape(); + css::uno::Any getRange() { return m_aRange; }; + void setRange( css::uno::Any aRange ) { m_aRange = aRange; }; + + static sal_Int32 getType( const css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException); + + // Attributes + virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException); + virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException); + virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getTop() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); + virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getZOrderPosition() throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException); + virtual double SAL_CALL getRotation() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRotation( double _rotation ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XPictureFormat > SAL_CALL getPictureFormat() throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getLockAspectRatio() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getLockAnchor() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException); + + // Methods + virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Delete() throw (css::uno::RuntimeException); + virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException); + virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException); + virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException); + virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException); + virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException); + virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException); + // Replace?? + virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException ); + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException ); +}; +#endif//SC_VBA_SHAPE_HXX diff --git a/vbahelper/inc/vbahelper/vbashaperange.hxx b/vbahelper/inc/vbahelper/vbashaperange.hxx new file mode 100644 index 000000000000..712a2f1ee2f4 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbashaperange.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbashaperange.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_SHAPERANGE_HXX +#define SC_VBA_SHAPERANGE_HXX + +#include +#include +#include +#include +#include +#include + +typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE; + +class VBAHELPER_DLLPUBLIC ScVbaShapeRange : public ScVbaShapeRange_BASE +{ +private: + css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; + css::uno::Reference< css::drawing::XShapes > m_xShapes; + sal_Int32 m_nShapeGroupCount; +protected: + css::uno::Reference< css::frame::XModel > m_xModel; + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + css::uno::Reference< css::drawing::XShapes > getShapes() throw (css::uno::RuntimeException) ; +public: + ScVbaShapeRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xShapes, const css::uno::Reference< css::drawing::XDrawPage>& xDrawShape, const css::uno::Reference< css::frame::XModel >& xModel ); + + // Methods + virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ::ooo::vba::msforms::XShape > SAL_CALL Group() throw (css::uno::RuntimeException); + virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException); + virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ; + virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException); + virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException); + virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getTop() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getLockAspectRatio() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getLockAnchor() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException); + //XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + // ScVbaCollectionBaseImpl + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); +}; + +#endif//SC_VBA_SHAPERANGE_HXX diff --git a/vbahelper/inc/vbahelper/vbashapes.hxx b/vbahelper/inc/vbahelper/vbashapes.hxx new file mode 100644 index 000000000000..19cbec2b2dca --- /dev/null +++ b/vbahelper/inc/vbahelper/vbashapes.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbashapes.hxx,v $ + * $Revision: 1.3.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_SHAPES_HXX +#define SC_VBA_SHAPES_HXX + +#include +#include +#include +#include + +#include + +#include + +typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE; + +class VBAHELPER_DLLPUBLIC ScVbaShapes : public ScVbaShapes_BASE +{ +private: + css::uno::Reference< css::drawing::XShapes > m_xShapes; + css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; + sal_Int32 m_nNewShapeCount; + void initBaseCollection(); +protected: + css::uno::Reference< css::frame::XModel > m_xModel; + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + virtual css::uno::Reference< css::container::XIndexAccess > getShapesByArrayIndices( const css::uno::Any& Index ) throw (css::uno::RuntimeException); + css::uno::Reference< css::drawing::XShape > createShape( rtl::OUString service ) throw (css::uno::RuntimeException); + css::uno::Any AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException); + css::uno::Any AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException); + css::uno::Any AddTextboxInWriter( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); + rtl::OUString createName( rtl::OUString sName ); + css::uno::Any AddShape( const rtl::OUString& sService, const rtl::OUString& sName, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); + //TODO helperapi using a writer document + //css::awt::Point calculateTopLeftMargin( css::uno::Reference< ov::XHelperInterface > xDocument ); + +public: + ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const css::uno::Reference< css::frame::XModel >& xModel ); + static void setDefaultShapeProperties( css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException); + static void setShape_NameProperty( css::uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName ); + //XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + virtual void SAL_CALL SelectAll() throw (css::uno::RuntimeException); + //helper::calc + virtual css::uno::Any SAL_CALL AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XShapeRange > SAL_CALL Range( const css::uno::Any& shapes ) throw (css::uno::RuntimeException); + // ScVbaCollectionBaseImpl + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException); +}; + +#endif//SC_VBA_SHAPES_HXX diff --git a/vbahelper/inc/vbahelper/vbatextframe.hxx b/vbahelper/inc/vbahelper/vbatextframe.hxx new file mode 100644 index 000000000000..f096d6732f92 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbatextframe.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbatextframe.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBA_TEXTFRAME_HXX +#define VBA_TEXTFRAME_HXX +#include +#include +#include +#include + +typedef InheritedHelperInterfaceImpl1< ov::msforms::XTextFrame > VbaTextFrame_BASE; + +class VBAHELPER_DLLPUBLIC VbaTextFrame : public VbaTextFrame_BASE +{ +protected: + css::uno::Reference< css::drawing::XShape > m_xShape; + css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; +protected: + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + virtual void setAsMSObehavior(); + sal_Int32 getMargin( rtl::OUString sMarginType ); + void setMargin( rtl::OUString sMarginType, float fMargin ); +public: + VbaTextFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext , css::uno::Reference< css::drawing::XShape > xShape); + virtual ~VbaTextFrame() {} + // Attributes + virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoSize( sal_Bool _autosize ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getMarginBottom() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMarginBottom( float _marginbottom ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getMarginTop() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMarginTop( float _margintop ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getMarginLeft() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMarginLeft( float _marginleft ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getMarginRight() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMarginRight( float _marginright ) throw (css::uno::RuntimeException); + + // Methods + virtual css::uno::Any SAL_CALL Characters( ) throw (css::uno::RuntimeException); + +}; + +#endif//SC_VBA_TEXTFRAME_HXX diff --git a/vbahelper/inc/vbahelper/vbawindowbase.hxx b/vbahelper/inc/vbahelper/vbawindowbase.hxx new file mode 100644 index 000000000000..515897d92cfe --- /dev/null +++ b/vbahelper/inc/vbahelper/vbawindowbase.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef VBA_WINDOWBASE_HXX +#define VBA_WINDOWBASE_HXX +#include +#include +#include +#include + +#include + +typedef InheritedHelperInterfaceImpl1 WindowBaseImpl_BASE; + +class VBAHELPER_DLLPUBLIC VbaWindowBase : public WindowBaseImpl_BASE +{ +protected: + css::uno::Reference< css::frame::XModel > m_xModel; +public: + VbaWindowBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ); + VbaWindowBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext ); + + // XWindowBase + virtual sal_Int32 SAL_CALL getHeight() throw (css::uno::RuntimeException) ; + virtual void SAL_CALL setHeight( sal_Int32 _height ) throw (css::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL getLeft() throw (css::uno::RuntimeException) ; + virtual void SAL_CALL setLeft( sal_Int32 _left ) throw (css::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL getTop() throw (css::uno::RuntimeException) ; + virtual void SAL_CALL setTop( sal_Int32 _top ) throw (css::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); + virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getWidth() throw (css::uno::RuntimeException) ; + virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException) ; + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + +#endif //VBA_WINDOWBASE_HXX diff --git a/vbahelper/prj/build.lst b/vbahelper/prj/build.lst new file mode 100644 index 000000000000..a38a6dcbd6bb --- /dev/null +++ b/vbahelper/prj/build.lst @@ -0,0 +1,6 @@ +vba vbahelper : oovbaapi basic sfx2 svx cppuhelper vcl comphelper svtools tools sal NULL +vba vbahelper usr1 - all vba_mkout NULL +#vba vbahelper\inc nmake - all vba_inc NULL +vba vbahelper\source\vbahelper nmake - all vba_vbahelper NULL +vba vbahelper\source\msforms nmake - all vba_msforms NULL +vba vbahelper\util nmake - all vba_util vba_vbahelper vba_msforms NULL diff --git a/vbahelper/prj/d.lst b/vbahelper/prj/d.lst new file mode 100644 index 000000000000..d7b61d1e5a61 --- /dev/null +++ b/vbahelper/prj/d.lst @@ -0,0 +1,27 @@ +..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT% +..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT% +..\%__SRC%\lib\ivbahelper.lib %_DEST%\lib%_EXT%\vbahelper.lib +..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.* +..\%__SRC%\bin\vbahelper*.* %_DEST%\bin%_EXT%\vbahelper*.* +..\%__SRC%\bin\msforms*.* %_DEST%\bin%_EXT%\msforms*.* + +mkdir: %_DEST%\inc%_EXT%\basic +..\inc\vbahelper\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\vbahelper\vbacollectionimpl.hxx +..\inc\vbahelper\vbahelper.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelper.hxx +..\inc\vbahelper\helperdecl.hxx %_DEST%\inc%_EXT%\vbahelper\helperdecl.hxx +..\inc\vbahelper\vbahelperinterface.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelperinterface.hxx +..\inc\vbahelper\vbaapplicationbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaapplicationbase.hxx +..\inc\vbahelper\vbafontbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbafontbase.hxx +..\inc\vbahelper\vbadllapi.h %_DEST%\inc%_EXT%\vbahelper\vbadllapi.h +..\inc\vbahelper\vbawindowbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbawindowbase.hxx +..\inc\vbahelper\vbadocumentbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentbase.hxx +..\inc\vbahelper\vbadocumentsbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentsbase.hxx +..\inc\vbahelper\vbapropvalue.hxx %_DEST%\inc%_EXT%\vbahelper\vbapropvalue.hxx +..\inc\vbahelper\vbaglobalbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaglobalbase.hxx +..\inc\vbahelper\vbadialogbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadialogbase.hxx +..\inc\vbahelper\vbadialogsbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadialogsbase.hxx +..\inc\vbahelper\vbashape.hxx %_DEST%\inc%_EXT%\vbahelper\vbashape.hxx +..\inc\vbahelper\vbashapes.hxx %_DEST%\inc%_EXT%\vbahelper\vbashapes.hxx +..\inc\vbahelper\vbatextframe.hxx %_DEST%\inc%_EXT%\vbahelper\vbatextframe.hxx +..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx +..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx diff --git a/vbahelper/source/msforms/makefile.mk b/vbahelper/source/msforms/makefile.mk new file mode 100644 index 000000000000..ad5e7b4685b3 --- /dev/null +++ b/vbahelper/source/msforms/makefile.mk @@ -0,0 +1,78 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.45 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=vbahelper +TARGET=msforms + +ENABLE_EXCEPTIONS := TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +SLOFILES=\ + $(SLO)$/vbacontrol.obj \ + $(SLO)$/vbacontrols.obj \ + $(SLO)$/vbabutton.obj \ + $(SLO)$/vbacombobox.obj \ + $(SLO)$/vbalabel.obj \ + $(SLO)$/vbatextbox.obj \ + $(SLO)$/vbaradiobutton.obj \ + $(SLO)$/vbalistbox.obj \ + $(SLO)$/vbatogglebutton.obj \ + $(SLO)$/vbacheckbox.obj \ + $(SLO)$/vbaframe.obj \ + $(SLO)$/vbascrollbar.obj \ + $(SLO)$/vbaprogressbar.obj \ + $(SLO)$/vbamultipage.obj \ + $(SLO)$/vbalistcontrolhelper.obj \ + $(SLO)$/vbaspinbutton.obj \ + $(SLO)$/vbaimage.obj \ + $(SLO)$/vbapages.obj \ + $(SLO)$/vbauserform.obj \ + $(SLO)$/service.obj \ + +# #FIXME vbapropvalue needs to move to vbahelper + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + +ALLTAR : \ + $(MISC)$/$(TARGET).don \ + +$(SLOFILES) : $(MISC)$/$(TARGET).don + +$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb + +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@ + echo $@ + diff --git a/vbahelper/source/msforms/service.cxx b/vbahelper/source/msforms/service.cxx new file mode 100644 index 000000000000..20a5a727515a --- /dev/null +++ b/vbahelper/source/msforms/service.cxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: service.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "cppuhelper/implementationentry.hxx" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "comphelper/servicedecl.hxx" + +// ============================================================================= +// component exports +// ============================================================================= +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +namespace sdecl = comphelper::service_decl; + +// reference service helper(s) +namespace controlprovider +{ +extern sdecl::ServiceDecl const serviceDecl; +} + +namespace userform +{ +extern sdecl::ServiceDecl const serviceDecl; +} + +extern "C" +{ + void SAL_CALL component_getImplementationEnvironment( + const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) + { + OSL_TRACE("In component_getImplementationEnv"); + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + } + + sal_Bool SAL_CALL component_writeInfo( + lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) + { + OSL_TRACE("In component_writeInfo"); + + // Component registration + return component_writeInfoHelper( pServiceManager, pRegistryKey, + controlprovider::serviceDecl, userform::serviceDecl ); + } + + void * SAL_CALL component_getFactory( + const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager, + registry::XRegistryKey * pRegistryKey ) + { + OSL_TRACE("In component_getFactory for %s", pImplName ); + void* pRet = component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, controlprovider::serviceDecl, userform::serviceDecl ); + OSL_TRACE("Ret is 0x%x", pRet); + return pRet; + } +} diff --git a/vbahelper/source/msforms/vbabutton.cxx b/vbahelper/source/msforms/vbabutton.cxx new file mode 100644 index 000000000000..4c21c70c88b5 --- /dev/null +++ b/vbahelper/source/msforms/vbabutton.cxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbabutton.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbabutton.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +ScVbaButton::ScVbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaButton::getCaption() throw (css::uno::RuntimeException) +{ + rtl::OUString Label; + m_xProps->getPropertyValue( LABEL ) >>= Label; + return Label; +} + +void SAL_CALL +ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); +} + +rtl::OUString& +ScVbaButton::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaButton") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaButton::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Button" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbabutton.hxx b/vbahelper/source/msforms/vbabutton.hxx new file mode 100644 index 000000000000..48dda8ba7bdb --- /dev/null +++ b/vbahelper/source/msforms/vbabutton.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbabutton.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_BUTTON_HXX +#define SC_VBA_BUTTON_HXX +#include +#include + +#include "vbacontrol.hxx" +#include + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XButton > ButtonImpl_BASE; + +class ScVbaButton : public ButtonImpl_BASE +{ +public: + ScVbaButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; +#endif //SC_VBA_BUTTON_HXX diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx new file mode 100644 index 000000000000..769899462976 --- /dev/null +++ b/vbahelper/source/msforms/vbacheckbox.cxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbacheckbox.hxx" +#include +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") ); +ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException) +{ + rtl::OUString Label; + m_xProps->getPropertyValue( LABEL ) >>= Label; + return Label; +} + +void SAL_CALL +ScVbaCheckbox::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); +} + +uno::Any SAL_CALL +ScVbaCheckbox::getValue() throw (css::uno::RuntimeException) +{ + sal_Int16 nValue = -1; + m_xProps->getPropertyValue( STATE ) >>= nValue; + if( nValue != 0 ) + nValue = -1; +// return uno::makeAny( nValue ); +// I must be missing something MSO says value should be -1 if selected, 0 if not +// selected + return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); +} + +void SAL_CALL +ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException) +{ + sal_Int16 nValue = 0; + sal_Bool bValue = false; + if( _value >>= nValue ) + { + if( nValue == -1) + nValue = 1; + } + else if ( _value >>= bValue ) + { + if ( bValue ) + nValue = 1; + } + m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); +} +rtl::OUString& +ScVbaCheckbox::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCheckbox") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaCheckbox::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.CheckBox" ) ); + } + return aServiceNames; +} + diff --git a/vbahelper/source/msforms/vbacheckbox.hxx b/vbahelper/source/msforms/vbacheckbox.hxx new file mode 100644 index 000000000000..f3374db0119c --- /dev/null +++ b/vbahelper/source/msforms/vbacheckbox.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_CHECKBOX_HXX +#define SC_VBA_CHECKBOX_HXX +#include +#include + +#include "vbacontrol.hxx" +#include + +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE; + +class ScVbaCheckbox : public CheckBoxImpl_BASE +{ +public: + ScVbaCheckbox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + +#endif //SC_VBA_CHECKBOX_HXX diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx new file mode 100644 index 000000000000..1d1f87915b6d --- /dev/null +++ b/vbahelper/source/msforms/vbacombobox.cxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbacombobox.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbacombobox.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +//SelectedItems list of integer indexes +//StringItemList list of items + +const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") ); +const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ); +const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ); +const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") ); + +ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType ) +{ + mpListHelper.reset( new ListControlHelper( m_xProps ) ); + // grab the default value property name + m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName; +} + +// Attributes + + +// Value, [read] e.g. getValue returns the value of ooo Text propery e.g. the value in +// the drop down +uno::Any SAL_CALL +ScVbaComboBox::getValue() throw (uno::RuntimeException) +{ + return m_xProps->getPropertyValue( sSourceName ); +} + +void SAL_CALL +ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException) +{ + sal_Int16 nIndex = 0; + if( _value >>= nIndex ) + { + uno::Sequence< rtl::OUString > sItems; + m_xProps->getPropertyValue( ITEMS ) >>= sItems; + if( ( nIndex >= 0 ) && ( sItems.getLength() > nIndex ) ) + { + rtl::OUString sText = sItems[ nIndex ]; + m_xProps->setPropertyValue( TEXT, uno::makeAny( sText ) ); + } + } +} + +uno::Any SAL_CALL +ScVbaComboBox::getListIndex() throw (uno::RuntimeException) +{ + uno::Sequence< rtl::OUString > sItems; + m_xProps->getPropertyValue( ITEMS ) >>= sItems; + // should really return the item that has focus regardless of + // it been selected + if ( sItems.getLength() > 0 ) + { + rtl::OUString sText = getText(); + sal_Int32 nLen = sItems.getLength(); + for ( sal_Int32 index = 0; sText.getLength() && index < nLen; ++index ) + { + if ( sItems[ index ].equals( sText ) ) + { + OSL_TRACE("getListIndex returning %d", index ); + return uno::makeAny( index ); + } + + } + } + OSL_TRACE("getListIndex returning %d", -1 ); + return uno::makeAny( sal_Int32( -1 ) ); +} + +// Value, [write]e.g. setValue sets the value in the drop down, and if the value is one +// of the values in the list then the selection is also set +void SAL_CALL +ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( sSourceName, _value ); +} + +// see Value + +::rtl::OUString SAL_CALL +ScVbaComboBox::getText() throw (uno::RuntimeException) +{ + rtl::OUString result; + getValue() >>= result; + return result; +} + +void SAL_CALL +ScVbaComboBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException) +{ + setValue( uno::makeAny( _text ) ); // seems the same +} + +// Methods +void SAL_CALL +ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException) +{ + mpListHelper->AddItem( pvargItem, pvargIndex ); +} + +void SAL_CALL +ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException) + { + mpListHelper->removeItem( index ); +} + +void SAL_CALL +ScVbaComboBox::Clear( ) throw (uno::RuntimeException) + { + mpListHelper->Clear(); + } + +void SAL_CALL +ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException) +{ + ScVbaControl::setRowSource( _rowsource ); + mpListHelper->setRowSource( _rowsource ); + } + +sal_Int32 SAL_CALL +ScVbaComboBox::getListCount() throw (uno::RuntimeException) +{ + return mpListHelper->getListCount(); +} + +uno::Any SAL_CALL +ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) +{ + return mpListHelper->List( pvargIndex, pvarColumn ); + } + +rtl::OUString& +ScVbaComboBox::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComboBox") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaComboBox::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ComboBox" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbacombobox.hxx b/vbahelper/source/msforms/vbacombobox.hxx new file mode 100644 index 000000000000..66b1a9abe408 --- /dev/null +++ b/vbahelper/source/msforms/vbacombobox.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbacombobox.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_COMBOBOX_HXX +#define SC_VBA_COMBOBOX_HXX +#include +#include +#include +#include +#include +#include +#include +#include + +#include "vbacontrol.hxx" +#include "vbalistcontrolhelper.hxx" +#include + +typedef cppu::ImplInheritanceHelper2 ComboBoxImpl_BASE; +class ScVbaComboBox : public ComboBoxImpl_BASE +{ + std::auto_ptr< ListControlHelper > mpListHelper; + rtl::OUString sSourceName; + rtl::OUString msDftPropName; + bool mbDialogType; + +public: + ScVbaComboBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialogType = false ); + + // Attributes + virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); + virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); + virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); + + // Methods + virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); + // XControl + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); + + // XDefaultProperty + ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + +#endif // diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx new file mode 100644 index 000000000000..3a6c6ec8d1b5 --- /dev/null +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -0,0 +1,536 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbacontrol.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef VBA_OOBUILD_HACK +#include +#endif +#include"vbacontrol.hxx" +#include"vbacombobox.hxx" +#include "vbabutton.hxx" +#include "vbalabel.hxx" +#include "vbatextbox.hxx" +#include "vbaradiobutton.hxx" +#include "vbalistbox.hxx" +#include "vbatogglebutton.hxx" +#include "vbacheckbox.hxx" +#include "vbaframe.hxx" +#include "vbascrollbar.hxx" +#include "vbaprogressbar.hxx" +#include "vbamultipage.hxx" +#include "vbaspinbutton.hxx" +#include "vbaimage.hxx" +#include + + +using namespace com::sun::star; +using namespace ooo::vba; + +uno::Reference< css::awt::XWindowPeer > +ScVbaControl::getWindowPeer() throw (uno::RuntimeException) +{ + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); + + uno::Reference< awt::XControlModel > xControlModel; + uno::Reference< css::awt::XWindowPeer > xWinPeer; + if ( !xControlShape.is() ) + { + // would seem to be a Userform control + uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW ); + xWinPeer = xControl->getPeer(); + return xWinPeer; + } + // form control + xControlModel.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + + uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + try + { + uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY ); + xWinPeer = xControl->getPeer(); + } + catch( uno::Exception ) + { + throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ), + uno::Reference< uno::XInterface >() ); + } + return xWinPeer; +} + +//ScVbaControlListener +class ScVbaControlListener: public cppu::WeakImplHelper1< lang::XEventListener > +{ +private: + ScVbaControl *pControl; +public: + ScVbaControlListener( ScVbaControl *pTmpControl ); + virtual ~ScVbaControlListener(); + virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException ); +}; + +ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl ) +{ +} + +ScVbaControlListener::~ScVbaControlListener() +{ +} + +void SAL_CALL +ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeException ) +{ + if( pControl ) + { + pControl->removeResouce(); + pControl = NULL; + } +} + +//ScVbaControl + +ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel ) +{ + //add listener + m_xEventListener.set( new ScVbaControlListener( this ) ); + setGeometryHelper( pGeomHelper ); + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); + xComponent->addEventListener( m_xEventListener ); + + //init m_xProps + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ; + uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ; + if ( xControlShape.is() ) // form control + m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + else if ( xUserFormControl.is() ) // userform control + m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW ); +} + +ScVbaControl::~ScVbaControl() +{ + if( m_xControl.is() ) +{ + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); + xComponent->removeEventListener( m_xEventListener ); +} +} + +void +ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper ) +{ + mpGeometryHelper.reset( pHelper ); +} + +void ScVbaControl::removeResouce() throw( uno::RuntimeException ) +{ + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); + xComponent->removeEventListener( m_xEventListener ); + m_xControl= NULL; + m_xProps = NULL; +} + +//In design model has different behavior +sal_Bool SAL_CALL ScVbaControl::getEnabled() throw (uno::RuntimeException) +{ + uno::Any aValue = m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) ); + sal_Bool bRet = false; + aValue >>= bRet; + return bRet; +} + +void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeException) +{ + uno::Any aValue( bVisible ); + m_xProps->setPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ), aValue); + +} + +sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException) +{ + uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW ); + return xWindow2->isVisible(); +} + +void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) +{ + uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW ); + xWindow2->setVisible( bVisible ); +} +double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException) +{ + return mpGeometryHelper->getHeight(); +} +void SAL_CALL ScVbaControl::setHeight( double _height ) throw (uno::RuntimeException) +{ + mpGeometryHelper->setHeight( _height ); +} + +double SAL_CALL ScVbaControl::getWidth() throw (uno::RuntimeException) +{ + return mpGeometryHelper->getWidth(); +} +void SAL_CALL ScVbaControl::setWidth( double _width ) throw (uno::RuntimeException) +{ + mpGeometryHelper->setWidth( _width ); +} + +double SAL_CALL +ScVbaControl::getLeft() throw (uno::RuntimeException) +{ + return mpGeometryHelper->getLeft(); +} + +void SAL_CALL +ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException) +{ + mpGeometryHelper->setLeft( _left ); + +} + +double SAL_CALL +ScVbaControl::getTop() throw (uno::RuntimeException) +{ + return mpGeometryHelper->getTop(); +} + +void SAL_CALL +ScVbaControl::setTop( double _top ) throw (uno::RuntimeException) +{ + mpGeometryHelper->setTop( _top ); +} + +uno::Reference< uno::XInterface > SAL_CALL +ScVbaControl::getObject() throw (uno::RuntimeException) +{ + uno::Reference< msforms::XControl > xRet( this ); + return xRet; +} + +void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException) +{ + uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW ); + xWin->setFocus(); +} + +rtl::OUString SAL_CALL +ScVbaControl::getControlSource() throw (uno::RuntimeException) +{ +// #FIXME I *hate* having these upstream differences +// but this is necessary until I manage to upstream other +// dependant parts +#ifdef VBA_OOBUILD_HACK + rtl::OUString sControlSource; + uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY ); + if ( xBindable.is() ) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellAddressConversion" ))), uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW ); + table::CellAddress aAddress; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= aAddress; + xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address") ), uno::makeAny( aAddress ) ); + xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sControlSource; + } + catch( uno::Exception& ) + { + } + } + return sControlSource; +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getControlSource not supported") ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +void SAL_CALL +ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException) +{ +#ifdef VBA_OOBUILD_HACK + rtl::OUString sEmpty; + svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, _controlsource, sEmpty ); +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setControlSource not supported ") ).concat( _controlsource ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +rtl::OUString SAL_CALL +ScVbaControl::getRowSource() throw (uno::RuntimeException) +{ +#ifdef VBA_OOBUILD_HACK + rtl::OUString sRowSource; + uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY ); + if ( xListSink.is() ) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellRangeAddressConversion" ))), uno::UNO_QUERY ); + + uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW ); + table::CellRangeAddress aAddress; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellRange") ) ) >>= aAddress; + xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address")), uno::makeAny( aAddress ) ); + xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sRowSource; + } + catch( uno::Exception& ) + { + } + } + return sRowSource; +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getRowSource not supported") ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +void SAL_CALL +ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) +{ +#ifdef VBA_OOBUILD_HACK + rtl::OUString sEmpty; + svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, sEmpty, _rowsource ); +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setRowSource not supported ") ).concat( _rowsource ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +rtl::OUString SAL_CALL +ScVbaControl::getName() throw (uno::RuntimeException) +{ + rtl::OUString sName; + m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName; + return sName; + +} + +void SAL_CALL +ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) ); + } + +rtl::OUString SAL_CALL +ScVbaControl::getControlTipText() throw (css::uno::RuntimeException) +{ + rtl::OUString sName; + m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ) ) >>= sName; + return sName; +} + +void SAL_CALL +ScVbaControl::setControlTipText( const rtl::OUString& rsToolTip ) throw (css::uno::RuntimeException) +{ + m_xProps->setPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ), uno::makeAny( rsToolTip ) ); +} +//ScVbaControlFactory + +ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel ) +{ +} + +ScVbaControl* ScVbaControlFactory::createControl() throw (uno::RuntimeException) +{ + return createControl( m_xModel ); +} +ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) +{ + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); + if ( xControlShape.is() ) // form controls + return createControl( xControlShape, xParent ); + uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ); + if ( !xControl.is() ) + throw uno::RuntimeException(); // really we should be more informative + return createControl( xControl, xParent ); + +} + +ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + sal_Int32 nClassId = -1; + const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") ); + xProps->getPropertyValue( sClassId ) >>= nClassId; + uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess + switch( nClassId ) + { + case form::FormComponentType::COMBOBOX: + return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::COMMANDBUTTON: + return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::FIXEDTEXT: + return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::TEXTFIELD: + return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::RADIOBUTTON: + return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::LISTBOX: + return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::SPINBUTTON: + return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::IMAGECONTROL: + return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + default: + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Donot support this Control Type." ), uno::Reference< uno::XInterface >() ); + } +} + +ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW ); + uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW ); + ScVbaControl* pControl = NULL; + uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess + if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) ) + pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) ) + pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) ) + pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) ) + { + sal_Bool bToggle = sal_False; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle; + if ( bToggle ) + pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else + pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + } + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) ) + pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) + pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) + pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) ) + pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) ) + pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) + pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) ) + pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) ) + pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) ) + pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else + throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() ); + return pControl; +} + +rtl::OUString& +ScVbaControl::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaControl::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Control" ) ); + } + return aServiceNames; +} + + + +typedef cppu::WeakImplHelper1< XControlProvider > ControlProvider_BASE; +class ControlProviderImpl : public ControlProvider_BASE +{ + uno::Reference< uno::XComponentContext > m_xCtx; +public: + ControlProviderImpl( const uno::Reference< uno::XComponentContext >& xCtx ) : m_xCtx( xCtx ) {} + virtual uno::Reference< msforms::XControl > SAL_CALL createControl( const uno::Reference< drawing::XControlShape >& xControl, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException); + virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException); +}; + +uno::Reference< msforms::XControl > SAL_CALL +ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException) +{ + uno::Reference< msforms::XControl > xControlToReturn; + if ( xControlShape.is() ) + { + ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner ); + xControlToReturn.set( controlFactory.createControl( xDocOwner ) ); + } + return xControlToReturn; + +} +uno::Reference< msforms::XControl > SAL_CALL +ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException) +{ + uno::Reference< msforms::XControl > xControlToReturn; + if ( xControl.is() && xDialog.is() ) + { + + ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner ); + xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xControlToReturn.get() ); + pControl->setGeometryHelper( new UserFormGeometryHelper( m_xCtx, xControl ) ); + } + return xControlToReturn; +} + +namespace controlprovider +{ +namespace sdecl = comphelper::service_decl; +sdecl::class_ > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "ControlProviderImpl", + "ooo.vba.ControlProvider" ); +} + + diff --git a/vbahelper/source/msforms/vbacontrol.cxx.orig b/vbahelper/source/msforms/vbacontrol.cxx.orig new file mode 100644 index 000000000000..25502d29f67a --- /dev/null +++ b/vbahelper/source/msforms/vbacontrol.cxx.orig @@ -0,0 +1,520 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbacontrol.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef VBA_OOBUILD_HACK +#include +#endif +#include"vbacontrol.hxx" +#include"vbacombobox.hxx" +#include "vbabutton.hxx" +#include "vbalabel.hxx" +#include "vbatextbox.hxx" +#include "vbaradiobutton.hxx" +#include "vbalistbox.hxx" +#include "vbatogglebutton.hxx" +#include "vbacheckbox.hxx" +#include "vbaframe.hxx" +#include "vbascrollbar.hxx" +#include "vbaprogressbar.hxx" +#include "vbamultipage.hxx" +#include "vbaspinbutton.hxx" +#include "vbaimage.hxx" +#include + + +using namespace com::sun::star; +using namespace ooo::vba; + +uno::Reference< css::awt::XWindowPeer > +ScVbaControl::getWindowPeer() throw (uno::RuntimeException) +{ + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); + + uno::Reference< awt::XControlModel > xControlModel; + uno::Reference< css::awt::XWindowPeer > xWinPeer; + if ( !xControlShape.is() ) + { + // would seem to be a Userform control + uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW ); + xWinPeer = xControl->getPeer(); + return xWinPeer; + } + // form control + xControlModel.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + + uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + try + { + uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY ); + xWinPeer = xControl->getPeer(); + } + catch( uno::Exception ) + { + throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ), + uno::Reference< uno::XInterface >() ); + } + return xWinPeer; +} + +//ScVbaControlListener +class ScVbaControlListener: public cppu::WeakImplHelper1< lang::XEventListener > +{ +private: + ScVbaControl *pControl; +public: + ScVbaControlListener( ScVbaControl *pTmpControl ); + virtual ~ScVbaControlListener(); + virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException ); +}; + +ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl ) +{ +} + +ScVbaControlListener::~ScVbaControlListener() +{ +} + +void SAL_CALL +ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeException ) +{ + if( pControl ) + { + pControl->removeResouce(); + pControl = NULL; + } +} + +//ScVbaControl + +ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel ) +{ + //add listener + m_xEventListener.set( new ScVbaControlListener( this ) ); + setGeometryHelper( pGeomHelper ); + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); + xComponent->addEventListener( m_xEventListener ); + + //init m_xProps + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ; + uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ; + if ( xControlShape.is() ) // form control + m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + else if ( xUserFormControl.is() ) // userform control + m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW ); +} + +ScVbaControl::~ScVbaControl() +{ + if( m_xControl.is() ) +{ + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); + xComponent->removeEventListener( m_xEventListener ); +} +} + +void +ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper ) +{ + mpGeometryHelper.reset( pHelper ); +} + +void ScVbaControl::removeResouce() throw( uno::RuntimeException ) +{ + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); + xComponent->removeEventListener( m_xEventListener ); + m_xControl= NULL; + m_xProps = NULL; +} + +//In design model has different behavior +sal_Bool SAL_CALL ScVbaControl::getEnabled() throw (uno::RuntimeException) +{ + uno::Any aValue = m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) ); + sal_Bool bRet = false; + aValue >>= bRet; + return bRet; +} + +void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeException) +{ + uno::Any aValue( bVisible ); + m_xProps->setPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ), aValue); + +} + +sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException) +{ + uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW ); + return xWindow2->isVisible(); +} + +void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) +{ + uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW ); + xWindow2->setVisible( bVisible ); +} +double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException) +{ + return mpGeometryHelper->getHeight(); +} +void SAL_CALL ScVbaControl::setHeight( double _height ) throw (uno::RuntimeException) +{ + mpGeometryHelper->setHeight( _height ); +} + +double SAL_CALL ScVbaControl::getWidth() throw (uno::RuntimeException) +{ + return mpGeometryHelper->getWidth(); +} +void SAL_CALL ScVbaControl::setWidth( double _width ) throw (uno::RuntimeException) +{ + mpGeometryHelper->setWidth( _width ); +} + +double SAL_CALL +ScVbaControl::getLeft() throw (uno::RuntimeException) +{ + return mpGeometryHelper->getLeft(); +} + +void SAL_CALL +ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException) +{ + mpGeometryHelper->setLeft( _left ); + +} + +double SAL_CALL +ScVbaControl::getTop() throw (uno::RuntimeException) +{ + return mpGeometryHelper->getTop(); +} + +void SAL_CALL +ScVbaControl::setTop( double _top ) throw (uno::RuntimeException) +{ + mpGeometryHelper->setTop( _top ); +} + +uno::Reference< uno::XInterface > SAL_CALL +ScVbaControl::getObject() throw (uno::RuntimeException) +{ + uno::Reference< msforms::XControl > xRet( this ); + return xRet; +} + +void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException) +{ + uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW ); + xWin->setFocus(); +} + +rtl::OUString SAL_CALL +ScVbaControl::getControlSource() throw (uno::RuntimeException) +{ +// #FIXME I *hate* having these upstream differences +// but this is necessary until I manage to upstream other +// dependant parts +#ifdef VBA_OOBUILD_HACK + rtl::OUString sControlSource; + uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY ); + if ( xBindable.is() ) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellAddressConversion" ))), uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW ); + table::CellAddress aAddress; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= aAddress; + xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address") ), uno::makeAny( aAddress ) ); + xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sControlSource; + } + catch( uno::Exception& ) + { + } + } + return sControlSource; +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getControlSource not supported") ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +void SAL_CALL +ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException) +{ +#ifdef VBA_OOBUILD_HACK + rtl::OUString sEmpty; + svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, _controlsource, sEmpty ); +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setControlSource not supported ") ).concat( _controlsource ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +rtl::OUString SAL_CALL +ScVbaControl::getRowSource() throw (uno::RuntimeException) +{ +#ifdef VBA_OOBUILD_HACK + rtl::OUString sRowSource; + uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY ); + if ( xListSink.is() ) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellRangeAddressConversion" ))), uno::UNO_QUERY ); + + uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW ); + table::CellRangeAddress aAddress; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellRange") ) ) >>= aAddress; + xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address")), uno::makeAny( aAddress ) ); + xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sRowSource; + } + catch( uno::Exception& ) + { + } + } + return sRowSource; +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getRowSource not supported") ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +void SAL_CALL +ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) +{ +#ifdef VBA_OOBUILD_HACK + rtl::OUString sEmpty; + svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, sEmpty, _rowsource ); +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setRowSource not supported ") ).concat( _rowsource ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +rtl::OUString SAL_CALL +ScVbaControl::getName() throw (uno::RuntimeException) +{ + rtl::OUString sName; + m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName; + return sName; + +} + +void SAL_CALL +ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) ); + } +//ScVbaControlFactory + +ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel ) +{ +} + +ScVbaControl* ScVbaControlFactory::createControl() throw (uno::RuntimeException) +{ + return createControl( m_xModel ); +} +ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) +{ + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); + if ( xControlShape.is() ) // form controls + return createControl( xControlShape, xParent ); + uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ); + if ( !xControl.is() ) + throw uno::RuntimeException(); // really we should be more informative + return createControl( xControl, xParent ); + +} + +ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + sal_Int32 nClassId = -1; + const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") ); + xProps->getPropertyValue( sClassId ) >>= nClassId; + uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess + switch( nClassId ) + { + case form::FormComponentType::COMBOBOX: + return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::COMMANDBUTTON: + return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::FIXEDTEXT: + return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::TEXTFIELD: + return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::RADIOBUTTON: + return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::LISTBOX: + return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::SPINBUTTON: + return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::IMAGECONTROL: + return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + default: + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Donot support this Control Type." ), uno::Reference< uno::XInterface >() ); + } +} + +ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW ); + uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW ); + ScVbaControl* pControl = NULL; + uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess + if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) ) + pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) ) + pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) ) + pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) ) + { + sal_Bool bToggle = sal_False; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle; + if ( bToggle ) + pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else + pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + } + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) ) + pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) + pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) + pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) ) + pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) ) + pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) + pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) ) + pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) ) + pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) ) + pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else + throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() ); + return pControl; +} + +rtl::OUString& +ScVbaControl::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaControl::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Control" ) ); + } + return aServiceNames; +} + + + +typedef cppu::WeakImplHelper1< XControlProvider > ControlProvider_BASE; +class ControlProviderImpl : public ControlProvider_BASE +{ + uno::Reference< uno::XComponentContext > m_xCtx; +public: + ControlProviderImpl( const uno::Reference< uno::XComponentContext >& xCtx ) : m_xCtx( xCtx ) {} + virtual uno::Reference< msforms::XControl > SAL_CALL createControl( const uno::Reference< drawing::XControlShape >& xControl, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException); + virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException); +}; + +uno::Reference< msforms::XControl > SAL_CALL +ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException) +{ + uno::Reference< msforms::XControl > xControlToReturn; + if ( xControlShape.is() ) + { + ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner ); + xControlToReturn.set( controlFactory.createControl( xDocOwner ) ); + } + return xControlToReturn; + +} +uno::Reference< msforms::XControl > SAL_CALL +ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException) +{ + uno::Reference< msforms::XControl > xControlToReturn; + if ( xControl.is() && xDialog.is() ) + { + + ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner ); + xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xControlToReturn.get() ); + pControl->setGeometryHelper( new UserFormGeometryHelper( m_xCtx, xControl ) ); + } + return xControlToReturn; +} + +namespace controlprovider +{ +namespace sdecl = comphelper::service_decl; +sdecl::class_ > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "ControlProviderImpl", + "ooo.vba.ControlProvider" ); +} + + diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx new file mode 100644 index 000000000000..15be1211d0b6 --- /dev/null +++ b/vbahelper/source/msforms/vbacontrol.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbacontrol.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_CONTROL_HXX +#define SC_VBA_CONTROL_HXX + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE; +typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE; + +class ScVbaControl : public ControlImpl_BASE +{ +private: + com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener; +protected: + std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper; + css::uno::Reference< css::beans::XPropertySet > m_xProps; + css::uno::Reference< css::uno::XInterface > m_xControl; + css::uno::Reference< css::frame::XModel > m_xModel; + + virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException); +public: + ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper ); + virtual ~ScVbaControl(); + // This class will own the helper, so make sure it is allocated from + // the heap + void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper ); + // XControl + virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); + virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException); + virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException); + virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getTop() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException); + virtual void SAL_CALL SetFocus( ) throw (css::uno::RuntimeException); + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException); + virtual void SAL_CALL setControlSource( const rtl::OUString& _controlsource ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getRowSource() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getControlTipText() throw (css::uno::RuntimeException); + virtual void SAL_CALL setControlTipText( const rtl::OUString& ) throw (css::uno::RuntimeException); + //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape + virtual void removeResouce() throw( css::uno::RuntimeException ); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + + +class ScVbaControlFactory +{ +public: + ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel ); + ScVbaControl* createControl() throw ( css::uno::RuntimeException ); + ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent ) throw ( css::uno::RuntimeException ); +private: + ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException ); + ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException ); + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::uno::XInterface > m_xControl; + css::uno::Reference< css::frame::XModel > m_xModel; +}; + +#endif//SC_VBA_CONTROL_HXX diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx new file mode 100644 index 000000000000..ccef1419c5d2 --- /dev/null +++ b/vbahelper/source/msforms/vbacontrols.cxx @@ -0,0 +1,232 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "vbacontrols.hxx" +#include +#include +#include +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > ArrayWrapImpl; + +typedef std::hash_map< rtl::OUString, sal_Int32, ::rtl::OUStringHash, + ::std::equal_to< ::rtl::OUString > > ControlIndexMap; +typedef std::vector< uno::Reference< awt::XControl > > ControlVec; + +class ControlArrayWrapper : public ArrayWrapImpl +{ + uno::Reference< awt::XControlContainer > mxDialog; + uno::Sequence< ::rtl::OUString > msNames; + ControlVec mControls; + ControlIndexMap mIndices; + + rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl ) + { + uno::Reference< beans::XPropertySet > xProp( xCtrl->getModel(), uno::UNO_QUERY ); + rtl::OUString sName; + xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName; + return sName; + } + +public: + + ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog ) + { + mxDialog.set( xDialog, uno::UNO_QUERY_THROW ); + uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls(); + + msNames.realloc( sXControls.getLength() ); + for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i ) + { + uno::Reference< awt::XControl > xCtrl = sXControls[ i ]; + msNames[ i ] = getControlName( xCtrl ); + mControls.push_back( xCtrl ); + mIndices[ msNames[ i ] ] = i; + } + } + + // XElementAccess + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) + { + return awt::XControl::static_type(0); + } + + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return ( mControls.size() > 0 ); + } + + // XNameAcess + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasByName( aName ) ) + throw container::NoSuchElementException(); + return getByIndex( mIndices[ aName ] ); + } + + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) + { + return msNames; + } + + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException) + { + ControlIndexMap::iterator it = mIndices.find( aName ); + return it != mIndices.end(); + } + + // XElementAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException) + { + return mControls.size(); + } + + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) + { + if ( Index < 0 || Index >= static_cast< sal_Int32 >( mControls.size() ) ) + throw lang::IndexOutOfBoundsException(); + return uno::makeAny( mControls[ Index ] ); + } +}; + + +class ControlsEnumWrapper : public EnumerationHelper_BASE +{ + uno::Reference m_xParent; + uno::Reference m_xContext; + uno::Reference m_xIndexAccess; + uno::Reference m_xDlg; + sal_Int32 nIndex; + +public: + + ControlsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< awt::XControl >& xDlg ) : m_xParent( xParent ), m_xContext( xContext), m_xIndexAccess( xIndexAccess ), m_xDlg( xDlg ), nIndex( 0 ) {} + + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return ( nIndex < m_xIndexAccess->getCount() ); + } + + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( nIndex < m_xIndexAccess->getCount() ) + { + uno::Reference< frame::XModel > xModel; + uno::Reference< awt::XControl > xControl; + m_xIndexAccess->getByIndex( nIndex++ ) >>= xControl; + + uno::Reference xServiceManager( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), m_xContext ), uno::UNO_QUERY_THROW ); + + uno::Reference< msforms::XControl > xVBAControl( xControlProvider->createUserformControl( xControl, m_xDlg, xModel ) ); + return uno::makeAny( xVBAControl ); + } + throw container::NoSuchElementException(); + } + +}; + + +uno::Reference +lcl_controlsWrapper( const uno::Reference< awt::XControl >& xDlg ) +{ + return new ControlArrayWrapper( xDlg ); +} + +ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, + const css::uno::Reference< awt::XControl >& xDialog ) + : ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) ) +{ + mxDialog.set( xDialog, uno::UNO_QUERY_THROW ); +} + +uno::Reference< container::XEnumeration > +ScVbaControls::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog ) ); + if ( !xEnum.is() ) + throw uno::RuntimeException(); + return xEnum; +} + +uno::Any +ScVbaControls::createCollectionObject( const css::uno::Any& aSource ) +{ + // Create control from awt::XControl + uno::Reference< awt::XControl > xControl; + aSource >>= xControl; + uno::Reference< frame::XModel > xModel; + uno::Reference xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW ); + + uno::Reference< msforms::XControl > xVBAControl( xControlProvider->createUserformControl( xControl, mxDialog, xModel ) ); + + return uno::makeAny( xVBAControl ); +} + +void SAL_CALL +ScVbaControls::Move( double cx, double cy ) throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumeration > xEnum( createEnumeration() ); + while ( xEnum->hasMoreElements() ) + { + uno::Reference< msforms::XControl > xControl( xEnum->nextElement(), uno::UNO_QUERY_THROW ); + xControl->setLeft( xControl->getLeft() + cx ); + xControl->setTop( xControl->getTop() + cy ); + } +} + +uno::Type +ScVbaControls::getElementType() throw (uno::RuntimeException) +{ + return ooo::vba::msforms::XControl::static_type(0); +} +rtl::OUString& +ScVbaControls::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControls") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaControls::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Controls" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbacontrols.hxx b/vbahelper/source/msforms/vbacontrols.hxx new file mode 100644 index 000000000000..3b5bddd80379 --- /dev/null +++ b/vbahelper/source/msforms/vbacontrols.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_CONTROLS_HXX +#define SC_VBA_CONTROLS_HXX + +#include +#include +#include + +#include +#include + +typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE; + +class ScVbaControls : public ControlsImpl_BASE +{ + css::uno::Reference< css::awt::XControl > mxDialog; +protected: + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +public: + ScVbaControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::awt::XControl >& xDialog ); + // XControls + virtual void SAL_CALL Move( double cx, double cy ) throw (css::uno::RuntimeException); + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + // ScVbaCollectionBaseImpl + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + +}; +#endif //SC_VBA_OLEOBJECTS_HXX + diff --git a/vbahelper/source/msforms/vbaframe.cxx b/vbahelper/source/msforms/vbaframe.cxx new file mode 100644 index 000000000000..24f8884e4d3b --- /dev/null +++ b/vbahelper/source/msforms/vbaframe.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbaframe.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaFrame::getCaption() throw (css::uno::RuntimeException) +{ + rtl::OUString Label; + m_xProps->getPropertyValue( LABEL ) >>= Label; + return Label; +} + +void SAL_CALL +ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); +} + +uno::Any SAL_CALL +ScVbaFrame::getValue() throw (css::uno::RuntimeException) +{ + return uno::makeAny( getCaption() ); +} + +void SAL_CALL +ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + rtl::OUString sCaption; + _value >>= sCaption; + setCaption( sCaption ); +} + +rtl::OUString& +ScVbaFrame::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaFrame::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbaframe.hxx b/vbahelper/source/msforms/vbaframe.hxx new file mode 100644 index 000000000000..071b5b09d028 --- /dev/null +++ b/vbahelper/source/msforms/vbaframe.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_FRAME_HXX +#define SC_VBA_FRAME_HXX +#include +#include + +#include "vbacontrol.hxx" +#include + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE; + +class ScVbaFrame : public FrameImpl_BASE +{ +public: + ScVbaFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; +#endif //SC_VBA_LABEL_HXX diff --git a/vbahelper/source/msforms/vbaimage.cxx b/vbahelper/source/msforms/vbaimage.cxx new file mode 100644 index 000000000000..7e6cd34c191e --- /dev/null +++ b/vbahelper/source/msforms/vbaimage.cxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaimage.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +ScVbaImage::ScVbaImage( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ImageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +rtl::OUString& +ScVbaImage::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaImage") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaImage::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Image" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbaimage.hxx b/vbahelper/source/msforms/vbaimage.hxx new file mode 100644 index 000000000000..0fe6b8bda148 --- /dev/null +++ b/vbahelper/source/msforms/vbaimage.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_IMAGE_HXX +#define SC_VBA_IMAGE_HXX +#include +#include + +#include "vbacontrol.hxx" +#include + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XImage > ImageImpl_BASE; + +class ScVbaImage : public ImageImpl_BASE +{ +public: + ScVbaImage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; +#endif //SC_VBA_IMAGE_HXX diff --git a/vbahelper/source/msforms/vbalabel.cxx b/vbahelper/source/msforms/vbalabel.cxx new file mode 100644 index 000000000000..0a7614ee4eb0 --- /dev/null +++ b/vbahelper/source/msforms/vbalabel.cxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbalabel.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbalabel.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +ScVbaLabel::ScVbaLabel( const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaLabel::getCaption() throw (css::uno::RuntimeException) +{ + rtl::OUString Label; + m_xProps->getPropertyValue( LABEL ) >>= Label; + return Label; +} + +void SAL_CALL +ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); +} +uno::Any SAL_CALL +ScVbaLabel::getValue() throw (css::uno::RuntimeException) +{ + return uno::makeAny( getCaption() ); +} + +void SAL_CALL +ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + rtl::OUString sCaption; + _value >>= sCaption; + setCaption( sCaption ); +} + + +rtl::OUString& +ScVbaLabel::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaLabel::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbalabel.hxx b/vbahelper/source/msforms/vbalabel.hxx new file mode 100644 index 000000000000..e390f3e3f0ed --- /dev/null +++ b/vbahelper/source/msforms/vbalabel.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbalabel.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_LABEL_HXX +#define SC_VBA_LABEL_HXX +#include +#include + +#include "vbacontrol.hxx" +#include +#include + +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XLabel, css::script::XDefaultProperty > LabelImpl_BASE; + +class ScVbaLabel : public LabelImpl_BASE +{ +public: + ScVbaLabel( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } +}; +#endif //SC_VBA_LABEL_HXX diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx new file mode 100644 index 000000000000..184f1387aaed --- /dev/null +++ b/vbahelper/source/msforms/vbalistbox.cxx @@ -0,0 +1,290 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbalistbox.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include + +#include "vbalistbox.hxx" +#include +#include +#include + +using namespace com::sun::star; +using namespace ooo::vba; + +const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") ); +const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ); +const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ); + + +ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ListBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ + mpListHelper.reset( new ListControlHelper( m_xProps ) ); +} + +// Attributes +void SAL_CALL +ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException) +{ + sal_Int32 nIndex = 0; + _value >>= nIndex; + uno::Reference< XPropValue > xPropVal( Selected( nIndex ), uno::UNO_QUERY_THROW ); + xPropVal->setValue( uno::makeAny( sal_True ) ); +} + +uno::Any SAL_CALL +ScVbaListBox::getListIndex() throw (uno::RuntimeException) +{ + uno::Sequence< sal_Int16 > sSelection; + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection; + if ( sSelection.getLength() == 0 ) + return uno::Any( sal_Int32( -1 ) ); + return uno::Any( sSelection[ 0 ] ); +} + +uno::Any SAL_CALL +ScVbaListBox::getValue() throw (uno::RuntimeException) +{ + uno::Sequence< sal_Int16 > sSelection; + uno::Sequence< rtl::OUString > sItems; + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection; + m_xProps->getPropertyValue( ITEMS ) >>= sItems; + if( getMultiSelect() ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Attribute use invalid." ), uno::Reference< uno::XInterface >() ); + uno::Any aRet; + if ( sSelection.getLength() ) + aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] ); + return aRet; +} + +void SAL_CALL +ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException) +{ + if( getMultiSelect() ) + { + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Attribute use invalid." ), uno::Reference< uno::XInterface >() ); + } + rtl::OUString sValue = getAnyAsString( _value ); + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + uno::Sequence< sal_Int16 > nList; + sal_Int16 nLength = static_cast( sList.getLength() ); + sal_Int16 nValue = -1; + sal_Int16 i = 0; + for( i = 0; i < nLength; i++ ) + { + if( sList[i].equals( sValue ) ) + { + nValue = i; + break; + } + } + if( nValue == -1 ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Attribute use invalid." ), uno::Reference< uno::XInterface >() ); + + uno::Sequence< sal_Int16 > nSelectedIndices(1); + nSelectedIndices[ 0 ] = nValue; + m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) ); + m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); +} + +::rtl::OUString SAL_CALL +ScVbaListBox::getText() throw (uno::RuntimeException) +{ + rtl::OUString result; + getValue() >>= result; + return result; +} + +void SAL_CALL +ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException) +{ + setValue( uno::makeAny( _text ) ); // seems the same +} + +sal_Bool SAL_CALL +ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException) +{ + sal_Bool bMultiSelect = sal_False; + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect; + return bMultiSelect; +} + +void SAL_CALL +ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException) +{ + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) ); +} + +css::uno::Any SAL_CALL +ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException) +{ + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() ); + // no choice but to do a horror cast as internally + // the indices are but sal_Int16 + sal_Int16 nIndex = static_cast< sal_Int16 >( index ); + if( nIndex < 0 || nIndex >= nLength ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Error Number." ), uno::Reference< uno::XInterface >() ); + m_nIndex = nIndex; + return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) ); +} + +// Methods +void SAL_CALL +ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException) +{ + mpListHelper->AddItem( pvargItem, pvargIndex ); + } + +void SAL_CALL +ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException) +{ + mpListHelper->removeItem( index ); +} + +void SAL_CALL +ScVbaListBox::Clear( ) throw (uno::RuntimeException) +{ + mpListHelper->Clear(); +} + +// this is called when something like the following vba code is used +// to set the selected state of particular entries in the Listbox +// ListBox1.Selected( 3 ) = false +//PropListener +void +ScVbaListBox::setValueEvent( const uno::Any& value ) +{ + sal_Bool bValue = sal_False; + if( !(value >>= bValue) ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() ); + uno::Sequence< sal_Int16 > nList; + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList; + sal_Int16 nLength = static_cast( nList.getLength() ); + sal_Int16 nIndex = m_nIndex; + for( sal_Int16 i = 0; i < nLength; i++ ) + { + if( nList[i] == nIndex ) + { + if( bValue ) + return; + else + { + for( ; i < nLength - 1; i++ ) + { + nList[i] = nList[i + 1]; + } + nList.realloc( nLength - 1 ); + //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); + m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) ); + return; + } + } + } + if( bValue ) + { + if( getMultiSelect() ) + { + nList.realloc( nLength + 1 ); + nList[nLength] = nIndex; + } + else + { + nList.realloc( 1 ); + nList[0] = nIndex; + } + //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); + m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) ); + } +} + +// this is called when something like the following vba code is used +// to determine the selected state of particular entries in the Listbox +// msgbox ListBox1.Selected( 3 ) + +css::uno::Any +ScVbaListBox::getValueEvent() +{ + uno::Sequence< sal_Int16 > nList; + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList; + sal_Int32 nLength = nList.getLength(); + sal_Int32 nIndex = m_nIndex; + + for( sal_Int32 i = 0; i < nLength; i++ ) + { + if( nList[i] == nIndex ) + return uno::makeAny( sal_True ); + } + + return uno::makeAny( sal_False ); +} + +void SAL_CALL +ScVbaListBox::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) +{ + ScVbaControl::setRowSource( _rowsource ); + mpListHelper->setRowSource( _rowsource ); +} + +sal_Int32 SAL_CALL +ScVbaListBox::getListCount() throw (uno::RuntimeException) +{ + return mpListHelper->getListCount(); +} + +uno::Any SAL_CALL +ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) +{ + return mpListHelper->List( pvargIndex, pvarColumn ); +} + +rtl::OUString& +ScVbaListBox::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaListBox") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaListBox::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ScVbaListBox" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx new file mode 100644 index 000000000000..e653338d82d9 --- /dev/null +++ b/vbahelper/source/msforms/vbalistbox.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbalistbox.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_LISTBOX_HXX +#define SC_VBA_LISTBOX_HXX +#include +#include +#include +#include +#include + +#include "vbacontrol.hxx" +#include +#include "vbalistcontrolhelper.hxx" +#include + +typedef cppu::ImplInheritanceHelper2 ListBoxImpl_BASE; +class ScVbaListBox : public ListBoxImpl_BASE + ,public PropListener +{ + std::auto_ptr< ListControlHelper > mpListHelper; + rtl::OUString sSourceName; + rtl::OUString msDftPropName; + + sal_Int16 m_nIndex; + +public: + ScVbaListBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + + // Attributes + virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException); + virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); + virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException); + + // Methods + virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); + // XControl + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); + + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + + //PropListener + virtual void setValueEvent( const css::uno::Any& value ); + virtual css::uno::Any getValueEvent(); + + +}; + +#endif // diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.cxx b/vbahelper/source/msforms/vbalistcontrolhelper.cxx new file mode 100644 index 000000000000..76763b42039e --- /dev/null +++ b/vbahelper/source/msforms/vbalistcontrolhelper.cxx @@ -0,0 +1,146 @@ +#include +#include + +using namespace com::sun::star; +using namespace ooo::vba; + +const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ); + +void SAL_CALL +ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException) +{ + if ( pvargItem.hasValue() ) + { + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + + sal_Int32 nIndex = sList.getLength(); + + if ( pvargIndex.hasValue() ) + pvargIndex >>= nIndex; + + rtl::OUString sString = getAnyAsString( pvargItem ); + + // if no index specified or item is to be appended to end of + // list just realloc the array and set the last item + if ( nIndex == sList.getLength() ) + { + sal_Int32 nOldSize = sList.getLength(); + sList.realloc( nOldSize + 1 ); + sList[ nOldSize ] = sString; + } + else + { + // just copy those elements above the one to be inserted + std::vector< rtl::OUString > sVec; + // reserve just the amount we need to copy + sVec.reserve( sList.getLength() - nIndex ); + + // point at first element to copy + rtl::OUString* pString = sList.getArray() + nIndex; + const rtl::OUString* pEndString = sList.getArray() + sList.getLength(); + // insert the new element + sVec.push_back( sString ); + // copy elements + for ( ; pString != pEndString; ++pString ) + sVec.push_back( *pString ); + + sList.realloc( sList.getLength() + 1 ); + + // point at first element to be overwritten + pString = sList.getArray() + nIndex; + pEndString = sList.getArray() + sList.getLength(); + std::vector< rtl::OUString >::iterator it = sVec.begin(); + for ( ; pString != pEndString; ++pString, ++it) + *pString = *it; + // + } + + m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) ); + + } +} + +void SAL_CALL +ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeException) +{ + sal_Int32 nIndex = 0; + // for int index + if ( index >>= nIndex ) + { + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () ); + if( sList.hasElements() ) + { + if( sList.getLength() == 1 ) + { + Clear(); + return; + } + for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ ) + { + sList[i] = sList[i+1]; + } + sList.realloc( sList.getLength() - 1 ); + } + + m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) ); + } +} + +void SAL_CALL +ListControlHelper::Clear( ) throw (uno::RuntimeException) +{ + // urk, setValue doesn't seem to work !! + //setValue( uno::makeAny( sal_Int16() ) ); + m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) ); +} + +void SAL_CALL +ListControlHelper::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) +{ + if ( _rowsource.getLength() == 0 ) + Clear(); +} + +sal_Int32 SAL_CALL +ListControlHelper::getListCount() throw (uno::RuntimeException) +{ + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + return sList.getLength(); +} + +uno::Any SAL_CALL +ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) +{ + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() ); + uno::Any aRet; + if ( pvargIndex.hasValue() ) + { + sal_Int16 nIndex = -1; + pvargIndex >>= nIndex; + if( nIndex < 0 || nIndex >= nLength ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Bad row Index" ), uno::Reference< uno::XInterface >() ); + aRet <<= sList[ nIndex ]; + } + else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Bad column Index" ), uno::Reference< uno::XInterface >() ); + else // List() ( e.g. no args ) + { + uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength ); + for ( sal_Int32 i = 0; i < nLength; ++i ) + { + sReturnArray[ i ].realloc( 10 ); + sReturnArray[ i ][ 0 ] = sList[ i ]; + } + aRet = uno::makeAny( sReturnArray ); + } + return aRet; +} diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.hxx b/vbahelper/source/msforms/vbalistcontrolhelper.hxx new file mode 100644 index 000000000000..d56729da17e6 --- /dev/null +++ b/vbahelper/source/msforms/vbalistcontrolhelper.hxx @@ -0,0 +1,20 @@ +#ifndef SC_VBA_LISTCONTROLHELPER +#define SC_VBA_LISTCONTROLHELPER + +#include + +class ListControlHelper +{ + css::uno::Reference< css::beans::XPropertySet > m_xProps; + +public: + ListControlHelper( const css::uno::Reference< css::beans::XPropertySet >& rxControl ) : m_xProps( rxControl ){} + virtual ~ListControlHelper() {} + virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); +}; +#endif diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx new file mode 100644 index 000000000000..69410dbadc64 --- /dev/null +++ b/vbahelper/source/msforms/vbamultipage.cxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbamultipage.hxx" +#include +#include "vbapages.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + +// uno servicename com.sun.star.awt.UnoControlProgressBarMode +const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ); +const rtl::OUString SVALUEMAX( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ); +const rtl::OUString SSTEP( RTL_CONSTASCII_USTRINGPARAM("Step") ); + +typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base; +class PagesImpl : public PagesImpl_Base +{ + sal_Int32 mnPages; +public: + PagesImpl( sal_Int32 nPages ) : mnPages( nPages ) {} + virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) { return mnPages; } + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, ::uno::RuntimeException) + { + if ( Index < 0 || Index > mnPages ) + throw lang::IndexOutOfBoundsException(); + return uno::makeAny( uno::Reference< uno::XInterface >() ); + } + // XElementAccess + virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException) + { + // no Pages object yet #FIXME + //return msforms::XPage::static_type(0); + return uno::XInterface::static_type(0); + } + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return ( mnPages > 0 ); + } +}; +uno::Reference< container::XIndexAccess > +ScVbaMultiPage::getPages( sal_Int32 nPages ) +{ + return new PagesImpl( nPages ); +} + +ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ + mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW ); + // set dialog step to value of multipage pseudo model + setValue(getValue()); +} + +// Attributes +sal_Int32 SAL_CALL +ScVbaMultiPage::getValue() throw (css::uno::RuntimeException) +{ + sal_Int32 nValue = 0; + m_xProps->getPropertyValue( SVALUE ) >>= nValue; + return nValue; +} + +void SAL_CALL +ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException) +{ + // track change in dialog ( dialog value is 1 based, 0 is a special value ) + m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) ); + mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) ); +} + + +rtl::OUString& +ScVbaMultiPage::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMultiPage") ); + return sImplName; +} + +uno::Any SAL_CALL +ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException) +{ + sal_Int32 nValue = 0; + m_xProps->getPropertyValue( SVALUEMAX ) >>= nValue; + uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( nValue ) ) ); + if ( !index.hasValue() ) + return uno::makeAny( xColl ); + return xColl->Item( uno::makeAny( index ), uno::Any() ); +} + +uno::Sequence< rtl::OUString > +ScVbaMultiPage::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.MultiPage" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbamultipage.hxx b/vbahelper/source/msforms/vbamultipage.hxx new file mode 100644 index 000000000000..b0214f684dbc --- /dev/null +++ b/vbahelper/source/msforms/vbamultipage.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_MULTIPAGE_HXX +#define SC_VBA_MULTIPAGE_HXX +#include +#include +#include + +#include "vbacontrol.hxx" +#include +//#include +#include + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XMultiPage > MultiPageImpl_BASE; + +class ScVbaMultiPage : public MultiPageImpl_BASE +{ + css::uno::Reference< css::container::XIndexAccess > getPages( sal_Int32 nPages ); + css::uno::Reference< css::beans::XPropertySet > mxDialogProps; +public: + ScVbaMultiPage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, const css::uno::Reference< css::uno::XInterface >& xDialog ); + // Attributes + virtual sal_Int32 SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( sal_Int32 _value ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Pages( const css::uno::Any& index ) throw (css::uno::RuntimeException); + + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } +}; +#endif //SC_VBA_LABEL_HXX diff --git a/vbahelper/source/msforms/vbapages.cxx b/vbahelper/source/msforms/vbapages.cxx new file mode 100644 index 000000000000..af06cffb75ae --- /dev/null +++ b/vbahelper/source/msforms/vbapages.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbapages.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +ScVbaPages::ScVbaPages( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPages ) throw( lang::IllegalArgumentException ) : ScVbaPages_BASE( xParent, xContext, xPages ) +{ +} + +uno::Type SAL_CALL +ScVbaPages::getElementType() throw (uno::RuntimeException) +{ + // return msforms::XPage::static_type(0); + return uno::XInterface::static_type(0); +} + +uno::Any +ScVbaPages::createCollectionObject( const css::uno::Any& aSource ) +{ + return aSource; +} + +rtl::OUString& +ScVbaPages::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPages") ); + return sImplName; +} + +uno::Reference< container::XEnumeration > SAL_CALL +ScVbaPages::createEnumeration() throw (uno::RuntimeException) +{ + return uno::Reference< container::XEnumeration >(); +} + +uno::Sequence< rtl::OUString > +ScVbaPages::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Pages" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbapages.hxx b/vbahelper/source/msforms/vbapages.hxx new file mode 100644 index 000000000000..b61e21bb0019 --- /dev/null +++ b/vbahelper/source/msforms/vbapages.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_PAGES_HXX +#define SC_VBA_PAGES_HXX + +#include +#include +#include +#include +#include +#include + +#include +typedef CollTestImplHelper< +ov::msforms::XPages > ScVbaPages_BASE; + +class ScVbaPages : public ScVbaPages_BASE +{ +protected: + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +public: + ScVbaPages( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPages ) throw ( css::lang::IllegalArgumentException ); + virtual ~ScVbaPages() {} + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + // ScVbaPages_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + +}; +#endif//SC_VBA_SHAPE_HXX diff --git a/vbahelper/source/msforms/vbaprogressbar.cxx b/vbahelper/source/msforms/vbaprogressbar.cxx new file mode 100644 index 000000000000..27f425f9b808 --- /dev/null +++ b/vbahelper/source/msforms/vbaprogressbar.cxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbaprogressbar.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + +// uno servicename com.sun.star.awt.UnoControlProgressBarMode +const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ); + +ScVbaProgressBar::ScVbaProgressBar( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ProgressBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +uno::Any SAL_CALL +ScVbaProgressBar::getValue() throw (css::uno::RuntimeException) +{ + return m_xProps->getPropertyValue( SVALUE ); +} + +void SAL_CALL +ScVbaProgressBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( SVALUE, _value ); +} + +rtl::OUString& +ScVbaProgressBar::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaProgressBar") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaProgressBar::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbaprogressbar.hxx b/vbahelper/source/msforms/vbaprogressbar.hxx new file mode 100644 index 000000000000..86cbae4e89a0 --- /dev/null +++ b/vbahelper/source/msforms/vbaprogressbar.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_PROGRESSBAR_HXX +#define SC_VBA_PROGRESSBAR_HXX +#include +#include + +#include "vbacontrol.hxx" +#include +#include + +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XProgressBar, css::script::XDefaultProperty > ProgressBarImpl_BASE; + +class ScVbaProgressBar : public ProgressBarImpl_BASE +{ +public: + ScVbaProgressBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } +}; +#endif //SC_VBA_LABEL_HXX diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx new file mode 100644 index 000000000000..3ce00bfd862b --- /dev/null +++ b/vbahelper/source/msforms/vbaradiobutton.cxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaradiobutton.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaradiobutton.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") ); +ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : RadioButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaRadioButton::getCaption() throw (css::uno::RuntimeException) +{ + rtl::OUString Label; + m_xProps->getPropertyValue( LABEL ) >>= Label; + return Label; +} + +void SAL_CALL +ScVbaRadioButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); +} + +uno::Any SAL_CALL +ScVbaRadioButton::getValue() throw (css::uno::RuntimeException) +{ + sal_Int16 nValue = -1; + m_xProps->getPropertyValue( STATE ) >>= nValue; + if( nValue != 0 ) + nValue = -1; +// return uno::makeAny( nValue ); +// I must be missing something MSO says value should be -1 if selected, 0 if not +// selected + return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); + +} + +void SAL_CALL +ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException) +{ + sal_Int16 nValue = 0; + sal_Bool bValue = sal_False; + if( _value >>= nValue ) + { + if( nValue == -1) + nValue = 1; + } + else if ( _value >>= bValue ) + { + if ( bValue ) + nValue = 1; + } + m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); +} + +rtl::OUString& +ScVbaRadioButton::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaRadioButton") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaRadioButton::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.RadioButton" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbaradiobutton.hxx b/vbahelper/source/msforms/vbaradiobutton.hxx new file mode 100644 index 000000000000..b13b1260ea8c --- /dev/null +++ b/vbahelper/source/msforms/vbaradiobutton.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaradiobutton.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_RADIOBUTTON_HXX +#define SC_VBA_RADIOBUTTON_HXX +#include +#include "vbacontrol.hxx" +#include +#include + +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > RadioButtonImpl_BASE; + +class ScVbaRadioButton : public RadioButtonImpl_BASE +{ +public: + ScVbaRadioButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue(const com::sun::star::uno::Any&) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + +}; +#endif //SC_VBA_RADIOBUTTON_HXX diff --git a/vbahelper/source/msforms/vbascrollbar.cxx b/vbahelper/source/msforms/vbascrollbar.cxx new file mode 100644 index 000000000000..3da3230a8761 --- /dev/null +++ b/vbahelper/source/msforms/vbascrollbar.cxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbascrollbar.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LARGECHANGE( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ); +const static rtl::OUString SMALLCHANGE( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ); +const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") ); +const static rtl::OUString SCROLLVALUE( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ); +const static rtl::OUString SCROLLMAX( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ); +const static rtl::OUString SCROLLMIN( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMin") ); + +ScVbaScrollBar::ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +uno::Any SAL_CALL +ScVbaScrollBar::getValue() throw (css::uno::RuntimeException) +{ + return m_xProps->getPropertyValue( SCROLLVALUE ); +} + +void SAL_CALL +ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( SCROLLVALUE, _value ); +} + +::sal_Int32 SAL_CALL +ScVbaScrollBar::getMax() throw (uno::RuntimeException) +{ + sal_Int32 nMax = 0; + m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax; + return nMax; +} + +void SAL_CALL +ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) ); +} + +::sal_Int32 SAL_CALL +ScVbaScrollBar::getMin() throw (uno::RuntimeException) +{ + sal_Int32 nVal = 0; + m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal; + return nVal; +} + +void SAL_CALL +ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) ); +} + +void SAL_CALL +ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) ); +} + +::sal_Int32 SAL_CALL +ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException) +{ + sal_Int32 nVal = 0; + m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal; + return nVal; +} + +::sal_Int32 SAL_CALL +ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException) +{ + sal_Int32 nSmallChange = 0; + m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange; + return nSmallChange; +} + +void SAL_CALL +ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) ); +} + +rtl::OUString& +ScVbaScrollBar::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaScrollBar") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaScrollBar::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbascrollbar.hxx b/vbahelper/source/msforms/vbascrollbar.hxx new file mode 100644 index 000000000000..459f610a71f8 --- /dev/null +++ b/vbahelper/source/msforms/vbascrollbar.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_SCROLLBAR_HXX +#define SC_VBA_SCROLLBAR_HXX +#include +#include + +#include "vbacontrol.hxx" +#include + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XScrollBar > ScrollBarImpl_BASE; + +class ScVbaScrollBar : public ScrollBarImpl_BASE +{ +public: + ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getLargeChange() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLargeChange( ::sal_Int32 _largechange ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getSmallChange() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSmallChange( ::sal_Int32 _smallchange ) throw (css::uno::RuntimeException); + + + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; +#endif //SC_VBA_LABEL_HXX diff --git a/vbahelper/source/msforms/vbaspinbutton.cxx b/vbahelper/source/msforms/vbaspinbutton.cxx new file mode 100644 index 000000000000..c9da8cf8827c --- /dev/null +++ b/vbahelper/source/msforms/vbaspinbutton.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbaspinbutton.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") ); +const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ); +const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ); +const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") ); + +ScVbaSpinButton::ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +uno::Any SAL_CALL +ScVbaSpinButton::getValue() throw (css::uno::RuntimeException) +{ + return m_xProps->getPropertyValue( SPINVALUE ); +} + +void SAL_CALL +ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( SPINVALUE, _value ); +} + +::sal_Int32 SAL_CALL +ScVbaSpinButton::getMax() throw (uno::RuntimeException) +{ + sal_Int32 nMax = 0; + m_xProps->getPropertyValue( SPINMAX ) >>= nMax; + return nMax; +} + +void SAL_CALL +ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) ); +} + +::sal_Int32 SAL_CALL +ScVbaSpinButton::getMin() throw (uno::RuntimeException) +{ + sal_Int32 nVal = 0; + m_xProps->getPropertyValue( SPINMIN ) >>= nVal; + return nVal; +} + +void SAL_CALL +ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) ); +} + +rtl::OUString& +ScVbaSpinButton::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaSpinButton::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbaspinbutton.hxx b/vbahelper/source/msforms/vbaspinbutton.hxx new file mode 100644 index 000000000000..8f1d6e3d4dc9 --- /dev/null +++ b/vbahelper/source/msforms/vbaspinbutton.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_SPINBUTTON_HXX +#define SC_VBA_SPINBUTTON_HXX +#include +#include + +#include "vbacontrol.hxx" +#include + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XSpinButton > SpinButtonImpl_BASE; + +class ScVbaSpinButton : public SpinButtonImpl_BASE +{ +public: + ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException); + + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; +#endif //SC_VBA_SPINBUTTON_HXX diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx new file mode 100644 index 000000000000..f6574550c0c9 --- /dev/null +++ b/vbahelper/source/msforms/vbatextbox.cxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbatextbox.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include + +#include "vbatextbox.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + + +ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog ) +{ +} + +// Attributes +uno::Any SAL_CALL +ScVbaTextBox::getValue() throw (css::uno::RuntimeException) +{ + return uno::makeAny( getText() ); +} + +void SAL_CALL +ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException) +{ + rtl::OUString sVal = getAnyAsString( _value ); + setText( sVal ); +} + +//getString() will cause some imfo lose. +rtl::OUString SAL_CALL +ScVbaTextBox::getText() throw (css::uno::RuntimeException) +{ + uno::Any aValue; + aValue = m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) ); + rtl::OUString sString; + aValue >>= sString; + return sString; +} + +void SAL_CALL +ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException) +{ + if ( !mbDialog ) + { + uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW ); + xTextRange->setString( _text ); +} + else + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) ); +} + +sal_Int32 SAL_CALL +ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException) +{ + uno::Any aValue; + aValue = m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ) ); + sal_Int32 nMaxLength = 0; + aValue >>= nMaxLength; + return nMaxLength; +} + +void SAL_CALL +ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException) +{ + uno::Any aValue( _maxlength ); + m_xProps->setPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue); +} + +sal_Bool SAL_CALL +ScVbaTextBox::getMultiline() throw (css::uno::RuntimeException) +{ + uno::Any aValue; + aValue = m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ) ); + sal_Bool bRet = false; + aValue >>= bRet; + return bRet; +} + +void SAL_CALL +ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException) +{ + uno::Any aValue( _multiline ); + m_xProps->setPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue); +} + +rtl::OUString& +ScVbaTextBox::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextBox") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaTextBox::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextBox" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/msforms/vbatextbox.hxx b/vbahelper/source/msforms/vbatextbox.hxx new file mode 100644 index 000000000000..ac2d8e789d46 --- /dev/null +++ b/vbahelper/source/msforms/vbatextbox.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbatextbox.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_TEXTBOX_HXX +#define SC_VBA_TEXTBOX_HXX +#include +#include +#include "vbacontrol.hxx" +#include + +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XTextBox, css::script::XDefaultProperty > TextBoxImpl_BASE; + +class ScVbaTextBox : public TextBoxImpl_BASE +{ + bool mbDialog; +public: + ScVbaTextBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialog = false ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); + virtual void SAL_CALL setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxLength() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; +#endif //SC_VBA_TEXTBOX_HXX diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx new file mode 100644 index 000000000000..d49b2e89affe --- /dev/null +++ b/vbahelper/source/msforms/vbatogglebutton.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbatogglebutton.hxx" +#include + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +const static rtl::OUString TOGGLE( RTL_CONSTASCII_USTRINGPARAM("Toggle") ); +const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") ); +ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ + OSL_TRACE("ScVbaToggleButton(ctor)"); + m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) ); +} + +ScVbaToggleButton::~ScVbaToggleButton() +{ + OSL_TRACE("~ScVbaToggleButton(dtor)"); +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException) +{ + rtl::OUString Label; + m_xProps->getPropertyValue( LABEL ) >>= Label; + return Label; +} + +void SAL_CALL +ScVbaToggleButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); +} + +uno::Any SAL_CALL +ScVbaToggleButton::getValue() throw (uno::RuntimeException) +{ + sal_Int16 nState = 0; + m_xProps->getPropertyValue( STATE ) >>= nState; + return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) ); +} + +void SAL_CALL +ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException) +{ + sal_Int16 nState = 0; + _value >>= nState; + OSL_TRACE( "nState - %d", nState ); + nState = ( nState == -1 ) ? 1 : 0; + OSL_TRACE( "nState - %d", nState ); + m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) ); +} + +rtl::OUString& +ScVbaToggleButton::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaToggleButton") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaToggleButton::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ToggleButton" ) ); + } + return aServiceNames; +} + diff --git a/vbahelper/source/msforms/vbatogglebutton.hxx b/vbahelper/source/msforms/vbatogglebutton.hxx new file mode 100644 index 000000000000..1932d514cce9 --- /dev/null +++ b/vbahelper/source/msforms/vbatogglebutton.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_TOGGLEBUTTON_HXX +#define SC_VBA_TOGGLEBUTTON_HXX +#include +#include + +#include "vbacontrol.hxx" +#include + +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XToggleButton, css::script::XDefaultProperty > ToggleButtonImpl_BASE; + +class ScVbaToggleButton : public ToggleButtonImpl_BASE +{ + rtl::OUString msDftPropName; +public: + ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + ~ScVbaToggleButton(); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } +}; +#endif //SC_VBA_TOGGLEBUTTON_HXX diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx new file mode 100644 index 000000000000..2a1885c0b528 --- /dev/null +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -0,0 +1,227 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include +#include "vbauserform.hxx" +#include +#include +#include +#include +#include +#include +#include "vbacontrols.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +// some little notes +// XDialog implementation has the following interesting bits +// a Controls property ( which is an array of the container controls ) +// each item in the controls array is a XControl, where the model is +// basically a property bag +// additionally the XDialog instance has itself a model +// this model has a ControlModels ( array of models ) property +// the models in ControlModels can be accessed by name +// also the XDialog is a XControl ( to access the model above + +ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) : ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ), mbDispose( true ) +{ + m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW ); + m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW ); + setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) ); +} + +ScVbaUserForm::~ScVbaUserForm() +{ +} + +void SAL_CALL +ScVbaUserForm::Show( ) throw (uno::RuntimeException) +{ + OSL_TRACE("ScVbaUserForm::Show( )"); + short aRet = 0; + mbDispose = true; + if ( m_xDialog.is() ) + aRet = m_xDialog->execute(); + OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); + if ( mbDispose ) + { + try + { + uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW ); + m_xDialog = NULL; + xComp->dispose(); + mbDispose = false; + } + catch( uno::Exception& ) + { + } + } +} + +rtl::OUString SAL_CALL +ScVbaUserForm::getCaption() throw (::com::sun::star::uno::RuntimeException) +{ + rtl::OUString sCaption; + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ) ) >>= sCaption; + return sCaption; +} +void +ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), uno::makeAny( _caption ) ); +} + +void SAL_CALL +ScVbaUserForm::Hide( ) throw (uno::RuntimeException) +{ + mbDispose = false; // hide not dispose + if ( m_xDialog.is() ) + m_xDialog->endExecute(); +} + +void SAL_CALL +ScVbaUserForm::RePaint( ) throw (uno::RuntimeException) +{ + // do nothing +} + +void SAL_CALL +ScVbaUserForm::UnloadObject( ) throw (uno::RuntimeException) +{ + mbDispose = true; + if ( m_xDialog.is() ) + m_xDialog->endExecute(); +} + +rtl::OUString& +ScVbaUserForm::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaUserForm") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaUserForm::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.UserForm" ) ); + } + return aServiceNames; +} + +uno::Reference< beans::XIntrospectionAccess > SAL_CALL +ScVbaUserForm::getIntrospection( ) throw (uno::RuntimeException) +{ + return uno::Reference< beans::XIntrospectionAccess >(); +} + +uno::Any SAL_CALL +ScVbaUserForm::invoke( const ::rtl::OUString& /*aFunctionName*/, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) +{ + throw uno::RuntimeException(); // unsupported operation +} + +void SAL_CALL +ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) +{ + uno::Any aObject = getValue( aPropertyName ); + // The Object *must* support XDefaultProperty here because getValue will + // only return properties that are Objects ( e.g. controls ) + // e.g. Userform1.aControl = something + // 'aControl' has to support XDefaultProperty to make sense here + uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW ); + rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName(); + uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) ); + uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW ); + xPropSet->setPropertyValue( aDfltPropName, aValue ); +} + +uno::Any SAL_CALL +ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException) +{ + uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); + ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); + pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); + return uno::makeAny( xVBAControl ); +} + +::sal_Bool SAL_CALL +ScVbaUserForm::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException) +{ + return sal_False; +} +uno::Any SAL_CALL +ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl ) ); + if ( index.hasValue() ) + return uno::makeAny( xControls->Item( index, uno::Any() ) ); + return uno::makeAny( xControls ); +} + +::sal_Bool SAL_CALL +ScVbaUserForm::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException) +{ + uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY ); + OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is() ); + if ( xControl.is() ) + { + uno::Reference< container::XNameAccess > xNameAccess( xControl->getModel(), uno::UNO_QUERY_THROW ); + sal_Bool bRes = xNameAccess->hasByName( aName ); + OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is(), bRes ); + return bRes; + } + return sal_False; +} + +namespace userform +{ +namespace sdecl = comphelper::service_decl; +sdecl::vba_service_class_ > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "ScVbaUserForm", + "ooo.vba.msforms.UserForm" ); +} + diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx new file mode 100644 index 000000000000..be93dc78eaa9 --- /dev/null +++ b/vbahelper/source/msforms/vbauserform.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_USERFORM_HXX +#define SC_VBA_USERFORM_HXX + +#include +#include +#include +#include + +#include +#include "vbacontrol.hxx" + +//typedef InheritedHelperInterfaceImpl1< ov::msforms::XUserForm > ScVbaUserForm_BASE; +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XUserForm > ScVbaUserForm_BASE; + +class ScVbaUserForm : public ScVbaUserForm_BASE +{ +private: + css::uno::Reference< css::awt::XDialog > m_xDialog; + bool mbDispose; +protected: +public: + ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException ); + virtual ~ScVbaUserForm(); + // XUserForm + virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException); + // XIntrospection + virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); + virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCaption() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL Hide( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL UnloadObject( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& index ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; +#endif diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk new file mode 100644 index 000000000000..bd57415ddec8 --- /dev/null +++ b/vbahelper/source/vbahelper/makefile.mk @@ -0,0 +1,80 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.45 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/../ +PRJNAME=vbahelper +TARGET=vbahelperbits + +ENABLE_EXCEPTIONS := TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +SLOFILES=\ + $(SLO)$/vbahelper.obj \ + $(SLO)$/vbapropvalue.obj \ + $(SLO)$/vbacommandbars.obj \ + $(SLO)$/vbacommandbar.obj \ + $(SLO)$/vbacommandbarcontrols.obj \ + $(SLO)$/vbacommandbarcontrol.obj \ + $(SLO)$/vbacommandbarhelper.obj \ + $(SLO)$/vbaapplicationbase.obj \ + $(SLO)$/vbawindowbase.obj \ + $(SLO)$/vbadocumentbase.obj \ + $(SLO)$/vbadocumentsbase.obj \ + $(SLO)$/vbaglobalbase.obj \ + $(SLO)$/vbafontbase.obj \ + $(SLO)$/vbadialogbase.obj \ + $(SLO)$/vbadialogsbase.obj \ + $(SLO)$/vbashape.obj \ + $(SLO)$/vbacolorformat.obj \ + $(SLO)$/vbashapes.obj \ + $(SLO)$/vbalineformat.obj \ + $(SLO)$/vbafillformat.obj \ + $(SLO)$/vbapictureformat.obj \ + $(SLO)$/vbashaperange.obj \ + $(SLO)$/vbatextframe.obj \ + $(SLO)$/vbapagesetupbase.obj \ + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + +ALLTAR : \ + $(MISC)$/$(TARGET).don \ + +$(SLOFILES) : $(MISC)$/$(TARGET).don + +$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb + +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@ + echo $@ + diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx new file mode 100644 index 000000000000..409e33f19167 --- /dev/null +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbahelper/vbaapplicationbase.hxx" +#include +#include +#include +#include +#include +#include +#include + +#include "vbacommandbars.hxx" +#include + +// start basic includes +#include +#include +#include +#include +#include +// end basic includes +using namespace com::sun::star; +using namespace ooo::vba; + +#define OFFICEVERSION "11.0" + +VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentContext >& xContext ) + : ApplicationBase_BASE( uno::Reference< XHelperInterface >(), xContext ) +{ +} + +VbaApplicationBase::~VbaApplicationBase() +{ +} + +sal_Bool SAL_CALL +VbaApplicationBase::getScreenUpdating() throw (uno::RuntimeException) +{ + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + return !xModel->hasControllersLocked(); +} + +void SAL_CALL +VbaApplicationBase::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException) +{ + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + if (bUpdate) + xModel->unlockControllers(); + else + xModel->lockControllers(); +} + +sal_Bool SAL_CALL +VbaApplicationBase::getDisplayStatusBar() throw (uno::RuntimeException) +{ + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); + + if( xProps.is() ){ + uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW ); + rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )); + if( xLayoutManager.is() && xLayoutManager->isElementVisible( url ) ){ + return sal_True; + } + } + return sal_False; +} + +void SAL_CALL +VbaApplicationBase::setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (uno::RuntimeException) +{ + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); + + if( xProps.is() ){ + uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW ); + rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )); + if( xLayoutManager.is() ){ + if( bDisplayStatusBar && !xLayoutManager->isElementVisible( url ) ){ + if( !xLayoutManager->showElement( url ) ) + xLayoutManager->createElement( url ); + return; + } + else if( !bDisplayStatusBar && xLayoutManager->isElementVisible( url ) ){ + xLayoutManager->hideElement( url ); + return; + } + } + } + return; +} + +uno::Any SAL_CALL +VbaApplicationBase::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + uno::Reference< XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext, uno::Reference< container::XIndexAccess >(), getCurrentDocument() ) ); + if( aIndex.hasValue() ) + return uno::makeAny( xCommandBars->Item( aIndex, uno::Any() ) ); + return uno::makeAny( xCommandBars ); +} + +::rtl::OUString SAL_CALL +VbaApplicationBase::getVersion() throw (uno::RuntimeException) +{ + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OFFICEVERSION)); +} + +void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException) +{ + VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName ); + if( aMacroInfo.IsResolved() ) + { + // handle the arguments + const uno::Any* aArgsPtrArray[] = { &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15, &varg16, &varg17, &varg18, &varg19, &varg20, &varg21, &varg22, &varg23, &varg24, &varg25, &varg26, &varg27, &varg28, &varg29, &varg30 }; + + int nArg = sizeof( aArgsPtrArray ) / sizeof( aArgsPtrArray[0] ); + uno::Sequence< uno::Any > aArgs( nArg ); + + const uno::Any** pArg = aArgsPtrArray; + const uno::Any** pArgEnd = ( aArgsPtrArray + nArg ); + + sal_Int32 nLastArgWithValue = 0; + sal_Int32 nArgProcessed = 0; + + for ( ; pArg != pArgEnd; ++pArg, ++nArgProcessed ) + { + aArgs[ nArgProcessed ] = **pArg; + if( (*pArg)->hasValue() ) + nLastArgWithValue = nArgProcessed; + } + + // resize array to position of last param with value + aArgs.realloc( nArgProcessed + 1 ); + + uno::Any aRet; + uno::Any aDummyCaller; + executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller ); + } + else + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The macro doesn't exist") ), uno::Reference< uno::XInterface >() ); + } +} + +float SAL_CALL VbaApplicationBase::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException) +{ + // i cm = 28.35 points + static const float rate = 28.35; + return ( _Centimeters * rate ); +} + +rtl::OUString& +VbaApplicationBase::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaApplicationBase") ); + return sImplName; +} +uno::Sequence +VbaApplicationBase::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VbaApplicationBase" ) ); + } + return aServiceNames; +} + +void VbaApplicationBase::Quit() throw (uno::RuntimeException) +{ + // need to stop basic + SbMethod* pMeth = StarBASIC::GetActiveMethod(); + if ( pMeth ) + { + SbModule* pMod = dynamic_cast< SbModule* >( pMeth->GetParent() ); + if ( pMod ) + { + StarBASIC* pBasic = dynamic_cast< StarBASIC* >( pMod->GetParent() ); + if ( pBasic ) + pBasic->QuitAndExitApplication(); + } + } +} diff --git a/vbahelper/source/vbahelper/vbacolorformat.cxx b/vbahelper/source/vbahelper/vbacolorformat.cxx new file mode 100644 index 000000000000..df918e9d15fc --- /dev/null +++ b/vbahelper/source/vbahelper/vbacolorformat.cxx @@ -0,0 +1,190 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbacolorformat.cxx,v $ + * $Revision: 1.3.146.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include "vbacolorformat.hxx" + +using namespace ooo::vba; +using namespace com::sun::star; + +sal_Int32 +MsoColorIndizes::getColorIndex( sal_Int32 nIndex ) +{ + const static sal_Int32 COLORINDIZES[56] = + { HAPICOLOR_BLACK, HAPICOLOR_WITHE, HAPICOLOR_RED, HAPICOLOR_BRIGHTGREEN, HAPICOLOR_BLUE, HAPICOLOR_YELLOW, HAPICOLOR_PINK, + HAPICOLOR_TURQUOISE, HAPICOLOR_DARKRED, HAPICOLOR_GREEN, HAPICOLOR_DARKBLUE, HAPICOLOR_DARKYELLOW, HAPICOLOR_VIOLET, + HAPICOLOR_TEAL, HAPICOLOR_GRAY_25_PERCENT, HAPICOLOR_GRAY_50_PERCENT, HAPICOLOR_PERIWINCKLE, HAPICOLOR_PLUM, + HAPICOLOR_IVORY, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_DARKPRUPLE, HAPICOLOR_CORAL, HAPICOLOR_OCEANBLUE, HAPICOLOR_ICEBLUE, + HAPICOLOR_GREEN, HAPICOLOR_PINK, HAPICOLOR_YELLOW, HAPICOLOR_TURQUOISE, HAPICOLOR_VIOLET, HAPICOLOR_DARKRED, HAPICOLOR_TEAL, + HAPICOLOR_BLUE, HAPICOLOR_SKYBLUE, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_LIGHTGREEN, HAPICOLOR_LIGHTYELLOW, HAPICOLOR_PALEBLUE, + HAPICOLOR_ROSE, HAPICOLOR_LAVENDER, HAPICOLOR_TAN, HAPICOLOR_LIGHTBLUE, HAPICOLOR_AQUA, HAPICOLOR_LIME, HAPICOLOR_GOLD, + HAPICOLOR_LIGHTORANGE, HAPICOLOR_ORANGE, HAPICOLOR_BLUEGRAY, HAPICOLOR_GRAY_40_PERCENT, HAPICOLOR_DARKTEAL, + HAPICOLOR_SEAGREEN, HAPICOLOR_NONAME, HAPICOLOR_OLIVEGREEN, HAPICOLOR_BROWN, HAPICOLOR_PLUM, HAPICOLOR_INDIGO, + HAPICOLOR_GRAY_80_PERCENT + }; + return COLORINDIZES[nIndex]; +} +ScVbaColorFormat::ScVbaColorFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XHelperInterface > xInternalParent, const uno::Reference< drawing::XShape > xShape, const sal_Int16 nColorFormatType ) : ScVbaColorFormat_BASE( xParent, xContext ), m_xInternalParent( xInternalParent ), m_xShape( xShape ), m_nColorFormatType( nColorFormatType ) +{ + m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); + m_nFillFormatBackColor = 0; + try + { + uno::Reference< ov::msforms::XFillFormat > xFillFormat( xInternalParent, uno::UNO_QUERY_THROW ); + m_pFillFormat = ( ScVbaFillFormat* )( xFillFormat.get() ); + }catch ( uno::RuntimeException e ) + { + m_pFillFormat = NULL; + } +} + +void +ScVbaColorFormat::setColorFormat( sal_Int16 _ntype ) +{ + m_nColorFormatType = _ntype; +} + +// Attribute +sal_Int32 SAL_CALL +ScVbaColorFormat::getRGB() throw (uno::RuntimeException) +{ + sal_Int32 nRGB = 0; + switch( m_nColorFormatType ) + { + case ColorFormatType::LINEFORMAT_FORECOLOR: + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LineColor") ) >>= nRGB; + break; + case ColorFormatType::LINEFORMAT_BACKCOLOR: + //TODO BackColor not supported + // m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("Color"), uno::makeAny( nRGB ) ); + break; + case ColorFormatType::FILLFORMAT_FORECOLOR: + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillColor") ) >>= nRGB; + break; + case ColorFormatType::FILLFORMAT_BACKCOLOR: + nRGB = m_nFillFormatBackColor; + break; + default: + throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); + } + nRGB = OORGBToXLRGB( nRGB ); + return nRGB; +} + +void SAL_CALL +ScVbaColorFormat::setRGB( sal_Int32 _rgb ) throw (uno::RuntimeException) +{ + sal_Int32 nRGB = XLRGBToOORGB( _rgb ); + switch( m_nColorFormatType ) + { + case ColorFormatType::LINEFORMAT_FORECOLOR: + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineColor" ), uno::makeAny( nRGB ) ); + break; + case ColorFormatType::LINEFORMAT_BACKCOLOR: + // TODO BackColor not supported + break; + case ColorFormatType::FILLFORMAT_FORECOLOR: + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor" ), uno::makeAny( nRGB ) ); + if( m_pFillFormat ) + { + m_pFillFormat->setForeColorAndInternalStyle(nRGB); + } + break; + case ColorFormatType::FILLFORMAT_BACKCOLOR: + m_nFillFormatBackColor = nRGB; + if( m_pFillFormat ) + { + m_pFillFormat->setForeColorAndInternalStyle(nRGB); + } + break; + default: + throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); + } +} + +sal_Int32 SAL_CALL +ScVbaColorFormat::getSchemeColor() throw (uno::RuntimeException) +{ + sal_Int32 nColor = getRGB(); + // #TODO I guess the number of elements is determined by the correct scheme + // the implementation here seems to be a rehash of color index ( which seems to be a + // different thing ) - I would guess we need to know/import etc. the correct color scheme + // or at least find out a little more + sal_Int32 i = 0; + for( ; i < 56; i++ ) + { + if( nColor == MsoColorIndizes::getColorIndex(i) ) + break; + } + + if( i == 56 ) // this is most likely an error condition + --i; + return i; + // #TODO figure out what craziness is this, + // the 56 colors seems incorrect, as in default XL ( 2003 ) there are 80 colors +/* + if( i == 56 ) + { + i = -2; + } + + return ( i + 2 ); +*/ +} + +void SAL_CALL +ScVbaColorFormat::setSchemeColor( sal_Int32 _schemecolor ) throw (uno::RuntimeException) +{ + // the table is 0 based + sal_Int32 nColor = MsoColorIndizes::getColorIndex( _schemecolor ); + // nColor is already xl RGB + setRGB( nColor ); +} + + +rtl::OUString& +ScVbaColorFormat::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaColorFormat") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaColorFormat::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ColorFormat" ) ); + } + return aServiceNames; +} + diff --git a/vbahelper/source/vbahelper/vbacolorformat.hxx b/vbahelper/source/vbahelper/vbacolorformat.hxx new file mode 100644 index 000000000000..cb53c130b173 --- /dev/null +++ b/vbahelper/source/vbahelper/vbacolorformat.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbacolorformat.hxx,v $ + * $Revision: 1.3.146.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_XCOLORFORMAT_HXX +#define SC_VBA_XCOLORFORMAT_HXX + +#include +#include +#include +#include +#include "vbafillformat.hxx" + +typedef InheritedHelperInterfaceImpl1< ov::msforms::XColorFormat > ScVbaColorFormat_BASE; + +class ColorFormatType +{ +public: + const static sal_Int16 LINEFORMAT_FORECOLOR = 1; + const static sal_Int16 LINEFORMAT_BACKCOLOR = 2; + const static sal_Int16 FILLFORMAT_FORECOLOR = 3; + const static sal_Int16 FILLFORMAT_BACKCOLOR = 4; + const static sal_Int16 THREEDFORMAT_EXTRUSIONCOLOR = 5; +}; + +struct MsoColorIndizes +{ + const static sal_Int32 HAPICOLOR_BLACK = 0; + const static sal_Int32 HAPICOLOR_WITHE = 16777215; + const static sal_Int32 HAPICOLOR_RED = 16711680; + const static sal_Int32 HAPICOLOR_BRIGHTGREEN = 65280; + const static sal_Int32 HAPICOLOR_BLUE = 255; + const static sal_Int32 HAPICOLOR_YELLOW = 16776960; + const static sal_Int32 HAPICOLOR_PINK = 16711935; + const static sal_Int32 HAPICOLOR_TURQUOISE = 65535; + const static sal_Int32 HAPICOLOR_DARKRED = 8388608; + const static sal_Int32 HAPICOLOR_GREEN = 32768; + const static sal_Int32 HAPICOLOR_DARKBLUE = 128; + const static sal_Int32 HAPICOLOR_DARKYELLOW = 8421376; + const static sal_Int32 HAPICOLOR_VIOLET = 8388736; + const static sal_Int32 HAPICOLOR_TEAL = 32896; + const static sal_Int32 HAPICOLOR_GRAY_25_PERCENT = 12632256; + const static sal_Int32 HAPICOLOR_GRAY_50_PERCENT = 8421504; + const static sal_Int32 HAPICOLOR_PERIWINCKLE = 10066431; + const static sal_Int32 HAPICOLOR_PLUM = 10040166; + const static sal_Int32 HAPICOLOR_IVORY = 16777164; + const static sal_Int32 HAPICOLOR_LIGHTTURQUOISE = 13434879; + const static sal_Int32 HAPICOLOR_DARKPRUPLE = 6684774; + const static sal_Int32 HAPICOLOR_CORAL = 16744576; + const static sal_Int32 HAPICOLOR_OCEANBLUE = 26316; + const static sal_Int32 HAPICOLOR_ICEBLUE = 13421823; + const static sal_Int32 HAPICOLOR_SKYBLUE = 52479; + const static sal_Int32 HAPICOLOR_LIGHTGREEN = 13434828; + const static sal_Int32 HAPICOLOR_LIGHTYELLOW = 16777113; + const static sal_Int32 HAPICOLOR_PALEBLUE = 10079487; + const static sal_Int32 HAPICOLOR_ROSE = 16751052; + const static sal_Int32 HAPICOLOR_LAVENDER = 13408767; + const static sal_Int32 HAPICOLOR_TAN = 16764057; + const static sal_Int32 HAPICOLOR_LIGHTBLUE = 3368703; + const static sal_Int32 HAPICOLOR_AQUA = 3394764; + const static sal_Int32 HAPICOLOR_LIME = 10079232; + const static sal_Int32 HAPICOLOR_GOLD = 16763904; + const static sal_Int32 HAPICOLOR_LIGHTORANGE = 16750848; + const static sal_Int32 HAPICOLOR_ORANGE = 16737792; + const static sal_Int32 HAPICOLOR_BLUEGRAY = 6710937; + const static sal_Int32 HAPICOLOR_GRAY_40_PERCENT = 9868950; + const static sal_Int32 HAPICOLOR_DARKTEAL = 13158; + const static sal_Int32 HAPICOLOR_SEAGREEN = 3381606; + const static sal_Int32 HAPICOLOR_NONAME = 13056; + const static sal_Int32 HAPICOLOR_OLIVEGREEN = 3355392; + const static sal_Int32 HAPICOLOR_BROWN = 10040064; + const static sal_Int32 HAPICOLOR_INDIGO = 3355545; + const static sal_Int32 HAPICOLOR_GRAY_80_PERCENT = 3355443; + + static sal_Int32 getColorIndex( sal_Int32 nIndex ); + +}; + +class ScVbaColorFormat : public ScVbaColorFormat_BASE +{ +private: + css::uno::Reference< ov::XHelperInterface > m_xInternalParent; + css::uno::Reference< css::drawing::XShape > m_xShape; + css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; + ScVbaFillFormat *m_pFillFormat; + sal_Int16 m_nColorFormatType; + sal_Int32 m_nFillFormatBackColor; +protected: + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + void setColorFormat( sal_Int16 nType ); +public: + ScVbaColorFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XHelperInterface > xInternalParent, const css::uno::Reference< css::drawing::XShape > xShape, const sal_Int16 nColorFormatType ); + + // Attributes + virtual sal_Int32 SAL_CALL getRGB() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRGB( sal_Int32 _rgb ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSchemeColor() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSchemeColor( sal_Int32 _schemecolor ) throw (css::uno::RuntimeException); + +}; + +#endif//SC_VBA_XCOLORFORMAT_HXX diff --git a/vbahelper/source/vbahelper/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx new file mode 100644 index 000000000000..84ec5ea4c242 --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbar.cxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbacommandbar.hxx" +#include "vbacommandbarcontrols.hxx" +#include +#include +#include +#include +#include +#include +#include + +using namespace com::sun::star; +using namespace ooo::vba; + +ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Bool bIsMenu, sal_Bool bTemporary ) throw( uno::RuntimeException ) : CommandBar_BASE( xParent, xContext ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl ), m_bIsMenu( bIsMenu ), m_bTemporary( bTemporary ) +{ +} + +::rtl::OUString SAL_CALL +ScVbaCommandBar::getName() throw ( uno::RuntimeException ) +{ + // This will get a "NULL length string" when Name is not set. + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); + uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ); + rtl::OUString sName; + aName >>= sName; + if( sName.getLength() < 1 ) + { + if( m_bIsMenu ) + { + if( m_sResourceUrl.equalsAscii( ITEM_MENUBAR_URL ) ) + { + if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.sheet.SpreadsheetDocument") ) + sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Worksheet Menu Bar") ); + else if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") ) + sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Menu Bar") ); + return sName; + } + } + // Toolbar name + uno::Reference< container::XNameAccess > xNameAccess = pCBarHelper->getPersistentWindowState(); + if( xNameAccess->hasByName( m_sResourceUrl ) ) + { + uno::Sequence< beans::PropertyValue > aToolBar; + xNameAccess->getByName( m_sResourceUrl ) >>= aToolBar; + getPropertyValue( aToolBar, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ) ) >>= sName; + } + } + return sName; +} +void SAL_CALL +ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); + xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("UIName"), uno::makeAny( _name ) ); + + pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings ); +} +::sal_Bool SAL_CALL +ScVbaCommandBar::getVisible() throw (uno::RuntimeException) +{ + // menu bar is allways visible in OOo + if( m_bIsMenu ) + return sal_True; + + sal_Bool bVisible = sal_False; + try + { + uno::Reference< container::XNameAccess > xNameAccess = pCBarHelper->getPersistentWindowState(); + if( xNameAccess->hasByName( m_sResourceUrl ) ) + { + uno::Sequence< beans::PropertyValue > aToolBar; + xNameAccess->getByName( m_sResourceUrl ) >>= aToolBar; + getPropertyValue( aToolBar, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ) >>= bVisible; + } + } + catch ( uno::Exception e ) + { + } + return bVisible; +} +void SAL_CALL +ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException) +{ + try + { + uno::Reference< frame::XLayoutManager > xLayoutManager = pCBarHelper->getLayoutManager(); + if( _visible ) + { + xLayoutManager->createElement( m_sResourceUrl ); + xLayoutManager->showElement( m_sResourceUrl ); + } + else + { + xLayoutManager->hideElement( m_sResourceUrl ); + xLayoutManager->destroyElement( m_sResourceUrl ); + } + } + catch( uno::Exception e ) + { + OSL_TRACE( "SetVisible get an exception\n" ); + } +} + +::sal_Bool SAL_CALL +ScVbaCommandBar::getEnabled() throw (uno::RuntimeException) +{ + // emulated with Visible + return getVisible(); +} + +void SAL_CALL +ScVbaCommandBar::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException) +{ + // emulated with Visible + setVisible( _enabled ); +} + +void SAL_CALL +ScVbaCommandBar::Delete( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + pCBarHelper->removeSettings( m_sResourceUrl ); + uno::Reference< container::XNameContainer > xNameContainer( pCBarHelper->getPersistentWindowState(), uno::UNO_QUERY_THROW ); + if( xNameContainer->hasByName( m_sResourceUrl ) ) + { + xNameContainer->removeByName( m_sResourceUrl ); + } +} +uno::Any SAL_CALL +ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException) +{ + uno::Reference< awt::XMenu > xMenu; + if( m_bIsMenu ) + { + uno::Reference< frame::XLayoutManager > xLayoutManager = pCBarHelper->getLayoutManager(); + uno::Reference< beans::XPropertySet > xPropertySet( xLayoutManager->getElement( m_sResourceUrl ), uno::UNO_QUERY_THROW ); + xMenu.set( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("XMenuBar") ), uno::UNO_QUERY ); + } + uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, m_xBarSettings, pCBarHelper, m_xBarSettings, m_sResourceUrl, xMenu ) ); + if( aIndex.hasValue() ) + { + return xCommandBarControls->Item( aIndex, uno::Any() ); + } + return uno::makeAny( xCommandBarControls ); +} + +sal_Int32 SAL_CALL +ScVbaCommandBar::Type() throw (script::BasicErrorException, uno::RuntimeException) +{ + // #FIXME support msoBarTypePopup + sal_Int32 nType = office::MsoBarType::msoBarTypePopup; + nType = m_bIsMenu? office::MsoBarType::msoBarTypeNormal : office::MsoBarType::msoBarTypeMenuBar; + return nType; +} + +uno::Any SAL_CALL +ScVbaCommandBar::FindControl( const uno::Any& /*aType*/, const uno::Any& /*aId*/, const uno::Any& /*aTag*/, const uno::Any& /*aVisible*/, const uno::Any& /*aRecursive*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // alwayse fail to find control + return uno::makeAny( uno::Reference< XCommandBarControl > () ); +} + +rtl::OUString& +ScVbaCommandBar::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBar") ); + return sImplName; +} +uno::Sequence +ScVbaCommandBar::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBar" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/vbahelper/vbacommandbar.hxx b/vbahelper/source/vbahelper/vbacommandbar.hxx new file mode 100644 index 000000000000..edecba273f07 --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbar.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_COMMANDBAR_HXX +#define SC_VBA_COMMANDBAR_HXX + +#include +#include +#include +#include +#include + +#include +#include "vbacommandbarhelper.hxx" + +#include + +typedef InheritedHelperInterfaceImpl1< ov::XCommandBar > CommandBar_BASE; + +class ScVbaCommandBar : public CommandBar_BASE +{ +private: + VbaCommandBarHelperRef pCBarHelper; + css::uno::Reference< css::container::XIndexAccess > m_xBarSettings; + rtl::OUString m_sResourceUrl; + sal_Bool m_bIsMenu; + sal_Bool m_bTemporary; + +public: + ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Bool bIsMenu, sal_Bool bTemporary = sal_True ) throw( css::uno::RuntimeException ); + + sal_Bool IsMenu() { return m_bIsMenu; } + + // Attributes + virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); + virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException); + + // Methods + virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; +#endif//SC_VBA_COMMANDBAR_HXX diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx new file mode 100644 index 000000000000..6c0b3b4e7f2c --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx @@ -0,0 +1,259 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbacommandbarcontrol.hxx" +#include "vbacommandbarcontrols.hxx" +#include +#include + +using namespace com::sun::star; +using namespace ooo::vba; + +ScVbaCommandBarControl::ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), pCBarHelper( pHelper ), m_sResourceUrl( sResourceUrl ), m_xCurrentSettings( xSettings ), m_xBarSettings( xBarSettings ), m_nPosition( 0 ), m_bTemporary( sal_True ) +{ +} + +ScVbaCommandBarControl::ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), pCBarHelper( pHelper ), m_sResourceUrl( sResourceUrl ), m_xCurrentSettings( xSettings ), m_xBarSettings( xBarSettings ), m_nPosition( nPosition ), m_bTemporary( bTemporary ) +{ + m_xCurrentSettings->getByIndex( nPosition ) >>= m_aPropertyValues; +} + +void ScVbaCommandBarControl::ApplyChange() throw ( uno::RuntimeException ) +{ + uno::Reference< container::XIndexContainer > xIndexContainer( m_xCurrentSettings, uno::UNO_QUERY_THROW ); + xIndexContainer->replaceByIndex( m_nPosition, uno::makeAny( m_aPropertyValues ) ); + pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings ); +} + +::rtl::OUString SAL_CALL +ScVbaCommandBarControl::getCaption() throw ( uno::RuntimeException ) +{ + // "Label" always empty + rtl::OUString sCaption; + getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption; + return sCaption; +} + +void SAL_CALL +ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException) +{ + rtl::OUString sCaption = _caption.replace('&','~'); + setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("Label"), uno::makeAny( sCaption ) ); + ApplyChange(); +} + +::rtl::OUString SAL_CALL +ScVbaCommandBarControl::getOnAction() throw (uno::RuntimeException) +{ + rtl::OUString sCommandURL; + getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") ) >>= sCommandURL; + return sCommandURL; +} + +void SAL_CALL +ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException) +{ + // get the current model + uno::Reference< frame::XModel > xModel( pCBarHelper->getModel() ); + VBAMacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( xModel ), _onaction, true ); + if ( aResolvedMacro.IsResolved() ) + { + rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.ResolvedMacro() ); + OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() ); + setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) ); + ApplyChange(); + } +} + +::sal_Bool SAL_CALL +ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException) +{ + sal_Bool bVisible = sal_True; + uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") ); + if( aValue.hasValue() ) + aValue >>= bVisible; + return bVisible; +} +void SAL_CALL +ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException) +{ + uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") ); + if( aValue.hasValue() ) + { + setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible"), uno::makeAny( _visible ) ); + ApplyChange(); + } +} + +::sal_Bool SAL_CALL +ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException) +{ + sal_Bool bEnabled = sal_True; + if( m_xParentMenu.is() ) + { + // currently only the menu in the MenuBat support Enable/Disable + // FIXME: how to support the menu item in Toolbar + bEnabled = m_xParentMenu->isItemEnabled( m_xParentMenu->getItemId( m_nPosition ) ); + } + else + { + // emulated with Visible + bEnabled = getVisible(); + } + return bEnabled; +} + +void SAL_CALL +ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException) +{ + if( m_xParentMenu.is() ) + { + // currently only the menu in the MenuBat support Enable/Disable + m_xParentMenu->enableItem( m_xParentMenu->getItemId( m_nPosition ), _enabled ); + } + else + { + // emulated with Visible + setVisible( _enabled ); + } +} + +void SAL_CALL +ScVbaCommandBarControl::Delete( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + if( m_xCurrentSettings.is() ) + { + uno::Reference< container::XIndexContainer > xIndexContainer( m_xCurrentSettings, uno::UNO_QUERY_THROW ); + xIndexContainer->removeByIndex( m_nPosition ); + + pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings ); + } +} + +uno::Any SAL_CALL +ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // only Popup Menu has controls + uno::Reference< container::XIndexAccess > xSubMenu; + getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu; + if( !xSubMenu.is() ) + throw uno::RuntimeException(); + + uno::Reference< awt::XMenu > xMenu; + if( m_xParentMenu.is() ) + { + sal_Int32 nItemId = m_xParentMenu->getItemId( m_nPosition ); + xMenu.set( m_xParentMenu->getPopupMenu( nItemId ), uno::UNO_QUERY ); + } + + uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, xSubMenu, pCBarHelper, m_xBarSettings, m_sResourceUrl, xMenu ) ); + if( aIndex.hasValue() ) + { + return xCommandBarControls->Item( aIndex, uno::Any() ); + } + return uno::makeAny( xCommandBarControls ); +} + +rtl::OUString& +ScVbaCommandBarControl::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControl") ); + return sImplName; +} + +uno::Sequence +ScVbaCommandBarControl::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControl" ) ); + } + return aServiceNames; +} + +//////////// ScVbaCommandBarPopup ////////////////////////////// +ScVbaCommandBarPopup::ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl ) +{ + m_nPosition = nPosition; + m_bTemporary = bTemporary; + m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues; + m_xParentMenu = xMenu; +} + +rtl::OUString& +ScVbaCommandBarPopup::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarPopup") ); + return sImplName; +} +uno::Sequence +ScVbaCommandBarPopup::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarPopup" ) ); + } + return aServiceNames; +} + +//////////// ScVbaCommandBarButton ////////////////////////////// +ScVbaCommandBarButton::ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl ) +{ + m_nPosition = nPosition; + m_bTemporary = bTemporary; + m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues; + m_xParentMenu = xMenu; +} + +rtl::OUString& +ScVbaCommandBarButton::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarButton") ); + return sImplName; +} +uno::Sequence +ScVbaCommandBarButton::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarButton" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx new file mode 100644 index 000000000000..e3beccfebdc2 --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_COMMANDBARCONTROL_HXX +#define SC_VBA_COMMANDBARCONTROL_HXX + +#include +#include +#include +#include +#include +#include +#include "vbacommandbarhelper.hxx" +#include + +typedef InheritedHelperInterfaceImpl1< ov::XCommandBarControl > CommandBarControl_BASE; + +class ScVbaCommandBarControl : public CommandBarControl_BASE +{ +protected: + VbaCommandBarHelperRef pCBarHelper; + rtl::OUString m_sResourceUrl; + css::uno::Reference< css::container::XIndexAccess > m_xCurrentSettings; + css::uno::Reference< css::container::XIndexAccess > m_xBarSettings; + css::uno::Sequence< css::beans::PropertyValue > m_aPropertyValues; + css::uno::Reference< css::awt::XMenu > m_xParentMenu; + + sal_Int32 m_nPosition; + sal_Bool m_bTemporary; + +private: + void ApplyChange() throw (css::uno::RuntimeException); + +public: + ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException); + ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException); + + // Attributes + virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException); + virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); + virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException) + { + return ov::office::MsoControlType::msoControlButton; + } + + // Methods + virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + +typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPopup > CommandBarPopup_BASE; +class ScVbaCommandBarPopup : public CommandBarPopup_BASE +{ +public: + ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException) + { + return ov::office::MsoControlType::msoControlPopup; + } + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + +typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarButton > CommandBarButton_BASE; +class ScVbaCommandBarButton : public CommandBarButton_BASE +{ +public: + ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException) + { + return ov::office::MsoControlType::msoControlButton; + } + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + +#endif//SC_VBA_COMMANDBARCONTROL_HXX diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx new file mode 100644 index 000000000000..3c0b022ebe3c --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbacommandbarcontrols.hxx" +#include "vbacommandbarcontrol.hxx" + +using namespace com::sun::star; +using namespace ooo::vba; + +typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnumeration_BASE; +class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE +{ + //uno::Reference< uno::XComponentContext > m_xContext; + ScVbaCommandBarControls* m_pCommandBarControls; + sal_Int32 m_nCurrentPosition; +public: + CommandBarControlEnumeration( ScVbaCommandBarControls* pCommandBarControls ) : m_pCommandBarControls( pCommandBarControls ), m_nCurrentPosition( 0 ) {} + virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException ) + { + if( m_nCurrentPosition < m_pCommandBarControls->getCount() ) + return sal_True; + return sal_False; + } + virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) + { + if( hasMoreElements() ) + { + return m_pCommandBarControls->createCollectionObject( uno::makeAny( m_nCurrentPosition++ ) ); + } + else + throw container::NoSuchElementException(); + } +}; + +ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess>& xIndexAccess, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess>& xBarSettings, const rtl::OUString& sResourceUrl, const uno::Reference< awt::XMenu >& xMenu ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl ), m_xMenu( xMenu ) +{ + m_bIsMenu = sResourceUrl.equalsAscii( ITEM_MENUBAR_URL ) ? sal_True : sal_False; +} + +uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const uno::Any& aSubMenu ) +{ + uno::Sequence< beans::PropertyValue > aProps(5); + + aProps[0].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_COMMANDURL ); + aProps[0].Value <<= sCommandURL; + aProps[1].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_HELPURL ); + aProps[1].Value <<= sHelpURL; + aProps[2].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_LABEL ); + aProps[2].Value <<= sLabel; + aProps[3].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_TYPE ); + aProps[3].Value <<= nType; + aProps[4].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ); + aProps[4].Value = aSubMenu; + + return aProps; +} + +uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateToolbarItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const uno::Any& aSubMenu, sal_Bool isVisible, sal_Int32 nStyle ) +{ + uno::Sequence< beans::PropertyValue > aProps(7); + + aProps[0].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_COMMANDURL ); + aProps[0].Value <<= sCommandURL; + aProps[1].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_HELPURL ); + aProps[1].Value <<= sHelpURL; + aProps[2].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_LABEL ); + aProps[2].Value <<= sLabel; + aProps[3].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_TYPE ); + aProps[3].Value <<= nType; + aProps[4].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ); + aProps[4].Value = aSubMenu; + aProps[5].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE ); + aProps[5].Value <<= isVisible; + aProps[6].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_STYLE ); + aProps[6].Value <<= nStyle; + + return aProps; +} + +// XEnumerationAccess +uno::Type SAL_CALL +ScVbaCommandBarControls::getElementType() throw ( uno::RuntimeException ) +{ + return XCommandBarControl::static_type( 0 ); +} + +uno::Reference< container::XEnumeration > +ScVbaCommandBarControls::createEnumeration() throw ( uno::RuntimeException ) +{ + return uno::Reference< container::XEnumeration >( new CommandBarControlEnumeration( this ) ); +} + +uno::Any +ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource ) +{ + sal_Int32 nPosition = -1; + aSource >>= nPosition; + uno::Sequence< beans::PropertyValue > aProps; + m_xIndexAccess->getByIndex( nPosition ) >>= aProps; + uno::Reference< container::XIndexAccess > xSubMenu; + getPropertyValue( aProps, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu; + ScVbaCommandBarControl* pNewCommandBarControl = NULL; + if( xSubMenu.is() ) + pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True, m_xMenu ); + else + pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True, m_xMenu ); + + return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) ); +} + +// Methods +uno::Any SAL_CALL +ScVbaCommandBarControls::Item( const uno::Any& aIndex, const uno::Any& /*aIndex*/ ) throw (uno::RuntimeException) +{ + sal_Int32 nPosition = -1; + if( aIndex.getValueTypeClass() == uno::TypeClass_STRING ) + { + rtl::OUString sName; + aIndex >>= sName; + nPosition = VbaCommandBarHelper::findControlByName( m_xIndexAccess, sName ); + } + else + { + aIndex >>= nPosition; + } + + if( nPosition < 0 || nPosition >= getCount() ) + { + throw uno::RuntimeException(); + } + + return createCollectionObject( uno::makeAny( nPosition ) ); +} + +uno::Reference< XCommandBarControl > SAL_CALL +ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const uno::Any& Parameter, const uno::Any& Before, const uno::Any& Temporary ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // Parameter is not supported + // the following name needs to be individually created; + rtl::OUString sLabel( rtl::OUString::createFromAscii("Custom") ); + rtl::OUString sCommandUrl = rtl::OUString::createFromAscii( CUSTOM_MENU_STR ) + sLabel; + sal_Int32 nType = office::MsoControlType::msoControlButton; + sal_Int32 nPosition = 0; + sal_Bool bTemporary = sal_True; + + if( Type.hasValue() ) + { + Type >>= nType; + } + + if( nType != office::MsoControlType::msoControlButton && + nType != office::MsoControlType::msoControlPopup ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + + if( Id.hasValue() || Parameter.hasValue( ) ) + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + } + + if( Before.hasValue() ) + Before >>= nPosition; + else + nPosition = m_xIndexAccess->getCount(); + + if( Temporary.hasValue() ) + Temporary >>= bTemporary; + + uno::Any aSubMenu; + if( nType == office::MsoControlType::msoControlPopup ) + { + // it is a Popmenu + uno::Reference< lang::XSingleComponentFactory > xSCF( m_xBarSettings, uno::UNO_QUERY_THROW ); + aSubMenu <<= xSCF->createInstanceWithContext( mxContext ); + } + + // create control + uno::Sequence< beans::PropertyValue > aProps; + rtl::OUString sHelpUrl; + sal_Int32 nItemType = 0; + if( IsMenu() ) + { + aProps = CreateMenuItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu ); + } + else + { + sal_Bool isVisible = sal_True; + sal_Int32 nStyle = 0; + aProps = CreateToolbarItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu, isVisible, nStyle ); + } + + + uno::Reference< container::XIndexContainer > xIndexContainer( m_xIndexAccess, uno::UNO_QUERY_THROW ); + xIndexContainer->insertByIndex( nPosition, uno::makeAny( aProps ) ); + + pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings ); + + // sometimes it would crash if passing m_xMenu instead of uno::Reference< awt::XMenu >() in Linux. + ScVbaCommandBarControl* pNewCommandBarControl = NULL; + if( nType == office::MsoControlType::msoControlPopup ) + pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary, uno::Reference< awt::XMenu >() ); + else + pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary, uno::Reference< awt::XMenu >() ); + + return uno::Reference< XCommandBarControl >( pNewCommandBarControl ); +} + +// XHelperInterface +rtl::OUString& +ScVbaCommandBarControls::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControls") ); + return sImplName; +} +uno::Sequence +ScVbaCommandBarControls::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControls" ) ); + } + return aServiceNames; +} + diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx new file mode 100644 index 000000000000..43897b763147 --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_COMMANDBARCONTROLS_HXX +#define SC_VBA_COMMANDBARCONTROLS_HXX + +#include +#include +#include +#include +#include "vbacommandbarhelper.hxx" + +typedef CollTestImplHelper< ov::XCommandBarControls > CommandBarControls_BASE; + +class ScVbaCommandBarControls : public CommandBarControls_BASE +{ +private: + VbaCommandBarHelperRef pCBarHelper; + css::uno::Reference< css::container::XIndexAccess > m_xBarSettings; + rtl::OUString m_sResourceUrl; + css::uno::Reference< css::awt::XMenu > m_xMenu; + sal_Bool m_bIsMenu; + + css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu ); + css::uno::Sequence< css::beans::PropertyValue > CreateToolbarItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu, sal_Bool isVisible, sal_Int32 nStyle ); + +public: + ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw( css::uno::RuntimeException ); + sal_Bool IsMenu(){ return m_bIsMenu; } + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + + // Methods + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::XCommandBarControl > SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& Id, const css::uno::Any& Parameter, const css::uno::Any& Before, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + +#endif//SC_VBA_COMMANDBARCONTROLS_HXX diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx new file mode 100644 index 000000000000..374cc4bc72b3 --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx @@ -0,0 +1,282 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbacommandbarhelper.hxx" +#include +#include +#include +#include +#include +#ifndef _COM_SUN_STAR_UI_UIElementType_HPP_ +#include +#endif +#include +#include +#include +#include + +using namespace com::sun::star; +using namespace ooo::vba; + +#define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr) + +typedef std::map< rtl::OUString, rtl::OUString > MSO2OOCommandbarMap; + +class MSO2OOCommandbarHelper +{ +private: + static MSO2OOCommandbarHelper* pMSO2OOCommandbarHelper; + MSO2OOCommandbarMap maBuildinToolbarMap; + + MSO2OOCommandbarHelper() + { + // Buildin toolbars + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Standard"),CREATEOUSTRING("private:resource/toolbar/standardbar") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Formatting"),CREATEOUSTRING("private:resource/toolbar/formatobjectbar") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Drawing"),CREATEOUSTRING("private:resource/toolbar/drawbar") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Toolbar List"),CREATEOUSTRING("private:resource/toolbar/toolbar") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Forms"),CREATEOUSTRING("private:resource/toolbar/formcontrols") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Form Controls"),CREATEOUSTRING("private:resource/toolbar/formcontrols") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Full Screen"),CREATEOUSTRING("private:resource/toolbar/fullscreenbar") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Chart"),CREATEOUSTRING("private:resource/toolbar/flowchartshapes") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Picture"),CREATEOUSTRING("private:resource/toolbar/graphicobjectbar") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("WordArt"),CREATEOUSTRING("private:resource/toolbar/fontworkobjectbar") ) ); + maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("3-D Settings"),CREATEOUSTRING("private:resource/toolbar/extrusionobjectbar") ) ); + } + +public: + virtual ~MSO2OOCommandbarHelper() {}; + static MSO2OOCommandbarHelper* getMSO2OOCommandbarHelper() + { + if( pMSO2OOCommandbarHelper == NULL ) + { + pMSO2OOCommandbarHelper = new MSO2OOCommandbarHelper(); + } + return pMSO2OOCommandbarHelper; + } + + rtl::OUString findBuildinToolbar( const rtl::OUString& sToolbarName ) + { + MSO2OOCommandbarMap::iterator it = maBuildinToolbarMap.begin(); + for(; it != maBuildinToolbarMap.end(); it++ ) + { + rtl::OUString sName = it->first; + if( sName.equalsIgnoreAsciiCase( sToolbarName ) ) + return it->second; + } + return rtl::OUString(); + } +}; + +MSO2OOCommandbarHelper* MSO2OOCommandbarHelper::pMSO2OOCommandbarHelper = NULL; + + +VbaCommandBarHelper::VbaCommandBarHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException) : mxContext( xContext ), mxModel( xModel ) +{ + Init(); +} + +void VbaCommandBarHelper::Init( ) throw (css::uno::RuntimeException) +{ + uno::Reference< css::ui::XUIConfigurationManagerSupplier > xUICfgSupplier( mxModel, uno::UNO_QUERY_THROW ); + m_xDocCfgMgr = xUICfgSupplier->getUIConfigurationManager(); + + uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel, uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument") ) ) ) + { + maModuleId = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument") ); + } + else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) ) + { + maModuleId = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument") ); + } + + if( maModuleId.getLength() == 0 ) + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + } + + uno::Reference< lang::XMultiServiceFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + + css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUICfgMgrSupp( xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ))), uno::UNO_QUERY_THROW ); + + m_xAppCfgMgr.set( xUICfgMgrSupp->getUIConfigurationManager( maModuleId ), uno::UNO_QUERY_THROW ); + + css::uno::Reference< css::container::XNameAccess > xNameAccess( xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.WindowStateConfiguration" ))), uno::UNO_QUERY_THROW ); + + m_xWindowState.set( xNameAccess->getByName( maModuleId ), uno::UNO_QUERY_THROW ); +} + +css::uno::Reference< css::container::XIndexAccess > VbaCommandBarHelper::getSettings( const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException) +{ + if( m_xDocCfgMgr->hasSettings( sResourceUrl ) ) + return m_xDocCfgMgr->getSettings( sResourceUrl, sal_True ); + else if( m_xAppCfgMgr->hasSettings( sResourceUrl ) ) + return m_xAppCfgMgr->getSettings( sResourceUrl, sal_True ); + else + { + css::uno::Reference< css::container::XIndexAccess > xSettings( m_xAppCfgMgr->createSettings( ), uno::UNO_QUERY_THROW ); + return xSettings; + } +} + +void VbaCommandBarHelper::removeSettings( const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException) +{ + if( m_xDocCfgMgr->hasSettings( sResourceUrl ) ) + m_xDocCfgMgr->removeSettings( sResourceUrl ); + else if( m_xAppCfgMgr->hasSettings( sResourceUrl ) ) + m_xAppCfgMgr->removeSettings( sResourceUrl ); + + // persistChanges(); +} + +void VbaCommandBarHelper::ApplyChange( const rtl::OUString& sResourceUrl, const css::uno::Reference< css::container::XIndexAccess >& xSettings, sal_Bool bTemporary ) throw (css::uno::RuntimeException) +{ + if( m_xDocCfgMgr->hasSettings( sResourceUrl ) ) + { + m_xDocCfgMgr->replaceSettings( sResourceUrl, xSettings ); + } + else + { + m_xDocCfgMgr->insertSettings( sResourceUrl, xSettings ); + } + if( !bTemporary ) + { + persistChanges(); + } +} + +sal_Bool VbaCommandBarHelper::persistChanges() throw (css::uno::RuntimeException) +{ + uno::Reference< css::ui::XUIConfigurationPersistence > xConfigPersistence( m_xDocCfgMgr, uno::UNO_QUERY_THROW ); + sal_Bool result = sal_False; + if( xConfigPersistence->isModified() ) + { + xConfigPersistence->store(); + result = sal_True; + } + return result; +} + +uno::Reference< frame::XLayoutManager > VbaCommandBarHelper::getLayoutManager() throw (uno::RuntimeException) +{ + uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropertySet( xFrame, uno::UNO_QUERY_THROW ); + uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LayoutManager") ), uno::UNO_QUERY_THROW ); + return xLayoutManager; +} + +sal_Bool VbaCommandBarHelper::hasToolbar( const rtl::OUString& sResourceUrl, const rtl::OUString& sName ) throw (css::uno::RuntimeException) +{ + if( m_xDocCfgMgr->hasSettings( sResourceUrl ) ) + { + rtl::OUString sUIName; + uno::Reference< beans::XPropertySet > xPropertySet( m_xDocCfgMgr->getSettings( sResourceUrl, sal_False ), uno::UNO_QUERY_THROW ); + xPropertySet->getPropertyValue( rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_UINAME) ) >>= sUIName; + if( sName.equalsIgnoreAsciiCase( sUIName ) ) + return sal_True; + } + return sal_False; +} + +// return the resource url if found +rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException) +{ + rtl::OUString sResourceUrl; + + // check if it is an buildin toolbar + sResourceUrl = MSO2OOCommandbarHelper::getMSO2OOCommandbarHelper()->findBuildinToolbar( sName ); + if( sResourceUrl.getLength() > 0 ) + return sResourceUrl; + + uno::Sequence< ::rtl::OUString > allNames = xNameAccess->getElementNames(); + for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) + { + sResourceUrl = allNames[i]; + if(sResourceUrl.indexOf( rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL ) ) == 0 ) + { + if( hasToolbar( sResourceUrl, sName ) ) + return sResourceUrl; + } + } + + // the customize toolbars creating during importing, shoud found there. + static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) ); + sResourceUrl = sToolbarPrefix.concat( sName ); + if( hasToolbar( sResourceUrl, sName ) ) + return sResourceUrl; + + return rtl::OUString(); +} + +// if found, return the position of the control. if not found, return -1 +sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException) +{ + sal_Int32 nCount = xIndexAccess->getCount(); + css::uno::Sequence< css::beans::PropertyValue > aProps; + for( sal_Int32 i = 0; i < nCount; i++ ) + { + rtl::OUString sLabel; + xIndexAccess->getByIndex( i ) >>= aProps; + getPropertyValue( aProps, rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_LABEL) ) >>= sLabel; + // handle the hotkey character '~' + rtl::OUString sNewLabel; + sal_Int32 index = sLabel.indexOf( sal_Unicode('~') ); + if( index < 0 ) + sNewLabel = sLabel; + else if( index == 0 ) + sNewLabel = sLabel.copy( index + 1); + else if( index == sNewLabel.getLength() - 1 ) + sNewLabel = sLabel.copy(0, index ); + else + sNewLabel = sLabel.copy( 0, index ) + sLabel.copy( index + 1 ); + OSL_TRACE("VbaCommandBarHelper::findControlByName, control name: %s", rtl::OUStringToOString( sNewLabel, RTL_TEXTENCODING_UTF8 ).getStr() ); + if( sName.equalsIgnoreAsciiCase( sNewLabel ) ) + return i; + } + + // not found + return -1; +} + +rtl::OUString VbaCommandBarHelper::generateCustomURL() +{ + rtl::OUString url = rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL ); + url += rtl::OUString::createFromAscii( CUSTOM_TOOLBAR_STR ); + + // use a random number to minimize possible clash with existing custom toolbars + srand( unsigned( time( NULL ) )); + url += rtl::OUString::valueOf( sal_Int64( rand() ), 16 ); + return url; +} diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx new file mode 100644 index 000000000000..7f7beb223363 --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef VBA_COMMANDBARHELPER_HXX +#define VBA_COMMANDBARHELPER_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; +static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL"; +static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer"; +static const char ITEM_DESCRIPTOR_LABEL[] = "Label"; +static const char ITEM_DESCRIPTOR_TYPE[] = "Type"; +static const char ITEM_DESCRIPTOR_STYLE[] = "Style"; +static const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible"; +static const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL"; +static const char ITEM_DESCRIPTOR_UINAME[] = "UIName"; + +static const char ITEM_MENUBAR_URL[] = "private:resource/menubar/menubar"; +static const char ITEM_TOOLBAR_URL[] = "private:resource/toolbar/"; + +static const char CUSTOM_TOOLBAR_STR[] = "custom_toolbar_"; +static const char CUSTOM_MENU_STR[] = "vnd.openoffice.org:CustomMenu"; + +class VbaCommandBarHelper; +typedef ::boost::shared_ptr< VbaCommandBarHelper > VbaCommandBarHelperRef; + +class VbaCommandBarHelper +{ +private: + css::uno::Reference< css::uno::XComponentContext > mxContext; + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::ui::XUIConfigurationManager > m_xDocCfgMgr; // current document + css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr; + css::uno::Reference< css::container::XNameAccess > m_xWindowState; + rtl::OUString maModuleId; + + void Init() throw (css::uno::RuntimeException); + sal_Bool hasToolbar( const rtl::OUString& sResourceUrl, const rtl::OUString& sName ) throw (css::uno::RuntimeException); +public: + VbaCommandBarHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException ); + + css::uno::Reference< css::frame::XModel > getModel() { return mxModel; } + + css::uno::Reference< css::ui::XUIConfigurationManager > getDocCfgManager() throw (css::uno::RuntimeException) + { + return m_xDocCfgMgr; + } + css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager() throw (css::uno::RuntimeException) + { + return m_xAppCfgMgr; + } + css::uno::Reference< css::container::XNameAccess > getPersistentWindowState() throw (css::uno::RuntimeException) + { + return m_xWindowState; + } + sal_Bool persistChanges() throw (css::uno::RuntimeException); + css::uno::Reference< css::container::XIndexAccess > getSettings( const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException); + void removeSettings( const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException); + void ApplyChange( const rtl::OUString& sResourceUrl, const css::uno::Reference< css::container::XIndexAccess >& xSettings, sal_Bool bTemporary = sal_True ) throw (css::uno::RuntimeException); + + css::uno::Reference< css::frame::XLayoutManager > getLayoutManager() throw (css::uno::RuntimeException); + + const rtl::OUString getModuleId(){ return maModuleId; } + rtl::OUString findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException); + static sal_Int32 findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException); + static rtl::OUString generateCustomURL(); +}; + +#endif//VBA_COMMANDBARHELPER_HXX diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx new file mode 100644 index 000000000000..76f69d1b748e --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbars.cxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include + +#include "vbacommandbars.hxx" +#include "vbacommandbar.hxx" + +using namespace com::sun::star; +using namespace ooo::vba; + + +typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarEnumeration_BASE; + +class CommandBarEnumeration : public CommandBarEnumeration_BASE +{ + uno::Reference< XHelperInterface > m_xParent; + uno::Reference< uno::XComponentContext > m_xContext; + VbaCommandBarHelperRef pCBarHelper; + uno::Sequence< rtl::OUString > m_sNames; + sal_Int32 m_nCurrentPosition; +public: + CommandBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, VbaCommandBarHelperRef pHelper) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), pCBarHelper( pHelper ) , m_nCurrentPosition( 0 ) + { + uno::Reference< container::XNameAccess > xNameAccess = pCBarHelper->getPersistentWindowState(); + m_sNames = xNameAccess->getElementNames(); + } + virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException ) + { + if( m_nCurrentPosition < m_sNames.getLength() ) + return sal_True; + return sal_False; + } + virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) + { + // FIXME: should be add menubar + if( hasMoreElements() ) + { + rtl::OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] ); + if( sResourceUrl.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) + { + uno::Reference< container::XIndexAccess > xCBarSetting = pCBarHelper->getSettings( sResourceUrl ); + uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( m_xParent, m_xContext, pCBarHelper, xCBarSetting, sResourceUrl, sal_False, sal_False ) ); + } + else + return nextElement(); + } + else + throw container::NoSuchElementException(); + return uno::Any(); + } +}; + +ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : CommandBars_BASE( xParent, xContext, xIndexAccess ) +{ + pCBarHelper.reset( new VbaCommandBarHelper( mxContext, xModel ) ); + m_xNameAccess = pCBarHelper->getPersistentWindowState(); +} + +ScVbaCommandBars::~ScVbaCommandBars() +{ +} + +// XEnumerationAccess +uno::Type SAL_CALL +ScVbaCommandBars::getElementType() throw ( uno::RuntimeException ) +{ + return XCommandBar::static_type( 0 ); +} + +uno::Reference< container::XEnumeration > +ScVbaCommandBars::createEnumeration() throw ( uno::RuntimeException ) +{ + return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( this, mxContext, pCBarHelper ) ); +} + +uno::Any +ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) +{ + // aSource should be a name at this time, because of the class is API wrapper. + rtl::OUString sResourceUrl; + uno::Reference< container::XIndexAccess > xBarSettings; + rtl::OUString sBarName; + sal_Bool bMenu = sal_False; + if( aSource >>= sBarName ) + { + if( sBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") ) + || sBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) ) + { + // menu bar + sResourceUrl = rtl::OUString::createFromAscii( ITEM_MENUBAR_URL ); + bMenu = sal_True; + } + else + { + sResourceUrl = pCBarHelper->findToolbarByName( m_xNameAccess, sBarName ); + bMenu = sal_False; + } + } + + if( sResourceUrl.getLength() ) + xBarSettings = pCBarHelper->getSettings( sResourceUrl ); + else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toolbar do not exist") ), uno::Reference< uno::XInterface >() ); + + return uno::Any( uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, pCBarHelper, xBarSettings, sResourceUrl, bMenu, sal_False ) ) ); +} + +// XCommandBars +uno::Reference< XCommandBar > SAL_CALL +ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Position*/, const css::uno::Any& /*MenuBar*/, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException) +{ + // FIXME: only support to add Toolbar + // Position - MsoBar MenuBar - sal_Bool + // Currently only the Name is supported. + rtl::OUString sName; + if( Name.hasValue() ) + Name >>= sName; + + rtl::OUString sResourceUrl; + if( sName.getLength() ) + { + sResourceUrl = pCBarHelper->findToolbarByName( m_xNameAccess, sName ); + if( sResourceUrl.getLength() ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toolbar exists") ), uno::Reference< uno::XInterface >() ); + } + else + { + sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom1") ); + } + + sal_Bool bTemporary = sal_False; + if( Temporary.hasValue() ) + Temporary >>= bTemporary; + + sResourceUrl = VbaCommandBarHelper::generateCustomURL(); + uno::Reference< container::XIndexAccess > xBarSettings( pCBarHelper->getSettings( sResourceUrl ), uno::UNO_QUERY_THROW ); + uno::Reference< XCommandBar > xCBar( new ScVbaCommandBar( this, mxContext, pCBarHelper, xBarSettings, sResourceUrl, sal_False, bTemporary ) ); + xCBar->setName( sName ); + return xCBar; +} +sal_Int32 SAL_CALL +ScVbaCommandBars::getCount() throw(css::uno::RuntimeException) +{ + // Filter out all toolbars from the window collection + sal_Int32 nCount = 1; // there is a Menubar in OOo + uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames(); + for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) + { + if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) + { + nCount++; + } + } + return nCount; +} + +// ScVbaCollectionBaseImpl +uno::Any SAL_CALL +ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException ) +{ + if( aIndex.getValueTypeClass() == uno::TypeClass_STRING ) + { + return createCollectionObject( aIndex ); + } + + // hardcode if "aIndex = 1" that would return "main menu". + sal_Int16 nIndex = 0; + aIndex >>= nIndex; + if( nIndex == 1 ) + { + uno::Any aSource; + if( pCBarHelper->getModuleId().equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ) ) + aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" ); + else if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") ) + aSource <<= rtl::OUString::createFromAscii( "Menu Bar" ); + if( aSource.hasValue() ) + return createCollectionObject( aSource ); + } + return uno::Any(); +} + +// XHelperInterface +rtl::OUString& +ScVbaCommandBars::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBars") ); + return sImplName; +} +uno::Sequence +ScVbaCommandBars::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBars" ) ); + } + return aServiceNames; +} + diff --git a/vbahelper/source/vbahelper/vbacommandbars.hxx b/vbahelper/source/vbahelper/vbacommandbars.hxx new file mode 100644 index 000000000000..2c0cc3f83ad9 --- /dev/null +++ b/vbahelper/source/vbahelper/vbacommandbars.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SC_VBA_COMMANDBARS_HXX +#define SC_VBA_COMMANDBARS_HXX + +#include +#include +#include +#include +#include +#include +#include "vbacommandbarhelper.hxx" + +typedef CollTestImplHelper< ov::XCommandBars > CommandBars_BASE; + +class ScVbaCommandBars : public CommandBars_BASE +{ +private: + VbaCommandBarHelperRef pCBarHelper; + +public: + ScVbaCommandBars( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException); + virtual ~ScVbaCommandBars(); + + // XCommandBars + virtual css::uno::Reference< ov::XCommandBar > SAL_CALL Add( const css::uno::Any& Name, const css::uno::Any& Position, const css::uno::Any& MenuBar, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + + virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& aIndex, const css::uno::Any& /*aIndex2*/ ) throw( css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +}; + +#endif//SC_VBA_COMMANDBARS_HXX diff --git a/vbahelper/source/vbahelper/vbadialogbase.cxx b/vbahelper/source/vbahelper/vbadialogbase.cxx new file mode 100644 index 000000000000..909352f3dbf1 --- /dev/null +++ b/vbahelper/source/vbahelper/vbadialogbase.cxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialog.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +// fails silently +void +VbaDialogBase::Show() throw(uno::RuntimeException) +{ + rtl::OUString aURL; + if ( m_xModel.is() ) + { + aURL = mapIndexToName( mnIndex ); + if( aURL.getLength() == 0 ) + throw uno::RuntimeException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ), + uno::Reference< XInterface > () ); + dispatchRequests( m_xModel, aURL ); + } +} + diff --git a/vbahelper/source/vbahelper/vbadialogsbase.cxx b/vbahelper/source/vbahelper/vbadialogsbase.cxx new file mode 100644 index 000000000000..ebb3da6f8757 --- /dev/null +++ b/vbahelper/source/vbahelper/vbadialogsbase.cxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialogs.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +::sal_Int32 +VbaDialogsBase::getCount() throw (uno::RuntimeException) +{ + //#TODO #FIXEME + return 0; +} + +uno::Any +VbaDialogsBase::Item( const uno::Any& /* &aItem */) throw (uno::RuntimeException) +{ + return uno::Any(); +} + diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx new file mode 100644 index 000000000000..d22d1b198376 --- /dev/null +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +VbaDocumentBase::VbaDocumentBase( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) :VbaDocumentBase_BASE( xParent, xContext ), mxModel(NULL) +{ +} + +VbaDocumentBase::VbaDocumentBase( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ) : VbaDocumentBase_BASE( xParent, xContext ), mxModel( xModel ) +{ +} + +VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args, + uno::Reference< uno::XComponentContext> const & xContext ) : VbaDocumentBase_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ) +{ +} + +::rtl::OUString +VbaDocumentBase::getName() throw (uno::RuntimeException) +{ + rtl::OUString sName = getModel()->getURL(); + if ( sName.getLength() ) + { + + INetURLObject aURL( getModel()->getURL() ); + ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName ); + } + else + { + const static rtl::OUString sTitle( RTL_CONSTASCII_USTRINGPARAM("Title" ) ); + // process "UntitledX - $(PRODUCTNAME)" + uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); + xProps->getPropertyValue(sTitle ) >>= sName; + sal_Int32 pos = 0; + sName = sName.getToken(0,' ',pos); + } + return sName; +} +::rtl::OUString +VbaDocumentBase::getPath() throw (uno::RuntimeException) +{ + INetURLObject aURL( getModel()->getURL() ); + rtl::OUString sURL( aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); + sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 ); + rtl::OUString sPath; + ::osl::File::getSystemPathFromFileURL( sURL, sPath ); + return sPath; +} + +::rtl::OUString +VbaDocumentBase::getFullName() throw (uno::RuntimeException) +{ + rtl::OUString sPath; + ::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath ); + return sPath; +} + +void +VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, + const uno::Any &rRouteArg ) throw (uno::RuntimeException) +{ + sal_Bool bSaveChanges = sal_False; + rtl::OUString aFileName; + sal_Bool bRouteWorkbook = sal_True; + + rSaveArg >>= bSaveChanges; + sal_Bool bFileName = ( rFileArg >>= aFileName ); + rRouteArg >>= bRouteWorkbook; + uno::Reference< frame::XStorable > xStorable( getModel(), uno::UNO_QUERY_THROW ); + uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); + + if( bSaveChanges ) + { + if( xStorable->isReadonly() ) + { + throw uno::RuntimeException(::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "Unable to save to a read only file ") ), + uno::Reference< XInterface >() ); + } + if( bFileName ) + xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) ); + else + xStorable->store(); + } + else + xModifiable->setModified( false ); + + uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY ); + + if( xCloseable.is() ) + // use close(boolean DeliverOwnership) + + // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may + // assume ownership if they object the closure by throwing a CloseVetoException + // Here we give up ownership. To be on the safe side, catch possible veto exception anyway. + xCloseable->close(sal_True); + // If close is not supported by this model - try to dispose it. + // But if the model disagree with a reset request for the modify state + // we shouldn't do so. Otherwhise some strange things can happen. + else + { + uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY ); + if ( xDisposable.is() ) + xDisposable->dispose(); + } +} + +void +VbaDocumentBase::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException) +{ + rtl::OUString rPassword; + uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); + SC_VBA_FIXME(("Workbook::Protect stub")); + if( aPassword >>= rPassword ) + xProt->protect( rPassword ); + else + xProt->protect( rtl::OUString() ); +} + +void +VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException) +{ + rtl::OUString rPassword; + uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); + if( !xProt->isProtected() ) + throw uno::RuntimeException(::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "File is already unprotected" ) ), + uno::Reference< XInterface >() ); + else + { + if( aPassword >>= rPassword ) + xProt->unprotect( rPassword ); + else + xProt->unprotect( rtl::OUString() ); + } +} + +void +VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException) +{ + uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); + xModifiable->setModified( bSave ); +} + +sal_Bool +VbaDocumentBase::getSaved() throw (uno::RuntimeException) +{ + uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); + return xModifiable->isModified(); +} + +void +VbaDocumentBase::Save() throw (uno::RuntimeException) +{ + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Save")); + uno::Reference< frame::XModel > xModel = getModel(); + dispatchRequests(xModel,url); +} + +void +VbaDocumentBase::Activate() throw (uno::RuntimeException) +{ + uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); + xFrame->activate(); +} + +rtl::OUString& +VbaDocumentBase::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaDocumentBase") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +VbaDocumentBase::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VbaDocumentBase" ) ); + } + return aServiceNames; +} + diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx new file mode 100644 index 000000000000..5bfc259c2d8c --- /dev/null +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -0,0 +1,305 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +static const rtl::OUString sSpreadsheetDocument( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) ); +static const rtl::OUString sTextDocument( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) ); + +typedef std::hash_map< rtl::OUString, +sal_Int32, ::rtl::OUStringHash, +::std::equal_to< ::rtl::OUString > > NameIndexHash; + +typedef std::vector < uno::Reference< frame::XModel > > Documents; + +typedef ::cppu::WeakImplHelper1< container::XEnumeration > DocumentsEnumImpl_BASE; + +// #FIXME clearly this is a candidate for some sort of helper base class as +// this is a copy of SelectedSheetsEnum ( vbawindow.cxx ) + +class DocumentsEnumImpl : public DocumentsEnumImpl_BASE +{ + uno::Reference< uno::XComponentContext > m_xContext; + Documents m_documents; + Documents::const_iterator m_it; + +public: + DocumentsEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const Documents& docs ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_documents( docs ) + { + m_it = m_documents.begin(); + } + DocumentsEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext ) + { + uno::Reference< lang::XMultiComponentFactory > xSMgr( + m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); + + uno::Reference< frame::XDesktop > xDesktop + (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), m_xContext), uno::UNO_QUERY_THROW ); + uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration(); + while( mxComponents->hasMoreElements() ) + { + uno::Reference< frame::XModel > xNext( mxComponents->nextElement(), uno::UNO_QUERY ); + if ( xNext.is() ) + m_documents.push_back( xNext ); + } + m_it = m_documents.begin(); + } + // XEnumeration + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return m_it != m_documents.end(); + } + + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasMoreElements() ) + { + throw container::NoSuchElementException(); + } + return makeAny( *(m_it++) ); + } +}; + +// #FIXME clearly this is also a candidate for some sort of helper base class as +// a very similar one is used in vbawindow ( SelectedSheetsEnumAccess ) +// Maybe a template base class that does all of the operations on the hashmap +// and vector only, and the sub-class does everything else +// => ctor, createEnumeration & factory method need be defined ( to be called +// by getByIndex, getByName ) +typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess + , com::sun::star::container::XIndexAccess + , com::sun::star::container::XNameAccess + > DocumentsAccessImpl_BASE; + +class DocumentsAccessImpl : public DocumentsAccessImpl_BASE +{ + uno::Reference< uno::XComponentContext > m_xContext; + Documents m_documents; + NameIndexHash namesToIndices; + VbaDocumentsBase::DOCUMENT_TYPE meDocType; +public: + DocumentsAccessImpl( const uno::Reference< uno::XComponentContext >& xContext, VbaDocumentsBase::DOCUMENT_TYPE eDocType ) throw (uno::RuntimeException) :m_xContext( xContext ), meDocType( eDocType ) + { + uno::Reference< container::XEnumeration > xEnum = new DocumentsEnumImpl( m_xContext ); + sal_Int32 nIndex=0; + while( xEnum->hasMoreElements() ) + { + uno::Reference< lang::XServiceInfo > xServiceInfo( xEnum->nextElement(), uno::UNO_QUERY ); + if ( xServiceInfo.is() + && ( ( xServiceInfo->supportsService( sSpreadsheetDocument ) && meDocType == VbaDocumentsBase::EXCEL_DOCUMENT ) + || ( xServiceInfo->supportsService( sTextDocument ) && meDocType == VbaDocumentsBase::WORD_DOCUMENT ) ) ) + { + uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given + m_documents.push_back( xModel ); + INetURLObject aURL( xModel->getURL() ); + namesToIndices[ aURL.GetLastName() ] = nIndex++; + } + } + + } + + //XEnumerationAccess + virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) + { + return new DocumentsEnumImpl( m_xContext, m_documents ); + } + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + return m_documents.size(); + } + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( Index < 0 + || static_cast< Documents::size_type >(Index) >= m_documents.size() ) + throw lang::IndexOutOfBoundsException(); + return makeAny( m_documents[ Index ] ); // returns xspreadsheetdoc + } + + //XElementAccess + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) + { + return frame::XModel::static_type(0); + } + + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return (m_documents.size() > 0); + } + + //XNameAccess + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + NameIndexHash::const_iterator it = namesToIndices.find( aName ); + if ( it == namesToIndices.end() ) + throw container::NoSuchElementException(); + return makeAny( m_documents[ it->second ] ); + + } + + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) + { + uno::Sequence< ::rtl::OUString > names( namesToIndices.size() ); + ::rtl::OUString* pString = names.getArray(); + NameIndexHash::const_iterator it = namesToIndices.begin(); + NameIndexHash::const_iterator it_end = namesToIndices.end(); + for ( ; it != it_end; ++it, ++pString ) + *pString = it->first; + return names; + } + + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) + { + NameIndexHash::const_iterator it = namesToIndices.find( aName ); + return (it != namesToIndices.end()); + } + +}; + +VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext, DOCUMENT_TYPE eDocType ) throw (uno::RuntimeException) : VbaDocumentsBase_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new DocumentsAccessImpl( xContext, eDocType ) ) ), meDocType( eDocType ) +{ +} + +uno::Any SAL_CALL +VbaDocumentsBase::Add() throw (uno::RuntimeException) +{ + uno::Reference< lang::XMultiComponentFactory > xSMgr( + mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + + uno::Reference< frame::XComponentLoader > xLoader( + xSMgr->createInstanceWithContext( + ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), + mxContext), uno::UNO_QUERY_THROW ); + rtl::OUString sURL; + if( meDocType == WORD_DOCUMENT ) + sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/swriter") ); + else if( meDocType == EXCEL_DOCUMENT ) + sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") ); + else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( + sURL , + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, + uno::Sequence< beans::PropertyValue >(0) ); + return uno::makeAny( xComponent ); +} + +void +VbaDocumentsBase::Close() throw (uno::RuntimeException) +{ +// #FIXME this *MUST* be wrong documents::close surely closes ALL documents +// in the collection, use of getCurrentDocument here is totally wrong +/* + uno::Reference< lang::XMultiComponentFactory > xSMgr( + mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc")); + dispatchRequests(xModel,url); +*/ +} + +// #TODO# #FIXME# can any of the unused params below be used? +uno::Any +VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) +{ + // we need to detect if this is a URL, if not then assume its a file path + rtl::OUString aURL; + INetURLObject aObj; + aObj.SetURL( rFileName ); + bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; + if ( bIsURL ) + aURL = rFileName; + else + osl::FileBase::getFileURLFromSystemPath( rFileName, aURL ); + uno::Reference< lang::XMultiComponentFactory > xSMgr( + mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop > xDesktop + (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") , mxContext), + uno::UNO_QUERY_THROW ); + uno::Reference< frame::XComponentLoader > xLoader( + xSMgr->createInstanceWithContext( + ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), + mxContext), + uno::UNO_QUERY_THROW ); + + uno::Sequence< beans::PropertyValue > sProps( rProps ); + sProps.realloc( sProps.getLength() + 1 ); + sProps[ sProps.getLength() - 1 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode") ); + sProps[ sProps.getLength() - 1 ].Value <<= uno::makeAny( document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN ); + + sal_Int32 nIndex = sProps.getLength() - 1; + + if ( ReadOnly.hasValue() ) + { + sal_Bool bIsReadOnly = sal_False; ReadOnly >>= bIsReadOnly; + if ( bIsReadOnly ) + { + static const rtl::OUString sReadOnly( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ); + sProps.realloc( sProps.getLength() + 1 ); + sProps[ nIndex ].Name = sReadOnly; + sProps[ nIndex++ ].Value = uno::makeAny( (sal_Bool)sal_True ); + } + } + + uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( aURL, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_default") ), + frame::FrameSearchFlag::CREATE, + sProps); + return uno::makeAny( xComponent ); +} + diff --git a/vbahelper/source/vbahelper/vbafillformat.cxx b/vbahelper/source/vbahelper/vbafillformat.cxx new file mode 100644 index 000000000000..3b25efcb614a --- /dev/null +++ b/vbahelper/source/vbahelper/vbafillformat.cxx @@ -0,0 +1,202 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbafillformat.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include "vbafillformat.hxx" +#include "vbacolorformat.hxx" + +using namespace ooo::vba; +using namespace com::sun::star; + +ScVbaFillFormat::ScVbaFillFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaFillFormat_BASE( xParent, xContext ), m_xShape( xShape ) +{ + m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); + m_nFillStyle = drawing::FillStyle_SOLID; + m_nForeColor = 0; + m_nBackColor = 0; + m_nGradientAngle = 0; +} + +void +ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::RuntimeException) +{ + m_nFillStyle = nFillStyle; + if( m_nFillStyle == drawing::FillStyle_GRADIENT ) + { + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_GRADIENT ) ); + awt::Gradient aGradient; + // AXIAL + // RADIAL + // ELLIPTICAL + // SQUARE + // RECT + aGradient.Style = awt::GradientStyle_LINEAR; + aGradient.StartColor = ForeColor()->getRGB(); + aGradient.EndColor = BackColor()->getRGB(); + aGradient.Angle = m_nGradientAngle; + aGradient.Border = 0; + aGradient.XOffset = 0; + aGradient.YOffset = 0; + aGradient.StartIntensity = 100; + aGradient.EndIntensity = 100; + aGradient.StepCount = 1; + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), uno::makeAny( aGradient ) ); + } + else if( m_nFillStyle == drawing::FillStyle_SOLID ) + { + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny(drawing::FillStyle_SOLID) ); + } +} + +void +ScVbaFillFormat::setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException) +{ + m_nForeColor = nForeColor; + setFillStyle( m_nFillStyle ); +} + +// Attributes +sal_Bool SAL_CALL +ScVbaFillFormat::getVisible() throw (uno::RuntimeException) +{ + drawing::FillStyle nFillStyle; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= nFillStyle; + if( nFillStyle == drawing::FillStyle_NONE ) + return sal_False; + return sal_True; +} + +void SAL_CALL +ScVbaFillFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) +{ + drawing::FillStyle aFillStyle; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= aFillStyle; + if( !_visible ) + { + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_NONE ) ); + } + else + { + if( aFillStyle == drawing::FillStyle_NONE ) + { + setFillStyle( m_nFillStyle ); + } + } +} + +double SAL_CALL +ScVbaFillFormat::getTransparency() throw (uno::RuntimeException) +{ + sal_Int16 nTransparence = 0; + double dTransparence = 0; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ) ) >>= nTransparence; + dTransparence = static_cast( nTransparence ); + dTransparence /= 100; + return dTransparence; +} + +void SAL_CALL +ScVbaFillFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) +{ + sal_Int16 nTransparence = static_cast< sal_Int16 >( _transparency * 100 ); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ), uno::makeAny( nTransparence ) ); +} + + +// Methods +void SAL_CALL +ScVbaFillFormat::Solid() throw (uno::RuntimeException) +{ + setFillStyle( drawing::FillStyle_SOLID ); +} + +void SAL_CALL +ScVbaFillFormat::TwoColorGradient( sal_Int32 style, sal_Int32 /*variant*/ ) throw (uno::RuntimeException) +{ + if( style == office::MsoGradientStyle::msoGradientHorizontal ) + { + m_nGradientAngle = 0; + setFillStyle( drawing::FillStyle_GRADIENT ); + } + else if( style == office::MsoGradientStyle::msoGradientVertical ) + { + m_nGradientAngle = 900; + setFillStyle( drawing::FillStyle_GRADIENT ); + } + else if( style == office::MsoGradientStyle::msoGradientDiagonalDown ) + { + m_nGradientAngle = 450; + setFillStyle( drawing::FillStyle_GRADIENT ); + } + else if( style == office::MsoGradientStyle::msoGradientDiagonalUp ) + { + m_nGradientAngle = 900 + 450; + setFillStyle( drawing::FillStyle_GRADIENT ); + } +} + +uno::Reference< msforms::XColorFormat > SAL_CALL +ScVbaFillFormat::BackColor() throw (uno::RuntimeException) +{ + if( !m_xColorFormat.is() ) + m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_BACKCOLOR ) ); + return m_xColorFormat; +} + +uno::Reference< msforms::XColorFormat > SAL_CALL +ScVbaFillFormat::ForeColor() throw (uno::RuntimeException) +{ + if( !m_xColorFormat.is() ) + m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_FORECOLOR ) ); + return m_xColorFormat; +} + + +rtl::OUString& +ScVbaFillFormat::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFillFormat") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaFillFormat::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.FillFormat" ) ); + } + return aServiceNames; +} + diff --git a/vbahelper/source/vbahelper/vbafillformat.hxx b/vbahelper/source/vbahelper/vbafillformat.hxx new file mode 100644 index 000000000000..f03fcfbd441e --- /dev/null +++ b/vbahelper/source/vbahelper/vbafillformat.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbafillformat.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_XFILLFORMAT_HXX +#define SC_VBA_XFILLFORMAT_HXX + +#include +#include +#include +#include + +typedef InheritedHelperInterfaceImpl1< ov::msforms::XFillFormat > ScVbaFillFormat_BASE; + +class ScVbaFillFormat : public ScVbaFillFormat_BASE +{ +private: + css::uno::Reference< css::drawing::XShape > m_xShape; + css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; + css::uno::Reference< ov::msforms::XColorFormat > m_xColorFormat; + css::drawing::FillStyle m_nFillStyle; + sal_Int32 m_nForeColor; + sal_Int32 m_nBackColor; + sal_Int16 m_nGradientAngle; +private: + void setFillStyle( css::drawing::FillStyle nFillStyle ) throw (css::uno::RuntimeException); +protected: + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + +public: + ScVbaFillFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); + + void setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException); + // Attributes + virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); + virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException); + + // Methods + virtual void SAL_CALL Solid() throw (css::uno::RuntimeException); + virtual void SAL_CALL TwoColorGradient( sal_Int32 style, sal_Int32 variant ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); + +}; + +#endif//SC_VBA_XFILLFORMAT_HXX diff --git a/vbahelper/source/vbahelper/vbafontbase.cxx b/vbahelper/source/vbahelper/vbafontbase.cxx new file mode 100644 index 000000000000..17baa8ae1612 --- /dev/null +++ b/vbahelper/source/vbahelper/vbafontbase.cxx @@ -0,0 +1,309 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbafont.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +VbaFontBase::VbaFontBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::container::XIndexAccess >& xPalette, uno::Reference< beans::XPropertySet > xPropertySet ) throw ( uno::RuntimeException ) : VbaFontBase_BASE( xParent, xContext ), mxFont( xPropertySet, css::uno::UNO_QUERY_THROW ), mxPalette( xPalette ) +{ +} + +VbaFontBase::~VbaFontBase() +{ +} + + +void SAL_CALL +VbaFontBase::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeException ) +{ + sal_Bool bValue = sal_False; + aValue >>= bValue; + sal_Int16 nValue = NORMAL; + sal_Int8 nValue2 = NORMALHEIGHT; + + if( bValue ) + { + nValue = SUPERSCRIPT; + nValue2 = SUPERSCRIPTHEIGHT; + } + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); +} + +uno::Any SAL_CALL +VbaFontBase::getSuperscript() throw ( uno::RuntimeException ) +{ + short nValue = 0; + mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; + return uno::makeAny( ( nValue == SUPERSCRIPT ) ); +} + +void SAL_CALL +VbaFontBase::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException ) +{ + sal_Bool bValue = sal_False; + aValue >>= bValue; + sal_Int16 nValue = NORMAL; + sal_Int8 nValue2 = NORMALHEIGHT; + + if( bValue ) + { + nValue= SUBSCRIPT; + nValue2 = SUBSCRIPTHEIGHT; + } + + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); + +} + +uno::Any SAL_CALL +VbaFontBase::getSubscript() throw ( uno::RuntimeException ) +{ + short nValue = NORMAL; + mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; + return uno::makeAny( ( nValue == SUBSCRIPT ) ); +} + +void SAL_CALL +VbaFontBase::setSize( const uno::Any& aValue ) throw( uno::RuntimeException ) +{ + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), aValue ); +} + +uno::Any SAL_CALL +VbaFontBase::getSize() throw ( uno::RuntimeException ) +{ + return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ) ); +} + +void SAL_CALL +VbaFontBase::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeException ) +{ + sal_Int32 nIndex = 0; + _colorindex >>= nIndex; + + --nIndex; // OOo indices are zero bases + + // setColor expects colors in XL RGB values + // #FIXME this is daft we convert OO RGB val to XL RGB val and + // then back again to OO RGB value + setColor( OORGBToXLRGB(mxPalette->getByIndex( nIndex )) ); +} + + +uno::Any SAL_CALL +VbaFontBase::getColorIndex() throw ( uno::RuntimeException ) +{ + sal_Int32 nColor = 0; + + XLRGBToOORGB( getColor() ) >>= nColor; + sal_Int32 nElems = mxPalette->getCount(); + sal_Int32 nIndex = -1; + for ( sal_Int32 count=0; countgetByIndex( count ) >>= nPaletteColor; + if ( nPaletteColor == nColor ) + { + nIndex = count + 1; // 1 based + break; + } + } + return uno::makeAny( nIndex ); +} + +void SAL_CALL +VbaFontBase::setBold( const uno::Any& aValue ) throw( uno::RuntimeException ) +{ + sal_Bool bValue = sal_False; + aValue >>= bValue; + double fBoldValue = awt::FontWeight::NORMAL; + if( bValue ) + fBoldValue = awt::FontWeight::BOLD; + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), ( uno::Any )fBoldValue ); + +} + +uno::Any SAL_CALL +VbaFontBase::getBold() throw ( uno::RuntimeException ) +{ + double fValue = 0.0; + mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ) ) >>= fValue; + return uno::makeAny( fValue == awt::FontWeight::BOLD ); +} + +void SAL_CALL +VbaFontBase::setStrikethrough( const uno::Any& aValue ) throw ( uno::RuntimeException ) +{ + sal_Bool bValue = sal_False; + aValue >>= bValue; + short nValue = awt::FontStrikeout::NONE; + if( bValue ) + nValue = awt::FontStrikeout::SINGLE; + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ), ( uno::Any )nValue ); +} + +uno::Any SAL_CALL +VbaFontBase::getStrikethrough() throw ( uno::RuntimeException ) +{ + short nValue = 0; + mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ) ) >>= nValue; + return uno::Any( nValue == awt::FontStrikeout::SINGLE ); +} + +void SAL_CALL +VbaFontBase::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException ) +{ + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue ); +} + +uno::Any SAL_CALL +VbaFontBase::getShadow() throw (uno::RuntimeException) +{ + return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) ); +} + +void SAL_CALL +VbaFontBase::setItalic( const uno::Any& aValue ) throw ( uno::RuntimeException ) +{ + sal_Bool bValue = sal_False; + aValue >>= bValue; + short nValue = awt::FontSlant_NONE; + if( bValue ) + nValue = awt::FontSlant_ITALIC; + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), ( uno::Any )nValue ); +} + +uno::Any SAL_CALL +VbaFontBase::getItalic() throw ( uno::RuntimeException ) +{ + + awt::FontSlant aFS; + mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ) ) >>= aFS; + return uno::makeAny( aFS == awt::FontSlant_ITALIC ); +} + +void SAL_CALL +VbaFontBase::setName( const uno::Any& aValue ) throw ( uno::RuntimeException ) +{ + rtl::OUString sString; + aValue >>= sString; + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), aValue); +} + +uno::Any SAL_CALL +VbaFontBase::getName() throw ( uno::RuntimeException ) +{ + return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ) ); +} +uno::Any +VbaFontBase::getColor() throw (uno::RuntimeException) +{ + uno::Any aAny; + aAny = OORGBToXLRGB( mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) ) ); + return aAny; +} + +void +VbaFontBase::setColor( const uno::Any& _color ) throw (uno::RuntimeException) +{ + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) , XLRGBToOORGB(_color)); +} + +void SAL_CALL +VbaFontBase::setUnderline( const uno::Any& aValue ) throw ( uno::RuntimeException ) +{ +/* + // default + sal_Int32 nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone; + aValue >>= nValue; + switch ( nValue ) + { +// NOTE:: #TODO #FIMXE +// xlUnderlineStyleDoubleAccounting & xlUnderlineStyleSingleAccounting +// don't seem to be supported in Openoffice. +// The import filter converts them to single or double underlines as appropriate +// So, here at the moment we are similarly silently converting +// xlUnderlineStyleSingleAccounting to xlUnderlineStyleSingle. + + case excel::XlUnderlineStyle::xlUnderlineStyleNone: + nValue = awt::FontUnderline::NONE; + break; + case excel::XlUnderlineStyle::xlUnderlineStyleSingle: + case excel::XlUnderlineStyle::xlUnderlineStyleSingleAccounting: + nValue = awt::FontUnderline::SINGLE; + break; + case excel::XlUnderlineStyle::xlUnderlineStyleDouble: + case excel::XlUnderlineStyle::xlUnderlineStyleDoubleAccounting: + nValue = awt::FontUnderline::DOUBLE; + break; + default: + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value for Underline")), uno::Reference< uno::XInterface >() ); + } + + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), ( uno::Any )nValue ); +*/ + +} + +uno::Any SAL_CALL +VbaFontBase::getUnderline() throw ( uno::RuntimeException ) +{ + sal_Int32 nValue = awt::FontUnderline::NONE; + mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ) ) >>= nValue; +/* + switch ( nValue ) + { + case awt::FontUnderline::DOUBLE: + nValue = excel::XlUnderlineStyle::xlUnderlineStyleDouble; + break; + case awt::FontUnderline::SINGLE: + nValue = excel::XlUnderlineStyle::xlUnderlineStyleSingle; + break; + case awt::FontUnderline::NONE: + nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone; + break; + default: + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value retrieved for Underline") ), uno::Reference< uno::XInterface >() ); + + } +*/ + return uno::makeAny( nValue ); +} + + diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx new file mode 100644 index 000000000000..68633dc6ca1e --- /dev/null +++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#include "vbahelper/vbaglobalbase.hxx" + +#include +#include +#include + +using namespace com::sun::star; +using namespace ooo::vba; + +rtl::OUString sApplication( RTL_CONSTASCII_USTRINGPARAM("Application") ); + +VbaGlobalsBase::VbaGlobalsBase( +const uno::Reference< ov::XHelperInterface >& xParent, +const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName ) +: Globals_BASE( xParent, xContext ) +{ + // overwrite context with custom one ( that contains the application ) + ::cppu::ContextEntry_Init aHandlerContextInfo[] = + { + ::cppu::ContextEntry_Init( sApplication, uno::Any() ), + ::cppu::ContextEntry_Init( sDocCtxName, uno::Any() ), + }; + + mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), xContext ); + +} + + +void +VbaGlobalsBase::init( const uno::Sequence< beans::PropertyValue >& aInitArgs ) +{ + sal_Int32 nLen = aInitArgs.getLength(); + for ( sal_Int32 nIndex = 0; nIndex < nLen; ++nIndex ) + { + uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY_THROW ); + if ( aInitArgs[ nIndex ].Name.equals( sApplication ) ) + { + xNameContainer->replaceByName( sApplication, aInitArgs[ nIndex ].Value ); + uno::Reference< XHelperInterface > xParent( aInitArgs[ nIndex ].Value, uno::UNO_QUERY ); + mxParent = xParent; + } + else + xNameContainer->replaceByName( aInitArgs[ nIndex ].Name, aInitArgs[ nIndex ].Value ); + } +} + +uno::Reference< uno::XInterface > SAL_CALL +VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (uno::Exception, uno::RuntimeException) +{ + uno::Reference< uno::XInterface > xReturn; + + if ( hasServiceName( aServiceSpecifier ) ) + xReturn = mxContext->getServiceManager()->createInstanceWithContext( aServiceSpecifier, mxContext ); + return xReturn; +} + +uno::Reference< uno::XInterface > SAL_CALL +VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException) +{ + + uno::Reference< uno::XInterface > xReturn; + + if ( hasServiceName( ServiceSpecifier ) ) + xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( ServiceSpecifier, Arguments, mxContext ); + return xReturn; +} + +uno::Sequence< ::rtl::OUString > SAL_CALL +VbaGlobalsBase::getAvailableServiceNames( ) throw (uno::RuntimeException) +{ + static const rtl::OUString names[] = { + // common + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.msforms.UserForm" ) ), + }; + static uno::Sequence< rtl::OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) ); + return serviceNames; +} + +bool +VbaGlobalsBase::hasServiceName( const rtl::OUString& serviceName ) +{ + uno::Sequence< rtl::OUString > sServiceNames( getAvailableServiceNames() ); + sal_Int32 nLen = sServiceNames.getLength(); + for ( sal_Int32 index = 0; index < nLen; ++index ) + { + if ( sServiceNames[ index ].equals( serviceName ) ) + return true; + } + return false; +} + + diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx new file mode 100644 index 000000000000..7a20841ec9b5 --- /dev/null +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -0,0 +1,1200 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.cxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef OOVBA_DLLIMPLEMENTATION +#define OOVBA_DLLIMPLEMENTATION +#endif + +#include +#include +// #FIXME needs service +//#include "vbashape.hxx" +//#include "unonames.hxx" + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +#define NAME_HEIGHT "Height" +#define NAME_WIDTH "Width" + +#define POINTTO100THMILLIMETERFACTOR 35.27778 + + +void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue ); + +uno::Any sbxToUnoValue( SbxVariable* pVar ); + + +namespace ooo +{ +namespace vba +{ + +uno::Reference< lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell ) +{ + uno::Any aUnoVar; + if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) ) + throw lang::IllegalArgumentException(); + uno::Reference< lang::XMultiServiceFactory > xVBAFactory( aUnoVar, uno::UNO_QUERY_THROW ); + return xVBAFactory; +} + +css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException) +{ + OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); + return getVBAServiceFactory( pShell )->createInstance( sVarName ); +} + +css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const uno::Sequence< uno::Any >& aArgs ) throw ( css::uno::RuntimeException ) +{ + OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); + uno::Reference< uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs ); + return xIf; +} +// helper method to determine if the view ( calc ) is in print-preview mode +bool isInPrintPreview( SfxViewFrame* pView ) +{ + sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0; + if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() > +nViewNo && !pView->GetObjectShell()->IsInPlaceActive() ) + { + SfxViewFactory &rViewFactory = + pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo); + if ( pView->GetCurViewId() == rViewFactory.GetOrdinal() ) + return true; + } + return false; +} +#if 0 +namespace excel // all in this namespace probably can be moved to sc +{ + + +const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning")); +class PasteCellsWarningReseter +{ +private: + bool bInitialWarningState; + static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException ) + { + static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + static uno::Reference xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW ); + static uno::Reference xServiceManager( + xContext->getServiceManager(), uno::UNO_QUERY_THROW ); + static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW ); + return xProps; + } + + bool getReplaceCellsWarning() throw ( uno::RuntimeException ) + { + sal_Bool res = sal_False; + getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res; + return ( res == sal_True ); + } + + void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException ) + { + getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) ); + } +public: + PasteCellsWarningReseter() throw ( uno::RuntimeException ) + { + bInitialWarningState = getReplaceCellsWarning(); + if ( bInitialWarningState ) + setReplaceCellsWarning( false ); + } + ~PasteCellsWarningReseter() + { + if ( bInitialWarningState ) + { + // don't allow dtor to throw + try + { + setReplaceCellsWarning( true ); + } + catch ( uno::Exception& /*e*/ ){} + } + } +}; + +void +implnPaste() +{ + PasteCellsWarningReseter resetWarningBox; + ScTabViewShell* pViewShell = getCurrentBestViewShell(); + if ( pViewShell ) + { + pViewShell->PasteFromSystem(); + pViewShell->CellContentChanged(); + } +} + + +void +implnCopy() +{ + ScTabViewShell* pViewShell = getCurrentBestViewShell(); + if ( pViewShell ) + pViewShell->CopyToClip(NULL,false,false,true); +} + +void +implnCut() +{ + ScTabViewShell* pViewShell = getCurrentBestViewShell(); + if ( pViewShell ) + pViewShell->CutToClip( NULL, TRUE ); +} +void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose) +{ + PasteCellsWarningReseter resetWarningBox; + sal_Bool bAsLink(sal_False), bOtherDoc(sal_False); + InsCellCmd eMoveMode = INS_NONE; + + if ( !pTabViewShell ) + // none active, try next best + pTabViewShell = getCurrentBestViewShell(); + if ( pTabViewShell ) + { + ScViewData* pView = pTabViewShell->GetViewData(); + Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL; + if ( pView && pWin ) + { + if ( bAsLink && bOtherDoc ) + pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK + else + { + ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); + ScDocument* pDoc = NULL; + if ( pOwnClip ) + pDoc = pOwnClip->GetDocument(); + pTabViewShell->PasteFromClip( nFlags, pDoc, + nFunction, bSkipEmpty, bTranspose, bAsLink, + eMoveMode, IDF_NONE, TRUE ); + pTabViewShell->CellContentChanged(); + } + } + } + +} + +ScDocShell* +getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) +{ + uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW ); + ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() ); + ScDocShell* pDocShell = NULL; + if ( pModel ) + pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); + return pDocShell; + +} + +ScTabViewShell* +getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) +{ + ScDocShell* pDocShell = getDocShell( xModel ); + if ( pDocShell ) + return pDocShell->GetBestViewShell(); + return NULL; +} + +ScTabViewShell* +getCurrentBestViewShell() +{ + uno::Reference< frame::XModel > xModel = getCurrentDocument(); + return getBestViewShell( xModel ); +} + +SfxViewFrame* +getCurrentViewFrame() +{ + ScTabViewShell* pViewShell = getCurrentBestViewShell(); + if ( pViewShell ) + return pViewShell->GetViewFrame(); + return NULL; +} +}; + +#endif +const double Millimeter::factor = 35.27778; + +uno::Reference< beans::XIntrospectionAccess > +getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException) +{ + static uno::Reference< beans::XIntrospection > xIntrospection; + if( !xIntrospection.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW ); + } + return xIntrospection->inspect( aObject ); +} + +uno::Reference< script::XTypeConverter > +getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) +{ + static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW ); + return xTypeConv; +} +const uno::Any& +aNULL() +{ + static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() ); + return aNULLL; +} + +void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall) +{ + SfxViewFrame* pViewFrame = NULL; + if ( pViewShell ) + pViewFrame = pViewShell->GetViewFrame(); + if ( pViewFrame ) + { + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + if( pDispatcher ) + { + pDispatcher->Execute( nSlot , nCall ); + } + } +} + +void +dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps ) +{ + + util::URL url ; + url.Complete = aUrl; + rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" )); + uno::Reference xController = xModel->getCurrentController(); + uno::Reference xFrame = xController->getFrame(); + uno::Reference xDispatchProvider (xFrame,uno::UNO_QUERY_THROW); + try + { + uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + uno::Reference xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW ); + if ( !xContext.is() ) + { + return ; + } + + uno::Reference xServiceManager( + xContext->getServiceManager() ); + if ( !xServiceManager.is() ) + { + return ; + } + uno::Reference xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ) + ,xContext), uno::UNO_QUERY_THROW ); + if (!xParser.is()) + return; + xParser->parseStrict (url); + } + catch ( uno::Exception & /*e*/ ) + { + return ; + } + + uno::Reference xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0); + + uno::Sequence dispatchProps(1); + + sal_Int32 nProps = sProps.getLength(); + beans::PropertyValue* pDest = dispatchProps.getArray(); + if ( nProps ) + { + dispatchProps.realloc( nProps + 1 ); + // need to reaccquire pDest after realloc + pDest = dispatchProps.getArray(); + beans::PropertyValue* pSrc = sProps.getArray(); + for ( sal_Int32 index=0; indexdispatch( url, dispatchProps ); +} + +void +dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl) +{ + uno::Sequence dispatchProps; + dispatchRequests( xModel, aUrl, dispatchProps ); +} + + + + + uno::Reference< frame::XModel > +getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException) +{ + uno::Reference< frame::XModel > xModel; + SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() ); + SbxObject* basicChosen = pBasic ; + if ( basicChosen == NULL) + { + OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" ); + return xModel; + } + SbxObject* p = pBasic; + SbxObject* pParent = p->GetParent(); + SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL; + + if( pParentParent ) + { + basicChosen = pParentParent; + } + else if( pParent ) + { + basicChosen = pParent; + } + + + uno::Any aModel; + SbxVariable *pCompVar = basicChosen->Find( sKey, SbxCLASS_OBJECT ); + + if ( pCompVar ) + { + aModel = sbxToUnoValue( pCompVar ); + if ( sal_False == ( aModel >>= xModel ) || + !xModel.is() ) + { + throw uno::RuntimeException( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the current documet context") ), uno::Reference< uno::XInterface >() ); + } + else + { + OSL_TRACE("Have model points to url %s", + ::rtl::OUStringToOString( xModel->getURL(), + RTL_TEXTENCODING_ASCII_US ).pData->buffer ); + } + } + else + { + OSL_TRACE("Failed to get %s", rtl::OUStringToOString( sKey, RTL_TEXTENCODING_UTF8 ).getStr() ); + throw uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "Can't determine the currently selected document") ), + uno::Reference< uno::XInterface >() ); + } + return xModel; +} + + uno::Reference< frame::XModel > +getCurrentDocCtx( const rtl::OUString& ctxName, const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) +{ + uno::Reference< frame::XModel > xModel; + // try fallback to calling doc + css::uno::Reference< css::container::XNameAccess > xNameAccess( xContext, css::uno::UNO_QUERY_THROW ); + xModel.set( xNameAccess->getByName( ctxName ), uno::UNO_QUERY_THROW ); + return xModel; +} + + uno::Reference< frame::XModel > +getCurrentExcelDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) +{ + static const rtl::OUString sThisExcelDoc( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc" ) ); + uno::Reference< frame::XModel > xModel; + try + { + xModel = getCurrentDoc( sThisExcelDoc ); + } + catch( uno::Exception& e ) + { + xModel = getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ExcelDocumentContext" ) ), xContext ); + } + return xModel; +} + + uno::Reference< frame::XModel > +getCurrentWordDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) +{ + static const rtl::OUString sThisWordDoc( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc" ) ); + uno::Reference< frame::XModel > xModel; + try + { + xModel = getCurrentDoc( sThisWordDoc ); + } + catch( uno::Exception& e ) + { + xModel = getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocumentContext" ) ), xContext ); + } + return xModel; +} + +sal_Int32 +OORGBToXLRGB( sal_Int32 nCol ) +{ + sal_Int32 nAutoBits = nCol; + nAutoBits &= 0xFF000000; + sal_Int32 nRed = nCol; + nRed &= 0x00FF0000; + nRed >>= 16; + sal_Int32 nGreen = nCol; + nGreen &= 0x0000FF00; + nGreen >>= 8; + sal_Int32 nBlue = nCol; + nBlue &= 0x000000FF; + sal_Int32 nRGB = ( nAutoBits | (nBlue << 16) | (nGreen << 8) | nRed ); + return nRGB; +} +sal_Int32 +XLRGBToOORGB( sal_Int32 nCol ) +{ + sal_Int32 nAutoBits = nCol; + nAutoBits &= 0xFF000000; + + sal_Int32 nBlue = nCol; + nBlue &= 0x00FF0000; + nBlue >>= 16; + sal_Int32 nGreen = nCol; + nGreen &= 0x0000FF00; + nGreen >>= 8; + sal_Int32 nRed = nCol; + nRed &= 0x000000FF; + sal_Int32 nRGB = ( nAutoBits | (nRed << 16) | (nGreen << 8) | nBlue ); + return nRGB; +} +uno::Any +OORGBToXLRGB( const uno::Any& aCol ) +{ + sal_Int32 nCol; + aCol >>= nCol; + nCol = OORGBToXLRGB( nCol ); + return uno::makeAny( nCol ); +} +uno::Any +XLRGBToOORGB( const uno::Any& aCol ) +{ + sal_Int32 nCol; + aCol >>= nCol; + nCol = XLRGBToOORGB( nCol ); + return uno::makeAny( nCol ); +} + +void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, sal_Bool bUseSelection ) +{ + sal_Int32 nTo = 0; + sal_Int32 nFrom = 0; + sal_Int16 nCopies = 1; + sal_Bool bPreview = sal_False; + sal_Bool bCollate = sal_False; + sal_Bool bSelection = bUseSelection; + From >>= nFrom; + To >>= nTo; + Copies >>= nCopies; + Preview >>= bPreview; + if ( nCopies > 1 ) // Collate only useful when more that 1 copy + Collate >>= bCollate; + + rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) ); + rtl::OUString sFileName; + + if (( nFrom || nTo ) ) + { + if ( nFrom ) + sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange ); + if ( nTo ) + sRange += ::rtl::OUString::valueOf( nTo ); + } + + if ( PrToFileName.getValue() ) + { + PrToFileName >>= sFileName; + } + SfxViewFrame* pViewFrame = NULL; + if ( pViewShell ) + pViewFrame = pViewShell->GetViewFrame(); + if ( pViewFrame ) + { + SfxAllItemSet aArgs( SFX_APP()->GetPool() ); + + SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate ); + aArgs.Put( sfxCollate, sfxCollate.Which() ); + SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies ); + aArgs.Put( sfxCopies, sfxCopies.Which() ); + if ( sFileName.getLength() ) + { + SfxStringItem sfxFileName( SID_FILE_NAME, sFileName); + aArgs.Put( sfxFileName, sfxFileName.Which() ); + + } + if ( sRange.getLength() ) + { + SfxStringItem sfxRange( SID_PRINT_PAGES, sRange ); + aArgs.Put( sfxRange, sfxRange.Which() ); + } + SfxBoolItem sfxSelection( SID_SELECTION, bSelection ); + aArgs.Put( sfxSelection, sfxSelection.Which() ); + SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False ); + aArgs.Put( sfxAsync, sfxAsync.Which() ); + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + + if ( pDispatcher ) + { + if ( bPreview ) + { + if ( !pViewFrame->GetFrame()->IsInPlace() ) + { + // #TODO is this necessary ( calc specific ) +// SC_MOD()->InputEnterHandler(); + pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON ); + while ( isInPrintPreview( pViewFrame ) ) + Application::Yield(); + } + } + else + pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs ); + } + + } + + // #FIXME #TODO + // 1 ActivePrinter ( how/can we switch a printer via API? ) + // 2 PrintToFile ( ms behaviour if this option is specified but no + // filename supplied 'PrToFileName' then the user will be prompted ) + // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To + // values ) in oOO these options are mutually exclusive + // 4 There is a pop up to do with transparent objects in the print source + // should be able to disable that via configuration for the duration + // of this method +} + + void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, SfxViewShell* pViewShell ) +{ + dispatchExecute( pViewShell, SID_VIEWSHELL1 ); +} + +rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException ) +{ + uno::Type aType = pvargItem.getValueType(); + uno::TypeClass eTypeClass = aType.getTypeClass(); + rtl::OUString sString; + switch ( eTypeClass ) + { + case uno::TypeClass_BOOLEAN: + { + sal_Bool bBool = sal_False; + pvargItem >>= bBool; + sString = rtl::OUString::valueOf( bBool ); + break; + } + case uno::TypeClass_STRING: + pvargItem >>= sString; + break; + case uno::TypeClass_FLOAT: + { + float aFloat = 0; + pvargItem >>= aFloat; + sString = rtl::OUString::valueOf( aFloat ); + break; + } + case uno::TypeClass_DOUBLE: + { + double aDouble = 0; + pvargItem >>= aDouble; + sString = rtl::OUString::valueOf( aDouble ); + break; + } + case uno::TypeClass_SHORT: + case uno::TypeClass_LONG: + case uno::TypeClass_BYTE: + { + sal_Int32 aNum = 0; + pvargItem >>= aNum; + sString = rtl::OUString::valueOf( aNum ); + break; + } + + case uno::TypeClass_HYPER: + { + sal_Int64 aHyper = 0; + pvargItem >>= aHyper; + sString = rtl::OUString::valueOf( aHyper ); + break; + } + default: + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() ); + } + return sString; +} + + +rtl::OUString +ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator) +{ + return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2)); +} + +rtl::OUString +ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix) +{ + sal_Int32 a = _nStartSuffix; + rtl::OUString scompname = _sElementName; + bool bElementexists = true; + sal_Int32 nLen = _slist.getLength(); + if ( nLen == 0 ) + return _sElementName; + + while (bElementexists == true) + { + for (sal_Int32 i = 0; i < nLen; i++) + { + if (FieldInList(_slist, scompname) == -1) + { + return scompname; + } + } + scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ ); + } + return rtl::OUString(); +} + +sal_Int32 +ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString ) +{ + sal_Int32 FieldLen = SearchList.getLength(); + sal_Int32 retvalue = -1; + for (sal_Int32 i = 0; i < FieldLen; i++) + { + // I wonder why comparing lexicographically is done + // when its a match is whats interesting? + //if (SearchList[i].compareTo(SearchString) == 0) + if ( SearchList[i].equals( SearchString ) ) + { + retvalue = i; + break; + } + } + return retvalue; + +} +bool NeedEsc(sal_Unicode cCode) +{ + String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()")); + return (STRING_NOTFOUND != sEsc.Search(cCode)); +} + +rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike ) +{ + rtl::OUStringBuffer sResult; + const sal_Unicode *start = rIn.getStr(); + const sal_Unicode *end = start + rIn.getLength(); + + int seenright = 0; + if ( bForLike ) + sResult.append(static_cast('^')); + + while (start < end) + { + switch (*start) + { + case '?': + sResult.append(static_cast('.')); + start++; + break; + case '*': + sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*"))); + start++; + break; + case '#': + sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]"))); + start++; + break; + case '~': + sResult.append(static_cast('\\')); + sResult.append(*(++start)); + start++; + break; + // dump the ~ and escape the next characture + case ']': + sResult.append(static_cast('\\')); + sResult.append(*start++); + break; + case '[': + sResult.append(*start++); + seenright = 0; + while (start < end && !seenright) + { + switch (*start) + { + case '[': + case '?': + case '*': + sResult.append(static_cast('\\')); + sResult.append(*start); + break; + case ']': + sResult.append(*start); + seenright = 1; + break; + case '!': + sResult.append(static_cast('^')); + break; + default: + if (NeedEsc(*start)) + sResult.append(static_cast('\\')); + sResult.append(*start); + break; + } + start++; + } + break; + default: + if (NeedEsc(*start)) + sResult.append(static_cast('\\')); + sResult.append(*start++); + } + } + + if ( bForLike ) + sResult.append(static_cast('$')); + + return sResult.makeStringAndClear( ); +} + +double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical) +{ + double fConvertFactor = 1.0; + if( bVertical ) + { + fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000; + } + else + { + fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000; + } + return fConvertFactor; +} + +double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical) +{ + double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical ); + return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor; +} +double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical) +{ + double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical ); + return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR; +} + +ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ) +{ + m_pShapeHelper.reset( new ShapeHelper( xShape ) ); +} + +sal_Int32 getPointerStyle( const uno::Reference< frame::XModel >& xModel ) +{ + + sal_Int32 nPointerStyle( POINTER_ARROW ); + try + { + const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); + const uno::Reference< frame::XFrame > xFrame ( xController->getFrame(), uno::UNO_SET_THROW ); + const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + // why the heck isn't there an XWindowPeer::getPointer, but a setPointer only? + const Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow ) + nPointerStyle = pWindow->GetSystemWindow()->GetPointer().GetStyle(); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return nPointerStyle; +} + +// #FIXME this method looks wrong, shouldn't it just affect calc *or* writer +// document/frame/window(s) but not both ( and depending on what api called +// this ) +void setCursorHelper( const uno::Reference< frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite ) +{ + ::std::vector< uno::Reference< frame::XController > > aControllers; + + uno::Reference< frame::XModel2 > xModel2( xModel, uno::UNO_QUERY ); + if ( xModel2.is() ) + { + const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW ); + while ( xEnumControllers->hasMoreElements() ) + { + const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW ); + aControllers.push_back( xController ); + } + } + else + { + const uno::Reference< frame::XModel > xModel( xModel2, uno::UNO_QUERY ); + if ( xModel.is() ) + { + const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); + aControllers.push_back( xController ); + } + } + + for ( ::std::vector< uno::Reference< frame::XController > >::const_iterator controller = aControllers.begin(); + controller != aControllers.end(); + ++controller + ) + { + const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW ); + const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + OSL_ENSURE( pWindow, "ScVbaApplication::setCursor: no window!" ); + if ( !pWindow ) + continue; + + pWindow->GetSystemWindow()->SetPointer( rPointer ); + pWindow->GetSystemWindow()->EnableChildPointerOverwrite( bOverWrite ); + } +} + +void setDefaultPropByIntrospection( const uno::Any& aObj, const uno::Any& aValue ) throw ( uno::RuntimeException ) +{ + uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObj ) ); + + // #MAYBE #FIXME sort of a bit of a hack, + uno::Reference< script::XDefaultProperty > xDflt( aObj, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet; + + if ( xUnoAccess.is() ) + xPropSet.set( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY); + + if ( xPropSet.is() ) + xPropSet->setPropertyValue( xDflt->getDefaultPropertyName(), aValue ); + else + throw uno::RuntimeException(); +} + +uno::Any getPropertyValue( const uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName ) +{ + uno::Any result; + for ( sal_Int32 i = 0; i < aProp.getLength(); i++ ) + { + if ( aProp[i].Name.equals(aName) ) + { + aProp[i].Value >>= result; + return result; + } + } + return result; +} + +sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue ) +{ + for ( sal_Int32 i = 0; i < aProp.getLength(); i++ ) + { + if ( aProp[i].Name.equals(aName) ) + { + aProp[i].Value = aValue; + return sal_True; + } + } + return sal_False; +} + +#define VBA_LEFT "PositionX" +#define VBA_TOP "PositionY" +UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl ) +{ + mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW ); +} + double UserFormGeometryHelper::getLeft() + { + sal_Int32 nLeft = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft; + return Millimeter::getInPoints( nLeft ); + } + void UserFormGeometryHelper::setLeft( double nLeft ) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) ); + } + double UserFormGeometryHelper::getTop() + { + sal_Int32 nTop = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop; + return Millimeter::getInPoints( nTop ); + } + void UserFormGeometryHelper::setTop( double nTop ) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) ); + } + double UserFormGeometryHelper::getHeight() + { + sal_Int32 nHeight = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ) ) >>= nHeight; + return Millimeter::getInPoints( nHeight ); + } + void UserFormGeometryHelper::setHeight( double nHeight ) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) ); + } + double UserFormGeometryHelper::getWidth() + { + sal_Int32 nWidth = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ) ) >>= nWidth; + return Millimeter::getInPoints( nWidth ); + } + void UserFormGeometryHelper::setWidth( double nWidth) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) ); + } + + double ConcreteXShapeGeometryAttributes::getLeft() + { + return m_pShapeHelper->getLeft(); + } + void ConcreteXShapeGeometryAttributes::setLeft( double nLeft ) + { + m_pShapeHelper->setLeft( nLeft ); + } + double ConcreteXShapeGeometryAttributes::getTop() + { + return m_pShapeHelper->getTop(); + } + void ConcreteXShapeGeometryAttributes::setTop( double nTop ) + { + m_pShapeHelper->setTop( nTop ); + } + + double ConcreteXShapeGeometryAttributes::getHeight() + { + return m_pShapeHelper->getHeight(); + } + void ConcreteXShapeGeometryAttributes::setHeight( double nHeight ) + { + m_pShapeHelper->setHeight( nHeight ); + } + double ConcreteXShapeGeometryAttributes::getWidth() + { + return m_pShapeHelper->getWidth(); + } + void ConcreteXShapeGeometryAttributes::setWidth( double nWidth) + { + m_pShapeHelper->setWidth( nWidth ); + } + + + ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape ) + { + if( !xShape.is() ) + throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() ); + } + + double ShapeHelper::getHeight() + { + return Millimeter::getInPoints(xShape->getSize().Height); + } + + + void ShapeHelper::setHeight(double _fheight) throw ( css::script::BasicErrorException ) + { + try + { + css::awt::Size aSize = xShape->getSize(); + aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight); + xShape->setSize(aSize); + } + catch ( css::uno::Exception& /*e*/) + { + throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); + } + } + + + double ShapeHelper::getWidth() + { + return Millimeter::getInPoints(xShape->getSize().Width); + } + + void ShapeHelper::setWidth(double _fWidth) throw ( css::script::BasicErrorException ) + { + try + { + css::awt::Size aSize = xShape->getSize(); + aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth); + xShape->setSize(aSize); + } + catch (css::uno::Exception& /*e*/) + { + throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); + } + } + + + double ShapeHelper::getLeft() + { + return Millimeter::getInPoints(xShape->getPosition().X); + } + + + void ShapeHelper::setLeft(double _fLeft) + { + css::awt::Point aPoint = xShape->getPosition(); + aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft); + xShape->setPosition(aPoint); + } + + + double ShapeHelper::getTop() + { + return Millimeter::getInPoints(xShape->getPosition().Y); + } + + + void ShapeHelper::setTop(double _fTop) + { + css::awt::Point aPoint = xShape->getPosition(); + aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop); + xShape->setPosition(aPoint); + } + + void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException ) + { + // #TODO #FIXME ( do we want to support additionalArg here ) + throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() ); + } + + void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ) + { + exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument ); + } + void DebugHelper::exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException ) + { + exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() ); + } + + Millimeter::Millimeter():m_nMillimeter(0) {} + + Millimeter::Millimeter(double mm):m_nMillimeter(mm) {} + + void Millimeter::set(double mm) { m_nMillimeter = mm; } + void Millimeter::setInPoints(double points) + { + m_nMillimeter = points * 0.352777778; + // 25.4mm / 72 + } + + void Millimeter::setInHundredthsOfOneMillimeter(double hmm) + { + m_nMillimeter = hmm / 100; + } + + double Millimeter::get() + { + return m_nMillimeter; + } + double Millimeter::getInHundredthsOfOneMillimeter() + { + return m_nMillimeter * 100; + } + double Millimeter::getInPoints() + { + return m_nMillimeter * 2.834645669; // 72 / 25.4mm + } + + sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points) + { + sal_Int32 mm = static_cast(points * factor); + return mm; + } + + double Millimeter::getInPoints(int _hmm) + { + double points = double( static_cast(_hmm) / factor); + return points; + } + + SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) + { + SfxObjectShell* pFoundShell = NULL; + if ( xModel.is() ) + { + uno::Reference< lang::XUnoTunnel > xObjShellTunnel( xModel, uno::UNO_QUERY_THROW ); + pFoundShell = reinterpret_cast( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId())); + } + if ( !pFoundShell ) + throw uno::RuntimeException(); + return pFoundShell; + } + +} // openoffice +} //org diff --git a/vbahelper/source/vbahelper/vbahelper.cxx.orig b/vbahelper/source/vbahelper/vbahelper.cxx.orig new file mode 100644 index 000000000000..c8c96cca01e5 --- /dev/null +++ b/vbahelper/source/vbahelper/vbahelper.cxx.orig @@ -0,0 +1,1128 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.cxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef OOVBA_DLLIMPLEMENTATION +#define OOVBA_DLLIMPLEMENTATION +#endif + +#include +#include +// #FIXME needs service +//#include "vbashape.hxx" +//#include "unonames.hxx" + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +#define NAME_HEIGHT "Height" +#define NAME_WIDTH "Width" + +#define POINTTO100THMILLIMETERFACTOR 35.27778 + + +void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue ); + +uno::Any sbxToUnoValue( SbxVariable* pVar ); + + +namespace ooo +{ +namespace vba +{ + +uno::Reference< lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell ) +{ + uno::Any aUnoVar; + if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) ) + throw lang::IllegalArgumentException(); + uno::Reference< lang::XMultiServiceFactory > xVBAFactory( aUnoVar, uno::UNO_QUERY_THROW ); + return xVBAFactory; +} + +css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException) +{ + OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); + return getVBAServiceFactory( pShell )->createInstance( sVarName ); +} + +css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const uno::Sequence< uno::Any >& aArgs ) throw ( css::uno::RuntimeException ) +{ + OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); + uno::Reference< uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs ); + return xIf; +} +// helper method to determine if the view ( calc ) is in print-preview mode +bool isInPrintPreview( SfxViewFrame* pView ) +{ + sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0; + if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() > +nViewNo && !pView->GetObjectShell()->IsInPlaceActive() ) + { + SfxViewFactory &rViewFactory = + pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo); + if ( pView->GetCurViewId() == rViewFactory.GetOrdinal() ) + return true; + } + return false; +} +#if 0 +namespace excel // all in this namespace probably can be moved to sc +{ + + +const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning")); +class PasteCellsWarningReseter +{ +private: + bool bInitialWarningState; + static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException ) + { + static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + static uno::Reference xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW ); + static uno::Reference xServiceManager( + xContext->getServiceManager(), uno::UNO_QUERY_THROW ); + static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW ); + return xProps; + } + + bool getReplaceCellsWarning() throw ( uno::RuntimeException ) + { + sal_Bool res = sal_False; + getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res; + return ( res == sal_True ); + } + + void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException ) + { + getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) ); + } +public: + PasteCellsWarningReseter() throw ( uno::RuntimeException ) + { + bInitialWarningState = getReplaceCellsWarning(); + if ( bInitialWarningState ) + setReplaceCellsWarning( false ); + } + ~PasteCellsWarningReseter() + { + if ( bInitialWarningState ) + { + // don't allow dtor to throw + try + { + setReplaceCellsWarning( true ); + } + catch ( uno::Exception& /*e*/ ){} + } + } +}; + +void +implnPaste() +{ + PasteCellsWarningReseter resetWarningBox; + ScTabViewShell* pViewShell = getCurrentBestViewShell(); + if ( pViewShell ) + { + pViewShell->PasteFromSystem(); + pViewShell->CellContentChanged(); + } +} + + +void +implnCopy() +{ + ScTabViewShell* pViewShell = getCurrentBestViewShell(); + if ( pViewShell ) + pViewShell->CopyToClip(NULL,false,false,true); +} + +void +implnCut() +{ + ScTabViewShell* pViewShell = getCurrentBestViewShell(); + if ( pViewShell ) + pViewShell->CutToClip( NULL, TRUE ); +} +void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose) +{ + PasteCellsWarningReseter resetWarningBox; + sal_Bool bAsLink(sal_False), bOtherDoc(sal_False); + InsCellCmd eMoveMode = INS_NONE; + + if ( !pTabViewShell ) + // none active, try next best + pTabViewShell = getCurrentBestViewShell(); + if ( pTabViewShell ) + { + ScViewData* pView = pTabViewShell->GetViewData(); + Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL; + if ( pView && pWin ) + { + if ( bAsLink && bOtherDoc ) + pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK + else + { + ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); + ScDocument* pDoc = NULL; + if ( pOwnClip ) + pDoc = pOwnClip->GetDocument(); + pTabViewShell->PasteFromClip( nFlags, pDoc, + nFunction, bSkipEmpty, bTranspose, bAsLink, + eMoveMode, IDF_NONE, TRUE ); + pTabViewShell->CellContentChanged(); + } + } + } + +} + +ScDocShell* +getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) +{ + uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW ); + ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() ); + ScDocShell* pDocShell = NULL; + if ( pModel ) + pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); + return pDocShell; + +} + +ScTabViewShell* +getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) +{ + ScDocShell* pDocShell = getDocShell( xModel ); + if ( pDocShell ) + return pDocShell->GetBestViewShell(); + return NULL; +} + +ScTabViewShell* +getCurrentBestViewShell() +{ + uno::Reference< frame::XModel > xModel = getCurrentDocument(); + return getBestViewShell( xModel ); +} + +SfxViewFrame* +getCurrentViewFrame() +{ + ScTabViewShell* pViewShell = getCurrentBestViewShell(); + if ( pViewShell ) + return pViewShell->GetViewFrame(); + return NULL; +} +}; + +#endif +const double Millimeter::factor = 35.27778; + +uno::Reference< beans::XIntrospectionAccess > +getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException) +{ + static uno::Reference< beans::XIntrospection > xIntrospection; + if( !xIntrospection.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW ); + } + return xIntrospection->inspect( aObject ); +} + +uno::Reference< script::XTypeConverter > +getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) +{ + static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW ); + return xTypeConv; +} +const uno::Any& +aNULL() +{ + static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() ); + return aNULLL; +} + +void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall) +{ + SfxViewFrame* pViewFrame = NULL; + if ( pViewShell ) + pViewFrame = pViewShell->GetViewFrame(); + if ( pViewFrame ) + { + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + if( pDispatcher ) + { + pDispatcher->Execute( nSlot , nCall ); + } + } +} + +void +dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps ) +{ + + util::URL url ; + url.Complete = aUrl; + rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" )); + uno::Reference xController = xModel->getCurrentController(); + uno::Reference xFrame = xController->getFrame(); + uno::Reference xDispatchProvider (xFrame,uno::UNO_QUERY_THROW); + try + { + uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + uno::Reference xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW ); + if ( !xContext.is() ) + { + return ; + } + + uno::Reference xServiceManager( + xContext->getServiceManager() ); + if ( !xServiceManager.is() ) + { + return ; + } + uno::Reference xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ) + ,xContext), uno::UNO_QUERY_THROW ); + if (!xParser.is()) + return; + xParser->parseStrict (url); + } + catch ( uno::Exception & /*e*/ ) + { + return ; + } + + uno::Reference xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0); + + uno::Sequence dispatchProps(1); + + sal_Int32 nProps = sProps.getLength(); + beans::PropertyValue* pDest = dispatchProps.getArray(); + if ( nProps ) + { + dispatchProps.realloc( nProps + 1 ); + // need to reaccquire pDest after realloc + pDest = dispatchProps.getArray(); + beans::PropertyValue* pSrc = sProps.getArray(); + for ( sal_Int32 index=0; indexdispatch( url, dispatchProps ); +} + +void +dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl) +{ + uno::Sequence dispatchProps; + dispatchRequests( xModel, aUrl, dispatchProps ); +} + + + + + uno::Reference< frame::XModel > +getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException) +{ + uno::Reference< frame::XModel > xModel; + SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() ); + SbxObject* basicChosen = pBasic ; + if ( basicChosen == NULL) + { + OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" ); + return xModel; + } + SbxObject* p = pBasic; + SbxObject* pParent = p->GetParent(); + SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL; + + if( pParentParent ) + { + basicChosen = pParentParent; + } + else if( pParent ) + { + basicChosen = pParent; + } + + + uno::Any aModel; + SbxVariable *pCompVar = basicChosen->Find( sKey, SbxCLASS_OBJECT ); + + if ( pCompVar ) + { + aModel = sbxToUnoValue( pCompVar ); + if ( sal_False == ( aModel >>= xModel ) || + !xModel.is() ) + { + throw uno::RuntimeException( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the current documet context") ), uno::Reference< uno::XInterface >() ); + } + else + { + OSL_TRACE("Have model points to url %s", + ::rtl::OUStringToOString( xModel->getURL(), + RTL_TEXTENCODING_ASCII_US ).pData->buffer ); + } + } + else + { + OSL_TRACE("Failed to get %s", rtl::OUStringToOString( sKey, RTL_TEXTENCODING_UTF8 ).getStr() ); + throw uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "Can't determine the currently selected document") ), + uno::Reference< uno::XInterface >() ); + } + return xModel; +} + + + uno::Reference< frame::XModel > +getCurrentExcelDoc() throw (uno::RuntimeException) +{ + static const rtl::OUString sThisExcelDoc( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc" ) ); + return getCurrentDoc( sThisExcelDoc ); +} + + uno::Reference< frame::XModel > +getCurrentWordDoc() throw (uno::RuntimeException) +{ + static const rtl::OUString sThisWordDoc( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc" ) ); + return getCurrentDoc( sThisWordDoc ); +} + +sal_Int32 +OORGBToXLRGB( sal_Int32 nCol ) +{ + sal_Int32 nAutoBits = nCol; + nAutoBits &= 0xFF000000; + sal_Int32 nRed = nCol; + nRed &= 0x00FF0000; + nRed >>= 16; + sal_Int32 nGreen = nCol; + nGreen &= 0x0000FF00; + nGreen >>= 8; + sal_Int32 nBlue = nCol; + nBlue &= 0x000000FF; + sal_Int32 nRGB = ( nAutoBits | (nBlue << 16) | (nGreen << 8) | nRed ); + return nRGB; +} +sal_Int32 +XLRGBToOORGB( sal_Int32 nCol ) +{ + sal_Int32 nAutoBits = nCol; + nAutoBits &= 0xFF000000; + + sal_Int32 nBlue = nCol; + nBlue &= 0x00FF0000; + nBlue >>= 16; + sal_Int32 nGreen = nCol; + nGreen &= 0x0000FF00; + nGreen >>= 8; + sal_Int32 nRed = nCol; + nRed &= 0x000000FF; + sal_Int32 nRGB = ( nAutoBits | (nRed << 16) | (nGreen << 8) | nBlue ); + return nRGB; +} +uno::Any +OORGBToXLRGB( const uno::Any& aCol ) +{ + sal_Int32 nCol; + aCol >>= nCol; + nCol = OORGBToXLRGB( nCol ); + return uno::makeAny( nCol ); +} +uno::Any +XLRGBToOORGB( const uno::Any& aCol ) +{ + sal_Int32 nCol; + aCol >>= nCol; + nCol = XLRGBToOORGB( nCol ); + return uno::makeAny( nCol ); +} + +void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, sal_Bool bUseSelection ) +{ + sal_Int32 nTo = 0; + sal_Int32 nFrom = 0; + sal_Int16 nCopies = 1; + sal_Bool bPreview = sal_False; + sal_Bool bCollate = sal_False; + sal_Bool bSelection = bUseSelection; + From >>= nFrom; + To >>= nTo; + Copies >>= nCopies; + Preview >>= bPreview; + if ( nCopies > 1 ) // Collate only useful when more that 1 copy + Collate >>= bCollate; + + rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) ); + rtl::OUString sFileName; + + if (( nFrom || nTo ) ) + { + if ( nFrom ) + sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange ); + if ( nTo ) + sRange += ::rtl::OUString::valueOf( nTo ); + } + + if ( PrToFileName.getValue() ) + { + PrToFileName >>= sFileName; + } + SfxViewFrame* pViewFrame = NULL; + if ( pViewShell ) + pViewFrame = pViewShell->GetViewFrame(); + if ( pViewFrame ) + { + SfxAllItemSet aArgs( SFX_APP()->GetPool() ); + + SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate ); + aArgs.Put( sfxCollate, sfxCollate.Which() ); + SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies ); + aArgs.Put( sfxCopies, sfxCopies.Which() ); + if ( sFileName.getLength() ) + { + SfxStringItem sfxFileName( SID_FILE_NAME, sFileName); + aArgs.Put( sfxFileName, sfxFileName.Which() ); + + } + if ( sRange.getLength() ) + { + SfxStringItem sfxRange( SID_PRINT_PAGES, sRange ); + aArgs.Put( sfxRange, sfxRange.Which() ); + } + SfxBoolItem sfxSelection( SID_SELECTION, bSelection ); + aArgs.Put( sfxSelection, sfxSelection.Which() ); + SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False ); + aArgs.Put( sfxAsync, sfxAsync.Which() ); + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + + if ( pDispatcher ) + { + if ( bPreview ) + { + if ( !pViewFrame->GetFrame()->IsInPlace() ) + { + // #TODO is this necessary ( calc specific ) +// SC_MOD()->InputEnterHandler(); + pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON ); + while ( isInPrintPreview( pViewFrame ) ) + Application::Yield(); + } + } + else + pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs ); + } + + } + + // #FIXME #TODO + // 1 ActivePrinter ( how/can we switch a printer via API? ) + // 2 PrintToFile ( ms behaviour if this option is specified but no + // filename supplied 'PrToFileName' then the user will be prompted ) + // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To + // values ) in oOO these options are mutually exclusive + // 4 There is a pop up to do with transparent objects in the print source + // should be able to disable that via configuration for the duration + // of this method +} + + void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, SfxViewShell* pViewShell ) +{ + dispatchExecute( pViewShell, SID_VIEWSHELL1 ); +} + +rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException ) +{ + uno::Type aType = pvargItem.getValueType(); + uno::TypeClass eTypeClass = aType.getTypeClass(); + rtl::OUString sString; + switch ( eTypeClass ) + { + case uno::TypeClass_BOOLEAN: + { + sal_Bool bBool = sal_False; + pvargItem >>= bBool; + sString = rtl::OUString::valueOf( bBool ); + break; + } + case uno::TypeClass_STRING: + pvargItem >>= sString; + break; + case uno::TypeClass_FLOAT: + { + float aFloat = 0; + pvargItem >>= aFloat; + sString = rtl::OUString::valueOf( aFloat ); + break; + } + case uno::TypeClass_DOUBLE: + { + double aDouble = 0; + pvargItem >>= aDouble; + sString = rtl::OUString::valueOf( aDouble ); + break; + } + case uno::TypeClass_SHORT: + case uno::TypeClass_LONG: + case uno::TypeClass_BYTE: + { + sal_Int32 aNum = 0; + pvargItem >>= aNum; + sString = rtl::OUString::valueOf( aNum ); + break; + } + + case uno::TypeClass_HYPER: + { + sal_Int64 aHyper = 0; + pvargItem >>= aHyper; + sString = rtl::OUString::valueOf( aHyper ); + break; + } + default: + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() ); + } + return sString; +} + + +rtl::OUString +ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator) +{ + return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2)); +} + +rtl::OUString +ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix) +{ + sal_Int32 a = _nStartSuffix; + rtl::OUString scompname = _sElementName; + bool bElementexists = true; + sal_Int32 nLen = _slist.getLength(); + if ( nLen == 0 ) + return _sElementName; + + while (bElementexists == true) + { + for (sal_Int32 i = 0; i < nLen; i++) + { + if (FieldInList(_slist, scompname) == -1) + { + return scompname; + } + } + scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ ); + } + return rtl::OUString(); +} + +sal_Int32 +ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString ) +{ + sal_Int32 FieldLen = SearchList.getLength(); + sal_Int32 retvalue = -1; + for (sal_Int32 i = 0; i < FieldLen; i++) + { + // I wonder why comparing lexicographically is done + // when its a match is whats interesting? + //if (SearchList[i].compareTo(SearchString) == 0) + if ( SearchList[i].equals( SearchString ) ) + { + retvalue = i; + break; + } + } + return retvalue; + +} +bool NeedEsc(sal_Unicode cCode) +{ + String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()")); + return (STRING_NOTFOUND != sEsc.Search(cCode)); +} + +rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike ) +{ + rtl::OUStringBuffer sResult; + const sal_Unicode *start = rIn.getStr(); + const sal_Unicode *end = start + rIn.getLength(); + + int seenright = 0; + if ( bForLike ) + sResult.append(static_cast('^')); + + while (start < end) + { + switch (*start) + { + case '?': + sResult.append(static_cast('.')); + start++; + break; + case '*': + sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*"))); + start++; + break; + case '#': + sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]"))); + start++; + break; + case '~': + sResult.append(static_cast('\\')); + sResult.append(*(++start)); + start++; + break; + // dump the ~ and escape the next characture + case ']': + sResult.append(static_cast('\\')); + sResult.append(*start++); + break; + case '[': + sResult.append(*start++); + seenright = 0; + while (start < end && !seenright) + { + switch (*start) + { + case '[': + case '?': + case '*': + sResult.append(static_cast('\\')); + sResult.append(*start); + break; + case ']': + sResult.append(*start); + seenright = 1; + break; + case '!': + sResult.append(static_cast('^')); + break; + default: + if (NeedEsc(*start)) + sResult.append(static_cast('\\')); + sResult.append(*start); + break; + } + start++; + } + break; + default: + if (NeedEsc(*start)) + sResult.append(static_cast('\\')); + sResult.append(*start++); + } + } + + if ( bForLike ) + sResult.append(static_cast('$')); + + return sResult.makeStringAndClear( ); +} + +double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical) +{ + double fConvertFactor = 1.0; + if( bVertical ) + { + fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000; + } + else + { + fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000; + } + return fConvertFactor; +} + +double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical) +{ + double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical ); + return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor; +} +double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical) +{ + double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical ); + return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR; +} + +ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ) +{ + m_pShapeHelper.reset( new ShapeHelper( xShape ) ); +} + +sal_Int32 getPointerStyle( const uno::Reference< frame::XModel >& xModel ) +{ + + sal_Int32 nPointerStyle( POINTER_ARROW ); + try + { + const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); + const uno::Reference< frame::XFrame > xFrame ( xController->getFrame(), uno::UNO_SET_THROW ); + const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + // why the heck isn't there an XWindowPeer::getPointer, but a setPointer only? + const Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow ) + nPointerStyle = pWindow->GetSystemWindow()->GetPointer().GetStyle(); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return nPointerStyle; +} + +// #FIXME this method looks wrong, shouldn't it just affect calc *or* writer +// document/frame/window(s) but not both ( and depending on what api called +// this ) +void setCursorHelper( const uno::Reference< frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite ) +{ + ::std::vector< uno::Reference< frame::XController > > aControllers; + + uno::Reference< frame::XModel2 > xModel2( xModel, uno::UNO_QUERY ); + if ( xModel2.is() ) + { + const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW ); + while ( xEnumControllers->hasMoreElements() ) + { + const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW ); + aControllers.push_back( xController ); + } + } + else + { + const uno::Reference< frame::XModel > xModel( xModel2, uno::UNO_QUERY ); + if ( xModel.is() ) + { + const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); + aControllers.push_back( xController ); + } + } + + for ( ::std::vector< uno::Reference< frame::XController > >::const_iterator controller = aControllers.begin(); + controller != aControllers.end(); + ++controller + ) + { + const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW ); + const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + OSL_ENSURE( pWindow, "ScVbaApplication::setCursor: no window!" ); + if ( !pWindow ) + continue; + + pWindow->GetSystemWindow()->SetPointer( rPointer ); + pWindow->GetSystemWindow()->EnableChildPointerOverwrite( bOverWrite ); + } +} + +#define VBA_LEFT "PositionX" +#define VBA_TOP "PositionY" +UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl ) +{ + mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW ); +} + double UserFormGeometryHelper::getLeft() + { + sal_Int32 nLeft = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft; + return Millimeter::getInPoints( nLeft ); + } + void UserFormGeometryHelper::setLeft( double nLeft ) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) ); + } + double UserFormGeometryHelper::getTop() + { + sal_Int32 nTop = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop; + return Millimeter::getInPoints( nTop ); + } + void UserFormGeometryHelper::setTop( double nTop ) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) ); + } + double UserFormGeometryHelper::getHeight() + { + sal_Int32 nHeight = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ) ) >>= nHeight; + return Millimeter::getInPoints( nHeight ); + } + void UserFormGeometryHelper::setHeight( double nHeight ) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) ); + } + double UserFormGeometryHelper::getWidth() + { + sal_Int32 nWidth = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ) ) >>= nWidth; + return Millimeter::getInPoints( nWidth ); + } + void UserFormGeometryHelper::setWidth( double nWidth) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) ); + } + + double ConcreteXShapeGeometryAttributes::getLeft() + { + return m_pShapeHelper->getLeft(); + } + void ConcreteXShapeGeometryAttributes::setLeft( double nLeft ) + { + m_pShapeHelper->setLeft( nLeft ); + } + double ConcreteXShapeGeometryAttributes::getTop() + { + return m_pShapeHelper->getTop(); + } + void ConcreteXShapeGeometryAttributes::setTop( double nTop ) + { + m_pShapeHelper->setTop( nTop ); + } + + double ConcreteXShapeGeometryAttributes::getHeight() + { + return m_pShapeHelper->getHeight(); + } + void ConcreteXShapeGeometryAttributes::setHeight( double nHeight ) + { + m_pShapeHelper->setHeight( nHeight ); + } + double ConcreteXShapeGeometryAttributes::getWidth() + { + return m_pShapeHelper->getWidth(); + } + void ConcreteXShapeGeometryAttributes::setWidth( double nWidth) + { + m_pShapeHelper->setWidth( nWidth ); + } + + + ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape ) + { + if( !xShape.is() ) + throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() ); + } + + double ShapeHelper::getHeight() + { + return Millimeter::getInPoints(xShape->getSize().Height); + } + + + void ShapeHelper::setHeight(double _fheight) throw ( css::script::BasicErrorException ) + { + try + { + css::awt::Size aSize = xShape->getSize(); + aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight); + xShape->setSize(aSize); + } + catch ( css::uno::Exception& /*e*/) + { + throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); + } + } + + + double ShapeHelper::getWidth() + { + return Millimeter::getInPoints(xShape->getSize().Width); + } + + void ShapeHelper::setWidth(double _fWidth) throw ( css::script::BasicErrorException ) + { + try + { + css::awt::Size aSize = xShape->getSize(); + aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth); + xShape->setSize(aSize); + } + catch (css::uno::Exception& /*e*/) + { + throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); + } + } + + + double ShapeHelper::getLeft() + { + return Millimeter::getInPoints(xShape->getPosition().X); + } + + + void ShapeHelper::setLeft(double _fLeft) + { + css::awt::Point aPoint = xShape->getPosition(); + aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft); + xShape->setPosition(aPoint); + } + + + double ShapeHelper::getTop() + { + return Millimeter::getInPoints(xShape->getPosition().Y); + } + + + void ShapeHelper::setTop(double _fTop) + { + css::awt::Point aPoint = xShape->getPosition(); + aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop); + xShape->setPosition(aPoint); + } + + void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException ) + { + // #TODO #FIXME ( do we want to support additionalArg here ) + throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() ); + } + + void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ) + { + exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument ); + } + void DebugHelper::exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException ) + { + exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() ); + } + + Millimeter::Millimeter():m_nMillimeter(0) {} + + Millimeter::Millimeter(double mm):m_nMillimeter(mm) {} + + void Millimeter::set(double mm) { m_nMillimeter = mm; } + void Millimeter::setInPoints(double points) + { + m_nMillimeter = points * 0.352777778; + // 25.4mm / 72 + } + + void Millimeter::setInHundredthsOfOneMillimeter(double hmm) + { + m_nMillimeter = hmm / 100; + } + + double Millimeter::get() + { + return m_nMillimeter; + } + double Millimeter::getInHundredthsOfOneMillimeter() + { + return m_nMillimeter * 100; + } + double Millimeter::getInPoints() + { + return m_nMillimeter * 2.834645669; // 72 / 25.4mm + } + + sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points) + { + sal_Int32 mm = static_cast(points * factor); + return mm; + } + + double Millimeter::getInPoints(int _hmm) + { + double points = double( static_cast(_hmm) / factor); + return points; + } + + SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) + { + SfxObjectShell* pFoundShell = NULL; + if ( xModel.is() ) + { + uno::Reference< lang::XUnoTunnel > xObjShellTunnel( xModel, uno::UNO_QUERY_THROW ); + pFoundShell = reinterpret_cast( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId())); + } + if ( !pFoundShell ) + throw uno::RuntimeException(); + return pFoundShell; + } + +} // openoffice +} //org diff --git a/vbahelper/source/vbahelper/vbahelper.cxx.rej b/vbahelper/source/vbahelper/vbahelper.cxx.rej new file mode 100644 index 000000000000..e6d2d95a7454 --- /dev/null +++ b/vbahelper/source/vbahelper/vbahelper.cxx.rej @@ -0,0 +1,45 @@ +*************** +*** 67,73 **** + #include + #include + #include +- #include + #include + #include + #include +--- 67,72 ---- + #include + #include + #include + #include + #include + #include +*************** UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp +*** 1117,1135 **** + double points = double( static_cast(_hmm) / factor); + return points; + } +- +- SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) +- { +- SfxObjectShell* pFoundShell = NULL; +- if ( xModel.is() ) +- { +- uno::Reference< lang::XUnoTunnel > xObjShellTunnel( xModel, uno::UNO_QUERY_THROW ); +- pFoundShell = reinterpret_cast( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId())); +- } +- if ( !pFoundShell ) +- throw uno::RuntimeException(); +- return pFoundShell; +- } + + } // openoffice + } //org +--- 1116,1122 ---- + double points = double( static_cast(_hmm) / factor); + return points; + } ++ + + } // openoffice + } //org diff --git a/vbahelper/source/vbahelper/vbalineformat.cxx b/vbahelper/source/vbahelper/vbalineformat.cxx new file mode 100644 index 000000000000..8e99086f74da --- /dev/null +++ b/vbahelper/source/vbahelper/vbalineformat.cxx @@ -0,0 +1,458 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbalineformat.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include "vbalineformat.hxx" +#include "vbacolorformat.hxx" + +using namespace ooo::vba; +using namespace com::sun::star; + +ScVbaLineFormat::ScVbaLineFormat( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaLineFormat_BASE( xParent, xContext ), m_xShape( xShape ) +{ + m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); + m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid; + m_nLineWeight = 1; +} + +sal_Int32 +ScVbaLineFormat::calculateArrowheadSize() +{ + return 0; +} + +sal_Int32 +ScVbaLineFormat::convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ) +{ + sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; + if (sLineName.equals(rtl::OUString::createFromAscii("Small Arrow")) || + sLineName.equals(rtl::OUString::createFromAscii("Arrow")) || + sLineName.equals(rtl::OUString::createFromAscii("msArrowEnd")) || + sLineName.equals(rtl::OUString::createFromAscii("Double Arrow"))) + { + // msoArrowheadTriangle + nLineType = office::MsoArrowheadStyle::msoArrowheadTriangle; + } + else if (sLineName.equals(rtl::OUString::createFromAscii("Square 45")) || + sLineName.equals(rtl::OUString::createFromAscii("Square")) || + sLineName.equals(rtl::OUString::createFromAscii("msArrowDiamondEnd"))) + { + // msoArrowheadDiamond + nLineType = office::MsoArrowheadStyle::msoArrowheadDiamond; + } + else if (sLineName.equals(rtl::OUString::createFromAscii("Circle")) || + sLineName.equals(rtl::OUString::createFromAscii("msArrowOvalEnd")) || + sLineName.equals(rtl::OUString::createFromAscii("Dimension Lines")) ) + { + // msoArrowheadOval + nLineType = office::MsoArrowheadStyle::msoArrowheadOval; + } + else if (sLineName.equals(rtl::OUString::createFromAscii("Arrow concave")) || + sLineName.equals(rtl::OUString::createFromAscii("msArrowStealthEnd"))) + { + // msoArrowheadStealth + nLineType = office::MsoArrowheadStyle::msoArrowheadStealth; + } + else if (sLineName.equals(rtl::OUString::createFromAscii("Rounded short Arrow")) || + sLineName.equals(rtl::OUString::createFromAscii("Rounded large Arrow")) || + sLineName.equals(rtl::OUString::createFromAscii("Symmetric Arrow")) || + sLineName.equals(rtl::OUString::createFromAscii("msArrowOpenEnd")) || + sLineName.equals(rtl::OUString::createFromAscii("Line Arrow"))) + { + // msoArrowheadOpen + nLineType = office::MsoArrowheadStyle::msoArrowheadOpen; + } + else + { + // msoArrowheadNone + nLineType = office::MsoArrowheadStyle::msoArrowheadNone; + } + return nLineType; +} + +rtl::OUString +ScVbaLineFormat::convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (uno::RuntimeException) +{ + switch( nArrowheadStyle ) + { + case office::MsoArrowheadStyle::msoArrowheadNone: + return rtl::OUString(rtl::OUString::createFromAscii( "" ) ); + case office::MsoArrowheadStyle::msoArrowheadStealth: + return rtl::OUString::createFromAscii( "Arrow concave" ); + case office::MsoArrowheadStyle::msoArrowheadOpen: + return rtl::OUString::createFromAscii("Line Arrow" ); + case office::MsoArrowheadStyle::msoArrowheadOval: + return rtl::OUString::createFromAscii("Circle" ); + case office::MsoArrowheadStyle::msoArrowheadDiamond: + return rtl::OUString::createFromAscii( "Square 45" ); + case office::MsoArrowheadStyle::msoArrowheadTriangle: + return rtl::OUString::createFromAscii( "Arrow" ); + default: + throw uno::RuntimeException( rtl::OUString::createFromAscii("Invalid Arrow Style!"), uno::Reference< uno::XInterface >() ); + } +} + +// Attributes +sal_Int32 SAL_CALL +ScVbaLineFormat::getBeginArrowheadStyle() throw (uno::RuntimeException) +{ + sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; + rtl::OUString sLineName; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ) ) >>= sLineName; + if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString::createFromAscii( "msArray" ) ) ) != -1 ) + { + sal_Int32 nIndex = sLineName.indexOf( rtl::OUString::createFromAscii(" ") ); + rtl::OUString sName = sLineName.copy( 0, nIndex ); + //sal_Int32 nSize = sLineName.copy( nIndex + 1 ).toInt32(); + nLineType = convertLineStartEndNameToArrowheadStyle( sName ); + } + else + { + nLineType = convertLineStartEndNameToArrowheadStyle( sLineName ); + } + return nLineType; +} + +void SAL_CALL +ScVbaLineFormat::setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (uno::RuntimeException) +{ + rtl::OUString sArrayName = convertArrowheadStyleToLineStartEndName( _beginarrowheadstyle ); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ), uno::makeAny( sArrayName ) ); +} + +sal_Int32 SAL_CALL +ScVbaLineFormat::getBeginArrowheadLength() throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); +} + +void SAL_CALL +ScVbaLineFormat::setBeginArrowheadLength( sal_Int32 /*_beginarrowheadlength*/ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); +} + +sal_Int32 SAL_CALL +ScVbaLineFormat::getBeginArrowheadWidth() throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); +} + +void SAL_CALL +ScVbaLineFormat::setBeginArrowheadWidth( sal_Int32 /*_beginarrowheadwidth*/ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); +} + +sal_Int32 SAL_CALL +ScVbaLineFormat::getEndArrowheadStylel() throw (uno::RuntimeException) +{ + return 0; +} + +void SAL_CALL +ScVbaLineFormat::setEndArrowheadStylel( sal_Int32 /*_endarrowheadstylel*/ ) throw (uno::RuntimeException) +{ +} + +sal_Int32 SAL_CALL +ScVbaLineFormat::getEndArrowheadLength() throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); +} + +void SAL_CALL +ScVbaLineFormat::setEndArrowheadLength( sal_Int32 /*_endarrowheadlength*/ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); +} + +sal_Int32 SAL_CALL +ScVbaLineFormat::getEndArrowheadWidth() throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); +} + +void SAL_CALL +ScVbaLineFormat::setEndArrowheadWidth( sal_Int32 /*_endarrowheadwidth*/ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); +} + +double SAL_CALL +ScVbaLineFormat::getWeight() throw (uno::RuntimeException) +{ + sal_Int32 nLineWidth=0; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineWidth") ) >>= nLineWidth; + double dLineWidth = Millimeter::getInPoints( nLineWidth ); + return dLineWidth; +} + +void SAL_CALL +ScVbaLineFormat::setWeight( double _weight ) throw (uno::RuntimeException) +{ + if( _weight < 0 ) + throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter: Must be positv."), uno::Reference< uno::XInterface >() ); + if( _weight == 0 ) + _weight = 0.5; + m_nLineWeight = _weight; + Millimeter aMillimeter; + aMillimeter.setInPoints( _weight ); + + sal_Int32 nLineWidth = static_cast( aMillimeter.getInHundredthsOfOneMillimeter() ); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineWidth" ), uno::makeAny( nLineWidth ) ); + setDashStyle( m_nLineDashStyle ); +} + +sal_Bool SAL_CALL +ScVbaLineFormat::getVisible() throw (uno::RuntimeException) +{ + drawing::LineStyle aLineStyle; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; + if( aLineStyle == drawing::LineStyle_NONE ) + { + return sal_False; + } + return sal_True; +} + +void SAL_CALL +ScVbaLineFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) +{ + drawing::LineStyle aLineStyle; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; + if( !_visible ) + { + aLineStyle = drawing::LineStyle_NONE; + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) ); + } + else + { + if( aLineStyle == drawing::LineStyle_NONE ) + { + setDashStyle( m_nLineDashStyle ); + } + } +} + +double SAL_CALL +ScVbaLineFormat::getTransparency() throw (uno::RuntimeException) +{ + sal_Int16 nTransparency = 0; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ) ) >>= nTransparency; + double fTransparency = static_cast( nTransparency ); + return fTransparency / 100; +} + +void SAL_CALL +ScVbaLineFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) +{ + sal_Int16 nTransparency = static_cast( _transparency * 100 ); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ), uno::makeAny( nTransparency ) ); +} + +sal_Int16 SAL_CALL +ScVbaLineFormat::getStyle() throw (uno::RuntimeException) +{ + //OpenOffice.org only supports one LineStyle (other than the DashStyles) + //Therefore we can only return the SingleLine + return 1; +} + +void SAL_CALL +ScVbaLineFormat::setStyle( sal_Int16 /*_style */) throw (uno::RuntimeException) +{ + //OpenOffice.org only supports one LineStyle (other than the DashStyles) + //Therefore we do not set the LineStyle, because it maybe is already set + //to Dashed or Single Line. Setting the 'Visible' or 'DashStyle' properties + //will be done with the according methods. +} + +sal_Int32 SAL_CALL +ScVbaLineFormat::getDashStyle() throw (uno::RuntimeException) +{ + drawing::LineStyle eLineStyle; + //LineStyle integer in Xray + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= eLineStyle; + if( eLineStyle == drawing::LineStyle_SOLID ) + m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid; + else + { + drawing::LineDash aLineDash; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineDash" ) ) >>= aLineDash; + if( aLineDash.Dots == 0 ) + { + //LineDash + //LineLongDash + m_nLineDashStyle = office::MsoLineDashStyle::msoLineDash; + if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) ) + { + m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDash; + } + } + else if( aLineDash.Dots == 1 ) + { + // LineDashDot + // LineLongDashDot + // LineSquareDot + // LineRoundDot ! not supported + m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDot; + if( aLineDash.Dashes == 0 ) + { + m_nLineDashStyle = office::MsoLineDashStyle::msoLineSquareDot; + } + else + { + if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) ) + { + m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDashDot; + } + } + } + else if( aLineDash.Dots == 2 ) + { + // LineDashDotDot + m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDotDot; + } + } + + return m_nLineDashStyle; +} + +void SAL_CALL +ScVbaLineFormat::setDashStyle( sal_Int32 _dashstyle ) throw (uno::RuntimeException) +{ + m_nLineDashStyle = _dashstyle; + if( _dashstyle == office::MsoLineDashStyle::msoLineSolid ) + { + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID )); + } + else + { + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_DASH ) ); + drawing::LineDash pLineDash; + Millimeter aMillimeter( m_nLineWeight ); + sal_Int32 nPixel = static_cast< sal_Int32 >( aMillimeter.getInHundredthsOfOneMillimeter() ); + switch( _dashstyle ) + { + case office::MsoLineDashStyle::msoLineDashDot: + pLineDash.Dots = 1; + pLineDash.DotLen = nPixel; + pLineDash.Dashes = 1; + pLineDash.DashLen = 5 * nPixel; + pLineDash.Distance = 4 * nPixel; + break; + case office::MsoLineDashStyle::msoLineLongDashDot: + pLineDash.Dots = 1; + pLineDash.DotLen = nPixel; + pLineDash.Dashes = 1; + pLineDash.DashLen = 10 * nPixel; + pLineDash.Distance = 4 * nPixel; + break; + case office::MsoLineDashStyle::msoLineDash: + pLineDash.Dots = 0; + pLineDash.DotLen = 0; + pLineDash.Dashes = 1; + pLineDash.DashLen = 6 * nPixel; + pLineDash.Distance = 4 * nPixel; + break; + case office::MsoLineDashStyle::msoLineDashDotDot: + pLineDash.Dots = 2; + pLineDash.DotLen = nPixel; + pLineDash.Dashes = 1; + pLineDash.DashLen = 10 * nPixel; + pLineDash.Distance = 3 * nPixel; + break; + case office::MsoLineDashStyle::msoLineLongDash: + pLineDash.Dots = 0; + pLineDash.DotLen = 0; + pLineDash.Dashes = 1; + pLineDash.DashLen = 10 * nPixel; + pLineDash.Distance = 4 * nPixel; + break; + case office::MsoLineDashStyle::msoLineSquareDot: + pLineDash.Dots = 1; + pLineDash.DotLen = nPixel; + pLineDash.Dashes = 0; + pLineDash.DashLen = 0; + pLineDash.Distance = nPixel; + break; + case office::MsoLineDashStyle::msoLineRoundDot: + pLineDash.Dots = 1; + pLineDash.DotLen = nPixel; + pLineDash.Dashes = 0; + pLineDash.DashLen = 0; + pLineDash.Distance = nPixel; + break; + default: + throw uno::RuntimeException( rtl::OUString::createFromAscii("this MsoLineDashStyle is not supported."), uno::Reference< uno::XInterface >() ); + } + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineDash" ), uno::makeAny( pLineDash ) ); + } +} + +// Methods +uno::Reference< msforms::XColorFormat > SAL_CALL +ScVbaLineFormat::BackColor() throw (uno::RuntimeException) +{ + return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_BACKCOLOR ) ); +} + +uno::Reference< msforms::XColorFormat > SAL_CALL +ScVbaLineFormat::ForeColor() throw (uno::RuntimeException) +{ + return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_FORECOLOR ) ); +} + + +rtl::OUString& +ScVbaLineFormat::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLineFormat") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaLineFormat::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.LineFormat" ) ); + } + return aServiceNames; +} + + diff --git a/vbahelper/source/vbahelper/vbalineformat.hxx b/vbahelper/source/vbahelper/vbalineformat.hxx new file mode 100644 index 000000000000..57f487cf583d --- /dev/null +++ b/vbahelper/source/vbahelper/vbalineformat.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbalineformat.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_XLINEFORMAT_HXX +#define SC_VBA_XLINEFORMAT_HXX + +#include +#include +#include +#include + +typedef InheritedHelperInterfaceImpl1< ov::msforms::XLineFormat > ScVbaLineFormat_BASE; + +class ScVbaLineFormat : public ScVbaLineFormat_BASE +{ +private: + css::uno::Reference< css::drawing::XShape > m_xShape; + css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; + sal_Int32 m_nLineDashStyle; + double m_nLineWeight; +protected: + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); + sal_Int32 convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ); + rtl::OUString convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (css::uno::RuntimeException); + sal_Int32 calculateArrowheadSize(); +public: + ScVbaLineFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); + + // Attributes + virtual sal_Int32 SAL_CALL getBeginArrowheadStyle() throw (css::uno::RuntimeException); + virtual void SAL_CALL setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBeginArrowheadLength() throw (css::uno::RuntimeException); + virtual void SAL_CALL setBeginArrowheadLength( sal_Int32 _beginarrowheadlength ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBeginArrowheadWidth() throw (css::uno::RuntimeException); + virtual void SAL_CALL setBeginArrowheadWidth( sal_Int32 _beginarrowheadwidth ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getEndArrowheadStylel() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEndArrowheadStylel( sal_Int32 _endarrowheadstylel ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getEndArrowheadLength() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEndArrowheadLength( sal_Int32 _endarrowheadlength ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getEndArrowheadWidth() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEndArrowheadWidth( sal_Int32 _endarrowheadwidth ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getWeight() throw (css::uno::RuntimeException); + virtual void SAL_CALL setWeight( double _weight ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); + virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getStyle() throw (css::uno::RuntimeException); + virtual void SAL_CALL setStyle( sal_Int16 _style ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDashStyle() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDashStyle( sal_Int32 _dashstyle ) throw (css::uno::RuntimeException); + + // Methods + virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); +}; + +#endif//SC_VBA_XLINEFORMAT_HXX diff --git a/vbahelper/source/vbahelper/vbapagesetupbase.cxx b/vbahelper/source/vbahelper/vbapagesetupbase.cxx new file mode 100644 index 000000000000..234971dc382b --- /dev/null +++ b/vbahelper/source/vbahelper/vbapagesetupbase.cxx @@ -0,0 +1,325 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +VbaPageSetupBase::VbaPageSetupBase(const uno::Reference< XHelperInterface >& xParent, + const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException): VbaPageSetupBase_BASE( xParent, xContext ) +{ +} + +double SAL_CALL VbaPageSetupBase::getTopMargin() throw (css::uno::RuntimeException) +{ + sal_Bool headerOn = sal_False; + sal_Int32 topMargin = 0; + sal_Int32 headerHeight = 0; + + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))); + aValue >>= headerOn; + + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))); + aValue >>= topMargin; + + if( headerOn ) + { + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))); + aValue >>= headerHeight; + topMargin = topMargin + headerHeight; + } + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( topMargin ); +} + +void SAL_CALL VbaPageSetupBase::setTopMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 topMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + sal_Bool headerOn = sal_False; + sal_Int32 headerHeight = 0; + + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))); + aValue >>= headerOn; + + if( headerOn ) + { + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))); + aValue >>= headerHeight; + topMargin -= headerHeight; + } + + aValue <<= topMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +double SAL_CALL VbaPageSetupBase::getBottomMargin() throw (css::uno::RuntimeException) +{ + sal_Bool footerOn = sal_False; + sal_Int32 bottomMargin = 0; + sal_Int32 footerHeight = 0; + + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))); + aValue >>= footerOn; + + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))); + aValue >>= bottomMargin; + + if( footerOn ) + { + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))); + aValue >>= footerHeight; + bottomMargin += footerHeight; + } + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( bottomMargin ); +} + +void SAL_CALL VbaPageSetupBase::setBottomMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 bottomMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + sal_Bool footerOn = sal_False; + sal_Int32 footerHeight = 0; + + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))); + aValue >>= footerOn; + + if( footerOn ) + { + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))); + aValue >>= footerHeight; + bottomMargin -= footerHeight; + } + + aValue <<= bottomMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +double SAL_CALL VbaPageSetupBase::getRightMargin() throw (css::uno::RuntimeException) +{ + sal_Int32 rightMargin = 0; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin"))); + aValue >>= rightMargin; + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( rightMargin );; +} + +void SAL_CALL VbaPageSetupBase::setRightMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 rightMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + try + { + uno::Any aValue; + aValue <<= rightMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin")), aValue ); + } + catch( uno::Exception& ) + { + } + +} + +double SAL_CALL VbaPageSetupBase::getLeftMargin() throw (css::uno::RuntimeException) +{ + sal_Int32 leftMargin = 0; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin"))); + aValue >>= leftMargin; + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( leftMargin );; +} + +void SAL_CALL VbaPageSetupBase::setLeftMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 leftMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + try + { + uno::Any aValue; + aValue <<= leftMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +double SAL_CALL VbaPageSetupBase::getHeaderMargin() throw (css::uno::RuntimeException) +{ + sal_Int32 headerMargin = 0; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))); + aValue >>= headerMargin; + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( headerMargin );; +} + +void SAL_CALL VbaPageSetupBase::setHeaderMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 headerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + try + { + uno::Any aValue; + aValue <<= headerMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +double SAL_CALL VbaPageSetupBase::getFooterMargin() throw (css::uno::RuntimeException) +{ + sal_Int32 footerMargin = 0; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))); + aValue >>= footerMargin; + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( footerMargin );; +} + +void SAL_CALL VbaPageSetupBase::setFooterMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 footerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + try + { + uno::Any aValue; + aValue <<= footerMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +sal_Int32 SAL_CALL VbaPageSetupBase::getOrientation() throw (css::uno::RuntimeException) +{ + sal_Int32 orientation = mnOrientPortrait; + try + { + sal_Bool isLandscape = sal_False; + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape"))); + aValue >>= isLandscape; + + if( isLandscape ) + { + orientation = mnOrientLandscape; + } + } + catch( uno::Exception& ) + { + } + return orientation; +} + +void SAL_CALL VbaPageSetupBase::setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException) +{ + if( ( orientation != mnOrientPortrait ) && + ( orientation != mnOrientLandscape ) ) + { + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + } + + try + { + sal_Bool isLandscape = sal_False; + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape"))); + aValue >>= isLandscape; + + sal_Bool switchOrientation = sal_False; + if(( isLandscape && orientation != mnOrientLandscape ) || + ( !isLandscape && orientation != mnOrientPortrait )) + { + switchOrientation = sal_True; + } + + if( switchOrientation ) + { + aValue <<= !isLandscape; + uno::Any aHeight = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height"))); + uno::Any aWidth = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width"))); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape")), aValue ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width")), aHeight ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height")), aWidth ); + } + + if( isLandscape ) + { + orientation = mnOrientLandscape; + } + } + catch( uno::Exception& ) + { + } +} + diff --git a/vbahelper/source/vbahelper/vbapictureformat.cxx b/vbahelper/source/vbahelper/vbapictureformat.cxx new file mode 100644 index 000000000000..0d79fc173d50 --- /dev/null +++ b/vbahelper/source/vbahelper/vbapictureformat.cxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbapictureformat.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbapictureformat.hxx" + +using namespace ooo::vba; +using namespace com::sun::star; + +ScVbaPictureFormat::ScVbaPictureFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext, + uno::Reference< drawing::XShape > xShape ) + throw( lang::IllegalArgumentException ) : ScVbaPictureFormat_BASE( xParent, xContext ), m_xShape( xShape ) +{ + m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); +} + +void +ScVbaPictureFormat::checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException) +{ + if( nRange < nMin ) + { + throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too small.") , uno::Reference< uno::XInterface >() ); + } + if( nRange > nMax ) + { + throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too high.") , uno::Reference< uno::XInterface >() ); + } +} + +// Attributes +double SAL_CALL +ScVbaPictureFormat::getBrightness() throw (uno::RuntimeException) +{ + sal_Int16 nLuminance = 0; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance") ) >>= nLuminance; + double fBrightness = static_cast< double >( nLuminance ); + fBrightness = ( fBrightness +100 ) / 200; + return fBrightness; +} + +void SAL_CALL +ScVbaPictureFormat::setBrightness( double _brightness ) throw (uno::RuntimeException) +{ + checkParameterRangeInDouble( _brightness, 0.0, 1.0 ); + double fLuminance = _brightness * 200 - 100; + sal_Int16 nLuminance = static_cast< sal_Int16 >( fLuminance ); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance"), uno::makeAny( nLuminance ) ); +} + +double SAL_CALL +ScVbaPictureFormat::getContrast() throw (uno::RuntimeException) +{ + sal_Int16 nContrast = 0; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustContrast") ) >>= nContrast; + double fContrast = static_cast< double >( nContrast ); + fContrast = ( fContrast + 100 ) / 200; + return fContrast; +} + +void SAL_CALL +ScVbaPictureFormat::setContrast( double _contrast ) throw (uno::RuntimeException) +{ + checkParameterRangeInDouble( _contrast, 0.0, 1.0 ); + double fContrast = _contrast * 200 - 100; + sal_Int16 nContrast = static_cast< sal_Int16 >( fContrast ); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustContrast"), uno::makeAny( nContrast ) ); +} + + +// Methods +void SAL_CALL +ScVbaPictureFormat::IncrementBrightness( double increment ) throw (uno::RuntimeException) +{ + double fBrightness = getBrightness(); + fBrightness += increment; + if( fBrightness < 0 ) + { + fBrightness = 0.0; + } + if( fBrightness > 1 ) + { + fBrightness = 1; + } + setBrightness( fBrightness ); +} + +void SAL_CALL +ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeException) +{ + double nContrast = getContrast(); + nContrast += increment; + if( increment < 0 ) + { + increment = 0.0; + } + if( increment > 1 ) + { + increment = 1.0; + } + setContrast( nContrast ); +} + + +rtl::OUString& +ScVbaPictureFormat::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPictureFormat") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaPictureFormat::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.PictureFormat" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/vbahelper/vbapictureformat.hxx b/vbahelper/source/vbahelper/vbapictureformat.hxx new file mode 100644 index 000000000000..0c15b58da3bb --- /dev/null +++ b/vbahelper/source/vbahelper/vbapictureformat.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbapictureformat.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_PICTUREFORMAT_HXX +#define SC_VBA_PICTUREFORMAT_HXX + +#include +#include +#include +#include + +typedef InheritedHelperInterfaceImpl1< ov::msforms::XPictureFormat > ScVbaPictureFormat_BASE; + +class ScVbaPictureFormat : public ScVbaPictureFormat_BASE +{ +private: + css::uno::Reference< css::drawing::XShape > m_xShape; + css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; +protected: + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence getServiceNames(); +private: + void checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException); +public: + ScVbaPictureFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::drawing::XShape > xShape ) throw( css::lang::IllegalArgumentException ); + + // Attributes + virtual double SAL_CALL getBrightness() throw (css::uno::RuntimeException); + virtual void SAL_CALL setBrightness( double _brightness ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getContrast() throw (css::uno::RuntimeException); + virtual void SAL_CALL setContrast( double _contrast ) throw (css::uno::RuntimeException); + + // Methods + virtual void SAL_CALL IncrementBrightness( double increment ) throw (css::uno::RuntimeException); + virtual void SAL_CALL IncrementContrast( double increment ) throw (css::uno::RuntimeException); +}; + +#endif//SC_VBA_PICTUREFORMAT_HXX diff --git a/vbahelper/source/vbahelper/vbapropvalue.cxx b/vbahelper/source/vbahelper/vbapropvalue.cxx new file mode 100644 index 000000000000..da7d9db7b00f --- /dev/null +++ b/vbahelper/source/vbahelper/vbapropvalue.cxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbapropvalue.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbahelper/vbapropvalue.hxx" + +using namespace com::sun::star; + +ScVbaPropValue::ScVbaPropValue( PropListener* pListener ) : m_pListener( pListener ) +{ +} + +css::uno::Any SAL_CALL +ScVbaPropValue::getValue() throw (css::uno::RuntimeException) +{ + return m_pListener->getValueEvent(); +} + +void SAL_CALL +ScVbaPropValue::setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException) +{ + m_pListener->setValueEvent( _value ); +} diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx new file mode 100644 index 000000000000..0728ec63a81b --- /dev/null +++ b/vbahelper/source/vbahelper/vbashape.cxx @@ -0,0 +1,676 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbashape.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include "vbalineformat.hxx" +#include "vbafillformat.hxx" +#include "vbapictureformat.hxx" +#include + +using namespace ::ooo::vba; +using namespace ::com::sun::star; +using namespace ::vos; + +ScVbaShape::ScVbaShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel, sal_Int32 nType ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( xParent, xContext ), m_xShape( xShape ), m_xShapes( xShapes ), m_nType( nType ), m_xModel( xModel ) +{ + m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); + m_pShapeHelper.reset( new ShapeHelper( m_xShape ) ); + addListeners(); +} + +ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< frame::XModel >& xModel ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xShape( xShape ), m_xModel( xModel ) +{ + // add listener + addListeners(); +} + +ScVbaShape::~ScVbaShape() +{ + // dtor must never ever throw + /*try + { + removeShapeListener(); + removeShapesListener(); + } + catch( uno::Exception& ) + { + }*/ +} + +void SAL_CALL +ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException ) +{ + try + { + uno::Reference< drawing::XShapes > xShapes( rEventObject.Source, uno::UNO_QUERY ); + uno::Reference< drawing::XShape > xShape( rEventObject.Source, uno::UNO_QUERY ); + if ( xShapes.is() ) + removeShapesListener(); + if ( xShape.is() ) + removeShapeListener(); + } + catch( uno::Exception& ) + { + } +} + + +void ScVbaShape::addListeners() +{ + uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY ); + if ( xComponent.is() ) + xComponent->addEventListener( this ); + + xComponent.set( m_xShapes, uno::UNO_QUERY ); + if ( xComponent.is() ) + xComponent->addEventListener( this ); +} + +void +ScVbaShape::removeShapeListener() throw( uno::RuntimeException ) +{ + if( m_xShape.is() ) + { + uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY_THROW ); + xComponent->removeEventListener( this ); + } + m_xShape = NULL; + m_xPropertySet = NULL; +} + +void +ScVbaShape::removeShapesListener() throw( uno::RuntimeException ) +{ + if( m_xShapes.is() ) + { + uno::Reference< lang::XComponent > xComponent( m_xShapes, uno::UNO_QUERY_THROW ); + xComponent->removeEventListener( this ); + } + m_xShapes = NULL; +} + +sal_Int32 +ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException) +{ + rtl::OUString sShapeType; + uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor( xShape, uno::UNO_QUERY_THROW ); + sShapeType = xShapeDescriptor->getShapeType(); + OSL_TRACE("ScVbaShape::getType: %s", rtl::OUStringToOString( sShapeType, RTL_TEXTENCODING_UTF8 ).getStr() ); + // office::MsoShapeType::msoDiagram to "com.sun.star.drawing.GroupShape" + if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) ) + return office::MsoShapeType::msoGroup; + else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) ) + return office::MsoShapeType::msoPicture; + else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) || + sShapeType.equals( rtl::OUString::createFromAscii( "FrameShape" ) ) ) + return office::MsoShapeType::msoOLEControlObject; + // OOo don't support office::MsoShapeType::msoComment as a Shape. + else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" ) ) ) + return office::MsoShapeType::msoChart; + // Art characters office::MsoShapeType::msoTextEffect, in OOo corresponding to "com.sun.star.drawing.CustomShape" + else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ConnectorShape" ) ) ) + { + enum drawing::ConnectorType connectorType; + uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); + xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("EdgeKind")) >>= connectorType; + if( connectorType == drawing::ConnectorType_CURVE ) + return office::MsoShapeType::msoFreeform; + else if( connectorType == drawing::ConnectorType_LINE ) + return office::MsoShapeType::msoLine; + else + return office::MsoShapeType::msoAutoShape; + } + else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) ) + return office::MsoShapeType::msoLine; + else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) ) || + sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape") ) ) + return office::MsoShapeType::msoAutoShape; + else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ) ) + return office::MsoShapeType::msoTextBox; + else + throw uno::RuntimeException( rtl::OUString::createFromAscii( "the shape type do not be supported: " ) + sShapeType, uno::Reference< uno::XInterface >() ); +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaShape::getName() throw (uno::RuntimeException) +{ + rtl::OUString sName; + uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW ); + sName = xNamed->getName(); + return sName; +} + +void SAL_CALL +ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) +{ + uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW ); + xNamed->setName( _name ); +} + +double SAL_CALL +ScVbaShape::getHeight() throw (uno::RuntimeException) +{ + return m_pShapeHelper->getHeight(); +} + +void SAL_CALL +ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException) +{ + m_pShapeHelper->setHeight( _height ); +} + +double SAL_CALL +ScVbaShape::getWidth() throw (uno::RuntimeException) +{ + return m_pShapeHelper->getWidth(); +} + +void SAL_CALL +ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException) +{ + m_pShapeHelper->setWidth( _width ); +} + +double SAL_CALL +ScVbaShape::getLeft() throw (uno::RuntimeException) +{ + return m_pShapeHelper->getLeft(); +} + +void SAL_CALL +ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException) +{ + m_pShapeHelper->setLeft( _left ); +} + +double SAL_CALL +ScVbaShape::getTop() throw (uno::RuntimeException) +{ + return m_pShapeHelper->getTop(); +} + +void SAL_CALL +ScVbaShape::setTop( double _top ) throw (uno::RuntimeException) +{ + return m_pShapeHelper->setTop( _top ); +} + +sal_Bool SAL_CALL +ScVbaShape::getVisible() throw (uno::RuntimeException) +{ + //UNO Shapes are always visible + return sal_True; +} + +void SAL_CALL +ScVbaShape::setVisible( sal_Bool /*_visible*/ ) throw (uno::RuntimeException) +{ + //UNO Shapes are always visible +} + +sal_Int32 SAL_CALL +ScVbaShape::getZOrderPosition() throw (uno::RuntimeException) +{ + sal_Int32 nZOrderPosition = 0; + uno::Any aZOrderPosition = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); + aZOrderPosition >>= nZOrderPosition; + return nZOrderPosition + 1; +} + +sal_Int32 SAL_CALL +ScVbaShape::getType() throw (uno::RuntimeException) +{ + return m_nType; +} + +double SAL_CALL +ScVbaShape::getRotation() throw (uno::RuntimeException) +{ + double dRotation = 0; + sal_Int32 nRotation = 0; + m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ) ) >>= nRotation; + dRotation = static_cast< double >( nRotation /100 ); + return dRotation; +} + +void SAL_CALL +ScVbaShape::setRotation( double _rotation ) throw (uno::RuntimeException) +{ + sal_Int32 nRotation = static_cast < sal_Int32 > ( _rotation * 100 ); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ), uno::makeAny( nRotation ) ); +} + +uno::Reference< msforms::XLineFormat > SAL_CALL +ScVbaShape::getLine() throw (uno::RuntimeException) +{ + // TODO should ongly return line + return uno::Reference< msforms::XLineFormat >( new ScVbaLineFormat( this, mxContext, m_xShape ) ); +} + +uno::Reference< msforms::XFillFormat > SAL_CALL +ScVbaShape::getFill() throw (uno::RuntimeException) +{ + return uno::Reference< msforms::XFillFormat >( new ScVbaFillFormat( this, mxContext, m_xShape ) ); +} + +uno::Reference< msforms::XPictureFormat > SAL_CALL +ScVbaShape::getPictureFormat() throw (uno::RuntimeException) +{ + return uno::Reference< msforms::XPictureFormat >( new ScVbaPictureFormat( this, mxContext, m_xShape ) ); +} + +// Methods +uno::Any SAL_CALL +ScVbaShape::TextFrame() throw (uno::RuntimeException) +{ + uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ) ) ) ) + { + uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + uno::Sequence< uno::Any > aArgs(2); + aArgs[0] = uno::makeAny( getParent() ); + aArgs[1] <<= m_xShape; + uno::Reference< uno::XInterface > xTextFrame( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.TextFrame") ) , aArgs ) , uno::UNO_QUERY_THROW ); + return uno::makeAny( xTextFrame ); + } + + return uno::makeAny( uno::Reference< msforms::XTextFrame >( new VbaTextFrame( this, mxContext, m_xShape ) ) ); +} + +void SAL_CALL +ScVbaShape::Delete() throw (uno::RuntimeException) +{ + OGuard aGuard( Application::GetSolarMutex() ); + m_xShapes->remove( m_xShape ); +} + +void SAL_CALL +ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException) +{ + sal_Int32 nOrderPositon; + uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); + aOrderPostion >>= nOrderPositon; + switch( ZOrderCmd ) + { + case office::MsoZOrderCmd::msoBringToFront: + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( SAL_MAX_INT32 ) ); + break; + case office::MsoZOrderCmd::msoSendToBack: + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( (sal_Int32)0 ) ); + break; + case office::MsoZOrderCmd::msoBringForward: + nOrderPositon += 1; + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); + break; + case office::MsoZOrderCmd::msoSendBackward: + if( nOrderPositon > 0 ) + { + nOrderPositon -= 1; + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); + } + break; + // below two commands use with Writer for text and image object. + case office::MsoZOrderCmd::msoBringInFrontOfText: + case office::MsoZOrderCmd::msoSendBehindText: + throw uno::RuntimeException( rtl::OUString::createFromAscii( "This ZOrderCmd is not implemented, it is use with writer." ), uno::Reference< uno::XInterface >() ); + default: + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Parameter." ), uno::Reference< uno::XInterface >() ); + } +} + +void SAL_CALL +ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException) +{ + double nCurrentRotation = getRotation(); + nCurrentRotation += Increment; + setRotation(nCurrentRotation); +} + +void SAL_CALL +ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException) +{ + double nCurrentLeft = getLeft(); + nCurrentLeft += Increment; + setLeft(nCurrentLeft); +} + +void SAL_CALL +ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException) +{ + double nCurrentTop = getTop(); + nCurrentTop += Increment; + setTop(nCurrentTop); +} + +void SAL_CALL +ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException) +{ + double nHeight = getHeight(); + double nNewHeight = nHeight * Factor; + if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft ) + { + setHeight(nNewHeight); + } + else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight ) + { + double nDeltaHeight = nNewHeight - nHeight; + double nNewTop = getTop() - nDeltaHeight; + setTop(nNewTop); + setHeight(nNewHeight); + } + else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle ) + { + double nDeltaHeight = (nNewHeight - nHeight) / 2; + double nNewTop = getTop() - nDeltaHeight; + setTop(nNewTop); + setHeight(nNewHeight); + } + else + { + throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); + } +} + +void SAL_CALL +ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException) +{ + double nWidth = getWidth(); + double nNewWidth = nWidth * Factor; + if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft ) + { + setWidth(nNewWidth); + } + else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight ) + { + double nDeltaWidth = nNewWidth - nWidth; + double nNewLeft = getLeft() - nDeltaWidth; + setLeft(nNewLeft); + setWidth(nNewWidth); + } + else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle ) + { + double nDeltaWidth = (nNewWidth - nWidth) / 2; + double nNewLeft = getLeft() - nDeltaWidth; + setLeft(nNewLeft); + setWidth(nNewWidth); + } + else + { + throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); + } +} + +void SAL_CALL +ScVbaShape::Select( const uno::Any& /*Replace*/ ) throw ( uno::RuntimeException ) +{ + uno::Reference< view::XSelectionSupplier > xSelectSupp( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + xSelectSupp->select( uno::makeAny( m_xShape ) ); +} + +// This method should not be part of Shape, what we reall need to do is... +// dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc. +// ( e.g. the ones that really do have ShapeRange as an attribute ) +uno::Any SAL_CALL +ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException ) +{ + // perhaps we should store a reference to the Shapes Collection + // in this class + // but anyway this method should not even be in this class + // #TODO not sure what the parent of the Shapes collection should be + + XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec aVec; + aVec.push_back( m_xShape ); + uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( aVec ) ); + uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW ); + // #FIXME for want of a better parent, setting this + uno::Reference< msforms::XShapeRange > xShapeRange( new ScVbaShapeRange( mxParent, mxContext, xIndexAccess, uno::Reference< drawing::XDrawPage >( xChild->getParent(), uno::UNO_QUERY_THROW ), m_xModel ) ); + if ( index.hasValue() ) + return xShapeRange->Item( index, uno::Any() ); + return uno::makeAny( xShapeRange ); +} + +sal_Bool SAL_CALL +ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException) +{ + // FIXME: + return sal_False; +} + +void SAL_CALL +ScVbaShape::setLockAspectRatio( sal_Bool /*_lockaspectratio*/ ) throw (uno::RuntimeException) +{ + // FIXME: +} + +sal_Bool SAL_CALL +ScVbaShape::getLockAnchor() throw (uno::RuntimeException) +{ + // FIXME: + return sal_True; +} + +void SAL_CALL +ScVbaShape::setLockAnchor( sal_Bool /*_lockanchor*/ ) throw (uno::RuntimeException) +{ + // FIXME: +} + +sal_Int32 SAL_CALL +ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException) +{ + sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin; + text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; + m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType; + + switch( eType ) + { + case text::TextContentAnchorType_AT_PARAGRAPH: + { + nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn; + break; + } + case text::TextContentAnchorType_AT_PAGE: + { + nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage; + break; + } + case text::TextContentAnchorType_AT_CHARACTER: + { + nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter; + break; + } + case text::TextContentAnchorType_AT_FRAME: + case text::TextContentAnchorType_AS_CHARACTER: + { + nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin; + break; + } + default: + { + nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin; + } + } + return nRelativeHorizontalPosition; +} + +void SAL_CALL +ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException) +{ + text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; + switch( _relativehorizontalposition ) + { + case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter: + { + eType = text::TextContentAnchorType_AT_CHARACTER; + break; + } + case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn: + case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin: + { + eType = text::TextContentAnchorType_AT_PARAGRAPH; + break; + } + case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage: + { + eType = text::TextContentAnchorType_AT_PAGE; + break; + } + default: + { + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + } + } + m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) ); +} + +sal_Int32 SAL_CALL +ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException) +{ + sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin; + text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; + m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType; + + switch( eType ) + { + case text::TextContentAnchorType_AT_PARAGRAPH: + { + nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph; + break; + } + case text::TextContentAnchorType_AT_PAGE: + { + nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage; + break; + } + case text::TextContentAnchorType_AT_CHARACTER: + { + nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine; + break; + } + case text::TextContentAnchorType_AT_FRAME: + case text::TextContentAnchorType_AS_CHARACTER: + { + nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin; + break; + } + default: + { + nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin; + } + } + return nRelativeVerticalPosition; +} + +void SAL_CALL +ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException) +{ + text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; + switch( _relativeverticalposition ) + { + case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine: + { + eType = text::TextContentAnchorType_AT_CHARACTER; + break; + } + case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph: + case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin: + { + eType = text::TextContentAnchorType_AT_PARAGRAPH; + break; + } + case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage: + { + eType = text::TextContentAnchorType_AT_PAGE; + break; + } + default: + { + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + } + } + m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) ); +} + +uno::Any SAL_CALL +ScVbaShape::WrapFormat() throw (uno::RuntimeException) +{ + uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) ) + { + uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + uno::Sequence< uno::Any > aArgs(2); + aArgs[0] = uno::makeAny( getParent() ); + aArgs[1] <<= m_xShape; + uno::Reference< uno::XInterface > xWrapFormat( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.WrapFormat") ) , aArgs ) , uno::UNO_QUERY_THROW ); + return uno::makeAny( xWrapFormat ); + } + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + + +rtl::OUString& +ScVbaShape::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShape") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaShape::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shape" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx new file mode 100644 index 000000000000..ffdcf0ce454f --- /dev/null +++ b/vbahelper/source/vbahelper/vbashaperange.cxx @@ -0,0 +1,382 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbashaperange.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include + +#include +#include +#include +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +class VbShapeRangeEnumHelper : public EnumerationHelper_BASE +{ + uno::Reference< XCollection > m_xParent; + uno::Reference m_xIndexAccess; + sal_Int32 nIndex; +public: + VbShapeRangeEnumHelper( const uno::Reference< XCollection >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return ( nIndex < m_xIndexAccess->getCount() ); + } + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + ScVbaShapeRange* pCollectionImpl = dynamic_cast< ScVbaShapeRange* >(m_xParent.get()); + if ( pCollectionImpl && hasMoreElements() ) + return pCollectionImpl->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); + throw container::NoSuchElementException(); + } + +}; + +ScVbaShapeRange::ScVbaShapeRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xShapes, const uno::Reference< drawing::XDrawPage >& xDrawPage, const uno::Reference< frame::XModel >& xModel ) : ScVbaShapeRange_BASE( xParent, xContext, xShapes ), m_xDrawPage( xDrawPage ), m_nShapeGroupCount(0), m_xModel( xModel ) +{ +} + +// Methods +void SAL_CALL +ScVbaShapeRange::Select( ) throw (uno::RuntimeException) +{ + uno::Reference< view::XSelectionSupplier > xSelectSupp( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + xSelectSupp->select( uno::makeAny( getShapes() ) ); +} + +uno::Reference< msforms::XShape > SAL_CALL +ScVbaShapeRange::Group() throw (uno::RuntimeException) +{ + uno::Reference< drawing::XShapeGrouper > xShapeGrouper( m_xDrawPage, uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XShapeGroup > xShapeGroup( xShapeGrouper->group( getShapes() ), uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XShape > xShape( xShapeGroup, uno::UNO_QUERY_THROW ); + return uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, getShapes(), m_xModel, office::MsoShapeType::msoGroup ) ); +} + +uno::Reference< drawing::XShapes > +ScVbaShapeRange::getShapes() throw (uno::RuntimeException) +{ + if ( !m_xShapes.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + m_xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW ); + sal_Int32 nLen = m_xIndexAccess->getCount(); + for ( sal_Int32 index = 0; index < nLen; ++index ) + m_xShapes->add( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW ) ); + + } + return m_xShapes; +} + + +void SAL_CALL +ScVbaShapeRange::IncrementRotation( double Increment ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->IncrementRotation( Increment ); + } +} + +void SAL_CALL +ScVbaShapeRange::IncrementLeft( double Increment ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->IncrementLeft( Increment ); + } +} + +void SAL_CALL +ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->IncrementTop( Increment ); + } +} + +double SAL_CALL ScVbaShapeRange::getHeight() throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getHeight( ); + } + throw uno::RuntimeException(); +} + +void SAL_CALL ScVbaShapeRange::setHeight( double _height ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->setHeight( _height ); + } +} + +double SAL_CALL ScVbaShapeRange::getWidth() throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getWidth( ); + } + throw uno::RuntimeException(); +} + +void SAL_CALL ScVbaShapeRange::setWidth( double _width ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->setWidth( _width ); + } +} + +double SAL_CALL ScVbaShapeRange::getLeft() throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getLeft(); + } + throw uno::RuntimeException(); +} + +void SAL_CALL ScVbaShapeRange::setLeft( double _left ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->setLeft( _left ); + } +} + +double SAL_CALL ScVbaShapeRange::getTop() throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getTop(); + } + throw uno::RuntimeException(); +} + +void SAL_CALL ScVbaShapeRange::setTop( double _top ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->setTop( _top ); + } +} + +uno::Reference< ov::msforms::XLineFormat > SAL_CALL ScVbaShapeRange::getLine() throw (css::uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getLine(); + } + throw uno::RuntimeException(); +} + +uno::Reference< ov::msforms::XFillFormat > SAL_CALL ScVbaShapeRange::getFill() throw (css::uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getFill(); + } + throw uno::RuntimeException(); +} + +::sal_Bool SAL_CALL ScVbaShapeRange::getLockAspectRatio() throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getLockAspectRatio(); + } + throw uno::RuntimeException(); +} + +void SAL_CALL ScVbaShapeRange::setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->setLockAspectRatio( _lockaspectratio ); + } +} + +::sal_Bool SAL_CALL ScVbaShapeRange::getLockAnchor() throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getLockAnchor(); + } + throw uno::RuntimeException(); +} + +void SAL_CALL ScVbaShapeRange::setLockAnchor( ::sal_Bool _lockanchor ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->setLockAnchor( _lockanchor ); + } +} + +::sal_Int32 SAL_CALL ScVbaShapeRange::getRelativeHorizontalPosition() throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getRelativeHorizontalPosition(); + } + throw uno::RuntimeException(); +} + +void SAL_CALL ScVbaShapeRange::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->setRelativeHorizontalPosition( _relativehorizontalposition ); + } +} + +::sal_Int32 SAL_CALL ScVbaShapeRange::getRelativeVerticalPosition() throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getRelativeVerticalPosition(); + } + throw uno::RuntimeException(); +} + +void SAL_CALL ScVbaShapeRange::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->setRelativeVerticalPosition( _relativeverticalposition ); + } +} + +uno::Any SAL_CALL ScVbaShapeRange::TextFrame( ) throw (css::uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->TextFrame(); + } + throw uno::RuntimeException(); +} + +uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->WrapFormat(); + } + throw uno::RuntimeException(); +} + +uno::Type SAL_CALL +ScVbaShapeRange::getElementType() throw (uno::RuntimeException) +{ + return msforms::XShape::static_type(0); +} + +uno::Reference< container::XEnumeration > SAL_CALL +ScVbaShapeRange::createEnumeration() throw (uno::RuntimeException) +{ + return new VbShapeRangeEnumHelper( this, m_xIndexAccess ); +} + +uno::Any +ScVbaShapeRange:: createCollectionObject( const css::uno::Any& aSource ) +{ + uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW ); + // #TODO #FIXME Shape parent should always be the sheet the shapes belong + // to + uno::Reference< msforms::XShape > xVbShape( new ScVbaShape( uno::Reference< XHelperInterface >(), mxContext, xShape, getShapes(), m_xModel, ScVbaShape::getType( xShape ) ) ); + return uno::makeAny( xVbShape ); +} + +rtl::OUString& +ScVbaShapeRange::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapeRange") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaShapeRange::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.ShapeRange" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx new file mode 100644 index 000000000000..fba919ddfebb --- /dev/null +++ b/vbahelper/source/vbahelper/vbashapes.cxx @@ -0,0 +1,491 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbashapes.cxx,v $ + * $Revision: 1.3.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +class VbShapeEnumHelper : public EnumerationHelper_BASE +{ + uno::Reference m_xParent; + uno::Reference m_xIndexAccess; + sal_Int32 nIndex; +public: + VbShapeEnumHelper( const uno::Reference< msforms::XShapes >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return ( nIndex < m_xIndexAccess->getCount() ); + } + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + ScVbaShapes* pShapes = dynamic_cast< ScVbaShapes* >(m_xParent.get()); + if ( pShapes && hasMoreElements() ) + return pShapes->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); + throw container::NoSuchElementException(); + } + +}; + +void ScVbaShapes::initBaseCollection() +{ + if ( m_xNameAccess.is() ) // already has NameAccess + return; + // no NameAccess then use ShapeCollectionHelper + XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes; + sal_Int32 nLen = m_xIndexAccess->getCount(); + mShapes.reserve( nLen ); + for ( sal_Int32 index=0; index( m_xIndexAccess->getByIndex( index ) , uno::UNO_QUERY ) ); + uno::Reference< container::XIndexAccess > xShapes( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) ); + m_xIndexAccess.set( xShapes, uno::UNO_QUERY ); + m_xNameAccess.set( xShapes, uno::UNO_QUERY ); +} + +ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0), m_xModel( xModel ) +{ + m_xShapes.set( xShapes, uno::UNO_QUERY_THROW ); + m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW ); + initBaseCollection(); +} + +uno::Reference< container::XEnumeration > +ScVbaShapes::createEnumeration() throw (uno::RuntimeException) +{ + return new VbShapeEnumHelper( this, m_xIndexAccess ); +} + +uno::Any +ScVbaShapes::createCollectionObject( const css::uno::Any& aSource ) throw (uno::RuntimeException) +{ + if( aSource.hasValue() ) + { + uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ) ) ); + } + return uno::Any(); +} + +uno::Type +ScVbaShapes::getElementType() throw (uno::RuntimeException) +{ + return ooo::vba::msforms::XShape::static_type(0); +} +rtl::OUString& +ScVbaShapes::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapes") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaShapes::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shapes" ) ); + } + return aServiceNames; +} + +css::uno::Reference< css::container::XIndexAccess > +ScVbaShapes::getShapesByArrayIndices( const uno::Any& Index ) throw (uno::RuntimeException) +{ + if ( Index.getValueTypeClass() != uno::TypeClass_SEQUENCE ) + throw uno::RuntimeException(); + + uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext); + uno::Any aConverted; + aConverted = xConverter->convertTo( Index, getCppuType((uno::Sequence< uno::Any >*)0) ); + + uno::Sequence< uno::Any > sIndices; + aConverted >>= sIndices; + XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes; + sal_Int32 nElems = sIndices.getLength(); + for( sal_Int32 index = 0; index < nElems; ++index ) + { + uno::Reference< drawing::XShape > xShape; + if ( sIndices[ index ].getValueTypeClass() == uno::TypeClass_STRING ) + { + rtl::OUString sName; + sIndices[ index ] >>= sName; + xShape.set( m_xNameAccess->getByName( sName ), uno::UNO_QUERY ); + } + else + { + sal_Int32 nIndex = 0; + sIndices[ index ] >>= nIndex; + // adjust for 1 based mso indexing + xShape.set( m_xIndexAccess->getByIndex( nIndex - 1 ), uno::UNO_QUERY ); + + } + // populate map with drawing::XShapes + if ( xShape.is() ) + mShapes.push_back( xShape ); + } + uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) ); + return xIndexAccess; +} + +uno::Any SAL_CALL +ScVbaShapes::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException) +{ + // I don't think we need to support Array of indices for shapes +/* + if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE ) + { + uno::Reference< container::XIndexAccess > xIndexAccess( getShapesByArrayIndices( Index ) ); + // return new collection instance + uno::Reference< XCollection > xShapesCollection( new ScVbaShapes( this->getParent(), mxContext, xIndexAccess ) ); + return uno::makeAny( xShapesCollection ); + } +*/ + return ScVbaShapes_BASE::Item( Index, Index2 ); +} + +uno::Reference< msforms::XShapeRange > SAL_CALL +ScVbaShapes::Range( const uno::Any& shapes ) throw (css::uno::RuntimeException) +{ + // shapes, can be an index or an array of indices + uno::Reference< container::XIndexAccess > xShapes; + if ( shapes.getValueTypeClass() == uno::TypeClass_SEQUENCE ) + xShapes = getShapesByArrayIndices( shapes ); + else + { + // wrap single index into a sequence + uno::Sequence< uno::Any > sIndices(1); + sIndices[ 0 ] = shapes; + uno::Any aIndex; + aIndex <<= sIndices; + xShapes = getShapesByArrayIndices( aIndex ); + } + return new ScVbaShapeRange( getParent(), mxContext, xShapes, m_xDrawPage, m_xModel ); +} + +void SAL_CALL +ScVbaShapes::SelectAll() throw (uno::RuntimeException) +{ + uno::Reference< view::XSelectionSupplier > xSelectSupp( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + try + { + xSelectSupp->select( uno::makeAny( m_xShapes ) ); + } + // viewuno.cxx ScTabViewObj::select will throw IllegalArgumentException + // if one of the shapes is no 'markable' e.g. a button + // the method still works + catch( lang::IllegalArgumentException& ) + { + } +} + +uno::Reference< drawing::XShape > +ScVbaShapes::createShape( rtl::OUString service ) throw (css::uno::RuntimeException) +{ + uno::Reference< lang::XMultiServiceFactory > xMSF( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XShape > xShape( xMSF->createInstance( service ), uno::UNO_QUERY_THROW ); + return xShape; +} + +uno::Any +ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) +{ + rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape" ) ); + sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); + sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); + sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); + sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); + + uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); + m_xShapes->add( xShape ); + + rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Rectangle" ) ); + setDefaultShapeProperties( xShape ); + setShape_NameProperty( xShape, sName ); + + awt::Point aMovePositionIfRange(0, 0); + awt::Point position; + position.X = nXPos - aMovePositionIfRange.X; + position.Y = nYPos - aMovePositionIfRange.Y; + xShape->setPosition( position ); + + awt::Size size; + size.Height = nHeight; + size.Width = nWidth; + xShape->setSize( size ); + + ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); + pScVbaShape->setRange( aRange ); + return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); +} + +uno::Any +ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) +{ + rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.EllipseShape" ) ); + sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); + sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); + sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); + sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); + + uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); + m_xShapes->add( xShape ); + + awt::Point aMovePositionIfRange( 0, 0 ); + //TODO helperapi using a writer document + /* + XDocument xDocument = (XDocument)getParent(); + if (AnyConverter.isVoid(_aRange)) + { + _aRange = xDocument.Range(new Integer(0), new Integer(1)); + // Top&Left in Word is Top&Left of the paper and not the writeable area. + aMovePositionIfRange = calculateTopLeftMargin((HelperInterfaceAdaptor)xDocument); + } + + setShape_AnchorTypeAndRangeProperty(xShape, _aRange); + */ + rtl::OUString name = createName( rtl::OUString::createFromAscii( "Oval" )); + setDefaultShapeProperties(xShape); + setShape_NameProperty(xShape, name); + + awt::Point position; + position.X = nXPos - aMovePositionIfRange.X; + position.Y = nYPos - aMovePositionIfRange.Y; + xShape->setPosition(position); + + awt::Size size; + size.Height = nHeight; + size.Width = nWidth; + xShape->setSize(size); + + ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); + pScVbaShape->setRange( aRange ); + return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); +} + +//helpeapi calc +uno::Any SAL_CALL +ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (uno::RuntimeException) +{ + sal_Int32 nLineWidth = endX - StartX; + sal_Int32 nLineHeight = endY - StartY; + + sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); + sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); + sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( StartX ); + sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( StartY ); + + uno::Reference< drawing::XShape > xShape( createShape( rtl::OUString::createFromAscii("com.sun.star.drawing.LineShape") ), uno::UNO_QUERY_THROW ); + m_xShapes->add( xShape ); + + awt::Point aMovePositionIfRange( 0, 0 ); + + rtl::OUString name = createName( rtl::OUString::createFromAscii( "Line" ) ); + setDefaultShapeProperties(xShape); + setShape_NameProperty(xShape, name); + + awt::Point position; + position.X = nXPos - aMovePositionIfRange.X; + position.Y = nYPos - aMovePositionIfRange.Y; + xShape->setPosition(position); + + awt::Size size; + size.Height = nHeight; + size.Width = nWidth; + xShape->setSize(size); + + ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); + return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); +} + +uno::Any SAL_CALL +ScVbaShapes::AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) +{ + uno::Any _aAnchor; + if (_nType == office::MsoAutoShapeType::msoShapeRectangle) + { + return AddRectangle(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor); + } + else if (_nType == office::MsoAutoShapeType::msoShapeOval) + { + return AddEllipse(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor); + } + return uno::Any(); +} + +uno::Any SAL_CALL +ScVbaShapes::AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) +{ + uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) ) + { + return AddTextboxInWriter( _nOrientation, _nLeft, _nTop, _nWidth, _nHeight ); + } + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +uno::Any +ScVbaShapes::AddTextboxInWriter( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) +{ + rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ); + sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft ); + sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop ); + sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth ); + sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( _nHeight ); + + uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); + m_xShapes->add( xShape ); + + setDefaultShapeProperties(xShape); + + rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Text Box") ); + setShape_NameProperty( xShape, sName ); + + awt::Size size; + size.Height = nHeight; + size.Width = nWidth; + xShape->setSize(size); + + uno::Reference< beans::XPropertySet > xShapeProps( xShape, uno::UNO_QUERY_THROW ); + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "AnchorType" ), uno::makeAny( text::TextContentAnchorType_AT_PAGE ) ); + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_LEFT ) ); + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrient" ), uno::makeAny( text::HoriOrientation::NONE ) ); + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nXPos ) ); + + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_FRAME ) ); + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrient" ), uno::makeAny( text::VertOrientation::NONE ) ); + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nYPos ) ); + + // set to visible + drawing::LineStyle aLineStyle = drawing::LineStyle_SOLID; + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) ); + // set to font + sal_Int16 nLayerId = 1; + rtl::OUString sLayerName = rtl::OUString::createFromAscii("Heaven"); + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerID" ), uno::makeAny( nLayerId ) ); + xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerName" ), uno::makeAny( sLayerName ) ); + + + ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); + return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); +} + +uno::Any +ScVbaShapes::AddShape( const rtl::OUString& sService, const rtl::OUString& sName, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) +{ + sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft ); + sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop ); + sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth ); + sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( _nHeight ); + + uno::Reference< drawing::XShape > xShape( createShape( sService ), uno::UNO_QUERY_THROW ); + m_xShapes->add( xShape ); + + setDefaultShapeProperties(xShape); + setShape_NameProperty( xShape, sName ); + + awt::Point aMovePositionIfRange( 0, 0 ); + awt::Point position; + position.X = nXPos - aMovePositionIfRange.X; + position.Y = nYPos - aMovePositionIfRange.Y; + xShape->setPosition(position); + + awt::Size size; + size.Height = nHeight; + size.Width = nWidth; + xShape->setSize(size); + + ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); + return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); +} +void +ScVbaShapes::setDefaultShapeProperties( uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); + xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillStyle" ), uno::makeAny( rtl::OUString::createFromAscii( "SOLID" ) ) ); + xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor"), uno::makeAny( sal_Int32(0xFFFFFF) ) ); + xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap"), uno::makeAny( text::WrapTextMode_THROUGHT ) ); + //not find in OOo2.3 + //xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Opaque"), uno::makeAny( sal_True ) ); +} + +void +ScVbaShapes::setShape_NameProperty( uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName ) +{ + uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); + try + { + xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Name" ), uno::makeAny( sName ) ); + } + catch( script::BasicErrorException e ) + { + } +} + +rtl::OUString +ScVbaShapes::createName( rtl::OUString sName ) +{ + sal_Int32 nActNumber = 1 + m_nNewShapeCount; + m_nNewShapeCount++; + sName += rtl::OUString::valueOf( nActNumber ); + return sName; +} + +#if 0 +//TODO helperapi using a writer document +awt::Point +calculateTopLeftMargin( uno::Reference< XHelperInterface > xDocument ) +{ + awt::Point aPoint( 0, 0 ); + uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW ); + return awt::Point(); +} +#endif diff --git a/vbahelper/source/vbahelper/vbatextframe.cxx b/vbahelper/source/vbahelper/vbatextframe.cxx new file mode 100644 index 000000000000..c36acd4864cd --- /dev/null +++ b/vbahelper/source/vbahelper/vbatextframe.cxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbatextframe.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +VbaTextFrame::VbaTextFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< drawing::XShape > xShape ) : VbaTextFrame_BASE( xParent, xContext ), m_xShape( xShape ) +{ + m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); +} + +void +VbaTextFrame::setAsMSObehavior() +{ + //set property TextWordWrap default as False. + // TextFitToSize control the text content. it seems we should set the default as False. + // com.sun.star.drawing.TextFitToSizeType.NONE + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap" ), uno::makeAny( sal_False ) ); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextFitToSize" ), uno::makeAny( drawing::TextFitToSizeType_NONE ) ); +} + +sal_Int32 VbaTextFrame::getMargin( rtl::OUString sMarginType ) +{ + sal_Int32 nMargin = 0; + uno::Any aMargin = m_xPropertySet->getPropertyValue( sMarginType ); + aMargin >>= nMargin; + return nMargin; +} + +void VbaTextFrame::setMargin( rtl::OUString sMarginType, float fMargin ) +{ + sal_Int32 nMargin = Millimeter::getInHundredthsOfOneMillimeter( fMargin ); + m_xPropertySet->setPropertyValue( sMarginType, uno::makeAny( nMargin ) ); +} + +// Attributes +sal_Bool SAL_CALL +VbaTextFrame::getAutoSize() throw (uno::RuntimeException) +{ + // I don't know why, but in OOo, TextAutoGrowHeight is the property control autosize. not TextFitToSize. + // TextFitToSize control the text content. + // and in mso, there isnot option TextWordWrap which means auto wrap. the default is False. + sal_Bool bAutosize = sal_False; + uno::Any aTextAutoGrowHeight = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ) ); + aTextAutoGrowHeight >>= bAutosize; + return bAutosize; +} + +void SAL_CALL +VbaTextFrame::setAutoSize( sal_Bool _autosize ) throw (uno::RuntimeException) +{ + setAsMSObehavior(); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ), uno::makeAny( _autosize ) ); +} + +float SAL_CALL +VbaTextFrame::getMarginBottom() throw (uno::RuntimeException) +{ + sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ) ); + float fMargin = (float)Millimeter::getInPoints( nMargin ); + return fMargin; +} + +void SAL_CALL +VbaTextFrame::setMarginBottom( float _marginbottom ) throw (uno::RuntimeException) +{ + setMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ), _marginbottom ); +} + +float SAL_CALL +VbaTextFrame::getMarginTop() throw (uno::RuntimeException) +{ + sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ) ); + float fMargin = (float)Millimeter::getInPoints( nMargin ); + return fMargin; +} + +void SAL_CALL +VbaTextFrame::setMarginTop( float _margintop ) throw (uno::RuntimeException) +{ + setMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ), _margintop ); +} + +float SAL_CALL +VbaTextFrame::getMarginLeft() throw (uno::RuntimeException) +{ + sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ) ); + float fMargin = (float)Millimeter::getInPoints( nMargin ); + return fMargin; +} + +void SAL_CALL +VbaTextFrame::setMarginLeft( float _marginleft ) throw (uno::RuntimeException) +{ + setMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ), _marginleft ); +} + +float SAL_CALL +VbaTextFrame::getMarginRight() throw (uno::RuntimeException) +{ + sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextRightDistance" ) ); + float fMargin = (float)Millimeter::getInPoints( nMargin ); + return fMargin; +} + +void SAL_CALL +VbaTextFrame::setMarginRight( float _marginright ) throw (uno::RuntimeException) +{ + setMargin( rtl::OUString::createFromAscii( "TextRightDistance" ), _marginright ); +} + + +// Methods +uno::Any SAL_CALL +VbaTextFrame::Characters() throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +rtl::OUString& +VbaTextFrame::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaTextFrame") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +VbaTextFrame::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextFrame" ) ); + } + return aServiceNames; +} + diff --git a/vbahelper/source/vbahelper/vbawindowbase.cxx b/vbahelper/source/vbahelper/vbawindowbase.cxx new file mode 100644 index 000000000000..a62388ca21ad --- /dev/null +++ b/vbahelper/source/vbahelper/vbawindowbase.cxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include +#include +#include +#include +#include + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +VbaWindowBase::VbaWindowBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowBaseImpl_BASE( xParent, xContext ), m_xModel( xModel ) +{ +} + +VbaWindowBase::VbaWindowBase( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext ) + : WindowBaseImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), + m_xModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ) +{ +} + +sal_Bool SAL_CALL +VbaWindowBase::getVisible() throw (uno::RuntimeException) +{ + sal_Bool bVisible = sal_True; + uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW ); + uno::Reference< css::awt::XWindow2 > xWindow2 (xWindow, uno::UNO_QUERY_THROW ); + if( xWindow2.is() ) + { + bVisible = xWindow2->isVisible(); + } + return bVisible; +} + +void SAL_CALL +VbaWindowBase::setVisible(sal_Bool _visible) throw (uno::RuntimeException) +{ + uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW ); + if( xWindow.is() ) + { + xWindow->setVisible( _visible ); + } +} + +css::awt::Rectangle getPosSize( const uno::Reference< frame::XModel >& xModel ) +{ + css::awt::Rectangle aRect; + uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW ); + if( xWindow.is() ) + { + aRect = xWindow->getPosSize(); + } + return aRect; +} + +void setPosSize( const uno::Reference< frame::XModel >& xModel, sal_Int32 nValue, USHORT nFlag ) +{ + uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); + uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW ); + if( xWindow.is() ) + { + css::awt::Rectangle aRect = xWindow->getPosSize(); + switch( nFlag ) + { + case css::awt::PosSize::X: + xWindow->setPosSize( nValue, aRect.Y, 0, 0, css::awt::PosSize::X ); + break; + case css::awt::PosSize::Y: + xWindow->setPosSize( aRect.X, nValue, 0, 0, css::awt::PosSize::Y ); + break; + case css::awt::PosSize::WIDTH: + xWindow->setPosSize( 0, 0, nValue, aRect.Height, css::awt::PosSize::WIDTH ); + break; + case css::awt::PosSize::HEIGHT: + xWindow->setPosSize( 0, 0, aRect.Width, nValue, css::awt::PosSize::HEIGHT ); + break; + default: + break; + } + } +} + +sal_Int32 SAL_CALL +VbaWindowBase::getHeight() throw (uno::RuntimeException) +{ + css::awt::Rectangle aRect = getPosSize(m_xModel); + return aRect.Height; +} + +void SAL_CALL +VbaWindowBase::setHeight( sal_Int32 _height ) throw (uno::RuntimeException) +{ + setPosSize(m_xModel, _height, css::awt::PosSize::HEIGHT); +} + +sal_Int32 SAL_CALL +VbaWindowBase::getLeft() throw (uno::RuntimeException) +{ + css::awt::Rectangle aRect = getPosSize(m_xModel); + return aRect.X; +} + +void SAL_CALL +VbaWindowBase::setLeft( sal_Int32 _left ) throw (uno::RuntimeException) +{ + setPosSize(m_xModel, _left, css::awt::PosSize::X); +} +sal_Int32 SAL_CALL +VbaWindowBase::getTop() throw (uno::RuntimeException) +{ + css::awt::Rectangle aRect = getPosSize(m_xModel); + return aRect.Y; +} + +void SAL_CALL +VbaWindowBase::setTop( sal_Int32 _top ) throw (uno::RuntimeException) +{ + setPosSize(m_xModel, _top, css::awt::PosSize::Y); +} +sal_Int32 SAL_CALL +VbaWindowBase::getWidth() throw (uno::RuntimeException) +{ + css::awt::Rectangle aRect = getPosSize(m_xModel); + return aRect.Width; +} + +void SAL_CALL +VbaWindowBase::setWidth( sal_Int32 _width ) throw (uno::RuntimeException) +{ + setPosSize(m_xModel, _width, css::awt::PosSize::WIDTH); +} + +rtl::OUString& +VbaWindowBase::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaWindowBase") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +VbaWindowBase::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VbaWindowBase" ) ); + } + return aServiceNames; +} diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk new file mode 100644 index 000000000000..33c0ca1f2960 --- /dev/null +++ b/vbahelper/util/makefile.mk @@ -0,0 +1,104 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.24 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. + +PRJNAME=vbahelper +TARGET=vbahelper + +# --- Settings --------------------------------------------------- + +.INCLUDE : settings.mk + + +TARGET_HELPER=vbahelper + +LIB1TARGET= $(SLB)$/$(TARGET).lib +LIB1FILES=$(SLB)$/$(TARGET)bits.lib + +SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX) + + +# dynamic libraries +SHL1STDLIBS= \ + $(CPPULIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(BASICLIB) \ + $(TOOLSLIB) \ + $(SALLIB)\ + $(SFXLIB) \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(VCLLIB) \ + $(SVTOOLLIB) \ + $(TKLIB) \ + $(SVXMSFILTERLIB) \ + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET_HELPER) +SHL1USE_EXPORTS=name +SHL1LIBS=$(LIB1TARGET) + +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +DEF1NAME=$(SHL1TARGET) +DEFLIB1NAME=$(TARGET) + +TARGET_MSFORMS=msforms +SHL2TARGET=$(TARGET_MSFORMS)$(DLLPOSTFIX).uno +SHL2IMPLIB= i$(TARGET_MSFORMS) + +SHL2VERSIONMAP=$(TARGET_MSFORMS).map +SHL2DEF=$(MISC)$/$(SHL2TARGET).def +DEF2NAME=$(SHL2TARGET) +SHL2STDLIBS= \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(COMPHELPERLIB) \ + $(SVLIB) \ + $(TOOLSLIB) \ + $(SALLIB)\ + $(VBAHELPERLIB) \ + $(SFXLIB) \ + $(SVXLIB) \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(VCLLIB) \ + $(TKLIB) \ + $(BASICLIB) \ + +SHL2DEPN=$(SHL1TARGETN) +SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib + +# --- Targets ----------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/vbahelper/util/msforms.map b/vbahelper/util/msforms.map new file mode 100644 index 000000000000..737cddbfe3df --- /dev/null +++ b/vbahelper/util/msforms.map @@ -0,0 +1,9 @@ +OOO_1.1 { + global: + component_getImplementationEnvironment; + component_getFactory; + component_writeInfo; + + local: + *; +}; From 1d6d409c5b2fe07fa2754508954df7fa62ade144 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Mon, 21 Sep 2009 12:01:00 +0000 Subject: [PATCH 014/117] remove files --- vbahelper/inc/vbahelper/vbahelper.hxx.orig | 228 ---- vbahelper/source/msforms/vbacontrol.cxx.orig | 520 -------- vbahelper/source/vbahelper/vbahelper.cxx.orig | 1128 ----------------- 3 files changed, 1876 deletions(-) delete mode 100644 vbahelper/inc/vbahelper/vbahelper.hxx.orig delete mode 100644 vbahelper/source/msforms/vbacontrol.cxx.orig delete mode 100644 vbahelper/source/vbahelper/vbahelper.cxx.orig diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx.orig b/vbahelper/inc/vbahelper/vbahelper.hxx.orig deleted file mode 100644 index 047019c214d0..000000000000 --- a/vbahelper/inc/vbahelper/vbahelper.hxx.orig +++ /dev/null @@ -1,228 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbahelper.hxx,v $ - * $Revision: 1.5.32.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef OOVBAAPI_VBA_HELPER_HXX -#define OOVBAAPI_VBA_HELPER_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#define VBAHELPER_DLLIMPLEMENTATION -#include -#include -namespace css = ::com::sun::star; - -namespace ooo -{ - namespace vba - { - template < class T > - css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true ) throw (css::lang::IllegalArgumentException) - { - if ( args.getLength() < ( nPos + 1) ) - throw css::lang::IllegalArgumentException(); - css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY ); - if ( !bCanBeNull && !aSomething.is() ) - throw css::lang::IllegalArgumentException(); - return aSomething; - } - VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException); - VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException); - VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException); - css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException); - VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc() throw (css::uno::RuntimeException); - VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc() throw (css::uno::RuntimeException); - - VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException); - VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException); - - VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ; - VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ; - VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON ); - VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 ); - VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 ); - VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& ); - VBAHELPER_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& ); - // provide a NULL object that can be passed as variant so that - // the object when passed to IsNull will return true. aNULL - // contains an empty object reference - VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL(); - VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection ); - VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* ); - - VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException ); - VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic ) - VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical); - VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); - VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); - VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& ); - VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite ); - -class VBAHELPER_DLLPUBLIC Millimeter -{ -//Factor to translate between points and hundredths of millimeters: -private: - static const double factor; - - double m_nMillimeter; - -public: - Millimeter(); - - Millimeter(double mm); - - void set(double mm); - void setInPoints(double points) ; - void setInHundredthsOfOneMillimeter(double hmm); - double get(); - double getInHundredthsOfOneMillimeter(); - double getInPoints(); - static sal_Int32 getInHundredthsOfOneMillimeter(double points); - static double getInPoints(int _hmm); -}; - -class VBAHELPER_DLLPUBLIC AbstractGeometryAttributes // probably should replace the ShapeHelper below -{ -public: - virtual ~AbstractGeometryAttributes() {} - virtual double getLeft() = 0; - virtual void setLeft( double ) = 0; - virtual double getTop() = 0; - virtual void setTop( double ) = 0; - virtual double getHeight() = 0; - virtual void setHeight( double ) = 0; - virtual double getWidth() = 0; - virtual void setWidth( double ) = 0; -}; - -namespace msforms { - class XShape; -} - -class VBAHELPER_DLLPUBLIC ShapeHelper -{ -protected: - css::uno::Reference< css::drawing::XShape > xShape; -public: - ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ); - - double getHeight(); - - void setHeight(double _fheight) throw ( css::script::BasicErrorException ); - - double getWidth(); - - void setWidth(double _fWidth) throw ( css::script::BasicErrorException ); - - double getLeft(); - - void setLeft(double _fLeft); - - double getTop(); - - void setTop(double _fTop); -}; - -class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes -{ - std::auto_ptr< ShapeHelper > m_pShapeHelper; -public: - ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ); - virtual double getLeft(); - virtual void setLeft( double nLeft ); - virtual double getTop(); - virtual void setTop( double nTop ); - virtual double getHeight(); - virtual void setHeight( double nHeight ); - virtual double getWidth(); - virtual void setWidth( double nWidth); -}; -#define VBA_LEFT "PositionX" -#define VBA_TOP "PositionY" -class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes -{ - - css::uno::Reference< css::beans::XPropertySet > mxModel; -public: - UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl ); - virtual double getLeft(); - virtual void setLeft( double nLeft ); - virtual double getTop(); - virtual void setTop( double nTop ); - virtual double getHeight(); - virtual void setHeight( double nHeight ); - virtual double getWidth(); - virtual void setWidth( double nWidth); -}; - -class VBAHELPER_DLLPUBLIC ContainerUtilities -{ - -public: - static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator); - static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix ); - - static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString ); -}; - -// really just a a place holder to ease the porting pain -class VBAHELPER_DLLPUBLIC DebugHelper -{ -public: - static void exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException ); - - static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ); - - static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException ); -}; - } // openoffice -} // org - -namespace ov = ooo::vba; - -#ifdef DEBUG -# define SC_VBA_FIXME(a) OSL_TRACE( a ) -# define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ )) -#else -# define SC_VBA_FIXME(a) -# define SC_VBA_STUB() -#endif - -#endif diff --git a/vbahelper/source/msforms/vbacontrol.cxx.orig b/vbahelper/source/msforms/vbacontrol.cxx.orig deleted file mode 100644 index 25502d29f67a..000000000000 --- a/vbahelper/source/msforms/vbacontrol.cxx.orig +++ /dev/null @@ -1,520 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbacontrol.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef VBA_OOBUILD_HACK -#include -#endif -#include"vbacontrol.hxx" -#include"vbacombobox.hxx" -#include "vbabutton.hxx" -#include "vbalabel.hxx" -#include "vbatextbox.hxx" -#include "vbaradiobutton.hxx" -#include "vbalistbox.hxx" -#include "vbatogglebutton.hxx" -#include "vbacheckbox.hxx" -#include "vbaframe.hxx" -#include "vbascrollbar.hxx" -#include "vbaprogressbar.hxx" -#include "vbamultipage.hxx" -#include "vbaspinbutton.hxx" -#include "vbaimage.hxx" -#include - - -using namespace com::sun::star; -using namespace ooo::vba; - -uno::Reference< css::awt::XWindowPeer > -ScVbaControl::getWindowPeer() throw (uno::RuntimeException) -{ - uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); - - uno::Reference< awt::XControlModel > xControlModel; - uno::Reference< css::awt::XWindowPeer > xWinPeer; - if ( !xControlShape.is() ) - { - // would seem to be a Userform control - uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW ); - xWinPeer = xControl->getPeer(); - return xWinPeer; - } - // form control - xControlModel.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); - - uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - try - { - uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY ); - xWinPeer = xControl->getPeer(); - } - catch( uno::Exception ) - { - throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ), - uno::Reference< uno::XInterface >() ); - } - return xWinPeer; -} - -//ScVbaControlListener -class ScVbaControlListener: public cppu::WeakImplHelper1< lang::XEventListener > -{ -private: - ScVbaControl *pControl; -public: - ScVbaControlListener( ScVbaControl *pTmpControl ); - virtual ~ScVbaControlListener(); - virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException ); -}; - -ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl ) -{ -} - -ScVbaControlListener::~ScVbaControlListener() -{ -} - -void SAL_CALL -ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeException ) -{ - if( pControl ) - { - pControl->removeResouce(); - pControl = NULL; - } -} - -//ScVbaControl - -ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel ) -{ - //add listener - m_xEventListener.set( new ScVbaControlListener( this ) ); - setGeometryHelper( pGeomHelper ); - uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); - xComponent->addEventListener( m_xEventListener ); - - //init m_xProps - uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ; - uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ; - if ( xControlShape.is() ) // form control - m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); - else if ( xUserFormControl.is() ) // userform control - m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW ); -} - -ScVbaControl::~ScVbaControl() -{ - if( m_xControl.is() ) -{ - uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); - xComponent->removeEventListener( m_xEventListener ); -} -} - -void -ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper ) -{ - mpGeometryHelper.reset( pHelper ); -} - -void ScVbaControl::removeResouce() throw( uno::RuntimeException ) -{ - uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); - xComponent->removeEventListener( m_xEventListener ); - m_xControl= NULL; - m_xProps = NULL; -} - -//In design model has different behavior -sal_Bool SAL_CALL ScVbaControl::getEnabled() throw (uno::RuntimeException) -{ - uno::Any aValue = m_xProps->getPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) ); - sal_Bool bRet = false; - aValue >>= bRet; - return bRet; -} - -void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeException) -{ - uno::Any aValue( bVisible ); - m_xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ), aValue); - -} - -sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException) -{ - uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW ); - return xWindow2->isVisible(); -} - -void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) -{ - uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW ); - xWindow2->setVisible( bVisible ); -} -double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException) -{ - return mpGeometryHelper->getHeight(); -} -void SAL_CALL ScVbaControl::setHeight( double _height ) throw (uno::RuntimeException) -{ - mpGeometryHelper->setHeight( _height ); -} - -double SAL_CALL ScVbaControl::getWidth() throw (uno::RuntimeException) -{ - return mpGeometryHelper->getWidth(); -} -void SAL_CALL ScVbaControl::setWidth( double _width ) throw (uno::RuntimeException) -{ - mpGeometryHelper->setWidth( _width ); -} - -double SAL_CALL -ScVbaControl::getLeft() throw (uno::RuntimeException) -{ - return mpGeometryHelper->getLeft(); -} - -void SAL_CALL -ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException) -{ - mpGeometryHelper->setLeft( _left ); - -} - -double SAL_CALL -ScVbaControl::getTop() throw (uno::RuntimeException) -{ - return mpGeometryHelper->getTop(); -} - -void SAL_CALL -ScVbaControl::setTop( double _top ) throw (uno::RuntimeException) -{ - mpGeometryHelper->setTop( _top ); -} - -uno::Reference< uno::XInterface > SAL_CALL -ScVbaControl::getObject() throw (uno::RuntimeException) -{ - uno::Reference< msforms::XControl > xRet( this ); - return xRet; -} - -void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException) -{ - uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW ); - xWin->setFocus(); -} - -rtl::OUString SAL_CALL -ScVbaControl::getControlSource() throw (uno::RuntimeException) -{ -// #FIXME I *hate* having these upstream differences -// but this is necessary until I manage to upstream other -// dependant parts -#ifdef VBA_OOBUILD_HACK - rtl::OUString sControlSource; - uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY ); - if ( xBindable.is() ) - { - try - { - uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellAddressConversion" ))), uno::UNO_QUERY ); - uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW ); - table::CellAddress aAddress; - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= aAddress; - xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address") ), uno::makeAny( aAddress ) ); - xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sControlSource; - } - catch( uno::Exception& ) - { - } - } - return sControlSource; -#else - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getControlSource not supported") ), uno::Reference< uno::XInterface >()); // not supported -#endif -} - -void SAL_CALL -ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException) -{ -#ifdef VBA_OOBUILD_HACK - rtl::OUString sEmpty; - svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, _controlsource, sEmpty ); -#else - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setControlSource not supported ") ).concat( _controlsource ), uno::Reference< uno::XInterface >()); // not supported -#endif -} - -rtl::OUString SAL_CALL -ScVbaControl::getRowSource() throw (uno::RuntimeException) -{ -#ifdef VBA_OOBUILD_HACK - rtl::OUString sRowSource; - uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY ); - if ( xListSink.is() ) - { - try - { - uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellRangeAddressConversion" ))), uno::UNO_QUERY ); - - uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW ); - table::CellRangeAddress aAddress; - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellRange") ) ) >>= aAddress; - xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address")), uno::makeAny( aAddress ) ); - xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sRowSource; - } - catch( uno::Exception& ) - { - } - } - return sRowSource; -#else - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getRowSource not supported") ), uno::Reference< uno::XInterface >()); // not supported -#endif -} - -void SAL_CALL -ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) -{ -#ifdef VBA_OOBUILD_HACK - rtl::OUString sEmpty; - svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, sEmpty, _rowsource ); -#else - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setRowSource not supported ") ).concat( _rowsource ), uno::Reference< uno::XInterface >()); // not supported -#endif -} - -rtl::OUString SAL_CALL -ScVbaControl::getName() throw (uno::RuntimeException) -{ - rtl::OUString sName; - m_xProps->getPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName; - return sName; - -} - -void SAL_CALL -ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) -{ - m_xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) ); - } -//ScVbaControlFactory - -ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel ) -{ -} - -ScVbaControl* ScVbaControlFactory::createControl() throw (uno::RuntimeException) -{ - return createControl( m_xModel ); -} -ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) -{ - uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); - if ( xControlShape.is() ) // form controls - return createControl( xControlShape, xParent ); - uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ); - if ( !xControl.is() ) - throw uno::RuntimeException(); // really we should be more informative - return createControl( xControl, xParent ); - -} - -ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW ); - sal_Int32 nClassId = -1; - const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") ); - xProps->getPropertyValue( sClassId ) >>= nClassId; - uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess - switch( nClassId ) - { - case form::FormComponentType::COMBOBOX: - return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::COMMANDBUTTON: - return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::FIXEDTEXT: - return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::TEXTFIELD: - return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::RADIOBUTTON: - return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::LISTBOX: - return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::SPINBUTTON: - return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - case form::FormComponentType::IMAGECONTROL: - return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); - default: - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Donot support this Control Type." ), uno::Reference< uno::XInterface >() ); - } -} - -ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW ); - uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW ); - ScVbaControl* pControl = NULL; - uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess - if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) ) - pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) ) - pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) ) - pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) ) - { - sal_Bool bToggle = sal_False; - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle; - if ( bToggle ) - pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else - pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - } - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) ) - pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) - pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) - pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) ) - pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) ) - pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) - pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) ) - pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) ) - pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent ); - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) ) - pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); - else - throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() ); - return pControl; -} - -rtl::OUString& -ScVbaControl::getServiceImplName() -{ - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") ); - return sImplName; -} - -uno::Sequence< rtl::OUString > -ScVbaControl::getServiceNames() -{ - static uno::Sequence< rtl::OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Control" ) ); - } - return aServiceNames; -} - - - -typedef cppu::WeakImplHelper1< XControlProvider > ControlProvider_BASE; -class ControlProviderImpl : public ControlProvider_BASE -{ - uno::Reference< uno::XComponentContext > m_xCtx; -public: - ControlProviderImpl( const uno::Reference< uno::XComponentContext >& xCtx ) : m_xCtx( xCtx ) {} - virtual uno::Reference< msforms::XControl > SAL_CALL createControl( const uno::Reference< drawing::XControlShape >& xControl, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException); - virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException); -}; - -uno::Reference< msforms::XControl > SAL_CALL -ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException) -{ - uno::Reference< msforms::XControl > xControlToReturn; - if ( xControlShape.is() ) - { - ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner ); - xControlToReturn.set( controlFactory.createControl( xDocOwner ) ); - } - return xControlToReturn; - -} -uno::Reference< msforms::XControl > SAL_CALL -ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException) -{ - uno::Reference< msforms::XControl > xControlToReturn; - if ( xControl.is() && xDialog.is() ) - { - - ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner ); - xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) ); - ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xControlToReturn.get() ); - pControl->setGeometryHelper( new UserFormGeometryHelper( m_xCtx, xControl ) ); - } - return xControlToReturn; -} - -namespace controlprovider -{ -namespace sdecl = comphelper::service_decl; -sdecl::class_ > serviceImpl; -extern sdecl::ServiceDecl const serviceDecl( - serviceImpl, - "ControlProviderImpl", - "ooo.vba.ControlProvider" ); -} - - diff --git a/vbahelper/source/vbahelper/vbahelper.cxx.orig b/vbahelper/source/vbahelper/vbahelper.cxx.orig deleted file mode 100644 index c8c96cca01e5..000000000000 --- a/vbahelper/source/vbahelper/vbahelper.cxx.orig +++ /dev/null @@ -1,1128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: vbahelper.cxx,v $ - * $Revision: 1.5.32.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef OOVBA_DLLIMPLEMENTATION -#define OOVBA_DLLIMPLEMENTATION -#endif - -#include -#include -// #FIXME needs service -//#include "vbashape.hxx" -//#include "unonames.hxx" - -using namespace ::com::sun::star; -using namespace ::ooo::vba; - -#define NAME_HEIGHT "Height" -#define NAME_WIDTH "Width" - -#define POINTTO100THMILLIMETERFACTOR 35.27778 - - -void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue ); - -uno::Any sbxToUnoValue( SbxVariable* pVar ); - - -namespace ooo -{ -namespace vba -{ - -uno::Reference< lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell ) -{ - uno::Any aUnoVar; - if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) ) - throw lang::IllegalArgumentException(); - uno::Reference< lang::XMultiServiceFactory > xVBAFactory( aUnoVar, uno::UNO_QUERY_THROW ); - return xVBAFactory; -} - -css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException) -{ - OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); - ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); - return getVBAServiceFactory( pShell )->createInstance( sVarName ); -} - -css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const uno::Sequence< uno::Any >& aArgs ) throw ( css::uno::RuntimeException ) -{ - OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); - ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); - uno::Reference< uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs ); - return xIf; -} -// helper method to determine if the view ( calc ) is in print-preview mode -bool isInPrintPreview( SfxViewFrame* pView ) -{ - sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0; - if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() > -nViewNo && !pView->GetObjectShell()->IsInPlaceActive() ) - { - SfxViewFactory &rViewFactory = - pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo); - if ( pView->GetCurViewId() == rViewFactory.GetOrdinal() ) - return true; - } - return false; -} -#if 0 -namespace excel // all in this namespace probably can be moved to sc -{ - - -const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning")); -class PasteCellsWarningReseter -{ -private: - bool bInitialWarningState; - static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException ) - { - static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - static uno::Reference xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW ); - static uno::Reference xServiceManager( - xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW ); - return xProps; - } - - bool getReplaceCellsWarning() throw ( uno::RuntimeException ) - { - sal_Bool res = sal_False; - getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res; - return ( res == sal_True ); - } - - void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException ) - { - getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) ); - } -public: - PasteCellsWarningReseter() throw ( uno::RuntimeException ) - { - bInitialWarningState = getReplaceCellsWarning(); - if ( bInitialWarningState ) - setReplaceCellsWarning( false ); - } - ~PasteCellsWarningReseter() - { - if ( bInitialWarningState ) - { - // don't allow dtor to throw - try - { - setReplaceCellsWarning( true ); - } - catch ( uno::Exception& /*e*/ ){} - } - } -}; - -void -implnPaste() -{ - PasteCellsWarningReseter resetWarningBox; - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( pViewShell ) - { - pViewShell->PasteFromSystem(); - pViewShell->CellContentChanged(); - } -} - - -void -implnCopy() -{ - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( pViewShell ) - pViewShell->CopyToClip(NULL,false,false,true); -} - -void -implnCut() -{ - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( pViewShell ) - pViewShell->CutToClip( NULL, TRUE ); -} -void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose) -{ - PasteCellsWarningReseter resetWarningBox; - sal_Bool bAsLink(sal_False), bOtherDoc(sal_False); - InsCellCmd eMoveMode = INS_NONE; - - if ( !pTabViewShell ) - // none active, try next best - pTabViewShell = getCurrentBestViewShell(); - if ( pTabViewShell ) - { - ScViewData* pView = pTabViewShell->GetViewData(); - Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL; - if ( pView && pWin ) - { - if ( bAsLink && bOtherDoc ) - pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK - else - { - ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); - ScDocument* pDoc = NULL; - if ( pOwnClip ) - pDoc = pOwnClip->GetDocument(); - pTabViewShell->PasteFromClip( nFlags, pDoc, - nFunction, bSkipEmpty, bTranspose, bAsLink, - eMoveMode, IDF_NONE, TRUE ); - pTabViewShell->CellContentChanged(); - } - } - } - -} - -ScDocShell* -getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) -{ - uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW ); - ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() ); - ScDocShell* pDocShell = NULL; - if ( pModel ) - pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); - return pDocShell; - -} - -ScTabViewShell* -getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) -{ - ScDocShell* pDocShell = getDocShell( xModel ); - if ( pDocShell ) - return pDocShell->GetBestViewShell(); - return NULL; -} - -ScTabViewShell* -getCurrentBestViewShell() -{ - uno::Reference< frame::XModel > xModel = getCurrentDocument(); - return getBestViewShell( xModel ); -} - -SfxViewFrame* -getCurrentViewFrame() -{ - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( pViewShell ) - return pViewShell->GetViewFrame(); - return NULL; -} -}; - -#endif -const double Millimeter::factor = 35.27778; - -uno::Reference< beans::XIntrospectionAccess > -getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException) -{ - static uno::Reference< beans::XIntrospection > xIntrospection; - if( !xIntrospection.is() ) - { - uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW ); - } - return xIntrospection->inspect( aObject ); -} - -uno::Reference< script::XTypeConverter > -getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) -{ - static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW ); - return xTypeConv; -} -const uno::Any& -aNULL() -{ - static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() ); - return aNULLL; -} - -void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall) -{ - SfxViewFrame* pViewFrame = NULL; - if ( pViewShell ) - pViewFrame = pViewShell->GetViewFrame(); - if ( pViewFrame ) - { - SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); - if( pDispatcher ) - { - pDispatcher->Execute( nSlot , nCall ); - } - } -} - -void -dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps ) -{ - - util::URL url ; - url.Complete = aUrl; - rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" )); - uno::Reference xController = xModel->getCurrentController(); - uno::Reference xFrame = xController->getFrame(); - uno::Reference xDispatchProvider (xFrame,uno::UNO_QUERY_THROW); - try - { - uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - uno::Reference xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW ); - if ( !xContext.is() ) - { - return ; - } - - uno::Reference xServiceManager( - xContext->getServiceManager() ); - if ( !xServiceManager.is() ) - { - return ; - } - uno::Reference xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ) - ,xContext), uno::UNO_QUERY_THROW ); - if (!xParser.is()) - return; - xParser->parseStrict (url); - } - catch ( uno::Exception & /*e*/ ) - { - return ; - } - - uno::Reference xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0); - - uno::Sequence dispatchProps(1); - - sal_Int32 nProps = sProps.getLength(); - beans::PropertyValue* pDest = dispatchProps.getArray(); - if ( nProps ) - { - dispatchProps.realloc( nProps + 1 ); - // need to reaccquire pDest after realloc - pDest = dispatchProps.getArray(); - beans::PropertyValue* pSrc = sProps.getArray(); - for ( sal_Int32 index=0; indexdispatch( url, dispatchProps ); -} - -void -dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl) -{ - uno::Sequence dispatchProps; - dispatchRequests( xModel, aUrl, dispatchProps ); -} - - - - - uno::Reference< frame::XModel > -getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel; - SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() ); - SbxObject* basicChosen = pBasic ; - if ( basicChosen == NULL) - { - OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" ); - return xModel; - } - SbxObject* p = pBasic; - SbxObject* pParent = p->GetParent(); - SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL; - - if( pParentParent ) - { - basicChosen = pParentParent; - } - else if( pParent ) - { - basicChosen = pParent; - } - - - uno::Any aModel; - SbxVariable *pCompVar = basicChosen->Find( sKey, SbxCLASS_OBJECT ); - - if ( pCompVar ) - { - aModel = sbxToUnoValue( pCompVar ); - if ( sal_False == ( aModel >>= xModel ) || - !xModel.is() ) - { - throw uno::RuntimeException( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the current documet context") ), uno::Reference< uno::XInterface >() ); - } - else - { - OSL_TRACE("Have model points to url %s", - ::rtl::OUStringToOString( xModel->getURL(), - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - } - else - { - OSL_TRACE("Failed to get %s", rtl::OUStringToOString( sKey, RTL_TEXTENCODING_UTF8 ).getStr() ); - throw uno::RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "Can't determine the currently selected document") ), - uno::Reference< uno::XInterface >() ); - } - return xModel; -} - - - uno::Reference< frame::XModel > -getCurrentExcelDoc() throw (uno::RuntimeException) -{ - static const rtl::OUString sThisExcelDoc( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc" ) ); - return getCurrentDoc( sThisExcelDoc ); -} - - uno::Reference< frame::XModel > -getCurrentWordDoc() throw (uno::RuntimeException) -{ - static const rtl::OUString sThisWordDoc( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc" ) ); - return getCurrentDoc( sThisWordDoc ); -} - -sal_Int32 -OORGBToXLRGB( sal_Int32 nCol ) -{ - sal_Int32 nAutoBits = nCol; - nAutoBits &= 0xFF000000; - sal_Int32 nRed = nCol; - nRed &= 0x00FF0000; - nRed >>= 16; - sal_Int32 nGreen = nCol; - nGreen &= 0x0000FF00; - nGreen >>= 8; - sal_Int32 nBlue = nCol; - nBlue &= 0x000000FF; - sal_Int32 nRGB = ( nAutoBits | (nBlue << 16) | (nGreen << 8) | nRed ); - return nRGB; -} -sal_Int32 -XLRGBToOORGB( sal_Int32 nCol ) -{ - sal_Int32 nAutoBits = nCol; - nAutoBits &= 0xFF000000; - - sal_Int32 nBlue = nCol; - nBlue &= 0x00FF0000; - nBlue >>= 16; - sal_Int32 nGreen = nCol; - nGreen &= 0x0000FF00; - nGreen >>= 8; - sal_Int32 nRed = nCol; - nRed &= 0x000000FF; - sal_Int32 nRGB = ( nAutoBits | (nRed << 16) | (nGreen << 8) | nBlue ); - return nRGB; -} -uno::Any -OORGBToXLRGB( const uno::Any& aCol ) -{ - sal_Int32 nCol; - aCol >>= nCol; - nCol = OORGBToXLRGB( nCol ); - return uno::makeAny( nCol ); -} -uno::Any -XLRGBToOORGB( const uno::Any& aCol ) -{ - sal_Int32 nCol; - aCol >>= nCol; - nCol = XLRGBToOORGB( nCol ); - return uno::makeAny( nCol ); -} - -void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, sal_Bool bUseSelection ) -{ - sal_Int32 nTo = 0; - sal_Int32 nFrom = 0; - sal_Int16 nCopies = 1; - sal_Bool bPreview = sal_False; - sal_Bool bCollate = sal_False; - sal_Bool bSelection = bUseSelection; - From >>= nFrom; - To >>= nTo; - Copies >>= nCopies; - Preview >>= bPreview; - if ( nCopies > 1 ) // Collate only useful when more that 1 copy - Collate >>= bCollate; - - rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) ); - rtl::OUString sFileName; - - if (( nFrom || nTo ) ) - { - if ( nFrom ) - sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange ); - if ( nTo ) - sRange += ::rtl::OUString::valueOf( nTo ); - } - - if ( PrToFileName.getValue() ) - { - PrToFileName >>= sFileName; - } - SfxViewFrame* pViewFrame = NULL; - if ( pViewShell ) - pViewFrame = pViewShell->GetViewFrame(); - if ( pViewFrame ) - { - SfxAllItemSet aArgs( SFX_APP()->GetPool() ); - - SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate ); - aArgs.Put( sfxCollate, sfxCollate.Which() ); - SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies ); - aArgs.Put( sfxCopies, sfxCopies.Which() ); - if ( sFileName.getLength() ) - { - SfxStringItem sfxFileName( SID_FILE_NAME, sFileName); - aArgs.Put( sfxFileName, sfxFileName.Which() ); - - } - if ( sRange.getLength() ) - { - SfxStringItem sfxRange( SID_PRINT_PAGES, sRange ); - aArgs.Put( sfxRange, sfxRange.Which() ); - } - SfxBoolItem sfxSelection( SID_SELECTION, bSelection ); - aArgs.Put( sfxSelection, sfxSelection.Which() ); - SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False ); - aArgs.Put( sfxAsync, sfxAsync.Which() ); - SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); - - if ( pDispatcher ) - { - if ( bPreview ) - { - if ( !pViewFrame->GetFrame()->IsInPlace() ) - { - // #TODO is this necessary ( calc specific ) -// SC_MOD()->InputEnterHandler(); - pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON ); - while ( isInPrintPreview( pViewFrame ) ) - Application::Yield(); - } - } - else - pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs ); - } - - } - - // #FIXME #TODO - // 1 ActivePrinter ( how/can we switch a printer via API? ) - // 2 PrintToFile ( ms behaviour if this option is specified but no - // filename supplied 'PrToFileName' then the user will be prompted ) - // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To - // values ) in oOO these options are mutually exclusive - // 4 There is a pop up to do with transparent objects in the print source - // should be able to disable that via configuration for the duration - // of this method -} - - void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, SfxViewShell* pViewShell ) -{ - dispatchExecute( pViewShell, SID_VIEWSHELL1 ); -} - -rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException ) -{ - uno::Type aType = pvargItem.getValueType(); - uno::TypeClass eTypeClass = aType.getTypeClass(); - rtl::OUString sString; - switch ( eTypeClass ) - { - case uno::TypeClass_BOOLEAN: - { - sal_Bool bBool = sal_False; - pvargItem >>= bBool; - sString = rtl::OUString::valueOf( bBool ); - break; - } - case uno::TypeClass_STRING: - pvargItem >>= sString; - break; - case uno::TypeClass_FLOAT: - { - float aFloat = 0; - pvargItem >>= aFloat; - sString = rtl::OUString::valueOf( aFloat ); - break; - } - case uno::TypeClass_DOUBLE: - { - double aDouble = 0; - pvargItem >>= aDouble; - sString = rtl::OUString::valueOf( aDouble ); - break; - } - case uno::TypeClass_SHORT: - case uno::TypeClass_LONG: - case uno::TypeClass_BYTE: - { - sal_Int32 aNum = 0; - pvargItem >>= aNum; - sString = rtl::OUString::valueOf( aNum ); - break; - } - - case uno::TypeClass_HYPER: - { - sal_Int64 aHyper = 0; - pvargItem >>= aHyper; - sString = rtl::OUString::valueOf( aHyper ); - break; - } - default: - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() ); - } - return sString; -} - - -rtl::OUString -ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator) -{ - return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2)); -} - -rtl::OUString -ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix) -{ - sal_Int32 a = _nStartSuffix; - rtl::OUString scompname = _sElementName; - bool bElementexists = true; - sal_Int32 nLen = _slist.getLength(); - if ( nLen == 0 ) - return _sElementName; - - while (bElementexists == true) - { - for (sal_Int32 i = 0; i < nLen; i++) - { - if (FieldInList(_slist, scompname) == -1) - { - return scompname; - } - } - scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ ); - } - return rtl::OUString(); -} - -sal_Int32 -ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString ) -{ - sal_Int32 FieldLen = SearchList.getLength(); - sal_Int32 retvalue = -1; - for (sal_Int32 i = 0; i < FieldLen; i++) - { - // I wonder why comparing lexicographically is done - // when its a match is whats interesting? - //if (SearchList[i].compareTo(SearchString) == 0) - if ( SearchList[i].equals( SearchString ) ) - { - retvalue = i; - break; - } - } - return retvalue; - -} -bool NeedEsc(sal_Unicode cCode) -{ - String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()")); - return (STRING_NOTFOUND != sEsc.Search(cCode)); -} - -rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike ) -{ - rtl::OUStringBuffer sResult; - const sal_Unicode *start = rIn.getStr(); - const sal_Unicode *end = start + rIn.getLength(); - - int seenright = 0; - if ( bForLike ) - sResult.append(static_cast('^')); - - while (start < end) - { - switch (*start) - { - case '?': - sResult.append(static_cast('.')); - start++; - break; - case '*': - sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*"))); - start++; - break; - case '#': - sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]"))); - start++; - break; - case '~': - sResult.append(static_cast('\\')); - sResult.append(*(++start)); - start++; - break; - // dump the ~ and escape the next characture - case ']': - sResult.append(static_cast('\\')); - sResult.append(*start++); - break; - case '[': - sResult.append(*start++); - seenright = 0; - while (start < end && !seenright) - { - switch (*start) - { - case '[': - case '?': - case '*': - sResult.append(static_cast('\\')); - sResult.append(*start); - break; - case ']': - sResult.append(*start); - seenright = 1; - break; - case '!': - sResult.append(static_cast('^')); - break; - default: - if (NeedEsc(*start)) - sResult.append(static_cast('\\')); - sResult.append(*start); - break; - } - start++; - } - break; - default: - if (NeedEsc(*start)) - sResult.append(static_cast('\\')); - sResult.append(*start++); - } - } - - if ( bForLike ) - sResult.append(static_cast('$')); - - return sResult.makeStringAndClear( ); -} - -double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical) -{ - double fConvertFactor = 1.0; - if( bVertical ) - { - fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000; - } - else - { - fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000; - } - return fConvertFactor; -} - -double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical) -{ - double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical ); - return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor; -} -double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical) -{ - double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical ); - return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR; -} - -ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ) -{ - m_pShapeHelper.reset( new ShapeHelper( xShape ) ); -} - -sal_Int32 getPointerStyle( const uno::Reference< frame::XModel >& xModel ) -{ - - sal_Int32 nPointerStyle( POINTER_ARROW ); - try - { - const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); - const uno::Reference< frame::XFrame > xFrame ( xController->getFrame(), uno::UNO_SET_THROW ); - const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); - // why the heck isn't there an XWindowPeer::getPointer, but a setPointer only? - const Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - nPointerStyle = pWindow->GetSystemWindow()->GetPointer().GetStyle(); - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return nPointerStyle; -} - -// #FIXME this method looks wrong, shouldn't it just affect calc *or* writer -// document/frame/window(s) but not both ( and depending on what api called -// this ) -void setCursorHelper( const uno::Reference< frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite ) -{ - ::std::vector< uno::Reference< frame::XController > > aControllers; - - uno::Reference< frame::XModel2 > xModel2( xModel, uno::UNO_QUERY ); - if ( xModel2.is() ) - { - const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW ); - while ( xEnumControllers->hasMoreElements() ) - { - const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW ); - aControllers.push_back( xController ); - } - } - else - { - const uno::Reference< frame::XModel > xModel( xModel2, uno::UNO_QUERY ); - if ( xModel.is() ) - { - const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); - aControllers.push_back( xController ); - } - } - - for ( ::std::vector< uno::Reference< frame::XController > >::const_iterator controller = aControllers.begin(); - controller != aControllers.end(); - ++controller - ) - { - const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW ); - const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); - - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - OSL_ENSURE( pWindow, "ScVbaApplication::setCursor: no window!" ); - if ( !pWindow ) - continue; - - pWindow->GetSystemWindow()->SetPointer( rPointer ); - pWindow->GetSystemWindow()->EnableChildPointerOverwrite( bOverWrite ); - } -} - -#define VBA_LEFT "PositionX" -#define VBA_TOP "PositionY" -UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl ) -{ - mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW ); -} - double UserFormGeometryHelper::getLeft() - { - sal_Int32 nLeft = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft; - return Millimeter::getInPoints( nLeft ); - } - void UserFormGeometryHelper::setLeft( double nLeft ) - { - mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) ); - } - double UserFormGeometryHelper::getTop() - { - sal_Int32 nTop = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop; - return Millimeter::getInPoints( nTop ); - } - void UserFormGeometryHelper::setTop( double nTop ) - { - mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) ); - } - double UserFormGeometryHelper::getHeight() - { - sal_Int32 nHeight = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ) ) >>= nHeight; - return Millimeter::getInPoints( nHeight ); - } - void UserFormGeometryHelper::setHeight( double nHeight ) - { - mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) ); - } - double UserFormGeometryHelper::getWidth() - { - sal_Int32 nWidth = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ) ) >>= nWidth; - return Millimeter::getInPoints( nWidth ); - } - void UserFormGeometryHelper::setWidth( double nWidth) - { - mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) ); - } - - double ConcreteXShapeGeometryAttributes::getLeft() - { - return m_pShapeHelper->getLeft(); - } - void ConcreteXShapeGeometryAttributes::setLeft( double nLeft ) - { - m_pShapeHelper->setLeft( nLeft ); - } - double ConcreteXShapeGeometryAttributes::getTop() - { - return m_pShapeHelper->getTop(); - } - void ConcreteXShapeGeometryAttributes::setTop( double nTop ) - { - m_pShapeHelper->setTop( nTop ); - } - - double ConcreteXShapeGeometryAttributes::getHeight() - { - return m_pShapeHelper->getHeight(); - } - void ConcreteXShapeGeometryAttributes::setHeight( double nHeight ) - { - m_pShapeHelper->setHeight( nHeight ); - } - double ConcreteXShapeGeometryAttributes::getWidth() - { - return m_pShapeHelper->getWidth(); - } - void ConcreteXShapeGeometryAttributes::setWidth( double nWidth) - { - m_pShapeHelper->setWidth( nWidth ); - } - - - ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape ) - { - if( !xShape.is() ) - throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() ); - } - - double ShapeHelper::getHeight() - { - return Millimeter::getInPoints(xShape->getSize().Height); - } - - - void ShapeHelper::setHeight(double _fheight) throw ( css::script::BasicErrorException ) - { - try - { - css::awt::Size aSize = xShape->getSize(); - aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight); - xShape->setSize(aSize); - } - catch ( css::uno::Exception& /*e*/) - { - throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); - } - } - - - double ShapeHelper::getWidth() - { - return Millimeter::getInPoints(xShape->getSize().Width); - } - - void ShapeHelper::setWidth(double _fWidth) throw ( css::script::BasicErrorException ) - { - try - { - css::awt::Size aSize = xShape->getSize(); - aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth); - xShape->setSize(aSize); - } - catch (css::uno::Exception& /*e*/) - { - throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); - } - } - - - double ShapeHelper::getLeft() - { - return Millimeter::getInPoints(xShape->getPosition().X); - } - - - void ShapeHelper::setLeft(double _fLeft) - { - css::awt::Point aPoint = xShape->getPosition(); - aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft); - xShape->setPosition(aPoint); - } - - - double ShapeHelper::getTop() - { - return Millimeter::getInPoints(xShape->getPosition().Y); - } - - - void ShapeHelper::setTop(double _fTop) - { - css::awt::Point aPoint = xShape->getPosition(); - aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop); - xShape->setPosition(aPoint); - } - - void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException ) - { - // #TODO #FIXME ( do we want to support additionalArg here ) - throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() ); - } - - void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ) - { - exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument ); - } - void DebugHelper::exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException ) - { - exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() ); - } - - Millimeter::Millimeter():m_nMillimeter(0) {} - - Millimeter::Millimeter(double mm):m_nMillimeter(mm) {} - - void Millimeter::set(double mm) { m_nMillimeter = mm; } - void Millimeter::setInPoints(double points) - { - m_nMillimeter = points * 0.352777778; - // 25.4mm / 72 - } - - void Millimeter::setInHundredthsOfOneMillimeter(double hmm) - { - m_nMillimeter = hmm / 100; - } - - double Millimeter::get() - { - return m_nMillimeter; - } - double Millimeter::getInHundredthsOfOneMillimeter() - { - return m_nMillimeter * 100; - } - double Millimeter::getInPoints() - { - return m_nMillimeter * 2.834645669; // 72 / 25.4mm - } - - sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points) - { - sal_Int32 mm = static_cast(points * factor); - return mm; - } - - double Millimeter::getInPoints(int _hmm) - { - double points = double( static_cast(_hmm) / factor); - return points; - } - - SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) - { - SfxObjectShell* pFoundShell = NULL; - if ( xModel.is() ) - { - uno::Reference< lang::XUnoTunnel > xObjShellTunnel( xModel, uno::UNO_QUERY_THROW ); - pFoundShell = reinterpret_cast( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId())); - } - if ( !pFoundShell ) - throw uno::RuntimeException(); - return pFoundShell; - } - -} // openoffice -} //org From 5a96967ccd0568fdc2731b182a81f617dc7799da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Wed, 23 Sep 2009 08:48:48 +0000 Subject: [PATCH 015/117] #b6875455# added Forms/ControlLayout/UseDocumentTextMetrics, controlling whether form controls should use the document's reference device for text rendering --- .../data/org/openoffice/Office/Common.xcu | 11 + .../schema/org/openoffice/Office/Common.xcs | 12704 ++++++++-------- 2 files changed, 6372 insertions(+), 6343 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 6e25dedba37e..fade7dd29aeb 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -513,6 +513,9 @@ true + + true + @@ -521,6 +524,14 @@ true + + true + + + + + true + diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index e6218530561c..b3f07f77f108 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -30,1063 +30,1080 @@ ************************************************************************ --> - - Contains common settings which are potentially shared by other components. - - - - - MAV - Contains a container for passwords. - - - - Contains a password encoded with the master password. - - - - - - AS - Contains settings for a history entry in the history list. - - - - Specifies the document URL. - - - - - Specifies the filter name that was chosen to load the document. - - - - - Indicates the title of the URL that is displayed on the user-interface. - - - - - Contains an encoded password used to open the document. - - - - - - AS - Describes a menu entry for configurable office menus (e.g. file new). - - - - Specifies the URL for dispatch. - - - - - Specifies the label of a menu entry. - - - - - Specifies the identifier of an assigned icon. - - - - - Specifies the dispatch target (for example, _blank to open URL in new frame). - - - - - - PB - Contains the width and height of the dialog size. - - - - Contains the height of the dialog [UNIT=pixel]. - - - - - Contains the width of the dialog [UNIT=pixel]. - - - - - - OJ - Describes the characteristics of a font. - - - - Specifies the exact name of the font ("Arial","Courier", "Frutiger"). - - - - - Specifies the height of the font in the measure of the destination. - - - - - Specifies the width of the font in the measure of the destination. - - - - - Specifies the style name of the font ("Bold", "Italic", "Italic Bold"). - - - - - Specifies the general style of the font. - - - - - DONTKNOW - - - - - DECORATIVE - - - - - MODERN - - - - - ROMAN - - - - - SCRIPT - - - - - SWISS - - - - - SYSTEM - - - - - DONTKNOW - - - - - - - Specifies the character set which is supported by the font. - - - - - DONTKNOW - - - - - ANSI - - - - - MAC - - - - - IBMPC_437 - - - - - IBMPC_850 - - - - - IBMPC_860 - - - - - IBMPC_861 - - - - - IBMPC_863 - - - - - IBMPC_865 - - - - - SYSTEM - - - - - SYMBOL - - - - - - - Specifies the pitch of the font. - - - - - DONTKNOW - - - - - FIXED - - - - - VARIABLE - - - - - - - Specifies the character width. Depending on the specified width, a font that supports this width may be selected. [UNIT=%]. - - - - - Specifies the thickness of the line. - - - - - Specifies if there is a character slant (italic). - - - - - NONE - - - - - OBLIQUE - - - - - ITALIC - - - - - DONTKNOW - - - - - REVERSE_OBLIQUE - - - - - REVERSE_ITALIC - - - - - - - Specifies the type of underline. - - - - - NONE - - - - - SINGLE - - - - - DOUBLE - - - - - DOTTED - - - - - DONTKNOW - - - - - DASH - - - - - LONGDASH - - - - - DASHDOT - - - - - DASHDOTDOT - - - - - SMALLWAVE - - - - - WAVE - - - - - DOUBLEWAVE - - - - - BOLD - - - - - BOLDDOTTED - - - - - BOLDDASH - - - - - BOLDLONGDASH - - - - - BOLDDASHDOT - - - - - BOLDDASHDOTDOT - - - - - BOLDWAVE - - - - - - - Specifies the type of strikeout. - - - - - NONE - - - - - SINGLE - - - - - DOUBLE - - - - - DONTKNOW - - - - - BOLD - - - - - SLASH - - - - - X - - - - - - - Specifies the rotation of the font. [UNIT=degree]. - - - - - Specifies if a kerning table is available (for requesting). For selecting, specifies if the kerning table is to be used. - - - - - Specifies if only words get underlined. - - - - - Specifies the technology of the font representation. - - - - - DONTKNOW - - - - - RASTER - - - - - DEVICE - - - - - SCALABLE - - - - - - - - OS - Contains settings for the font replacement. - - - - Contains the name of font that is to be replaced. - - - - - Contains the name of the replacing font. - - - - - Determines if the font pair replacement is applied on the screen. - - false - - - - Determines if the font pair replacement is applied on the printer. - - false - - - - - Use LogicalGraphicSize instead of this. - SJ - Specifies the size of a graphic. [UNIT=1/100 mm]. - - - - Specifies the width of graphic. [UNIT=1/100 mm]. - - - - - Represents the highest value that can be entered in the dialog. - - - - - Represents the lowest value that can be entered in the dialog. - - - - 10000 - - - - Specifies the height of graphic. [UNIT=1/100 mm]. - - - - - Represents the lowest value that can be entered in the dialog. - - - - - Represents the highest value that can be entered in the dialog. - - - - 10000 - - - - - SJ - Specifies the logical size of a graphic. [UNIT=1/100 mm]. - - - - Specifies the logical width of a graphic. [UNIT=1/100 mm]. - - - - - Represents the lowest value that can be entered in the dialog. - - - - - Represents the highest value that can be entered in the dialog. - - - - 10000 - - - - Specifies the logical height of graphic. [UNIT=1/100 mm]. - - - - - Represents the lowest value that can be entered in the dialog. - - - - - Represents the highest value that can be entered in the dialog. - - - - 10000 - - - - - Replaced by org.openoffice.Office.Embedding/ObjectName. - MAV - Deprecated - - - - - MAV - Deprecated - - - - - - MAV - Deprecated - - - - - - AS - Specifies an entry of the recovery list which is then used by CrashGuard to save information about the last opened files. - - - - Specifies an URL that should be recovered after the next Office start. - - - - - Specifies a filter that should be used to open the document referenced by the URL property. - - - - - Contains the name of the temporary file which represents the document. - - - - - - OS - Contains the characters (so called forbidden characters) that are not allowed at the beginning or end of a line. - - - - Contains the characters that are not allowed at the beginning of a line. - - - - - Contains the characters that are not allowed at the end of a line. - - - - - - MBA - Stores an association between a numeric value and a name. - - - - Specifies a name that is associated with a counter. - - - - - Specifies a number that is associated with a name. - - - - - - Without replacement. - OBR - Contains the command line profile for external mail applications. - - - - Contains the different string tokens for "to" and "cc" etc. Addresses will be concatenated to create the command line. - - - - Contains the fixed text (optional) preceding the mail arguments. - - - - - Contains the string token describing the "from" address field. - - - - - Contains the string token describing the "to" address field. - - - - - Contains the string token describing the "cc" address field. - - - - - Contains the string token describing the "bcc" address field. - - - - - Contains the string token describing the subject. - - - - - Contains the string token describing the attachments of the message. - - - - - Contains the string token describing the body of the message. - - - - - - Contains the delimiters used to separate values for various command line parameters of the external mailer. - - - - Contains the delimiter used between the external mailer name and the "to" field. - - - - - Contains the delimiters between different cc addressees. - - - - - Contains the delimiters between different bcc addressees. - - - - - Contains the delimiters between different attachments. - - - - - - - Use cfg package Jobs instead of this. - AS - Use cfg package Jobs instead of this. - - - - Use cfg package Jobs instead of this. - - - - - Use cfg package Jobs instead of this. - - - - - Use cfg package Jobs instead of this. - - - - - Use cfg package Jobs instead of this. - - - - - - GT - All Certificate informations needed to handle and identify the signature. - - - - Subject name of Certificate. - - - - - Serial Number of Certificate. - - - - - Raw of Certificate. - - - - - - FS - specifies, on a per-application-type basis, certain defaults for layouting form controls - - - - specifies the default visual effect for form controls - - - - - specifies no special visual effect - - - - - specifies a flat appearance - - - - - specifies a 3D appearance - - - - - - - specifies whether the controls should use dynamic border coloring, if possible. -Dymamic border coloring means that when the mouse is hovered over a control, and when a control receives the focus, this is indicated with special border colors. - - false - - - - - Stores registration data which is related to a specific product version. - - - - An instance UUID associated with the product version ID. - - - - - - - - - MAV - Contains internal MSExport settings that are common for all apps. - - - - Specifies if an old ( 5.0 format )way instead of a new one ( 6.0 OLE embedded document ) should be used for export of inplace objects in case MS-filters are not used for them. - - false - - - - - MAV - Contains a description of the persistent password container. - - - - Specifies if passwords can be stored persistently. - - false - - - - Specifies if there is a valid master password. - - false - - - - Contains the master password encrypted by itself. - - - - - - Contains a list of passwords encoded with the master password. - - - - - - AW - Specifies settings for the 3D engine. - - - - - - - AW - Specifies if dithering is used to display more colors with few colors available. - - - true - - - - - - - AW - Specifies if 3D graphics from Draw and Impress will be displayed on the user's system using an OpenGL capable hardware. If the system does not have an OpenGL capable hardware, this setting will be ignored. The 3D display is always done per software. - - - false - - - - - - - AW - Specifies whether all geometry data will be simultaneously transferred in an array to the graphic driver. Not every graphic driver correctly supports this OpenGL capability. For this reason, this option can be deactivated in case of presentation errors of 3D output. All geometry data will be then transferred as single components. This option is only available if OpenGL is used, otherwise it is disabled. - - - true - - - - - - - AW - Specifies interaction with full display. If a 3-D object is rotated or moved, the full display is rotated or moved and not a grid frame. - - - false - - - - - AW - Specifies settings for the Drawinglayer. - - - - AW - Specifies if the Overlay pane is allowed to use an own buffer. If on, Overlay is fast but a buffer (graphics memory) is used. If off, Overlay is slow, but no Buffer is needed. This is the global switch which will enable/disable overlay for all Applications. This is the global switch for the whole office. - - - true - - - - AW - Similar to OverlayBuffer, but only for Calc Application - - - true - - - - AW - Similar to OverlayBuffer, but only for Writer Application - - - true - - - - AW - Similar to OverlayBuffer, but only for Draw/Impress Applications - - - true - - - - AW - Specifies if the Application Repaint shall use a buffer for Pre-Rendering. If on, screen flicker is greatly reduced and remote display is fast, but a buffer (graphics memory) is needed. If off, screen flicker will occurr and remote display is slow, but no buffer is needed. This is the global switch for the whole office. - - - true - - - - AW - Similar to PaintBuffer, but only for Calc Application. PaintBuffer is the global switch. - - - true - - - - AW - Similar to PaintBuffer, but only for Writer Application. PaintBuffer is the global switch. - - - true - - - - AW - Similar to PaintBuffer, but only for Draw/Impress Applications. PaintBuffer is the global switch. - - - true - - - - AW - Specifies the first one of two colors used from overlay to display striped lines as helplines. Default is black. - - - 0 - - - - AW - Specifies the second one of two colors used from overlay to display striped lines as helplines. Default is white. - - - 16777215 - - - - AW - Specifies the length in pixels of a single stripe used from overlay to display striped lines as helplines. Default is four. - - - 4 - - - - AW - Specifies the maximum allowed Paper Width for page definitions in cm. Default is 3m, i.e. 300 cm. When this is changed to higher values, it is done on own risk. - - - 300 - - - - AW - Specifies the maximum allowed Paper Height for page definitions in cm. Default is 3m, i.e. 300 cm. When this is changed to higher values, it is done on own risk. - - - 300 - - - - AW - Specifies the maximum allowed Left Margin for the page definitions in 1/100th cm. - - - 9999 - - - - AW - Specifies the maximum allowed Right Margin for the page definitions in 1/100th cm. - - - 9999 - - - - AW - Specifies the maximum allowed Top Margin for the page definitions in 1/100th cm. - - - 9999 - + + Contains common settings which are potentially shared by other components. + + + + + MAV + Contains a container for passwords. + + + + Contains a password encoded with the master password. + + + + + + AS + Contains settings for a history entry in the history list. + + + + Specifies the document URL. + + + + + Specifies the filter name that was chosen to load the document. + + + + + Indicates the title of the URL that is displayed on the user-interface. + + + + + Contains an encoded password used to open the document. + + + + + + AS + Describes a menu entry for configurable office menus (e.g. file new). + + + + Specifies the URL for dispatch. + + + + + Specifies the label of a menu entry. + + + + + Specifies the identifier of an assigned icon. + + + + + Specifies the dispatch target (for example, _blank to open URL in new frame). + + + + + + PB + Contains the width and height of the dialog size. + + + + Contains the height of the dialog [UNIT=pixel]. + + + + + Contains the width of the dialog [UNIT=pixel]. + + + + + + OJ + Describes the characteristics of a font. + + + + Specifies the exact name of the font ("Arial","Courier", "Frutiger"). + + + + + Specifies the height of the font in the measure of the destination. + + + + + Specifies the width of the font in the measure of the destination. + + + + + Specifies the style name of the font ("Bold", "Italic", "Italic Bold"). + + + + + Specifies the general style of the font. + + + + + DONTKNOW + + + + + DECORATIVE + + + + + MODERN + + + + + ROMAN + + + + + SCRIPT + + + + + SWISS + + + + + SYSTEM + + + + + DONTKNOW + + + + + + + Specifies the character set which is supported by the font. + + + + + DONTKNOW + + + + + ANSI + + + + + MAC + + + + + IBMPC_437 + + + + + IBMPC_850 + + + + + IBMPC_860 + + + + + IBMPC_861 + + + + + IBMPC_863 + + + + + IBMPC_865 + + + + + SYSTEM + + + + + SYMBOL + + + + + + + Specifies the pitch of the font. + + + + + DONTKNOW + + + + + FIXED + + + + + VARIABLE + + + + + + + Specifies the character width. Depending on the specified width, a font that supports this width may be selected. [UNIT=%]. + + + + + Specifies the thickness of the line. + + + + + Specifies if there is a character slant (italic). + + + + + NONE + + + + + OBLIQUE + + + + + ITALIC + + + + + DONTKNOW + + + + + REVERSE_OBLIQUE + + + + + REVERSE_ITALIC + + + + + + + Specifies the type of underline. + + + + + NONE + + + + + SINGLE + + + + + DOUBLE + + + + + DOTTED + + + + + DONTKNOW + + + + + DASH + + + + + LONGDASH + + + + + DASHDOT + + + + + DASHDOTDOT + + + + + SMALLWAVE + + + + + WAVE + + + + + DOUBLEWAVE + + + + + BOLD + + + + + BOLDDOTTED + + + + + BOLDDASH + + + + + BOLDLONGDASH + + + + + BOLDDASHDOT + + + + + BOLDDASHDOTDOT + + + + + BOLDWAVE + + + + + + + Specifies the type of strikeout. + + + + + NONE + + + + + SINGLE + + + + + DOUBLE + + + + + DONTKNOW + + + + + BOLD + + + + + SLASH + + + + + X + + + + + + + Specifies the rotation of the font. [UNIT=degree]. + + + + + Specifies if a kerning table is available (for requesting). For selecting, specifies if the kerning table is to be used. + + + + + Specifies if only words get underlined. + + + + + Specifies the technology of the font representation. + + + + + DONTKNOW + + + + + RASTER + + + + + DEVICE + + + + + SCALABLE + + + + + + + + OS + Contains settings for the font replacement. + + + + Contains the name of font that is to be replaced. + + + + + Contains the name of the replacing font. + + + + + Determines if the font pair replacement is applied on the screen. + + false + + + + Determines if the font pair replacement is applied on the printer. + + false + + + + + Use LogicalGraphicSize instead of this. + SJ + Specifies the size of a graphic. [UNIT=1/100 mm]. + + + + Specifies the width of graphic. [UNIT=1/100 mm]. + + + + + Represents the highest value that can be entered in the dialog. + + + + + Represents the lowest value that can be entered in the dialog. + + + + 10000 + + + + Specifies the height of graphic. [UNIT=1/100 mm]. + + + + + Represents the lowest value that can be entered in the dialog. + + + + + Represents the highest value that can be entered in the dialog. + + + + 10000 + + + + + SJ + Specifies the logical size of a graphic. [UNIT=1/100 mm]. + + + + Specifies the logical width of a graphic. [UNIT=1/100 mm]. + + + + + Represents the lowest value that can be entered in the dialog. + + + + + Represents the highest value that can be entered in the dialog. + + + + 10000 + + + + Specifies the logical height of graphic. [UNIT=1/100 mm]. + + + + + Represents the lowest value that can be entered in the dialog. + + + + + Represents the highest value that can be entered in the dialog. + + + + 10000 + + + + + Replaced by org.openoffice.Office.Embedding/ObjectName. + MAV + Deprecated + + + + + MAV + Deprecated + + + + + + MAV + Deprecated + + + + + + AS + Specifies an entry of the recovery list which is then used by CrashGuard to save information about the last opened files. + + + + Specifies an URL that should be recovered after the next Office start. + + + + + Specifies a filter that should be used to open the document referenced by the URL property. + + + + + Contains the name of the temporary file which represents the document. + + + + + + OS + Contains the characters (so called forbidden characters) that are not allowed at the beginning or end of a line. + + + + Contains the characters that are not allowed at the beginning of a line. + + + + + Contains the characters that are not allowed at the end of a line. + + + + + + MBA + Stores an association between a numeric value and a name. + + + + Specifies a name that is associated with a counter. + + + + + Specifies a number that is associated with a name. + + + + + + Without replacement. + OBR + Contains the command line profile for external mail applications. + + + + Contains the different string tokens for "to" and "cc" etc. Addresses will be concatenated to create the command line. + + + + Contains the fixed text (optional) preceding the mail arguments. + + + + + Contains the string token describing the "from" address field. + + + + + Contains the string token describing the "to" address field. + + + + + Contains the string token describing the "cc" address field. + + + + + Contains the string token describing the "bcc" address field. + + + + + Contains the string token describing the subject. + + + + + Contains the string token describing the attachments of the message. + + + + + Contains the string token describing the body of the message. + + + + + + Contains the delimiters used to separate values for various command line parameters of the external mailer. + + + + Contains the delimiter used between the external mailer name and the "to" field. + + + + + Contains the delimiters between different cc addressees. + + + + + Contains the delimiters between different bcc addressees. + + + + + Contains the delimiters between different attachments. + + + + + + + Use cfg package Jobs instead of this. + AS + Use cfg package Jobs instead of this. + + + + Use cfg package Jobs instead of this. + + + + + Use cfg package Jobs instead of this. + + + + + Use cfg package Jobs instead of this. + + + + + Use cfg package Jobs instead of this. + + + + + + GT + All Certificate informations needed to handle and identify the signature. + + + + Subject name of Certificate. + + + + + Serial Number of Certificate. + + + + + Raw of Certificate. + + + + + + FS + specifies, on a per-application-type basis, certain defaults for layouting form controls + + + + specifies the default visual effect for form controls + + + + + specifies no special visual effect + + + + + specifies a flat appearance + + + + + specifies a 3D appearance + + + + + + + + specifies whether the controls should use dynamic border coloring, if possible. + Dymamic border coloring means that when the mouse is hovered over a control, and when a control receives the focus, this is indicated with special border colors. + + + false + + + + + controls whether form controls, when they render their text, use the same metrics as the document + does. If this is set to <true>, then the control text's appearance better matches the text + in the surrounding document.</p> + <p>Technically, documents use a reference device for formatting, which usually has a higher + resolution than the actual output device. The option decides whether form controls should use + the same reference device as the surrounding document. However, some of OOo's document implementations + do not properly use their reference device in all situations, in which case the option might better + be disabled.<p> + + + false + + + + + Stores registration data which is related to a specific product version. + + + + An instance UUID associated with the product version ID. + + + + + + + + + MAV + Contains internal MSExport settings that are common for all apps. + + + + Specifies if an old ( 5.0 format )way instead of a new one ( 6.0 OLE embedded document ) should be used for export of inplace objects in case MS-filters are not used for them. + + false + + + + + MAV + Contains a description of the persistent password container. + + + + Specifies if passwords can be stored persistently. + + false + + + + Specifies if there is a valid master password. + + false + + + + Contains the master password encrypted by itself. + + + + + + Contains a list of passwords encoded with the master password. + + + + + + AW + Specifies settings for the 3D engine. + + + + + + + AW + Specifies if dithering is used to display more colors with few colors available. + + + true + + + + + + + AW + Specifies if 3D graphics from Draw and Impress will be displayed on the user's system using an OpenGL capable hardware. If the system does not have an OpenGL capable hardware, this setting will be ignored. The 3D display is always done per software. + + + false + + + + + + + AW + Specifies whether all geometry data will be simultaneously transferred in an array to the graphic driver. Not every graphic driver correctly supports this OpenGL capability. For this reason, this option can be deactivated in case of presentation errors of 3D output. All geometry data will be then transferred as single components. This option is only available if OpenGL is used, otherwise it is disabled. + + + true + + + + + + + AW + Specifies interaction with full display. If a 3-D object is rotated or moved, the full display is rotated or moved and not a grid frame. + + + false + + + + + AW + Specifies settings for the Drawinglayer. + + + + AW + Specifies if the Overlay pane is allowed to use an own buffer. If on, Overlay is fast but a buffer (graphics memory) is used. If off, Overlay is slow, but no Buffer is needed. This is the global switch which will enable/disable overlay for all Applications. This is the global switch for the whole office. + + + true + + + + AW + Similar to OverlayBuffer, but only for Calc Application + + + true + + + + AW + Similar to OverlayBuffer, but only for Writer Application + + + true + + + + AW + Similar to OverlayBuffer, but only for Draw/Impress Applications + + + true + + + + AW + Specifies if the Application Repaint shall use a buffer for Pre-Rendering. If on, screen flicker is greatly reduced and remote display is fast, but a buffer (graphics memory) is needed. If off, screen flicker will occurr and remote display is slow, but no buffer is needed. This is the global switch for the whole office. + + + true + + + + AW + Similar to PaintBuffer, but only for Calc Application. PaintBuffer is the global switch. + + + true + + + + AW + Similar to PaintBuffer, but only for Writer Application. PaintBuffer is the global switch. + + + true + + + + AW + Similar to PaintBuffer, but only for Draw/Impress Applications. PaintBuffer is the global switch. + + + true + + + + AW + Specifies the first one of two colors used from overlay to display striped lines as helplines. Default is black. + + + 0 + + + + AW + Specifies the second one of two colors used from overlay to display striped lines as helplines. Default is white. + + + 16777215 + + + + AW + Specifies the length in pixels of a single stripe used from overlay to display striped lines as helplines. Default is four. + + + 4 + + + + AW + Specifies the maximum allowed Paper Width for page definitions in cm. Default is 3m, i.e. 300 cm. When this is changed to higher values, it is done on own risk. + + + 300 + + + + AW + Specifies the maximum allowed Paper Height for page definitions in cm. Default is 3m, i.e. 300 cm. When this is changed to higher values, it is done on own risk. + + + 300 + + + + AW + Specifies the maximum allowed Left Margin for the page definitions in 1/100th cm. + + + 9999 + + + + AW + Specifies the maximum allowed Right Margin for the page definitions in 1/100th cm. + + + 9999 + + + + AW + Specifies the maximum allowed Top Margin for the page definitions in 1/100th cm. + + + 9999 + AW @@ -1152,8 +1169,8 @@ Dymamic border coloring means that when the mouse is hovered over a control, and This switch decides if Interactions in the DrawingLayer are visualized using Wireframe or Full-Object previews. If false, only Wireframe will be used. If true, Full-Object preview which gives a much better - feedback about the object interaction will be used. This mode is used for modification and creation of - objects. During interaction, a geometric copy of the object(s) is shown with 50% transparence in the + feedback about the object interaction will be used. This mode is used for modification and creation of + objects. During interaction, a geometric copy of the object(s) is shown with 50% transparence in the foreground. That copy shows exactly what You will get when You end the interaction. @@ -1175,10 +1192,11 @@ Dymamic border coloring means that when the mouse is hovered over a control, and AW - This defines a Limitation for the default raster conversion of FormControls in edit mode. - These have the ability to be displayed using this fallback to Bitmaps. - The number is the maximum number of pixels to use, e.g. 300x150 Pixels is allowed as default. - When FormControls would need more Pixels than this, the Bitmap will be limited and scaled to the needed pixel size at paint time. + + This defines a Limitation for the default raster conversion of FormControls in edit mode. + These have the ability to be displayed using this fallback to Bitmaps. + The number is the maximum number of pixels to use, e.g. 300x150 Pixels is allowed as default. + When FormControls would need more Pixels than this, the Bitmap will be limited and scaled to the needed pixel size at paint time. @@ -1188,8 +1206,8 @@ Dymamic border coloring means that when the mouse is hovered over a control, and AW - This switch defines if the selections in the applications (text or cells) are visualized using - inverse (XOR) when set to false (the old selection method, also used when in HighContrast mode) + This switch defines if the selections in the applications (text or cells) are visualized using + inverse (XOR) when set to false (the old selection method, also used when in HighContrast mode) or a transparent overlay selection using the system's selection color. @@ -1221,276 +1239,276 @@ Dymamic border coloring means that when the mouse is hovered over a control, and 70 - - - OS - Contains miscellaneous settings for the auto correction. - - - - - - - OS - Specifies if the replacement table should be used to replace letter combinations with defined text - - - true - - - - - - - OS - Specifies if two initial capitals should be corrected automatically. - - - true - - - - - - - OS - Specifies if the letter at the beginning of a sentence should be capitalized automatically. - - - true - - - - - - - OS - Specifies if text should be formatted in bold or underlined when the corresponding characters are entered (*bold*, _underline_). - - - true - - - - - - - OS - Specifies if character strings which could represent an URL should be converted to a hyperlink. - - - true - - - - - - - OS - Specifies if ordinal numbers should be displayed with raised endings. - - - true - - - - - - - OS - Specifies if character combinations for fractions should be replaced with a corresponding single character. - - - true - - - - - - - OS - Specifies if minus signs should be replaced by dashes automatically. - - - true - - - - - - - OS - Specifies if multiple spaces should be combined into one. - - - false - - - - - - - OS - Specifies if single quotes should be replaced. - - - false - - - - - - - OS - Specifies the start single quote. - - - - - - - - - OS - Specifies the end single quote. - - - - - - - - - OS - Specifies if double quotes should be replaced. - - - true - - - - - - - OS - Specifies the start quote. - - - - - - - - - OS - Specifies the end quote. - - - - - - Contains settings to apply replacement rules and exceptions. - - - - - - - OS - Specifies if defined words with two initial capital letters should not be included in the AutoCorrect replacement. - - - true - - - - - - - OS - Specifies if defined abbreviations should be taken into account to exclude a preceding capital letter. - - - true - - - - - - AF - Specifies cache related options. - - - - AF - Specifies the cache related options for the drawing engine. - - - - - - - AF - Determines the maximum number of OLE objects that can be held in RAM for drawings, presentations and inserted drawing objects. The fewer OLE objects contained in RAM, the more space is available for other functions. The more OLE objects in RAM, the faster you can page through the objects since they do not always need to be loaded from the hard drive. - - 20 - - - - - AF - Specifies the cache related options for Writer. - - - - - - - AF - Determines the maximum number of OLE objects that can be held in RAM for the writer. The fewer OLE objects contained in RAM, the more space is available for other functions. The more OLE objects in RAM, the faster you can page through the objects since they do not always need to be loaded from the hard drive. - - 20 - - - - - Specifies a group of graphic manager cache options. - - - - - AF - Specifies the maximum cache size for all graphical display objects. - - - 22000000 - - - - AF - Specifies the maximum cache size for a single graphic display object. - - - 5500000 - - - - AF - Specifies the time in seconds after which a cached object is freed from the cache. - - - 600 - - - - - - - - - MBA - Contains the current and default path settings used by the Office. - + + + OS + Contains miscellaneous settings for the auto correction. + + + + + + + OS + Specifies if the replacement table should be used to replace letter combinations with defined text + + + true + + + + + + + OS + Specifies if two initial capitals should be corrected automatically. + + + true + + + + + + + OS + Specifies if the letter at the beginning of a sentence should be capitalized automatically. + + + true + + + + + + + OS + Specifies if text should be formatted in bold or underlined when the corresponding characters are entered (*bold*, _underline_). + + + true + + + + + + + OS + Specifies if character strings which could represent an URL should be converted to a hyperlink. + + + true + + + + + + + OS + Specifies if ordinal numbers should be displayed with raised endings. + + + true + + + + + + + OS + Specifies if character combinations for fractions should be replaced with a corresponding single character. + + + true + + + + + + + OS + Specifies if minus signs should be replaced by dashes automatically. + + + true + + + + + + + OS + Specifies if multiple spaces should be combined into one. + + + false + + + + + + + OS + Specifies if single quotes should be replaced. + + + false + + + + + + + OS + Specifies the start single quote. + + + + + + + + + OS + Specifies the end single quote. + + + + + + + + + OS + Specifies if double quotes should be replaced. + + + true + + + + + + + OS + Specifies the start quote. + + + + + + + + + OS + Specifies the end quote. + + + + + + Contains settings to apply replacement rules and exceptions. + + + + + + + OS + Specifies if defined words with two initial capital letters should not be included in the AutoCorrect replacement. + + + true + + + + + + + OS + Specifies if defined abbreviations should be taken into account to exclude a preceding capital letter. + + + true + + + + + + AF + Specifies cache related options. + + + + AF + Specifies the cache related options for the drawing engine. + + + + + + + AF + Determines the maximum number of OLE objects that can be held in RAM for drawings, presentations and inserted drawing objects. The fewer OLE objects contained in RAM, the more space is available for other functions. The more OLE objects in RAM, the faster you can page through the objects since they do not always need to be loaded from the hard drive. + + 20 + + + + + AF + Specifies the cache related options for Writer. + + + + + + + AF + Determines the maximum number of OLE objects that can be held in RAM for the writer. The fewer OLE objects contained in RAM, the more space is available for other functions. The more OLE objects in RAM, the faster you can page through the objects since they do not always need to be loaded from the hard drive. + + 20 + + + + + Specifies a group of graphic manager cache options. + + + + + AF + Specifies the maximum cache size for all graphical display objects. + + + 22000000 + + + + AF + Specifies the maximum cache size for a single graphic display object. + + + 5500000 + + + + AF + Specifies the time in seconds after which a cached object is freed from the cache. + + + 600 + + + + + + + + + MBA + Contains the current and default path settings used by the Office. + CD @@ -1503,5015 +1521,5015 @@ Dymamic border coloring means that when the mouse is hovered over a control, and true - - - MBA - Contains the global path settings, mainly those of the Options dialog. - - - - - - MBA - Contains the Office installation path. - - - - - - - - - MBA - Contains the Office installation path in URL notation. Must match the UCB configuration. - - - - - - - NN - Specifies the directory that contains spreadsheet add-ins which use the old add-in API. - - $(progpath)/addin - - - - OS - Specifies the settings of the AutoCorrect dialog. - - $(insturl)/share/autocorr:$(userurl)/autocorr - - - - OS - Contains the directory which contains the AutoText modules. - - $(insturl)/share/autotext/$(vlang):$(userurl)/autotext - - - - MBA - Stores the automatic backup copies of documents. - - $(userurl)/backup - - - - MBA - Contains the Basic files, which are used by the AutoPilots. - - $(insturl)/share/basic:$(userurl)/basic - - - - MBA - Contains the bitmap files which can be used for menu and toolbar icons. - - $(insturl)/share/config/symbol - - - - MBA - Contains the configuration files. This value cannot be changed through the user interface. - - $(insturl)/share/config - - - - TL - Contains the provided dictionaries. - - $(insturl)/share/wordbook/$(vlang) - - - - PB - Specifies the path to save folder bookmarks. - - $(userurl)/config/folders - - - - MBA - Specifies the directory where all the filters are stored. - - $(progpath)/filter - - - - AF - Specifies the directory which contains the Gallery database and multimedia files. - - $(insturl)/share/gallery:$(userurl)/gallery - - - - DL - Specifies the directory that is displayed when the dialog for opening a graphic or for saving a new graphic is called. - - $(userurl)/gallery - - - - ABI - Specifies the path to the Office help files. - - $(instpath)/help - - - - TL - Contains the files that are necessary for the spellcheck. - - $(insturl)/share/dict - - - - MBA - Contains the Office modules. - - $(progpath) - - - - DL - Specifies the path to the palette files *.SOB to *.SOF containing user-defined colors and patterns. - - $(userurl)/config - - - - MBA - Specifies the directory in which the plugins are saved. - - $(progpath)/plugin - - - - Without replacement. - ABI - Specifies the location where misc data are stored. - - $(userpath)/store - - - - MBA - Specifies the base directory used by the Office to store temp files. - - $(temp) - - - - MBA - Specifies the templates originate from these folders and sub-folders. - - $(insturl)/share/template/$(vlang):$(userurl)/template - - - - MBA - Specifies additional folders containing a global user interface configuration. The final user interface configuration is merged from UserConfig and from these folders. - - $(insturl)/share/config - - - - MBA - Specifies the folder with the user settings. - - $(userurl)/config - - - - TL - Contains the custom dictionaries. - - $(userurl)/wordbook - - - - MBA - Specifies the path of the work folder, which can be modified according to the user's needs. The path specified here can be seen in the Open or Save dialog. - - $(work) - - - - - MBA - Contains the default values of all the paths, which can be modified according to the user's needs. They are used when pressing the Standard-button in the Options dialog. - - - - Specifies the default directory that contains spreadsheet add-ins which use the old add-in API. - - $(progpath)/addin - - - - Specifies the default directory for the settings of the AutoCorrect dialog. - - $(insturl)/share/autocorr:$(userurl)/autocorr - - - - Specifies the default directory where the AutoText modules are located. - - $(insturl)/share/autotext/$(vlang):$(userurl)/autotext - - - - Specifies the default directory for the automatic backup copies of documents. - - $(userurl)/backup - - - - Specifies the default directory where the Basic files, used by the AutoPilots, are located. - - $(insturl)/share/basic:$(userurl)/basic - - - - Specifies the default directory where the bitmap files, which can be used for the menu and toolbar icons, are located. - - $(insturl)/share/config/symbol - - - - Specifies the default directory where the configuration files are stored. - - $(insturl)/share/config - - - - Specifies the default directory where the provided dictionaries are located. - - $(insturl)/share/wordbook/$(vlang) - - - - Specifies the default directory where folder bookmarks are stored. - - $(userurl)/config/folders - - - - Specifies the default directory where all the filters are stored. - - $(progpath)/filter - - - - Specifies the default directory where the Gallery database and multimedia files are located. - - $(insturl)/share/gallery:$(userurl)/gallery - - - - Specifies the default directory used by the dialog for opening a graphic or for saving a new graphic. - - $(userurl)/gallery - - - - Specifies the default directory where Office help files are located. - - $(instpath)/help - - - - Specifies the default directory where the files that are necessary for the spellcheck are saved. - - $(insturl)/share/dict - - - - Specifies the default directory which contains the Office modules. - - $(progpath) - - - - Specifies the default directory for the palette files *.SOB to *.SOF containing user-defined colors and patterns. - - $(userurl)/config - - - - Specifies the default directory where the Office plugins are located. - - $(progpath)/plugin - - - - Specifies the default directory that is used as a base directory for all temporary Office files. - - $(temp) - - - - Specifies the default directory where all provided templates are located in folders and sub-folders. - - $(insturl)/share/template/$(vlang):$(userurl)/template - - - - Specifies the default directories for the global user interface configuration. The final user interface configuration is merged from UserConfig and from these folders. - - - - - - Specifies the default directory which stores the user settings. - - $(userurl)/config - - - - Specifies the default directory which stores the custom dictionaries. - - $(userurl)/wordbook - - - - Specifies the default working directory where user stores documents. - - $(work) - - - - - - OS - Contains some common settings for fonts. - - - - OS - Contains settings for the font substitution. - - - - - - - OS - Determines if the list of font replacements is applied or not - - - false - - - - - - - OS - Specifies a substitution of the requested font, even if this font is available on the user's system. - - - - - - PB - Contains the settings for the font selection box in the object bar. - - - - - - - PB - Contains the last five fonts, which are shown on the top of a list, beginning with the last one. This list will be displayed on the font-name-box of the object bar. - - true - - - - - - - PB - Specifies that the names of the selectable fonts will be displayed with this font. - - true - - - - - OS - Specifies the font name and height used in HTML source view - - - - Specifies the name of the font that is used in source views (HTML source view or BASIC IDE) - - - - - Specifies the height, in points, of the font that is used in source views (HTML source view or BASIC IDE) - - 10 - - - - Specifies whether only non-proportional font should be presented on the dialog page. - - true - - - - - - AF - Specifies Gallery options. - - - - - - - - - AF - Deprecated. - - false - - - - - AS - Contains information about configurable menus. - - - - Contains all entries of new menu. - - - - - Contains all entries of wizard menu. - - - - - PB - Contains all help bookmarks. - - - - - - - AS - Contains history information. - - - - PB - Describes the range and current size of the help bookmark history list. - - - - - Defines the minimum range of the help bookmark history list. - - - - - Defines the maximum range of the help bookmark history list. - - - - 10000 - - - - Describes the range and current size of the history list. - - - - - Defines the min range for the history size. - - - - - Defines the max range for the history size. - - - - 100 - - - - - Describes the range and current size of the picklist shown inside the menu. - - - - - Defines the min range for the picklist size. - - - - - Defines the max range for the picklist size. - - - - 10 - - - - Contains the most recently opened help documents. - - - - - Contains the most recently opened documents. - - - - - - Contains the most recently used documents displayed in the file menu. - - - - - - MBA - Contains settings which are used during the Office startup to check for unfinished work. - - - - - - - MBA - Sends a mail that includes the stack trace after a crash. - - false - - - - - MBA - Enables UI for sending document as e-mail - - false - - - - - - - MBA - Enables mechanism for centralized disabling of functionality - - false - - - - BM - Specifies that If this option is set to true, the new development chart library is used instead of the standard one. Do not set this option to true unless you know exactly what to do. This new library will be unstable and incomplete most of the time. This flag will be removed when the new library is in a stable state. - - false - - - - CD - Specifies the current or last temp directory. This directory will be removed during shutdown or next office start. - - - - - - - AS - Contains the documents that were opened when the office crashed. - - - - - - MBA - Contains general settings about the saving process. - - - - - - - MBA - Specifies if the all open windows and documents should be saved. If set to true, the URLs of all open documents and all view properties of all open views are saved when terminating the application. - - - false - - - - MBA - Contains settings which specify how documents are saved. - - - - - MBA - Saves OOo 6.0 XML file documents unpacked into a directory. Documents are represented by the directory content and not by a single file. - - - false - - - - - - PB - Specifies if the user's name should be written into the Properties dialog of the document when saving the document. - - - true - - - - - - - MBA - Specifies whether all modified documents are automatically saved in a time interval. - - - false - - - - - - - MBA - Specifies whether to create a backup copy when a modified document is saved. - - - false - - - - - - - MBA - Specifies if the document properties dialog will be opened for editing every time a document is saved under a new filename. - - - false - - - - - - - MBA - Shows a prompt during AutoSave,even when the document has a filename. - - - true - - - - - - - MBA - Specifies the AutoSave time interval in minutes. - - - - - - Specifies that the minimum time interval is 1 minute. - - - - - Specifies that the maximum time interval is 60 minutes. - - - - 15 - - - - - - - MBA - Saves view properties of last active document view when saving a document. - - - true - - - - - - - MBA - Specifies whether all currently open windows of a document should be saved. If true the view properties for all open document views of that document are saved. - - - false - - - - - - MBA - Specifies if files saved in the OOo 6.0 XML file formats should be in pretty printing format. Saving and loading the document takes more time in pretty printing format. - - - false - - - - - MBA - Specifies if a warning message is shown if a file is going to be saved to an alien format. - - - true - - - - MAV - If the option is set, every time a user triggers a plain Save operation, SaveAs operation with possible additional user notifications will be started. - - false - - - - PB - If the value is "true", then the ODF that is saved by OpenOffice.org will be backward compatible to previous minor versions. - - true - - - - - PB - Specifies if the printer settings will be loaded with the document. - - true - - - - - MBA - Contains settings on how graphics contained in a document should be saved. - - - - - - - AF - Specifies how graphics contained in a document are saved. - - - - - - Normal - - - - - Compressed - - - - - Original format - - - - 1 - - - - - MBA - Specifies how URLs in documents should be processed during save. - - - - - - - MBA - Specifies whether URLs in documents should be saved relative to the file system. - - - true - - - - - - - MBA - Specifies if URLs in documents should be saved relative to the Internet. - - - true - - - - - PB - Specifies ODF settings. - - - - - PB - Specifies the default ODF version for saving documents. - - - - - ODFVER_UNKNOWN - - - - - ODFVER_010 - - - - - ODFVER_011 - - - - - ODFVER_012 - - - - 3 - - - - - - MBA - Contains settings regarding the loading of documents. - - - - - MBA - Specifies whether the user defined configuration settings are loaded together with the document. - - - true - - - - MAV - Specifies whether the office update dialog should be shown in case the loaded document has newer ODF version than the maximal supported one. - - true - - - - - MBA - Contains security specific Office settings. - - - - MBA - Contains security settings regarding Basic scripts. - - - - - - - MBA - Lists all trustworthy URLs: file: All scripts from the local file system including a LAN; private:explorer: Scripts from the Explorer; private:help: Scripts in the help system; private:newmenu: Scripts that are executed by the commands File-New and AutoPilot; private:schedule: Scripts of the scheduler; private:searchfolder: Scripts of the searchfolder; private:user: Scripts that are entered in the URL field. - - - - - - - - - MBA - Determines how Office Basic scripts should be handled. - - - - - Never - - - - - According to Path List - - - - - Always - - - - 1 - - - - MBA - Specifies whether execution of plugins found inside a document is allowed. - - true - - - - MBA - Specifies whether a warning box should be displayed before executing a script. - - false - - - - MBA - Specifies whether the user must confirm before a basic script can be executed. - - true - - - - GT - Specifies wether to warn when saving or sending documents with personal/hidden data. - - false - - - - GT - Specifies wether to warn when signing documents with personal/hidden data. - - true - - - - GT - Specifies wether to warn when printing documents with personal/hidden data. - - false - - - - GT - Specifies wether to warn when creating PDF documents with personal/hidden data. - - false - - - - GT - Specifies wether to remove personal information on saving. - - false - - - - GT - Specifies wether to recommend password protection when saving documents. - - false - - - - PB - Specifies whether ctrl-click is required to follow hyperlinks. - - true - - - - GT - Level of Macro security. - - - - - Lowest level. - - - - - Highest level. - - - - 2 - - - - MAV - Specifies whether the macro execution is disabled in general. If it is set to true, the "MacroSecurityLevel" is ignored. If it is set to false, the mentioned entry specified the level of macro security. - - false - - - - GT - List with trusted authors. - - - - - - - MBA - Contains window and dialog settings. - - - - - - - PB - Specifies the scaling only of the screen representation [UNIT=%]. - - - - - - PB - Specifies the minimum range of the scaling. - - - - - PB - Specifies the maximum range of the scaling. - - - - 100 - - - - - - - PB - Determines the look and feel of the application. - - - - - - Standard - - - - - Macintosh - - - - - X Window - - - - - OS/2 - - - - 0 - - - - MBA - Contains settings on how the application window should be displayed. - - - - - - MBA - Specifies whether the application window should be opened in Fullscreen mode. - - false - - - - - - MBA - Specifies the preferred view of the application window. - - - - - Use last setting - - - - - Show in task bar - - - - - Open in Fullscreen mode - - - - 0 - - - - - MBA - Contains settings which specify how dialogs and toolbars should be displayed. - - - - - - - MBA - Specifies whether toolbar buttons should be drawn large or small. True means large. - - - false - - - - - - - MBA - Specifies whether toolbox buttons should be drawn with a flat or 3D design. True means flat design. - - - true - - - - - - - PB - Specifies TabDialogs with colored tab control (True) - - - false - - - - - - - PB - Determines the automatic mouse positioning on dialogs: 0 - Default button 1 - Dialog center 2 - No automatic positioning - - - - - - Snap To Button - - - - - Snap To Middle - - - - - No Snap - - - - 2 - - - - - - OS - Determines the action assigned to the middle mouse button: 0 - No action 1 -Auto scroll 2 - Paste selection. - - - - - - No action - - - - - Auto scroll - - - - - Paste selection - - - - 1 - - - - - - - PB - Specifies TabDialogs with single line tab control (True). - - - false - - - - - SSA - Contains localization specific settings. - - - - - - SSA - Specifies if shortcuts are assigned automatically. - - - - - - - SSA - Specifies the percentage for enlarging controls. - - - - - SSA - Specifies the upper limit for enlarging the controls is 100%. - - - - - SSA - Specifies the upper limit for enlarging the controls is 100%. - - - - - - - - PB - Contains menu view settings. - - - - - - - PB - Shows all deactivated menu entries. Menu commands that are normally not necessary are hidden by default. - - true - - - - CMC - Indicates whether icons in the office menus should shown/hidden by following the System theme. - - true - - - - - - CD - Indicates whether icons in the office menus should be displayed. - - true - - - - - - - PB - Specifies automatic selection while moving the mouse over a menu (True). - - - true - - - - - MBA - Contains settings for general windows used by the Office. - - - - - - - PB - Specifies the representation of the window while dragging. - - - - - - With window contents - - - - - Frame only - - - - - From system settings - - - - 2 - - - - - - - - MBA - Deprecated. - - - - - - - - - Deprecated. - - - - - - - - - - - Deprecated. - - false - - - - - - - - Deprecated. - - - - - ZoomIn - - - - - Small - - - - - ForceDock - - - - - AutoHide - - - - - Task - - - - - CantGetFocus - - - - - - - - - - - Deprecated. - - - - - - - - - MBA - Specifies the properties of window containers for docked windows. - - - - - - - - MBA - Deprecated. - - - - - - - - - - - MBA - Deprecated. - - - - - - - - MBA - Deprecated. - - - - - Stick/Hidden - - - - - Floating/Hidden - - - - - Stick/Visible - - - - - Floating/Visible - - - - - - - - Deprecated. - - - - - - - - - Deprecated. - - - - - - - - - Font antialiasing properties - - - - Specifies font antialiasing properties - - - true - - - - Specifies an additional limit if Font Antialiasing is enabled. Fonts that are smaller than the specified limit are not anti-aliased. - - - 8 - - - - - - MBA - Contains the settings regarding the undo operation in the Office. - - - - - - - MBA - Specifies how many operations can be undone in a row. - - - - - - Specifies the lowest number of undo steps possible. - - - - - Specifies the highest number of undo steps possible. - - - - 100 - - - - - PB - Specifies options related to the setup. - - - - Specifies options related to the installed languages. - - - - - - - Contains the installed Office languages for the menus and dialogs. - - - - - - - AF - Specifies options related to printing. - - - - - MBA - Specifies if printing a document can modify a document due to reformatting - - - false - - - - OS - Contains settings for print specific warnings. - - - - - - - OS - Specifies if a warning should be displayed in case the printout requires a specific paper size - - - false - - - - - - - OS - Specifies if a warning should be displayed in case the printout requires a specific paper orientation - - - false - - - - - - - OS - Specifies if a warning should be displayed in case the printer defined in the document was not found - - - false - - - - - AF - Specifies if a warning should be displayed in case the printout contains transparent objects. - - - true - - - - - AF - Specifies the options related to printing. - - - - Specifies the options related to printing. - - - - - AF - Indicates whether to ignore transparency for the output of objects. - - - false - - - - - AF - Specifies type of transparency reduction: 0 - Automatically determine reduction, 1 - Always disabled. - - - 0 - - - - - AF - Indicates whether to reduce memory usage for output of gradients by limiting the number of gradient steps. - - - false - - - - - AF - Specifies type of gradient reduction: 0 - reduce the number of stripes, 1 - reduce to color. - - - 0 - - - - - AF - Specifies the maximum number stripes used for output of gradients. - - - 64 - - - - - AF - Indicates whether to reduce the memory usage of bitmaps for print process by limiting the resolution. - - - false - - - - - AF - Specifies type of bitmap reduction: 0 - Automatically determine optimal resolution, 1 - Use original resolution, 2 - User defined resolution. - - - 1 - - - - - AF - Specifies resolution of reduced bitmaps: 0 - 72DPI, 1 - 96DPI, 2 - 150DPI, 3 - 200DPI, 4 - 300DPI, 5 - 600DPI. - - - 3 - - - - - AF - Indicates whether to reduce the resolution of automatically created substitution bitmaps of transparent objects. - - - true - - - - - AF - Indicates whether to create only grayscale output of all objects. - - - false - - - - - Specifies the options for printing to a file. - - - - - - AF - Indicates whether to ignore transparency for the output of objects. - - - false - - - - - AF - Indicates the type of transparency reduction: 0 - Automatically determine reduction, 1 - Always disabled. - - - 0 - - - - - AF - Indicates whether to reduce memory usage for output of gradients by limiting the number of gradient steps. - - - false - - - - - AF - Indicates the type of gradient reduction: 0 - Reduce the number of stripes, 1 - Reduce to color. - - - 0 - - - - - AF - Specifies the maximum number stripes used for output of gradients. - - - 64 - - - - - AF - Indicates whether to reduce the memory usage of bitmaps for the print process by limiting the resolution. - - - false - - - - - AF - Specifies the type of bitmap reduction: 0 - Automatically determine optimal resolution, 1 - Use original resolution, 2 - User defined resolution. - - - 1 - - - - - AF - Specifies the resolution of reduced bitmaps: 0 - 72DPI, 1 - 96DPI, 2 - 150DPI, 3 - 200DPI, 4 - 300DPI, 5 - 600DPI. - - - 3 - - - - - AF - Indicates whether to reduce the resolution of automatically created substitution bitmaps of transparent objects. - - - true - - - - - AF - Indicates whether to create only grayscale output of all objects. - - - false - - - - - - - - MBA - Lists open documents or windows. - - - - - - - - MBA - Lists open documents or windows. - - - - - - OS - Contains settings specifying if a XML package is added to the applications binary files. - - - - - - - OS - Defines if a XML package is added to the Writer binary files. - - - - - - - - OS - Defines if a XML package is added to the Calc binary files. - - - - - - - - OS - Defines if a XML package is added to the Impress binary files. - - - - - - - - OS - Defines if a XML package is added to the Draw binary files. - - - - - - FS - Contains settings that specify the common help settings. - - - - ABI - Determines wether basic help should be shown. - - true - - - - ABI - Determines the locale for the help pages. - - - - - - - ABI - Determines the operating system on which the help system is displayed. - - - - - - - - - MBA - Activates the Tip help. - - - true - - - - - - MBA - Activates the Extended help. - - - false - - - - ABI - Specifies the name of the stylesheet used to display help content. - - Default - - - - MBA - Specifies the properties of the HelpAgent. - - - - Specifies whether the HelpAgent is enabled. - - - true - - - - Specifies the time-out value in seconds after which the HelpAgent is closed automatically if ignored by the user. - - - 30 - - - - Specifies how often the user must ignore a given HelpAgent topic until it is disregarded in the future (any requests for this topic will be dropped silently). - - - 3 - - - - Contains the help URLs which have been ignored at least once by the user, together with a counter of how often they have been ignored. - - - - - - - PL - Contains settings for the start center. - - - - Contains a string specifying the URL to be browsed for additional features (e.g. extensions) - - - - - - Contains a string specifying the URL to be browsed for information about the product - - - - - - Contains a string specifying the URL to be browsed for additional template documents - - - - - - - FS - Contains various settings regarding the product registration feature. - - - - Contains a string specifying the URL with placeholders to be used for online registration. - - - - - - - Contains a string specifying the real URL to be used for online registration. - - - - - - - Contains a string representation of the date on which the user receives a reminder (e.g. "13.02.2002"). - - - - - - - Contains the number used internally to determine when the dialog should be started. - - 1 - - - - Contains a Boolean that specifies if the "Registration..." menu item is available. - - true - - - - CD/OBR - Current product ID. - This data is saved in a dedicated file since OOo 3.0 FCS - - - - - CD/OBR - Specifies product specific IDs and associated instance UUIDs - This data is saved in a dedicated file since OOo 3.0 FCS - - - - - - - JL - Contains Java related settings. - - - - Contains Applet related settings. - - - - - - - Enables/disables Java applets in Office documents. - - - false - - - - - - AF - Specifies the options related to the vectorization of bitmaps. - - - - - - - AF - Specifies the number of colors that are used to create a vector graphic in Draw/Impress [UNIT=count]. - - - - - - Specifies that the lowest number that can be used to create a vector graphic is 8. - - - - - Specifies that the lowest number that can be used to create a vector graphic is 32. - - - - 8 - - - - - - - AF - Specifies the number of pixels that you want to combine as a single pixel when creating a vector graphic. - - - - - - Specifies the minimum value to reduce point is 0 pixels. - - - - - Specifies the maximum value to reduce point is 32 pixels. - - - - 0 - - - - - - - AF - Indicates whether to create a tiled background before vectorizing. - - - false - - - - - - - AF - Specifies the extent of background tiles that are used for vectorizing [UNIT=pixel]. - - - - - - Specifies that the minimum extent is 8 pixels. - - - - - Specifies that the maximum extent is 128 pixels. - - - - 32 - - - - - AF - Specifies the options for images. - - - - - Specifies the color options for images. - - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 256 - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 16 - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 10 - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 10 - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 4500 - - - - - - - - AF - Deprecated. - - - true - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 50 - - - - Specifies the RGB color options for images. - - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 10 - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 10 - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 10 - - - - - - Specifies the effects options for images. - - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 4 - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 4 - - - - - - - - AF - Deprecated. - - - - - - Deprecated - - - - - Deprecated - - - - - Deprecated - - - - - Deprecated - - - - 2 - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 10 - - - - - - - - AF - Deprecated. - - - false - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 4 - - - - - - - - AF - Deprecated. - - - - - - Deprecated. - - - - - Deprecated. - - - - 4 - - - - - - - - - AF - Deprecated. - - - - - - Deprecated - - - - - Deprecated - - - - - Deprecated - - - - - Deprecated - - - - 2 - - - - - - - - AF - Deprecated. - - - - - - Specifies that the minimum intensity is 0. - - - - - Specifies that the maximum intensity is 100. - - - - 10 - - - - - - NN - Specifies settings for the date formats used. - - - - - - - NN - Specifies the first year that can be entered using two-digit-year date formats. - - - 1930 - - - - - SJ / OS / KA - Specifies default settings of Microsoft-, Graphic- and HTML filters. - - - - SJ - Specifies default settings of Microsoft filters. - - - - Specifies default settings of Microsoft import filters. - - - - Specifies if convertible MathType OLE objects are converted into Math objects. - - false - - - - Specifies if convertible WinWord OLE objects are converted into Writer objects. - - false - - - - Specifies if convertible Excel OLE objects are converted into Calc objects. - - false - - - - Specifies if convertible PowerPoint OLE objects are converted into Impress objects. - - false - - - - Flag to control use of enhanced fields. - - true - - - - - Specifies default settings of Microsoft export filters. - - - - Specifies if embedded Math objects are converted into MathType objects. - - false - - - - Specifies if embedded Writer objects are converted into WinWord objects. - - false - - - - Specifies if embedded Calc objects are converted into Excel objects. - - false - - - - Specifies if embedded Impress objects are converted into PowerPoint objects. - - false - - - - SJ - Specifies if previews are created when saving PowerPoint documents. - - true - - - - SJ - Specifies if previews are created when saving Excel documents. - - false - - - - SJ - Specifies if previews are created when saving Word documents. - - false - - - - - - SJ - Specifies default settings of graphic import and export dialogs. - - - - Specifies default settings of graphic import dialogs. - - - - Specifies default settings of the PCD - Photo CD Base import dialog. - - - - - - Specifies import resolution of PCD graphics. - - - - - - PCD-Base16, 192*128 PCD graphic. - - - - - PCD-Base4, 384*256 PCD graphic. - - - - - PCD-Base, 768*512 PCD graphic. - - - - 2 - - - - - - Specifies default settings of graphic export dialogs. - - - - Specifies default settings of the Windows Bitmap export dialog. - - - - - - - Specifies usable export modes. - - - - - - Original size - - - - - Logical size (dpi/pixel ratio) - - - - - Given size - - - - 0 - - - - - - - Specifies resolution which is to be used if export mode is 1. [UNIT=dpi] - - - - - - 75 - - - - - 150 - - - - - 300 - - - - - 600 - - - - 75 - - - - - - Specifies the number of colors that are to be used for the export. - - - - - - Original - - - - - 1 bit, 1 bit threshold - - - - - 1 bit, 1 bit dithered - - - - - 4 bit, 4 bit grayscale - - - - - 4 bit, 4 bit color palette - - - - - 8 bit, 8 bit grayscale color - - - - - 8 bit, 8 bit color palette - - - - - 24 bit, 24 bit true color - - - - 0 - - - - - - - Specifies if Run-Length-Encoding should be used in the export. - - - true - - - - Specifies the logical size of a graphic. [UNIT=1/100 mm]. - - - - - - - - - - Specifies default settings of the EPS - Encapsulated Postscript export dialog. - - - - Specifies if a preview graphic should be exported together with the Encapsulated PostScript file. Due to the fact that most programs can't render eps graphics, it is useful to provide a preview that can be displayed as replacement. The preview graphic will also be printed if the printer is not capable of Postscript. - - - - - - None - - - - - TIFF - - - - - Interchange (EPSI) - 1 bit color resolution - - - - - TIFF and EPSI - - - - 0 - - - - Specifies the PostScript version that has to be used for the EPS export. Because not every PostScript printer is capable of version 2 PostScript, it is sometimes necessary to create version 1 PostScript graphics. PostScript Level 1 does not support color and bitmap compression. - - - - - - Version 1 PostScript - - - - - Version 2 PostScript - - - - 2 - - - - Specifies if color or grayscale format is used for the EPS export. This option is not available for version 1 PostScript files. - - - - - - Color format - - - - - Grayscale format - - - - 2 - - - - Specifies if bitmaps are exported by using the LZW (Lempel - Ziv - Welch) compression algorithm. Compression is only available for level 2 PostScript files. - - - - - - LZW compression - - - - - No compression - - - - 2 - - - - Specifies if glyph outlines are exported. They produce the highest quality and it is the only possible way to create EPS files that are CJK compliant. Not using glyphs will produce smaller files, but it might lead to problems if not all fonts are available during printing. - - - - - - Glyph outlines - - - - - No glyph outlines - - - - 0 - - - - - Specifies default settings of the GIF - Graphics Interchange export dialog. - - - - - - - Specifies if graphics should be exported using interlace. It is recommended for big pictures to activate interlace, so the content can be displayed immediately when loading the picture. - - - - - Deactivate - - - - - Activate - - - - 1 - - - - - - - Specifies if the graphic background is stored as transparent. - - - - - No transparency - - - - - Transparency - - - - 1 - - - - - Specifies default settings of the JPEG - Joint Photographic Experts Group export dialog. - - - - - - - Specifies quality of the JPG export. A higher value results in higher quality and file size. - - - - - Represents lowest value that can be used. The lower the value, the less good is the compression quality and the bigger is be the file size. - - - - - Represents highest value that can be used. The higher the value, the better is the compression quality and the smaller is the file size. - - - - 75 - - - - - - - Specifies if graphics are exported using true color or grayscale. - - - - - True colors - - - - - Grayscale - - - - 0 - - - - - Specifies if graphics are exported with the original- or selected size. - - - - - - - Specifies if graphics are exported with the original- or selected size. - - - - - Original size - - - - - Given size - - - - 0 - - - - Specifies the logical size of a graphic. [UNIT=1/100 mm]. - - - - - - - - Specifies default settings of the PCT - Mac Pict export dialog. - - - - - - - Specifies if graphics are exported with original- or selected size. - - - - - Original size - - - - - Given size - - - - 0 - - - - Specifies the logical size of a graphic. [UNIT=1/100 mm]. - - - - - - - - Specifies default settings of the PBM - Portable Bitmap export dialog. - - - - - - - Specifies if graphics are exported to binary- or ASCII format. - - - - - Binary - - - - - ASCII - - - - 1 - - - - - Specifies default settings of the PGM - Portable Graymap export dialog. - - - - - - - Specifies if graphics are exported to a binary- or ASCII format. - - - - - Binary - - - - - ASCII - - - - 1 - - - - - Specifies default settings of the PPM - Portable Pixelmap export dialog. - - - - - - - Specifies if graphics are exported to a binary- or ASCII format. - - - - - Binary - - - - - ASCII - - - - 1 - - - - - Specifies default settings of the SVM - StarView Meta File export dialog. - - - - - - - Specifies if graphics should be exported with the original- or selected size. - - - - - Original size - - - - - Given size - - - - 0 - - - - Specifies the logical size of a graphic. [UNIT=1/100 mm]. - - - - - - - - Specifies default settings of the WMF - Windows Metafile export dialog. - - - - - - - Specifies if graphics should be exported with the original- or selected size. - - - - - Original size - - - - - Given size - - - - 0 - - - - Specifies the logical size of a graphic. [UNIT=1/100 mm]. - - - - - - - - Specifies default settings of the EMF - Enhanced Metafile export dialog. - - - - - - - Specifies if graphics should be exported with the original- or selected size. - - - - - Original size - - - - - Given size - - - - 0 - - - - Specifies the logical size of a graphic. [UNIT=1/100 mm]. - - - - - - - - Specifies default settings of the PNG - Portable Network Graphic export dialog. - - - - - - - Specifies export compression settings which ranges from 0 (no compression) to 9 (maximum compression). The calculating time increases with an ascending compression value. - - - - - Represents lowest value that can be used. The lower the value, the lower the compression quality and the larger the file size. - - - - - Represents the highest value that can be used. The higher the value, the higher the compression quality and the smaller the file size. - - - - 6 - - - - - - - Specifies if graphics should be exported using interlace. It is recommended for big pictures to activate interlace, so the content can be displayed immediately when loading the picture. - - - - - Deactivate interlace mode - - - - - Activate interlace mode - - - - 1 - - - - - - - OS - Contains settings for HTML import/export. - - - - Contains settings for HTML import. - - - - - ER - Specifies if numbers should be parsed according to the en-US locale instead of the user's locale. - - - false - - - - - - - OS - Specifies if unknown tags should be imported as fields. - - - false - - - - - - - OS - Specifies if font settings should be ignored when importing. - - - false - - - - Specifies font size for HTML. - - - - - - - OS - Specifies font size for HTML as Token Font 1. - - - 7 - - - - - - - OS - Specifies font size for HTML as Token Font 2. - - - 10 - - - - - - - OS - Specifies font size for HTML as Token Font 3. - - - 12 - - - - - - - OS - Specifies font size for HTML as Token Font 4. - - - 14 - - - - - - - OS - Specifies font size for HTML as Token Font 5. - - - 18 - - - - - - - OS - Specifies font size for HTML as Token Font 6. - - - 24 - - - - - - - OS - Specifies font size for HTML as Token Font 7. - - - 36 - - - - - - Contains settings for HTML export. - - - - - - - OS - Specifies the browser for which the HTML export should be optimized - - - - - - Html 3.2 - - - - - MSIE 4.0 - - - - - Netscape 3.0 - - - - - Writer - - - - - Netscape 4.0 - - - - 4 - - - - - - - OS - Specifies if Office Basic instructions are considered when exporting in HTML format. - - - false - - - - - - - OS - Specifies if the print layout of the current document should also be exported. - - - false - - - - - - - OS - Specifies if graphics are copied to the Internet server when uploading via FTP. - - - true - - - - - - - OS - Specifies if a warning should be displayed to point out that the available Basic macros will be lost when exporting in HTML format. - - - true - - - - - OS - Specifies the mimetype for the text encoding. - - - - - - - - - KA - Specifies default settings of PDF export dialog. - - - - - Specifies default settings of PDF export dialog. - - - - Use following properties instead: UseLosslessCompression, Quality, UseResolutionReduction, ResolutionReduction - SJ - Deprecated. - - 1 - - - - SJ - Specifies if graphics are exported to PDF using a lossless compression eg. PNG or if they are compressed using the JPEG format. - - false - - - - SJ - Specifies quality of the JPG export. A higher value results in higher quality and file size. - - - - - Represents lowest value that can be used. The lower the value, the less good is the compression quality and the bigger is be the file size. - - - - - Represents highest value that can be used. The higher the value, the better is the compression quality and the smaller is the file size. - - - - 90 - - - - SJ - Specifies if the resolution of each image is reduced to the resolution specified by the property MaxImageResolution. - - false - - - - If the property ReduceImageResolution is set to true all images will be reduced to the given value in DPI. - - - - - 75 - - - - - 150 - - - - - 300 - - - - - 600 - - - - - 1200 - - - - 300 - - - - SJ - Determines if PDF are created by using special tags also known as Tagged PDF. - - false - - - - SJ - Specifies if notes are exported to PDF. - - false - - - - PL - Specifies if bookmarks are exported to PDF. - - true - - - - PL - Specifies how many bookmark levels should be opened in the reader application when the PDF gets opened. - - -1 - - - - SJ - Specifies if notes pages are exported to PDF. (Notes pages are available in Impress documents only). - - false - - - - SJ - Specifies slide transitions are exported to PDF. This option is active only if storing Impress documents. - - true - - - - pl - Specifies whether form fields are exported as widgets or only their fixed print representation is exported. - - true - - - - Specifies the submitted format of a PDF form. - - - - - Specifies that forms type FDF is used. - - - - - Specifies that forms type PDF is used. - - - - - Specifies that forms type HTML is used. - - - - - Specifies that forms type XML is used. - - - - 0 - - - - FME - Specifies that automatically inserted empty pages are suppressed. This option is active only if storing Writer documents. - - true - - - - PL - Specifies that a stream is inserted to the PDF file which contains the original document for archiving purposes. - - false - - - - beppec56 - Specifies whether to hide the PDF viewer menubar when the document is active. - - false - - - - beppec56 - Specifies whether to hide the PDF viewer toolbar when the document is active. - - false - - - - beppec56 - Specifies whether to hide the PDF viewer controls when the document is active. - - false - - - - beppec56 - Specifies that the PDF viewer window is opened full screen when the document is opened. - - false - - - - beppec56 - Specifies that the PDF viewer window is centered to the screen when the PDF document is opened. - - false - - - - beppec56 - Specifies that the PDF viewer window is opened full screen, on top of all windows.. - - false - - - - beppec56 - Specifies that the title of the document, if present in the document properties, is displayed in the PDF viewer window title bar. - - true - - - - beppec56 - Specifies how the PDF document should be displayed when opened. - - - - - Select the default viewer mode, neither outlines or thumbnails. - - - - - The document is opened with outline pane opened - - - - - The document is opened with thumbnail pane opened - - - - 0 - - - - beppec56 - Specifies the action to be performed when the PDF document is opened. - - - - - Opens with default zoom magnification. - - - - - Opens magnified to fit the entire page within the window. - - - - - Opens magnified to fit the entire page width within the window. - - - - - Opens magnified to fit the entire width of its boundig box within the window (cuts out margins). - - - - - Opens with the zoom level specified in the Zoom property. - - - - 0 - - - - pl - specifies the zoom level a PDF document is opened with. Only valid if "Magnification" is set to "4". - - 100 - - - - pl - Specifies the page on which a PDF document should be opened in the viewer application. - - 1 - - - - beppec56 - Specifies the page layout to be used when the document is opened. - - - - - Display the pages according to the reader configuration. - - - - - Display one page at a time. - - - - - Display the pages in one column. - - - - - Display the pages in two columns odd pages on the right, to have the odd pages on the left the FirstPageOnLeft property should be used as well. - - - - 0 - - - - beppec56 - Used with the value 3 of the PageLayout property above, true if the first page (odd) should be on the left side of the screen. - - false - - - - - beppec56 - Specifies what printing is allowed. - - - - - The document cannot be printed. - - - - - The document can be printed at low resolution only. - - - - - The document can be printed at maximum resolution. - - - - 2 - - - - beppec56 - Specifies the change allowed to the document. - - - - - The document cannot be changed. - - - - - Inserting deleting and rotating pages is allowed. - - - - - Filling of form field is allowed. - - - - - Both filling of form field and commenting is allowed. - - - - - All the changes of the previous selections are permitted, with the only exclusion of page extraction (copy). - - - - 4 - - - - beppec56 - Specifies that the pages and the document content can be extracted to be used in other documents (copy and paste). - - true - - - - beppec56 - Specifies that the document content can be extracted to be used in accessibility applications. - - true - - - - - - beppec56 - Specifies the version of PDF to emit. - - - - - PDF 1.4 (default selection). - - - - - PDF/A-1 (ISO 19005-1:2005) - - - - 0 - - - - - - beppec56 - Specifies that the file system related hyperlinks (file:// protocol) present in the document will be exported as relative to the source document location. - - false - - - - beppec56 - Specifies the way the exported PDF will be viewed (experienced) by the user. - - - - - Specifies that the PDF will be exported with all the links external to the document treated as URI. This is the Default - - - - - Specifies that the PDF will be exported in order to be viewed through a PDF reader application only. Valid only if not exporting to PDF/A-1 (e.g. SelectPdfVersion not set to 1). - - - - - Specifies that the PDF will be exported in order to be viewed through an Internet browser, using the PDF plug-in provided with it. The bookmark of the URI will be rendered compatible with the target bookmark generated with OOo PDF Export feature (see ExportBookmarksToPDFDestination, below). - - - - 0 - - - - beppec56 - Specifies that the target documents with .od[tpgs] extension, will have that extension changed to .pdf when the link is exported to PDF. The source document remains untouched. - - false - - - - beppec56 - Specifies that the bookmarks contained in the source OpenOffice.org file should be exported to the PDF file as Named Destination (see PDF 1.4 section 8.2.1). - - false - - - - - - - - MBA - Determines the miscellaneous entries for the common group. - - - - AS - Determines the maximum count of documents, which are allowed to be open at the same time. NIL will be interpreted as infinite! - - - - - - - - PB - Enables/Disables Plugins. - - - true - - - - FS - Determines if the system's file and folder pickers should be used. If false, the proprietary file/folder picker implementations will be used. Relevant on platforms where file/folder picker integration is implemented. - - true - - - - MAV - Allows to specify whether the OOo document file locking mechanics should use the system file locking. - - true - - - - MAV - Allows to specify whether the OOo document file locking mechanics should use the lock file for locking. - - true - - - - PL - Determines if the system's print dialog should be used. If false, the platform independent print dialog implementation will be used. Relevant on platforms where print dialog integration is implemented. - - false - - - - - MBA - Specifies which size of the symbols is used for the toolbars. - - - - - 16x16 pixel icons - - - - - 32x32 pixel icons - - - - 0 - - - - - kendy - Specifies which style of the symbols is used for the toolbars, menus, etc. - - - - - Automatic, chosen according to the desktop - - - - - Default - the OpenOffice.org default theme - - - - - HiContrast - - - - - Industrial - - - - - Crystal - the KDE default theme - - - - - Tango - the Gnome default theme - - - - - Classic - the OpenOffice.org 2.0 default theme - - - - auto - - - - - MBA - Specifies which button style the toolbars should use. - - - - - 3D style - - - - - Flat style - - - - 1 - - - - FS - Enables/Disables the usage of AutoPilots for form controls. - - true - - - - MBA - Specifies if the office has never before been started. - - - true - - - - - FS - contains settings for the form layer of the applications. - - - - specifies certain default layout settings for form controls. All those settings can be overruled in concrete documents, they specify creation-time defaults only. - - - - specifies certain default layout settings for form controls in text documents - - - - - specifies certain default layout settings for form controls in web pages - - - - - specifies certain default layout settings for form controls in spreadsheet documents - - - - - specifies certain default layout settings for form controls in drawing documents - - - - - specifies certain default layout settings for form controls in presentation documents - - - - - specifies certain default layout settings for form controls in XML form documents - - - - - specifies certain default layout settings for form controls in database form documents - - - - - specifies certain default layout settings for form controls in database text report documents. - - - - - - specifies settings for the property browser used for forms and form controls. - - - - FS - Enables or disables the property browser's access to form/control properties which are not officially supported. - - false - - - - FS - Enables or disables a help section at the bottom of the property browser, which shows the help of the currently active property. - - false - - - - - - OS - Contains layout specific settings for Asian languages. - - - - - - - OS - Determines the kerning of western text and/or punctuation inside of Asian text. - - - true - - - - - - - OS - Determines the type of character distance compression in Asian text: 0 - no compression; 1 - compress punctuation only; 2 - compress interpunction an japanese kana. - - - 0 - - - - OS - Contains the characters at which lines are not allowed to begin or to end. For each locale there is a separate entry with the locale as its node name. - - - - - - - OS / PB - Contains all options for search. - - - - - - - PB - Specifies search for whole words only. - - false - - - - - - - PB - Specifies search backwards. - - false - - - - - - - PB - Specifies search with the use of regular expressions. - - false - - - - - - - PB - Specifies search for styles only. - - false - - - - - - - PB - Specifies search with similarity. - - false - - - - - - - PB - Specifies search as case sensitive. - - false - - - - - - - PB - Specifies search with the use of Asian options. - - false - - - - - OS - Specifies the divider label in case of a component-based search extension. - - - - - - OS - Specifies the label of the first component-based search command. - - - - - - OS - Specifies the label of the second component-based search command. - - - - - - mod - Specifies if search includes notes(SwPostItFields) - - false - - - - OS - Contains search options for the Japanese language. - - - - - - - OS - Does not distinguish between full-width and half-width characters. - - true - - - - - - - OS - Does not distinguish between hiragana and katakana characters. - - true - - - - - - - OS - Specifies search without distinguishing between characters with diphthongs and double consonants and plain characters. - - true - - - - - - - OS - Specifies search without distinguishing between minus signs, dashes, and long vowel sounds. - - true - - - - - - - OS - Specifies search without distinguishing between repeat character marks. - - true - - - - - - - OS - Specifies search without distinguishing between standard and nonstandard ideography. - - true - - - - - - - OS - Specifies search without distinguishing between standard and nonstandard ideography. - - true - - - - - - - OS - Specifies search without distinguishing between 'Di' and 'Zi' or 'Du' and 'Zu'. - - true - - - - - - - OS - Specifies search without distinguishing between 'Ba' and 'Va' or 'Ha' and 'Fa'. - - true - - - - - - - OS - Specifies search without distinguishing between 'Tsi', 'Thi' and 'Chi' or 'Dhi' and 'Zi'. - - true - - - - - - - OS - Specifies search without distinguishing between 'Hyu' and 'Fyu' or 'Byu' and 'Vyu'. - - true - - - - - - - OS - Specifies search without distinguishing between 'Se' and 'She' or 'Ze' and 'Je'. - - true - - - - - - - OS - Specifies search without distinguishing between 'Ia' and 'Iya'. - - true - - - - - - - OS - Specifies search without distinguishing between 'Ki' and 'Ku'. - - true - - - - - - - OS - Specifies search without distinguishing between punctuation characters. - - true - - - - - - - OS - Specifies search without distinguishing between characters used as blank spaces, such as full-width spaces, half-width spaces, and tabs. - - true - - - - - - - OS - Specifies search without distinguishing between prolonged sound marks. - - true - - - - - - - OS - Specifies search without distinguishing between normal dots and middle dots. - - true - - - - - - OS - Specifies settings for the accessibility options. - - - - FS - Enables the automatic detection of a high contrast mode set for your desktop. Some OS' do not provide this option explicitly, but allow the user to choose a color scheme that is HC-compliant implicitly, which is recognized if the option is set. - - - true - - - - OS - Enables the use of high contrast colors, instead of displaying the normal/original WYSIWYG colors. - - - true - - - - OS - Enables or disables the automatic time out of help tips. You can specify a duration (n) of 1 to 99 seconds. If this option is disabled, press the Esc key to dismiss the help tip. - - - true - - - - OS - Enables or disables the automatic time out of help tips. You can specify a duration (n) of 1 to 99 seconds. If this option is disabled, press the Esc key to dismiss the help tip. - - - - - - Specifies the number of seconds to wait before displaying a help tip. - - - - - Specifies the number of seconds to display a help tip. - - - - 4 - - - - AF - Indicates whether to allow the graphical animation in all SO/OO applications (i.e. animated GIFs and objects in Impress during presentation, animated graphical previews (Gallery, Insert-Graphics-From File, Animation Tool in Impress.) - - - true - - - - AF - Indicates whether to allow all textual animation like blinking and scrolling in all SO/OO applications. - - - true - - - - OS - Overrides all text color attributes set in a SO/OO document for display only. - - - false - - - - OS - Allows the user to change the UI font to the system default. - - - true - - - - OS - Indicates whether the cursor is displayed in read-only texts. - - - false - - - - - Replaced by org.openoffice.Office.Embedding/ObjectNames. - MAV - Deprecated - - - - - Without replacement. - OBR - Specifies external helper applications / protocol handlers. - - - - - OBR - Specifies an external mail application to be used for Send as email. - - - - Without replacement. - Indicates if the mail application in the OS specific user settings should be used. - - - - - Specifies the external mail application to be used. - - - - - - Without replacement. - Specifies the default external mail application. - - Mozilla 1.0 - 1.2 - - - - Without replacement. - Contains a set of supported command line profiles. - - - - - - OS - Contains various language/localization specific settings. - - - - PL - Contains settings for (language/localization specific) input methods. - - - - Controls the behavior of the IIIMP status window on Unix. If true, the status window is always displayed. If false, the status window is never displayed. If nil (the default), the status window is displayed depending on the current locale. - - - - - - Contains settings for the Asian languages (Chinese, Japanese, Korean,...) layout. - - - - - Specifies, whether CJK font settings are available (true) or not (false). - - false - - - - - Specifies, whether vertical text is available (true) or not (false). - - false - - - - - Specifies, whether Asian typography options like compression and forbidden characters are available (true) or not (false). - - false - - - - - Specifies, whether Japanese find options are selectable for search and replace (true) or not (false). - - false - - - - - Specifies whether Rubys are available (true) or not (false). - - false - - - - - Specifies whether case mapping to half and full width, hiragana and katagana are available (true) or not (false). - - false - - - - - Specifies whether writing in double lines is available (true) or not (false). - - false - - - - - Specifies whether emphasis marks are available (true) or not (false). - - false - - - - - Specifies whether vertical call out objects are available (true) or not (false). - - false - - - - - Contains settings for the languages with complex text layout (Hebrew, Arabic, Thai,...). - - - - - Specifies whether CTL font settings are available (true) or not (false). - - false - - - - - Specifies whether CTL strings are checked for the correct input sequence(true) or not (false). - - false - - - - - Specifies whether CTL strings are checked restricted for the correct input sequence(true) or not (false). Is only effective when CTLSequenceChecking is true. - - false - - - - - Specifies whether CTL input sequences are corrected while typing. Is only effective when CTLSequenceChecking is true. - - false - - - - - Specifies the type of text cursor movement (logical (0) or visual (1)) within mixed text (RTL and LTR). - - 0 - - - - - Specifies the type of numerals (Arabic (0), Hindi (1), system settings (2) or Context(3)) is used per default in all applications. - - 0 - - - - SSA - Specifies whether the whole user interface (UI) will be mirrored. If true, the UI will be right-to-left. If false, the UI will be left-to-right. If nil (the default), the UI will be mirrored depending on the office locale. - - - - - - - Use cfg package Jobs instead of this. - AS - Uses cfg package Jobs instead of this component. - - - - Use cfg package Jobs instead of this. - Uses cfg package Jobs instead of this component. - - - - - Use cfg package Jobs instead of this. - Uses cfg package Jobs instead of this component. - - - - - - FME - Contains settings for smart tags. - - - - FME - Contains Writer specific settings for smart tags. - - - - FME - Specifies whether smart tag recognization is enabled. - - true - - - - FME - A list of excluded smart tag types. - - - + + + MBA + Contains the global path settings, mainly those of the Options dialog. + + + + + + MBA + Contains the Office installation path. + + + + + + + + + MBA + Contains the Office installation path in URL notation. Must match the UCB configuration. + + + + + + + NN + Specifies the directory that contains spreadsheet add-ins which use the old add-in API. + + $(progpath)/addin + + + + OS + Specifies the settings of the AutoCorrect dialog. + + $(insturl)/share/autocorr:$(userurl)/autocorr + + + + OS + Contains the directory which contains the AutoText modules. + + $(insturl)/share/autotext/$(vlang):$(userurl)/autotext + + + + MBA + Stores the automatic backup copies of documents. + + $(userurl)/backup + + + + MBA + Contains the Basic files, which are used by the AutoPilots. + + $(insturl)/share/basic:$(userurl)/basic + + + + MBA + Contains the bitmap files which can be used for menu and toolbar icons. + + $(insturl)/share/config/symbol + + + + MBA + Contains the configuration files. This value cannot be changed through the user interface. + + $(insturl)/share/config + + + + TL + Contains the provided dictionaries. + + $(insturl)/share/wordbook/$(vlang) + + + + PB + Specifies the path to save folder bookmarks. + + $(userurl)/config/folders + + + + MBA + Specifies the directory where all the filters are stored. + + $(progpath)/filter + + + + AF + Specifies the directory which contains the Gallery database and multimedia files. + + $(insturl)/share/gallery:$(userurl)/gallery + + + + DL + Specifies the directory that is displayed when the dialog for opening a graphic or for saving a new graphic is called. + + $(userurl)/gallery + + + + ABI + Specifies the path to the Office help files. + + $(instpath)/help + + + + TL + Contains the files that are necessary for the spellcheck. + + $(insturl)/share/dict + + + + MBA + Contains the Office modules. + + $(progpath) + + + + DL + Specifies the path to the palette files *.SOB to *.SOF containing user-defined colors and patterns. + + $(userurl)/config + + + + MBA + Specifies the directory in which the plugins are saved. + + $(progpath)/plugin + + + + Without replacement. + ABI + Specifies the location where misc data are stored. + + $(userpath)/store + + + + MBA + Specifies the base directory used by the Office to store temp files. + + $(temp) + + + + MBA + Specifies the templates originate from these folders and sub-folders. + + $(insturl)/share/template/$(vlang):$(userurl)/template + + + + MBA + Specifies additional folders containing a global user interface configuration. The final user interface configuration is merged from UserConfig and from these folders. + + $(insturl)/share/config + + + + MBA + Specifies the folder with the user settings. + + $(userurl)/config + + + + TL + Contains the custom dictionaries. + + $(userurl)/wordbook + + + + MBA + Specifies the path of the work folder, which can be modified according to the user's needs. The path specified here can be seen in the Open or Save dialog. + + $(work) + + + + + MBA + Contains the default values of all the paths, which can be modified according to the user's needs. They are used when pressing the Standard-button in the Options dialog. + + + + Specifies the default directory that contains spreadsheet add-ins which use the old add-in API. + + $(progpath)/addin + + + + Specifies the default directory for the settings of the AutoCorrect dialog. + + $(insturl)/share/autocorr:$(userurl)/autocorr + + + + Specifies the default directory where the AutoText modules are located. + + $(insturl)/share/autotext/$(vlang):$(userurl)/autotext + + + + Specifies the default directory for the automatic backup copies of documents. + + $(userurl)/backup + + + + Specifies the default directory where the Basic files, used by the AutoPilots, are located. + + $(insturl)/share/basic:$(userurl)/basic + + + + Specifies the default directory where the bitmap files, which can be used for the menu and toolbar icons, are located. + + $(insturl)/share/config/symbol + + + + Specifies the default directory where the configuration files are stored. + + $(insturl)/share/config + + + + Specifies the default directory where the provided dictionaries are located. + + $(insturl)/share/wordbook/$(vlang) + + + + Specifies the default directory where folder bookmarks are stored. + + $(userurl)/config/folders + + + + Specifies the default directory where all the filters are stored. + + $(progpath)/filter + + + + Specifies the default directory where the Gallery database and multimedia files are located. + + $(insturl)/share/gallery:$(userurl)/gallery + + + + Specifies the default directory used by the dialog for opening a graphic or for saving a new graphic. + + $(userurl)/gallery + + + + Specifies the default directory where Office help files are located. + + $(instpath)/help + + + + Specifies the default directory where the files that are necessary for the spellcheck are saved. + + $(insturl)/share/dict + + + + Specifies the default directory which contains the Office modules. + + $(progpath) + + + + Specifies the default directory for the palette files *.SOB to *.SOF containing user-defined colors and patterns. + + $(userurl)/config + + + + Specifies the default directory where the Office plugins are located. + + $(progpath)/plugin + + + + Specifies the default directory that is used as a base directory for all temporary Office files. + + $(temp) + + + + Specifies the default directory where all provided templates are located in folders and sub-folders. + + $(insturl)/share/template/$(vlang):$(userurl)/template + + + + Specifies the default directories for the global user interface configuration. The final user interface configuration is merged from UserConfig and from these folders. + + + + + + Specifies the default directory which stores the user settings. + + $(userurl)/config + + + + Specifies the default directory which stores the custom dictionaries. + + $(userurl)/wordbook + + + + Specifies the default working directory where user stores documents. + + $(work) + + + + + + OS + Contains some common settings for fonts. + + + + OS + Contains settings for the font substitution. + + + + + + + OS + Determines if the list of font replacements is applied or not + + + false + + + + + + + OS + Specifies a substitution of the requested font, even if this font is available on the user's system. + + + + + + PB + Contains the settings for the font selection box in the object bar. + + + + + + + PB + Contains the last five fonts, which are shown on the top of a list, beginning with the last one. This list will be displayed on the font-name-box of the object bar. + + true + + + + + + + PB + Specifies that the names of the selectable fonts will be displayed with this font. + + true + + + + + OS + Specifies the font name and height used in HTML source view + + + + Specifies the name of the font that is used in source views (HTML source view or BASIC IDE) + + + + + Specifies the height, in points, of the font that is used in source views (HTML source view or BASIC IDE) + + 10 + + + + Specifies whether only non-proportional font should be presented on the dialog page. + + true + + + + + + AF + Specifies Gallery options. + + + + + + + + + AF + Deprecated. + + false + + + + + AS + Contains information about configurable menus. + + + + Contains all entries of new menu. + + + + + Contains all entries of wizard menu. + + + + + PB + Contains all help bookmarks. + + + + + + + AS + Contains history information. + + + + PB + Describes the range and current size of the help bookmark history list. + + + + + Defines the minimum range of the help bookmark history list. + + + + + Defines the maximum range of the help bookmark history list. + + + + 10000 + + + + Describes the range and current size of the history list. + + + + + Defines the min range for the history size. + + + + + Defines the max range for the history size. + + + + 100 + + + + + Describes the range and current size of the picklist shown inside the menu. + + + + + Defines the min range for the picklist size. + + + + + Defines the max range for the picklist size. + + + + 10 + + + + Contains the most recently opened help documents. + + + + + Contains the most recently opened documents. + + + + + + Contains the most recently used documents displayed in the file menu. + + + + + + MBA + Contains settings which are used during the Office startup to check for unfinished work. + + + + + + + MBA + Sends a mail that includes the stack trace after a crash. + + false + + + + + MBA + Enables UI for sending document as e-mail + + false + + + + + + + MBA + Enables mechanism for centralized disabling of functionality + + false + + + + BM + Specifies that If this option is set to true, the new development chart library is used instead of the standard one. Do not set this option to true unless you know exactly what to do. This new library will be unstable and incomplete most of the time. This flag will be removed when the new library is in a stable state. + + false + + + + CD + Specifies the current or last temp directory. This directory will be removed during shutdown or next office start. + + + + + + + AS + Contains the documents that were opened when the office crashed. + + + + + + MBA + Contains general settings about the saving process. + + + + + + + MBA + Specifies if the all open windows and documents should be saved. If set to true, the URLs of all open documents and all view properties of all open views are saved when terminating the application. + + + false + + + + MBA + Contains settings which specify how documents are saved. + + + + + MBA + Saves OOo 6.0 XML file documents unpacked into a directory. Documents are represented by the directory content and not by a single file. + + + false + + + + + + PB + Specifies if the user's name should be written into the Properties dialog of the document when saving the document. + + + true + + + + + + + MBA + Specifies whether all modified documents are automatically saved in a time interval. + + + false + + + + + + + MBA + Specifies whether to create a backup copy when a modified document is saved. + + + false + + + + + + + MBA + Specifies if the document properties dialog will be opened for editing every time a document is saved under a new filename. + + + false + + + + + + + MBA + Shows a prompt during AutoSave,even when the document has a filename. + + + true + + + + + + + MBA + Specifies the AutoSave time interval in minutes. + + + + + + Specifies that the minimum time interval is 1 minute. + + + + + Specifies that the maximum time interval is 60 minutes. + + + + 15 + + + + + + + MBA + Saves view properties of last active document view when saving a document. + + + true + + + + + + + MBA + Specifies whether all currently open windows of a document should be saved. If true the view properties for all open document views of that document are saved. + + + false + + + + + + MBA + Specifies if files saved in the OOo 6.0 XML file formats should be in pretty printing format. Saving and loading the document takes more time in pretty printing format. + + + false + + + + + MBA + Specifies if a warning message is shown if a file is going to be saved to an alien format. + + + true + + + + MAV + If the option is set, every time a user triggers a plain Save operation, SaveAs operation with possible additional user notifications will be started. + + false + + + + PB + If the value is "true", then the ODF that is saved by OpenOffice.org will be backward compatible to previous minor versions. + + true + + + + + PB + Specifies if the printer settings will be loaded with the document. + + true + + + + + MBA + Contains settings on how graphics contained in a document should be saved. + + + + + + + AF + Specifies how graphics contained in a document are saved. + + + + + + Normal + + + + + Compressed + + + + + Original format + + + + 1 + + + + + MBA + Specifies how URLs in documents should be processed during save. + + + + + + + MBA + Specifies whether URLs in documents should be saved relative to the file system. + + + true + + + + + + + MBA + Specifies if URLs in documents should be saved relative to the Internet. + + + true + + + + + PB + Specifies ODF settings. + + + + + PB + Specifies the default ODF version for saving documents. + + + + + ODFVER_UNKNOWN + + + + + ODFVER_010 + + + + + ODFVER_011 + + + + + ODFVER_012 + + + + 3 + + + + + + MBA + Contains settings regarding the loading of documents. + + + + + MBA + Specifies whether the user defined configuration settings are loaded together with the document. + + + true + + + + MAV + Specifies whether the office update dialog should be shown in case the loaded document has newer ODF version than the maximal supported one. + + true + + + + + MBA + Contains security specific Office settings. + + + + MBA + Contains security settings regarding Basic scripts. + + + + + + + MBA + Lists all trustworthy URLs: file: All scripts from the local file system including a LAN; private:explorer: Scripts from the Explorer; private:help: Scripts in the help system; private:newmenu: Scripts that are executed by the commands File-New and AutoPilot; private:schedule: Scripts of the scheduler; private:searchfolder: Scripts of the searchfolder; private:user: Scripts that are entered in the URL field. + + + + + + + + + MBA + Determines how Office Basic scripts should be handled. + + + + + Never + + + + + According to Path List + + + + + Always + + + + 1 + + + + MBA + Specifies whether execution of plugins found inside a document is allowed. + + true + + + + MBA + Specifies whether a warning box should be displayed before executing a script. + + false + + + + MBA + Specifies whether the user must confirm before a basic script can be executed. + + true + + + + GT + Specifies wether to warn when saving or sending documents with personal/hidden data. + + false + + + + GT + Specifies wether to warn when signing documents with personal/hidden data. + + true + + + + GT + Specifies wether to warn when printing documents with personal/hidden data. + + false + + + + GT + Specifies wether to warn when creating PDF documents with personal/hidden data. + + false + + + + GT + Specifies wether to remove personal information on saving. + + false + + + + GT + Specifies wether to recommend password protection when saving documents. + + false + + + + PB + Specifies whether ctrl-click is required to follow hyperlinks. + + true + + + + GT + Level of Macro security. + + + + + Lowest level. + + + + + Highest level. + + + + 2 + + + + MAV + Specifies whether the macro execution is disabled in general. If it is set to true, the "MacroSecurityLevel" is ignored. If it is set to false, the mentioned entry specified the level of macro security. + + false + + + + GT + List with trusted authors. + + + + + + + MBA + Contains window and dialog settings. + + + + + + + PB + Specifies the scaling only of the screen representation [UNIT=%]. + + + + + + PB + Specifies the minimum range of the scaling. + + + + + PB + Specifies the maximum range of the scaling. + + + + 100 + + + + + + + PB + Determines the look and feel of the application. + + + + + + Standard + + + + + Macintosh + + + + + X Window + + + + + OS/2 + + + + 0 + + + + MBA + Contains settings on how the application window should be displayed. + + + + + + MBA + Specifies whether the application window should be opened in Fullscreen mode. + + false + + + + + + MBA + Specifies the preferred view of the application window. + + + + + Use last setting + + + + + Show in task bar + + + + + Open in Fullscreen mode + + + + 0 + + + + + MBA + Contains settings which specify how dialogs and toolbars should be displayed. + + + + + + + MBA + Specifies whether toolbar buttons should be drawn large or small. True means large. + + + false + + + + + + + MBA + Specifies whether toolbox buttons should be drawn with a flat or 3D design. True means flat design. + + + true + + + + + + + PB + Specifies TabDialogs with colored tab control (True) + + + false + + + + + + + PB + Determines the automatic mouse positioning on dialogs: 0 - Default button 1 - Dialog center 2 - No automatic positioning + + + + + + Snap To Button + + + + + Snap To Middle + + + + + No Snap + + + + 2 + + + + + + OS + Determines the action assigned to the middle mouse button: 0 - No action 1 -Auto scroll 2 - Paste selection. + + + + + + No action + + + + + Auto scroll + + + + + Paste selection + + + + 1 + + + + + + + PB + Specifies TabDialogs with single line tab control (True). + + + false + + + + + SSA + Contains localization specific settings. + + + + + + SSA + Specifies if shortcuts are assigned automatically. + + + + + + + SSA + Specifies the percentage for enlarging controls. + + + + + SSA + Specifies the upper limit for enlarging the controls is 100%. + + + + + SSA + Specifies the upper limit for enlarging the controls is 100%. + + + + + + + + PB + Contains menu view settings. + + + + + + + PB + Shows all deactivated menu entries. Menu commands that are normally not necessary are hidden by default. + + true + + + + CMC + Indicates whether icons in the office menus should shown/hidden by following the System theme. + + true + + + + + + CD + Indicates whether icons in the office menus should be displayed. + + true + + + + + + + PB + Specifies automatic selection while moving the mouse over a menu (True). + + + true + + + + + MBA + Contains settings for general windows used by the Office. + + + + + + + PB + Specifies the representation of the window while dragging. + + + + + + With window contents + + + + + Frame only + + + + + From system settings + + + + 2 + + + + + + + + MBA + Deprecated. + + + + + + + + + Deprecated. + + + + + + + + + + + Deprecated. + + false + + + + + + + + Deprecated. + + + + + ZoomIn + + + + + Small + + + + + ForceDock + + + + + AutoHide + + + + + Task + + + + + CantGetFocus + + + + + + + + + + + Deprecated. + + + + + + + + + MBA + Specifies the properties of window containers for docked windows. + + + + + + + + MBA + Deprecated. + + + + + + + + + + + MBA + Deprecated. + + + + + + + + MBA + Deprecated. + + + + + Stick/Hidden + + + + + Floating/Hidden + + + + + Stick/Visible + + + + + Floating/Visible + + + + + + + + Deprecated. + + + + + + + + + Deprecated. + + + + + + + + + Font antialiasing properties + + + + Specifies font antialiasing properties + + + true + + + + Specifies an additional limit if Font Antialiasing is enabled. Fonts that are smaller than the specified limit are not anti-aliased. + + + 8 + + + + + + MBA + Contains the settings regarding the undo operation in the Office. + + + + + + + MBA + Specifies how many operations can be undone in a row. + + + + + + Specifies the lowest number of undo steps possible. + + + + + Specifies the highest number of undo steps possible. + + + + 100 + + + + + PB + Specifies options related to the setup. + + + + Specifies options related to the installed languages. + + + + + + + Contains the installed Office languages for the menus and dialogs. + + + + + + + AF + Specifies options related to printing. + + + + + MBA + Specifies if printing a document can modify a document due to reformatting + + + false + + + + OS + Contains settings for print specific warnings. + + + + + + + OS + Specifies if a warning should be displayed in case the printout requires a specific paper size + + + false + + + + + + + OS + Specifies if a warning should be displayed in case the printout requires a specific paper orientation + + + false + + + + + + + OS + Specifies if a warning should be displayed in case the printer defined in the document was not found + + + false + + + + + AF + Specifies if a warning should be displayed in case the printout contains transparent objects. + + + true + + + + + AF + Specifies the options related to printing. + + + + Specifies the options related to printing. + + + + + AF + Indicates whether to ignore transparency for the output of objects. + + + false + + + + + AF + Specifies type of transparency reduction: 0 - Automatically determine reduction, 1 - Always disabled. + + + 0 + + + + + AF + Indicates whether to reduce memory usage for output of gradients by limiting the number of gradient steps. + + + false + + + + + AF + Specifies type of gradient reduction: 0 - reduce the number of stripes, 1 - reduce to color. + + + 0 + + + + + AF + Specifies the maximum number stripes used for output of gradients. + + + 64 + + + + + AF + Indicates whether to reduce the memory usage of bitmaps for print process by limiting the resolution. + + + false + + + + + AF + Specifies type of bitmap reduction: 0 - Automatically determine optimal resolution, 1 - Use original resolution, 2 - User defined resolution. + + + 1 + + + + + AF + Specifies resolution of reduced bitmaps: 0 - 72DPI, 1 - 96DPI, 2 - 150DPI, 3 - 200DPI, 4 - 300DPI, 5 - 600DPI. + + + 3 + + + + + AF + Indicates whether to reduce the resolution of automatically created substitution bitmaps of transparent objects. + + + true + + + + + AF + Indicates whether to create only grayscale output of all objects. + + + false + - + + + Specifies the options for printing to a file. + + + + + + AF + Indicates whether to ignore transparency for the output of objects. + + + false + + + + + AF + Indicates the type of transparency reduction: 0 - Automatically determine reduction, 1 - Always disabled. + + + 0 + + + + + AF + Indicates whether to reduce memory usage for output of gradients by limiting the number of gradient steps. + + + false + + + + + AF + Indicates the type of gradient reduction: 0 - Reduce the number of stripes, 1 - Reduce to color. + + + 0 + + + + + AF + Specifies the maximum number stripes used for output of gradients. + + + 64 + + + + + AF + Indicates whether to reduce the memory usage of bitmaps for the print process by limiting the resolution. + + + false + + + + + AF + Specifies the type of bitmap reduction: 0 - Automatically determine optimal resolution, 1 - Use original resolution, 2 - User defined resolution. + + + 1 + + + + + AF + Specifies the resolution of reduced bitmaps: 0 - 72DPI, 1 - 96DPI, 2 - 150DPI, 3 - 200DPI, 4 - 300DPI, 5 - 600DPI. + + + 3 + + + + + AF + Indicates whether to reduce the resolution of automatically created substitution bitmaps of transparent objects. + + + true + + + + + AF + Indicates whether to create only grayscale output of all objects. + + + false + + + + + + + + MBA + Lists open documents or windows. + + + + + + + + MBA + Lists open documents or windows. + + + + + + OS + Contains settings specifying if a XML package is added to the applications binary files. + + + + + + + OS + Defines if a XML package is added to the Writer binary files. + + + + + + + + OS + Defines if a XML package is added to the Calc binary files. + + + + + + + + OS + Defines if a XML package is added to the Impress binary files. + + + + + + + + OS + Defines if a XML package is added to the Draw binary files. + + + + + + FS + Contains settings that specify the common help settings. + + + + ABI + Determines wether basic help should be shown. + + true + + + + ABI + Determines the locale for the help pages. + + + + + + + ABI + Determines the operating system on which the help system is displayed. + + + + + + + + + MBA + Activates the Tip help. + + + true + + + + + + MBA + Activates the Extended help. + + + false + + + + ABI + Specifies the name of the stylesheet used to display help content. + + Default + + + + MBA + Specifies the properties of the HelpAgent. + + + + Specifies whether the HelpAgent is enabled. + + + true + + + + Specifies the time-out value in seconds after which the HelpAgent is closed automatically if ignored by the user. + + + 30 + + + + Specifies how often the user must ignore a given HelpAgent topic until it is disregarded in the future (any requests for this topic will be dropped silently). + + + 3 + + + + Contains the help URLs which have been ignored at least once by the user, together with a counter of how often they have been ignored. + + + + + + + PL + Contains settings for the start center. + + + + Contains a string specifying the URL to be browsed for additional features (e.g. extensions) + + + + + + Contains a string specifying the URL to be browsed for information about the product + + + + + + Contains a string specifying the URL to be browsed for additional template documents + + + + + + + FS + Contains various settings regarding the product registration feature. + + + + Contains a string specifying the URL with placeholders to be used for online registration. + + + + + + + Contains a string specifying the real URL to be used for online registration. + + + + + + + Contains a string representation of the date on which the user receives a reminder (e.g. "13.02.2002"). + + + + + + + Contains the number used internally to determine when the dialog should be started. + + 1 + + + + Contains a Boolean that specifies if the "Registration..." menu item is available. + + true + + + + CD/OBR + Current product ID. + This data is saved in a dedicated file since OOo 3.0 FCS + + + + + CD/OBR + Specifies product specific IDs and associated instance UUIDs + This data is saved in a dedicated file since OOo 3.0 FCS + + + + + + + JL + Contains Java related settings. + + + + Contains Applet related settings. + + + + + + + Enables/disables Java applets in Office documents. + + + false + + + + + + AF + Specifies the options related to the vectorization of bitmaps. + + + + + + + AF + Specifies the number of colors that are used to create a vector graphic in Draw/Impress [UNIT=count]. + + + + + + Specifies that the lowest number that can be used to create a vector graphic is 8. + + + + + Specifies that the lowest number that can be used to create a vector graphic is 32. + + + + 8 + + + + + + + AF + Specifies the number of pixels that you want to combine as a single pixel when creating a vector graphic. + + + + + + Specifies the minimum value to reduce point is 0 pixels. + + + + + Specifies the maximum value to reduce point is 32 pixels. + + + + 0 + + + + + + + AF + Indicates whether to create a tiled background before vectorizing. + + + false + + + + + + + AF + Specifies the extent of background tiles that are used for vectorizing [UNIT=pixel]. + + + + + + Specifies that the minimum extent is 8 pixels. + + + + + Specifies that the maximum extent is 128 pixels. + + + + 32 + + + + + AF + Specifies the options for images. + + + + + Specifies the color options for images. + + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 256 + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 16 + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 10 + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 10 + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 4500 + + + + + + + + AF + Deprecated. + + + true + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 50 + + + + Specifies the RGB color options for images. + + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 10 + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 10 + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 10 + + + + + + Specifies the effects options for images. + + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 4 + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 4 + + + + + + + + AF + Deprecated. + + + + + + Deprecated + + + + + Deprecated + + + + + Deprecated + + + + + Deprecated + + + + 2 + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 10 + + + + + + + + AF + Deprecated. + + + false + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 4 + + + + + + + + AF + Deprecated. + + + + + + Deprecated. + + + + + Deprecated. + + + + 4 + + + + + + + + + AF + Deprecated. + + + + + + Deprecated + + + + + Deprecated + + + + + Deprecated + + + + + Deprecated + + + + 2 + + + + + + + + AF + Deprecated. + + + + + + Specifies that the minimum intensity is 0. + + + + + Specifies that the maximum intensity is 100. + + + + 10 + + + + + + NN + Specifies settings for the date formats used. + + + + + + + NN + Specifies the first year that can be entered using two-digit-year date formats. + + + 1930 + + + + + SJ / OS / KA + Specifies default settings of Microsoft-, Graphic- and HTML filters. + + + + SJ + Specifies default settings of Microsoft filters. + + + + Specifies default settings of Microsoft import filters. + + + + Specifies if convertible MathType OLE objects are converted into Math objects. + + false + + + + Specifies if convertible WinWord OLE objects are converted into Writer objects. + + false + + + + Specifies if convertible Excel OLE objects are converted into Calc objects. + + false + + + + Specifies if convertible PowerPoint OLE objects are converted into Impress objects. + + false + + + + Flag to control use of enhanced fields. + + true + + + + + Specifies default settings of Microsoft export filters. + + + + Specifies if embedded Math objects are converted into MathType objects. + + false + + + + Specifies if embedded Writer objects are converted into WinWord objects. + + false + + + + Specifies if embedded Calc objects are converted into Excel objects. + + false + + + + Specifies if embedded Impress objects are converted into PowerPoint objects. + + false + + + + SJ + Specifies if previews are created when saving PowerPoint documents. + + true + + + + SJ + Specifies if previews are created when saving Excel documents. + + false + + + + SJ + Specifies if previews are created when saving Word documents. + + false + + + + + + SJ + Specifies default settings of graphic import and export dialogs. + + + + Specifies default settings of graphic import dialogs. + + + + Specifies default settings of the PCD - Photo CD Base import dialog. + + + + + + Specifies import resolution of PCD graphics. + + + + + + PCD-Base16, 192*128 PCD graphic. + + + + + PCD-Base4, 384*256 PCD graphic. + + + + + PCD-Base, 768*512 PCD graphic. + + + + 2 + + + + + + Specifies default settings of graphic export dialogs. + + + + Specifies default settings of the Windows Bitmap export dialog. + + + + + + + Specifies usable export modes. + + + + + + Original size + + + + + Logical size (dpi/pixel ratio) + + + + + Given size + + + + 0 + + + + + + + Specifies resolution which is to be used if export mode is 1. [UNIT=dpi] + + + + + + 75 + + + + + 150 + + + + + 300 + + + + + 600 + + + + 75 + + + + + + Specifies the number of colors that are to be used for the export. + + + + + + Original + + + + + 1 bit, 1 bit threshold + + + + + 1 bit, 1 bit dithered + + + + + 4 bit, 4 bit grayscale + + + + + 4 bit, 4 bit color palette + + + + + 8 bit, 8 bit grayscale color + + + + + 8 bit, 8 bit color palette + + + + + 24 bit, 24 bit true color + + + + 0 + + + + + + + Specifies if Run-Length-Encoding should be used in the export. + + + true + + + + Specifies the logical size of a graphic. [UNIT=1/100 mm]. + + + + + + + + + + Specifies default settings of the EPS - Encapsulated Postscript export dialog. + + + + Specifies if a preview graphic should be exported together with the Encapsulated PostScript file. Due to the fact that most programs can't render eps graphics, it is useful to provide a preview that can be displayed as replacement. The preview graphic will also be printed if the printer is not capable of Postscript. + + + + + + None + + + + + TIFF + + + + + Interchange (EPSI) - 1 bit color resolution + + + + + TIFF and EPSI + + + + 0 + + + + Specifies the PostScript version that has to be used for the EPS export. Because not every PostScript printer is capable of version 2 PostScript, it is sometimes necessary to create version 1 PostScript graphics. PostScript Level 1 does not support color and bitmap compression. + + + + + + Version 1 PostScript + + + + + Version 2 PostScript + + + + 2 + + + + Specifies if color or grayscale format is used for the EPS export. This option is not available for version 1 PostScript files. + + + + + + Color format + + + + + Grayscale format + + + + 2 + + + + Specifies if bitmaps are exported by using the LZW (Lempel - Ziv - Welch) compression algorithm. Compression is only available for level 2 PostScript files. + + + + + + LZW compression + + + + + No compression + + + + 2 + + + + Specifies if glyph outlines are exported. They produce the highest quality and it is the only possible way to create EPS files that are CJK compliant. Not using glyphs will produce smaller files, but it might lead to problems if not all fonts are available during printing. + + + + + + Glyph outlines + + + + + No glyph outlines + + + + 0 + + + + + Specifies default settings of the GIF - Graphics Interchange export dialog. + + + + + + + Specifies if graphics should be exported using interlace. It is recommended for big pictures to activate interlace, so the content can be displayed immediately when loading the picture. + + + + + Deactivate + + + + + Activate + + + + 1 + + + + + + + Specifies if the graphic background is stored as transparent. + + + + + No transparency + + + + + Transparency + + + + 1 + + + + + Specifies default settings of the JPEG - Joint Photographic Experts Group export dialog. + + + + + + + Specifies quality of the JPG export. A higher value results in higher quality and file size. + + + + + Represents lowest value that can be used. The lower the value, the less good is the compression quality and the bigger is be the file size. + + + + + Represents highest value that can be used. The higher the value, the better is the compression quality and the smaller is the file size. + + + + 75 + + + + + + + Specifies if graphics are exported using true color or grayscale. + + + + + True colors + + + + + Grayscale + + + + 0 + + + + + Specifies if graphics are exported with the original- or selected size. + + + + + + + Specifies if graphics are exported with the original- or selected size. + + + + + Original size + + + + + Given size + + + + 0 + + + + Specifies the logical size of a graphic. [UNIT=1/100 mm]. + + + + + + + + Specifies default settings of the PCT - Mac Pict export dialog. + + + + + + + Specifies if graphics are exported with original- or selected size. + + + + + Original size + + + + + Given size + + + + 0 + + + + Specifies the logical size of a graphic. [UNIT=1/100 mm]. + + + + + + + + Specifies default settings of the PBM - Portable Bitmap export dialog. + + + + + + + Specifies if graphics are exported to binary- or ASCII format. + + + + + Binary + + + + + ASCII + + + + 1 + + + + + Specifies default settings of the PGM - Portable Graymap export dialog. + + + + + + + Specifies if graphics are exported to a binary- or ASCII format. + + + + + Binary + + + + + ASCII + + + + 1 + + + + + Specifies default settings of the PPM - Portable Pixelmap export dialog. + + + + + + + Specifies if graphics are exported to a binary- or ASCII format. + + + + + Binary + + + + + ASCII + + + + 1 + + + + + Specifies default settings of the SVM - StarView Meta File export dialog. + + + + + + + Specifies if graphics should be exported with the original- or selected size. + + + + + Original size + + + + + Given size + + + + 0 + + + + Specifies the logical size of a graphic. [UNIT=1/100 mm]. + + + + + + + + Specifies default settings of the WMF - Windows Metafile export dialog. + + + + + + + Specifies if graphics should be exported with the original- or selected size. + + + + + Original size + + + + + Given size + + + + 0 + + + + Specifies the logical size of a graphic. [UNIT=1/100 mm]. + + + + + + + + Specifies default settings of the EMF - Enhanced Metafile export dialog. + + + + + + + Specifies if graphics should be exported with the original- or selected size. + + + + + Original size + + + + + Given size + + + + 0 + + + + Specifies the logical size of a graphic. [UNIT=1/100 mm]. + + + + + + + + Specifies default settings of the PNG - Portable Network Graphic export dialog. + + + + + + + Specifies export compression settings which ranges from 0 (no compression) to 9 (maximum compression). The calculating time increases with an ascending compression value. + + + + + Represents lowest value that can be used. The lower the value, the lower the compression quality and the larger the file size. + + + + + Represents the highest value that can be used. The higher the value, the higher the compression quality and the smaller the file size. + + + + 6 + + + + + + + Specifies if graphics should be exported using interlace. It is recommended for big pictures to activate interlace, so the content can be displayed immediately when loading the picture. + + + + + Deactivate interlace mode + + + + + Activate interlace mode + + + + 1 + + + + + + + OS + Contains settings for HTML import/export. + + + + Contains settings for HTML import. + + + + + ER + Specifies if numbers should be parsed according to the en-US locale instead of the user's locale. + + + false + + + + + + + OS + Specifies if unknown tags should be imported as fields. + + + false + + + + + + + OS + Specifies if font settings should be ignored when importing. + + + false + + + + Specifies font size for HTML. + + + + + + + OS + Specifies font size for HTML as Token Font 1. + + + 7 + + + + + + + OS + Specifies font size for HTML as Token Font 2. + + + 10 + + + + + + + OS + Specifies font size for HTML as Token Font 3. + + + 12 + + + + + + + OS + Specifies font size for HTML as Token Font 4. + + + 14 + + + + + + + OS + Specifies font size for HTML as Token Font 5. + + + 18 + + + + + + + OS + Specifies font size for HTML as Token Font 6. + + + 24 + + + + + + + OS + Specifies font size for HTML as Token Font 7. + + + 36 + + + + + + Contains settings for HTML export. + + + + + + + OS + Specifies the browser for which the HTML export should be optimized + + + + + + Html 3.2 + + + + + MSIE 4.0 + + + + + Netscape 3.0 + + + + + Writer + + + + + Netscape 4.0 + + + + 4 + + + + + + + OS + Specifies if Office Basic instructions are considered when exporting in HTML format. + + + false + + + + + + + OS + Specifies if the print layout of the current document should also be exported. + + + false + + + + + + + OS + Specifies if graphics are copied to the Internet server when uploading via FTP. + + + true + + + + + + + OS + Specifies if a warning should be displayed to point out that the available Basic macros will be lost when exporting in HTML format. + + + true + + + + + OS + Specifies the mimetype for the text encoding. + + + + + + + + + KA + Specifies default settings of PDF export dialog. + + + + + Specifies default settings of PDF export dialog. + + + + Use following properties instead: UseLosslessCompression, Quality, UseResolutionReduction, ResolutionReduction + SJ + Deprecated. + + 1 + + + + SJ + Specifies if graphics are exported to PDF using a lossless compression eg. PNG or if they are compressed using the JPEG format. + + false + + + + SJ + Specifies quality of the JPG export. A higher value results in higher quality and file size. + + + + + Represents lowest value that can be used. The lower the value, the less good is the compression quality and the bigger is be the file size. + + + + + Represents highest value that can be used. The higher the value, the better is the compression quality and the smaller is the file size. + + + + 90 + + + + SJ + Specifies if the resolution of each image is reduced to the resolution specified by the property MaxImageResolution. + + false + + + + If the property ReduceImageResolution is set to true all images will be reduced to the given value in DPI. + + + + + 75 + + + + + 150 + + + + + 300 + + + + + 600 + + + + + 1200 + + + + 300 + + + + SJ + Determines if PDF are created by using special tags also known as Tagged PDF. + + false + + + + SJ + Specifies if notes are exported to PDF. + + false + + + + PL + Specifies if bookmarks are exported to PDF. + + true + + + + PL + Specifies how many bookmark levels should be opened in the reader application when the PDF gets opened. + + -1 + + + + SJ + Specifies if notes pages are exported to PDF. (Notes pages are available in Impress documents only). + + false + + + + SJ + Specifies slide transitions are exported to PDF. This option is active only if storing Impress documents. + + true + + + + pl + Specifies whether form fields are exported as widgets or only their fixed print representation is exported. + + true + + + + Specifies the submitted format of a PDF form. + + + + + Specifies that forms type FDF is used. + + + + + Specifies that forms type PDF is used. + + + + + Specifies that forms type HTML is used. + + + + + Specifies that forms type XML is used. + + + + 0 + + + + FME + Specifies that automatically inserted empty pages are suppressed. This option is active only if storing Writer documents. + + true + + + + PL + Specifies that a stream is inserted to the PDF file which contains the original document for archiving purposes. + + false + + + + beppec56 + Specifies whether to hide the PDF viewer menubar when the document is active. + + false + + + + beppec56 + Specifies whether to hide the PDF viewer toolbar when the document is active. + + false + + + + beppec56 + Specifies whether to hide the PDF viewer controls when the document is active. + + false + + + + beppec56 + Specifies that the PDF viewer window is opened full screen when the document is opened. + + false + + + + beppec56 + Specifies that the PDF viewer window is centered to the screen when the PDF document is opened. + + false + + + + beppec56 + Specifies that the PDF viewer window is opened full screen, on top of all windows.. + + false + + + + beppec56 + Specifies that the title of the document, if present in the document properties, is displayed in the PDF viewer window title bar. + + true + + + + beppec56 + Specifies how the PDF document should be displayed when opened. + + + + + Select the default viewer mode, neither outlines or thumbnails. + + + + + The document is opened with outline pane opened + + + + + The document is opened with thumbnail pane opened + + + + 0 + + + + beppec56 + Specifies the action to be performed when the PDF document is opened. + + + + + Opens with default zoom magnification. + + + + + Opens magnified to fit the entire page within the window. + + + + + Opens magnified to fit the entire page width within the window. + + + + + Opens magnified to fit the entire width of its boundig box within the window (cuts out margins). + + + + + Opens with the zoom level specified in the Zoom property. + + + + 0 + + + + pl + specifies the zoom level a PDF document is opened with. Only valid if "Magnification" is set to "4". + + 100 + + + + pl + Specifies the page on which a PDF document should be opened in the viewer application. + + 1 + + + + beppec56 + Specifies the page layout to be used when the document is opened. + + + + + Display the pages according to the reader configuration. + + + + + Display one page at a time. + + + + + Display the pages in one column. + + + + + Display the pages in two columns odd pages on the right, to have the odd pages on the left the FirstPageOnLeft property should be used as well. + + + + 0 + + + + beppec56 + Used with the value 3 of the PageLayout property above, true if the first page (odd) should be on the left side of the screen. + + false + + + + + beppec56 + Specifies what printing is allowed. + + + + + The document cannot be printed. + + + + + The document can be printed at low resolution only. + + + + + The document can be printed at maximum resolution. + + + + 2 + + + + beppec56 + Specifies the change allowed to the document. + + + + + The document cannot be changed. + + + + + Inserting deleting and rotating pages is allowed. + + + + + Filling of form field is allowed. + + + + + Both filling of form field and commenting is allowed. + + + + + All the changes of the previous selections are permitted, with the only exclusion of page extraction (copy). + + + + 4 + + + + beppec56 + Specifies that the pages and the document content can be extracted to be used in other documents (copy and paste). + + true + + + + beppec56 + Specifies that the document content can be extracted to be used in accessibility applications. + + true + + + + + + beppec56 + Specifies the version of PDF to emit. + + + + + PDF 1.4 (default selection). + + + + + PDF/A-1 (ISO 19005-1:2005) + + + + 0 + + + + + + beppec56 + Specifies that the file system related hyperlinks (file:// protocol) present in the document will be exported as relative to the source document location. + + false + + + + beppec56 + Specifies the way the exported PDF will be viewed (experienced) by the user. + + + + + Specifies that the PDF will be exported with all the links external to the document treated as URI. This is the Default + + + + + Specifies that the PDF will be exported in order to be viewed through a PDF reader application only. Valid only if not exporting to PDF/A-1 (e.g. SelectPdfVersion not set to 1). + + + + + Specifies that the PDF will be exported in order to be viewed through an Internet browser, using the PDF plug-in provided with it. The bookmark of the URI will be rendered compatible with the target bookmark generated with OOo PDF Export feature (see ExportBookmarksToPDFDestination, below). + + + + 0 + + + + beppec56 + Specifies that the target documents with .od[tpgs] extension, will have that extension changed to .pdf when the link is exported to PDF. The source document remains untouched. + + false + + + + beppec56 + Specifies that the bookmarks contained in the source OpenOffice.org file should be exported to the PDF file as Named Destination (see PDF 1.4 section 8.2.1). + + false + + + + + + + + MBA + Determines the miscellaneous entries for the common group. + + + + AS + Determines the maximum count of documents, which are allowed to be open at the same time. NIL will be interpreted as infinite! + + + + + + + + PB + Enables/Disables Plugins. + + + true + + + + FS + Determines if the system's file and folder pickers should be used. If false, the proprietary file/folder picker implementations will be used. Relevant on platforms where file/folder picker integration is implemented. + + true + + + + MAV + Allows to specify whether the OOo document file locking mechanics should use the system file locking. + + true + + + + MAV + Allows to specify whether the OOo document file locking mechanics should use the lock file for locking. + + true + + + + PL + Determines if the system's print dialog should be used. If false, the platform independent print dialog implementation will be used. Relevant on platforms where print dialog integration is implemented. + + false + + + + + MBA + Specifies which size of the symbols is used for the toolbars. + + + + + 16x16 pixel icons + + + + + 32x32 pixel icons + + + + 0 + + + + + kendy + Specifies which style of the symbols is used for the toolbars, menus, etc. + + + + + Automatic, chosen according to the desktop + + + + + Default - the OpenOffice.org default theme + + + + + HiContrast + + + + + Industrial + + + + + Crystal - the KDE default theme + + + + + Tango - the Gnome default theme + + + + + Classic - the OpenOffice.org 2.0 default theme + + + + auto + + + + + MBA + Specifies which button style the toolbars should use. + + + + + 3D style + + + + + Flat style + + + + 1 + + + + FS + Enables/Disables the usage of AutoPilots for form controls. + + true + + + + MBA + Specifies if the office has never before been started. + + + true + + + + + FS + contains settings for the form layer of the applications. + + + + specifies certain default layout settings for form controls. All those settings can be overruled in concrete documents, they specify creation-time defaults only. + + + + specifies certain default layout settings for form controls in text documents + + + + + specifies certain default layout settings for form controls in web pages + + + + + specifies certain default layout settings for form controls in spreadsheet documents + + + + + specifies certain default layout settings for form controls in drawing documents + + + + + specifies certain default layout settings for form controls in presentation documents + + + + + specifies certain default layout settings for form controls in XML form documents + + + + + specifies certain default layout settings for form controls in database form documents + + + + + specifies certain default layout settings for form controls in database text report documents. + + + + + + specifies settings for the property browser used for forms and form controls. + + + + FS + Enables or disables the property browser's access to form/control properties which are not officially supported. + + false + + + + FS + Enables or disables a help section at the bottom of the property browser, which shows the help of the currently active property. + + false + + + + + + OS + Contains layout specific settings for Asian languages. + + + + + + + OS + Determines the kerning of western text and/or punctuation inside of Asian text. + + + true + + + + + + + OS + Determines the type of character distance compression in Asian text: 0 - no compression; 1 - compress punctuation only; 2 - compress interpunction an japanese kana. + + + 0 + + + + OS + Contains the characters at which lines are not allowed to begin or to end. For each locale there is a separate entry with the locale as its node name. + + + + + + + OS / PB + Contains all options for search. + + + + + + + PB + Specifies search for whole words only. + + false + + + + + + + PB + Specifies search backwards. + + false + + + + + + + PB + Specifies search with the use of regular expressions. + + false + + + + + + + PB + Specifies search for styles only. + + false + + + + + + + PB + Specifies search with similarity. + + false + + + + + + + PB + Specifies search as case sensitive. + + false + + + + + + + PB + Specifies search with the use of Asian options. + + false + + + + + OS + Specifies the divider label in case of a component-based search extension. + + + + + + OS + Specifies the label of the first component-based search command. + + + + + + OS + Specifies the label of the second component-based search command. + + + + + + mod + Specifies if search includes notes(SwPostItFields) + + false + + + + OS + Contains search options for the Japanese language. + + + + + + + OS + Does not distinguish between full-width and half-width characters. + + true + + + + + + + OS + Does not distinguish between hiragana and katakana characters. + + true + + + + + + + OS + Specifies search without distinguishing between characters with diphthongs and double consonants and plain characters. + + true + + + + + + + OS + Specifies search without distinguishing between minus signs, dashes, and long vowel sounds. + + true + + + + + + + OS + Specifies search without distinguishing between repeat character marks. + + true + + + + + + + OS + Specifies search without distinguishing between standard and nonstandard ideography. + + true + + + + + + + OS + Specifies search without distinguishing between standard and nonstandard ideography. + + true + + + + + + + OS + Specifies search without distinguishing between 'Di' and 'Zi' or 'Du' and 'Zu'. + + true + + + + + + + OS + Specifies search without distinguishing between 'Ba' and 'Va' or 'Ha' and 'Fa'. + + true + + + + + + + OS + Specifies search without distinguishing between 'Tsi', 'Thi' and 'Chi' or 'Dhi' and 'Zi'. + + true + + + + + + + OS + Specifies search without distinguishing between 'Hyu' and 'Fyu' or 'Byu' and 'Vyu'. + + true + + + + + + + OS + Specifies search without distinguishing between 'Se' and 'She' or 'Ze' and 'Je'. + + true + + + + + + + OS + Specifies search without distinguishing between 'Ia' and 'Iya'. + + true + + + + + + + OS + Specifies search without distinguishing between 'Ki' and 'Ku'. + + true + + + + + + + OS + Specifies search without distinguishing between punctuation characters. + + true + + + + + + + OS + Specifies search without distinguishing between characters used as blank spaces, such as full-width spaces, half-width spaces, and tabs. + + true + + + + + + + OS + Specifies search without distinguishing between prolonged sound marks. + + true + + + + + + + OS + Specifies search without distinguishing between normal dots and middle dots. + + true + + + + + + OS + Specifies settings for the accessibility options. + + + + FS + Enables the automatic detection of a high contrast mode set for your desktop. Some OS' do not provide this option explicitly, but allow the user to choose a color scheme that is HC-compliant implicitly, which is recognized if the option is set. + + + true + + + + OS + Enables the use of high contrast colors, instead of displaying the normal/original WYSIWYG colors. + + + true + + + + OS + Enables or disables the automatic time out of help tips. You can specify a duration (n) of 1 to 99 seconds. If this option is disabled, press the Esc key to dismiss the help tip. + + + true + + + + OS + Enables or disables the automatic time out of help tips. You can specify a duration (n) of 1 to 99 seconds. If this option is disabled, press the Esc key to dismiss the help tip. + + + + + + Specifies the number of seconds to wait before displaying a help tip. + + + + + Specifies the number of seconds to display a help tip. + + + + 4 + + + + AF + Indicates whether to allow the graphical animation in all SO/OO applications (i.e. animated GIFs and objects in Impress during presentation, animated graphical previews (Gallery, Insert-Graphics-From File, Animation Tool in Impress.) + + + true + + + + AF + Indicates whether to allow all textual animation like blinking and scrolling in all SO/OO applications. + + + true + + + + OS + Overrides all text color attributes set in a SO/OO document for display only. + + + false + + + + OS + Allows the user to change the UI font to the system default. + + + true + + + + OS + Indicates whether the cursor is displayed in read-only texts. + + + false + + + + + Replaced by org.openoffice.Office.Embedding/ObjectNames. + MAV + Deprecated + + + + + Without replacement. + OBR + Specifies external helper applications / protocol handlers. + + + + + OBR + Specifies an external mail application to be used for Send as email. + + + + Without replacement. + Indicates if the mail application in the OS specific user settings should be used. + + + + + Specifies the external mail application to be used. + + + + + + Without replacement. + Specifies the default external mail application. + + Mozilla 1.0 - 1.2 + + + + Without replacement. + Contains a set of supported command line profiles. + + + + + + OS + Contains various language/localization specific settings. + + + + PL + Contains settings for (language/localization specific) input methods. + + + + Controls the behavior of the IIIMP status window on Unix. If true, the status window is always displayed. If false, the status window is never displayed. If nil (the default), the status window is displayed depending on the current locale. + + + + + + Contains settings for the Asian languages (Chinese, Japanese, Korean,...) layout. + + + + + Specifies, whether CJK font settings are available (true) or not (false). + + false + + + + + Specifies, whether vertical text is available (true) or not (false). + + false + + + + + Specifies, whether Asian typography options like compression and forbidden characters are available (true) or not (false). + + false + + + + + Specifies, whether Japanese find options are selectable for search and replace (true) or not (false). + + false + + + + + Specifies whether Rubys are available (true) or not (false). + + false + + + + + Specifies whether case mapping to half and full width, hiragana and katagana are available (true) or not (false). + + false + + + + + Specifies whether writing in double lines is available (true) or not (false). + + false + + + + + Specifies whether emphasis marks are available (true) or not (false). + + false + + + + + Specifies whether vertical call out objects are available (true) or not (false). + + false + + + + + Contains settings for the languages with complex text layout (Hebrew, Arabic, Thai,...). + + + + + Specifies whether CTL font settings are available (true) or not (false). + + false + + + + + Specifies whether CTL strings are checked for the correct input sequence(true) or not (false). + + false + + + + + Specifies whether CTL strings are checked restricted for the correct input sequence(true) or not (false). Is only effective when CTLSequenceChecking is true. + + false + + + + + Specifies whether CTL input sequences are corrected while typing. Is only effective when CTLSequenceChecking is true. + + false + + + + + Specifies the type of text cursor movement (logical (0) or visual (1)) within mixed text (RTL and LTR). + + 0 + + + + + Specifies the type of numerals (Arabic (0), Hindi (1), system settings (2) or Context(3)) is used per default in all applications. + + 0 + + + + SSA + Specifies whether the whole user interface (UI) will be mirrored. If true, the UI will be right-to-left. If false, the UI will be left-to-right. If nil (the default), the UI will be mirrored depending on the office locale. + + + + + + + Use cfg package Jobs instead of this. + AS + Uses cfg package Jobs instead of this component. + + + + Use cfg package Jobs instead of this. + Uses cfg package Jobs instead of this component. + + + + + Use cfg package Jobs instead of this. + Uses cfg package Jobs instead of this component. + + + + + + FME + Contains settings for smart tags. + + + + FME + Contains Writer specific settings for smart tags. + + + + FME + Specifies whether smart tag recognization is enabled. + + true + + + + FME + A list of excluded smart tag types. + + + + + From cae80de04529d2d44c84b5f8950f92b6eb737e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Wed, 23 Sep 2009 08:51:57 +0000 Subject: [PATCH 016/117] #b6875455# make reference device usage for form controls depend on a configuration setting (per document type) --- svx/inc/svx/fmmodel.hxx | 10 +++++--- svx/source/form/fmcontrollayout.cxx | 10 ++++++++ svx/source/form/fmmodel.cxx | 40 +++++++++++++++++++---------- svx/source/form/fmobj.cxx | 4 ++- svx/source/inc/fmcontrollayout.hxx | 5 ++++ 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/svx/inc/svx/fmmodel.hxx b/svx/inc/svx/fmmodel.hxx index 2f61967bc3ac..f831729b5006 100644 --- a/svx/inc/svx/fmmodel.hxx +++ b/svx/inc/svx/fmmodel.hxx @@ -89,14 +89,16 @@ public: /** check whether the OpenInDesignMode has been set explicitly or been loaded () or if it still has the default value from construction () */ - sal_Bool OpenInDesignModeIsDefaulted( ); + sal_Bool OpenInDesignModeIsDefaulted(); -//#if 0 // _SOLAR__PRIVATE - void implSetOpenInDesignMode( sal_Bool _bOpenDesignMode, sal_Bool _bForce ); + /** determines whether form controls should use the SdrModel's reference device for text rendering + */ + sal_Bool ControlsUseRefDevice() const; FmXUndoEnvironment& GetUndoEnv(); -//#endif +private: + void implSetOpenInDesignMode( sal_Bool _bOpenDesignMode, sal_Bool _bForce ); }; #endif // _FM_FMMODEL_HXX diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx index 92e987db796c..8cf6ccd2a84d 100644 --- a/svx/source/form/fmcontrollayout.cxx +++ b/svx/source/form/fmcontrollayout.cxx @@ -141,6 +141,16 @@ namespace svxform return bDynamicBorderColor; } + //-------------------------------------------------------------------- + bool ControlLayouter::useDocumentReferenceDevice( DocumentType _eDocType ) + { + OConfigurationNode aConfig = getLayoutSettings( _eDocType ); + Any aUseRefDevice = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentTextMetrics" ) ) ); + bool bUseRefDevice = false; + OSL_VERIFY( aUseRefDevice >>= bUseRefDevice ); + return bUseRefDevice; + } + //........................................................................ } // namespace svxform //........................................................................ diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx index 09008ae220b9..15932d4d93cc 100644 --- a/svx/source/form/fmmodel.cxx +++ b/svx/source/form/fmmodel.cxx @@ -30,30 +30,27 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + +#include "fmundo.hxx" +#include "fmdocumentclassification.hxx" +#include "fmcontrollayout.hxx" + +#include +#include +#include #include #ifndef SVX_LIGHT -#ifndef _SFX_OBJSH_HXX //autogen #include -#endif #else class SfxObjectShell; #endif -#ifndef _FM_FMMODEL_HXX -#include -#endif - -#ifndef _FM_PAGE_HXX -#include -#endif -#include "fmundo.hxx" -#ifndef _SVX_SVDOBJ_HXX -#include -#endif +#include using ::com::sun::star::uno::Reference; using ::com::sun::star::container::XNameContainer; +using namespace svxform; TYPEINIT1(FmFormModel, SdrModel); @@ -62,11 +59,14 @@ struct FmFormModelImplData FmXUndoEnvironment* pUndoEnv; sal_Bool bOpenInDesignIsDefaulted; sal_Bool bMovingPage; + ::boost::optional< sal_Bool > + aControlsUseRefDevice; FmFormModelImplData() :pUndoEnv( NULL ) ,bOpenInDesignIsDefaulted( sal_True ) ,bMovingPage( sal_False ) + ,aControlsUseRefDevice() { } }; @@ -313,6 +313,20 @@ sal_Bool FmFormModel::OpenInDesignModeIsDefaulted( ) } #endif +//------------------------------------------------------------------------ +sal_Bool FmFormModel::ControlsUseRefDevice() const +{ + if ( !m_pImpl->aControlsUseRefDevice ) + { + OSL_PRECOND( m_pObjShell, "FmFormModel::ControlsUseRefDevice: no object shell -> no document -> no document type -> no way!" ); + DocumentType eDocType = eUnknownDocumentType; + if ( m_pObjShell ) + eDocType = DocumentClassification::classifyHostDocument( m_pObjShell->GetModel() ); + m_pImpl->aControlsUseRefDevice.reset( ControlLayouter::useDocumentReferenceDevice( eDocType ) ); + } + return *m_pImpl->aControlsUseRefDevice; +} + //------------------------------------------------------------------------ void FmFormModel::SetAutoControlFocus( sal_Bool _bAutoControlFocus ) { diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 95b0e151e078..b5a055730f71 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -131,8 +131,10 @@ void FmFormObj::ClearObjEnv() void FmFormObj::impl_checkRefDevice_nothrow( bool _force ) { const FmFormModel* pFormModel = PTR_CAST( FmFormModel, GetModel() ); - OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL; + if ( !pFormModel || !pFormModel->ControlsUseRefDevice() ) + return; + OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL; if ( ( m_pLastKnownRefDevice == pCurrentRefDevice ) && !_force ) return; diff --git a/svx/source/inc/fmcontrollayout.hxx b/svx/source/inc/fmcontrollayout.hxx index 1110c274b9f8..c370e8547f0e 100644 --- a/svx/source/inc/fmcontrollayout.hxx +++ b/svx/source/inc/fmcontrollayout.hxx @@ -62,6 +62,11 @@ namespace svxform */ static bool useDynamicBorderColor( DocumentType _eDocType ); + /** determines whether for the given document type, form controls should use the document's reference device + for text rendering + */ + static bool useDocumentReferenceDevice( DocumentType _eDocType ); + private: ControlLayouter(); // never implemented From 906fc07bf29b7e3f12848f9e51d087523200a743 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 23 Sep 2009 11:40:05 +0000 Subject: [PATCH 017/117] add missing Application::Quit bits --- basic/source/classes/sbxmod.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 889426d68d4c..dd5600ed35a0 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -706,6 +706,22 @@ USHORT SbModule::Run( SbMethod* pMeth ) delete pRt; pMOD = pOldMod; + if ( pINST->nCallLvl == 0 && IsVBACompat() ) + { + // VBA always ensure screenupdating is enabled after completing + StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); + if ( pBasic && pBasic->IsDocBasic() ) + { + uno::Any aUnoVar; + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) ); + SbUnoObject* pGlobs = dynamic_cast( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) ); + if ( pGlobs ) + aUnoVar = pGlobs->getUnoAny(); + uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY); + if ( xModel.is() ) + xModel->unlockControllers(); + } + } if( bDelInst ) { // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, @@ -730,6 +746,7 @@ USHORT SbModule::Run( SbMethod* pMeth ) pINST->nCallLvl--; // Call-Level wieder runter StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); } + if( bDelInst ) { // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, From b0465391ff56c5a87b5db2147eff358ebf8d73ed Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 23 Sep 2009 11:48:33 +0000 Subject: [PATCH 018/117] oops, remove last changes ( they are not to do with Application:Quit ) or at least not directly --- basic/source/classes/sbxmod.cxx | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index dd5600ed35a0..889426d68d4c 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -706,22 +706,6 @@ USHORT SbModule::Run( SbMethod* pMeth ) delete pRt; pMOD = pOldMod; - if ( pINST->nCallLvl == 0 && IsVBACompat() ) - { - // VBA always ensure screenupdating is enabled after completing - StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); - if ( pBasic && pBasic->IsDocBasic() ) - { - uno::Any aUnoVar; - ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) ); - SbUnoObject* pGlobs = dynamic_cast( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) ); - if ( pGlobs ) - aUnoVar = pGlobs->getUnoAny(); - uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY); - if ( xModel.is() ) - xModel->unlockControllers(); - } - } if( bDelInst ) { // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, @@ -746,7 +730,6 @@ USHORT SbModule::Run( SbMethod* pMeth ) pINST->nCallLvl--; // Call-Level wieder runter StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); } - if( bDelInst ) { // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, From faef6c92ce013e10eb238cafa47376c35683e698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Wed, 23 Sep 2009 11:54:09 +0000 Subject: [PATCH 019/117] #b6875455# introduce lcl_initializeControlFont: set an explicit font at the control. Previously, we relied on the implicit font used by the underlying VCL controls, which could differ heavily when you changed the platform or even only the desktop theme. Now, we use the default font of the document we live in, taken from the proper style family. --- svx/source/form/formcontrolfactory.cxx | 156 ++++++++++++++++++++----- 1 file changed, 124 insertions(+), 32 deletions(-) diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 50434af4917b..6ffa6775a34c 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -48,10 +48,13 @@ #include #include #include +#include #include #include #include #include +#include +#include /** === end UNO includes === **/ #include @@ -96,6 +99,7 @@ namespace svxform using ::com::sun::star::uno::TypeClass_LONG; using ::com::sun::star::util::XNumberFormats; using ::com::sun::star::util::XNumberFormatTypes; + using ::com::sun::star::awt::FontDescriptor; /** === end UNO using === **/ namespace FormComponentType = ::com::sun::star::form::FormComponentType; namespace ScrollBarOrientation = ::com::sun::star::awt::ScrollBarOrientation; @@ -104,6 +108,8 @@ namespace svxform namespace DataType = ::com::sun::star::sdbc::DataType; namespace ColumnValue = ::com::sun::star::sdbc::ColumnValue; namespace WritingMode2 = ::com::sun::star::text::WritingMode2; + namespace FontEmphasis = ::com::sun::star::text::FontEmphasis; + namespace FontEmphasisMark = ::com::sun::star::awt::FontEmphasisMark; //==================================================================== //= FormControlFactory_Data @@ -426,44 +432,33 @@ namespace svxform NULL }; + //.................................................................... + Reference< XPropertySet > lcl_getDefaultDocumentTextStyle_throw( const Reference< XPropertySet >& _rxModel ) + { + // the style family collection + Reference< XStyleFamiliesSupplier > xSuppStyleFamilies( getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() ), UNO_SET_THROW ); + Reference< XNameAccess > xStyleFamilies( xSuppStyleFamilies->getStyleFamilies(), UNO_SET_THROW ); + + // the names of the family, and the style - depends on the document type we live in + ::rtl::OUString sFamilyName, sStyleName; + if ( !lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName ) ) + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unknown document type!" ) ), NULL ); + + // the concrete style + Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY_THROW ); + return Reference< XPropertySet >( xStyleFamily->getByName( sStyleName ), UNO_QUERY_THROW ); + } + //.................................................................... static void lcl_initializeCharacterAttributes( const Reference< XPropertySet >& _rxModel ) { - // need to initialize the attributes from the "Default" style of the document we live in - try { - // the style family collection - Reference< XStyleFamiliesSupplier > xSuppStyleFamilies = getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() ); - Reference< XNameAccess > xStyleFamilies; - if ( xSuppStyleFamilies.is() ) - xStyleFamilies = xSuppStyleFamilies->getStyleFamilies(); - OSL_ENSURE( xStyleFamilies.is(), "lcl_initializeCharacterAttributes: could not obtain the style families!" ); - if ( !xStyleFamilies.is() ) - return; + Reference< XPropertySet > xStyle( lcl_getDefaultDocumentTextStyle_throw( _rxModel ), UNO_SET_THROW ); - // the names of the family, and the style - depends on the document type we live in - ::rtl::OUString sFamilyName, sStyleName; - bool bKnownDocumentType = lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName ); - OSL_ENSURE( bKnownDocumentType, "lcl_initializeCharacterAttributes: Huh? What document type is this?" ); - if ( !bKnownDocumentType ) - return; - - // the concrete style - Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY ); - Reference< XPropertySet > xStyle; - if ( xStyleFamily.is() ) - xStyleFamily->getByName( sStyleName ) >>= xStyle; - OSL_ENSURE( xStyle.is(), "lcl_initializeCharacterAttributes: could not retrieve the style!" ); - if ( !xStyle.is() ) - return; - - // transfer all properties which are described by the com.sun.star.style. - Reference< XPropertySetInfo > xSourcePropInfo( xStyle->getPropertySetInfo() ); - Reference< XPropertySetInfo > xDestPropInfo( _rxModel->getPropertySetInfo() ); - OSL_ENSURE( xSourcePropInfo.is() && xDestPropInfo.is(), "lcl_initializeCharacterAttributes: no property set info!" ); - if ( !xSourcePropInfo.is() || !xDestPropInfo.is() ) - return; + // transfer all properties which are described by the style + Reference< XPropertySetInfo > xSourcePropInfo( xStyle->getPropertySetInfo(), UNO_SET_THROW ); + Reference< XPropertySetInfo > xDestPropInfo( _rxModel->getPropertySetInfo(), UNO_SET_THROW ); ::rtl::OUString sPropertyName; const sal_Char** pCharacterProperty = aCharacterAndParagraphProperties; @@ -482,6 +477,99 @@ namespace svxform DBG_UNHANDLED_EXCEPTION(); } } + + //.................................................................... + /// translates a css.text.FontEmphasis into a css.awt.FontEmphasisMark + Any lcl_translateFontEmphasis( const Any& _rTextFontEmphasis ) + { + sal_Int16 nTextFontEmphasis( FontEmphasis::NONE ); + OSL_VERIFY( _rTextFontEmphasis >>= nTextFontEmphasis ); + + sal_Int16 nFontEmphasisMark = FontEmphasisMark::NONE; + switch ( nTextFontEmphasis ) + { + case FontEmphasis::NONE : nFontEmphasisMark = FontEmphasisMark::NONE; break; + case FontEmphasis::DOT_ABOVE : nFontEmphasisMark = FontEmphasisMark::DOT | FontEmphasisMark::ABOVE; break; + case FontEmphasis::CIRCLE_ABOVE : nFontEmphasisMark = FontEmphasisMark::CIRCLE | FontEmphasisMark::ABOVE; break; + case FontEmphasis::DISK_ABOVE : nFontEmphasisMark = FontEmphasisMark::DISC | FontEmphasisMark::ABOVE; break; + case FontEmphasis::ACCENT_ABOVE : nFontEmphasisMark = FontEmphasisMark::ACCENT | FontEmphasisMark::ABOVE; break; + case FontEmphasis::DOT_BELOW : nFontEmphasisMark = FontEmphasisMark::DOT | FontEmphasisMark::BELOW; break; + case FontEmphasis::CIRCLE_BELOW : nFontEmphasisMark = FontEmphasisMark::CIRCLE | FontEmphasisMark::BELOW; break; + case FontEmphasis::DISK_BELOW : nFontEmphasisMark = FontEmphasisMark::DISC | FontEmphasisMark::BELOW; break; + case FontEmphasis::ACCENT_BELOW : nFontEmphasisMark = FontEmphasisMark::ACCENT | FontEmphasisMark::BELOW; break; + default: + OSL_ENSURE( false, "lcl_translateFontEmphasis: invalid text emphasis!" ); + break; + } + return makeAny( nFontEmphasisMark ); + } + + //.................................................................... + template< typename SIMPLE_TYPE > + void lcl_transferPropertyValue( const Reference< XPropertySet >& _rxSource, const Reference< XPropertySetInfo >& _rxCachedPSI, + const sal_Char* _pAsciiPropertyName, SIMPLE_TYPE& _out_rDest ) + { + const ::rtl::OUString sPropertyName( ::rtl::OUString::createFromAscii( _pAsciiPropertyName ) ); + if ( !_rxCachedPSI->hasPropertyByName( sPropertyName ) ) + return; + Any aValue = _rxSource->getPropertyValue( sPropertyName ); + OSL_VERIFY( aValue >>= _out_rDest ); + } + + //.................................................................... + static void lcl_initializeControlFont( const Reference< XPropertySet >& _rxModel ) + { + try + { + Reference< XPropertySet > xStyle( lcl_getDefaultDocumentTextStyle_throw( _rxModel ), UNO_SET_THROW ); + Reference< XPropertySetInfo > xStylePSI( xStyle->getPropertySetInfo(), UNO_SET_THROW ); + FontDescriptor aFont; + + lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontName", aFont.Name ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontStyleName", aFont.StyleName ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontFamily", aFont.Family ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontCharSet", aFont.CharSet ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontPitch", aFont.Pitch ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharUnderline", aFont.Underline ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharWeight", aFont.Weight ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharPosture", aFont.Slant ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharStrikeout", aFont.Strikeout ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharWordMode", aFont.WordLineMode ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontType", aFont.Type ); + lcl_transferPropertyValue( xStyle, xStylePSI, "CharAutoKerning", aFont.Kerning ); + + short nCharScaleWidth = 100; + lcl_transferPropertyValue( xStyle, xStylePSI, "CharScaleWidth", nCharScaleWidth ); + if ( nCharScaleWidth ) + aFont.CharacterWidth = (float)nCharScaleWidth; + + float nCharHeight = 0; + lcl_transferPropertyValue( xStyle, xStylePSI, "CharHeight", nCharHeight ); + aFont.Height = (short)nCharHeight; + + _rxModel->setPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontDescriptor" ) ), + makeAny( aFont ) + ); + + _rxModel->setPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontEmphasisMark" ) ), + lcl_translateFontEmphasis( xStyle->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEmphasis" ) ) ) ) + ); + _rxModel->setPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontRelief" ) ), + xStyle->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharRelief" ) ) ) + ); + _rxModel->setPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextLineColor" ) ), + xStyle->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderlineColor" ) ) ) + ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } } //-------------------------------------------------------------------- @@ -558,6 +646,10 @@ namespace svxform break; } + // let the control have the same font as the host document uses by default + // #b6875455# / 2009-09-23 / frank.schoenheit@sun.com + lcl_initializeControlFont( _rxControlModel ); + // initial default label for the control if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) ) { From b8078a18ca44ec9f437e0f48fb63d413c53648ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Wed, 23 Sep 2009 12:13:14 +0000 Subject: [PATCH 020/117] make the 'use document font for form controls' dependent on some conditions ... --- svx/source/form/formcontrolfactory.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 6ffa6775a34c..30be3e46e160 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -648,7 +648,12 @@ namespace svxform // let the control have the same font as the host document uses by default // #b6875455# / 2009-09-23 / frank.schoenheit@sun.com - lcl_initializeControlFont( _rxControlModel ); + if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReferenceDevice" ) ) ) + && ControlLayouter::useDocumentReferenceDevice( _eDocType ) + ) + // the above is a somewhat weak heuristics for "when to use the document font", admittedly. + // However, /me thinks this can only be solved with real "Form Control Styles" in each application. + lcl_initializeControlFont( _rxControlModel ); // initial default label for the control if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) ) From 19e777390c8dabeafe2caeeac391f46c0a4578da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Wed, 23 Sep 2009 12:33:04 +0000 Subject: [PATCH 021/117] enable UseDocumentTextMetrics in all document types except spreadsheets - there it doesn't really work reliably, since Calc does not properly pass its own reference device to the drawing layer --- .../registry/data/org/openoffice/Office/Common.xcu | 10 ++-------- .../registry/schema/org/openoffice/Office/Common.xcs | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index fade7dd29aeb..aa5af16a7eae 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -513,9 +513,6 @@ true - - true - @@ -524,13 +521,10 @@ true - - true - - + - true + false diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index b3f07f77f108..72a296f4eb1b 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -864,7 +864,7 @@ be disabled.<p> - false + true From eb5d803c3bc424026047636654188bdebfa45938 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 23 Sep 2009 13:05:45 +0000 Subject: [PATCH 022/117] trim unwanted patches that crept in while importing stuff from ooo-build --- sfx2/source/doc/objxtor.cxx | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 5b1c6bdd3106..660856f654ba 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -136,33 +136,6 @@ DBG_NAME(SfxObjectShell) extern svtools::AsynchronLink* pPendingCloser; static WeakReference< XInterface > s_xCurrentComponent; -void lcl_UpdateAppBasicDocVars( const Reference< XInterface >& _rxComponent, bool bClear = false ) -{ - BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); - if ( pAppMgr ) - { - uno::Reference< beans::XPropertySet > xProps( _rxComponent, uno::UNO_QUERY ); - if ( xProps.is() ) - { - try - { - beans::PropertyValue aProp; - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisVBADocObj") ) ) >>= aProp; - rtl::OString sTmp( rtl::OUStringToOString( aProp.Name, RTL_TEXTENCODING_UTF8 ) ); - const char* pAscii = sTmp.getStr(); - if ( bClear ) - pAppMgr->SetGlobalUNOConstant( pAscii, uno::makeAny( uno::Reference< uno::XInterface >() ) ); - else - pAppMgr->SetGlobalUNOConstant( pAscii, aProp.Value ); - - } - catch( uno::Exception& e ) - { - } - } - } -} - //========================================================================= From 5fa4a87a6393151e3d92b60b8686eb0b22ba87e1 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 23 Sep 2009 13:55:36 +0000 Subject: [PATCH 023/117] trim more uncessary patches --- sfx2/source/doc/objxtor.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 660856f654ba..26ba76517d8c 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -170,7 +170,6 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source ) { - lcl_UpdateAppBasicDocVars( SfxObjectShell::GetCurrentComponent(), true ); // remove ThisComponent reference from AppBasic SfxObjectShell::SetCurrentComponent( Reference< XInterface >() ); } @@ -1049,10 +1048,7 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); s_xCurrentComponent = _rxComponent; if ( pAppMgr ) - { - lcl_UpdateAppBasicDocVars( _rxComponent ); pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxComponent ) ); - } #if OSL_DEBUG_LEVEL > 0 const char* pComponentImplName = _rxComponent.get() ? typeid( *_rxComponent.get() ).name() : "void"; From 118c7e834667c41575754b79a9c0435106520e9e Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 23 Sep 2009 14:06:30 +0000 Subject: [PATCH 024/117] warnings as errors --- basic/source/classes/sbxmod.cxx | 2 +- vbahelper/source/vbahelper/vbafontbase.cxx | 2 +- vbahelper/source/vbahelper/vbahelper.cxx | 3 +-- vbahelper/source/vbahelper/vbashapes.cxx | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 889426d68d4c..b8c8447bf4af 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -113,7 +113,7 @@ public: DECL_LINK( OnAsyncQuit, void* ); }; -IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, pNull ) +IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ ) { QuitApplication(); return 0L; diff --git a/vbahelper/source/vbahelper/vbafontbase.cxx b/vbahelper/source/vbahelper/vbafontbase.cxx index 17baa8ae1612..207dad395cce 100644 --- a/vbahelper/source/vbahelper/vbafontbase.cxx +++ b/vbahelper/source/vbahelper/vbafontbase.cxx @@ -246,7 +246,7 @@ VbaFontBase::setColor( const uno::Any& _color ) throw (uno::RuntimeException) } void SAL_CALL -VbaFontBase::setUnderline( const uno::Any& aValue ) throw ( uno::RuntimeException ) +VbaFontBase::setUnderline( const uno::Any& /*aValue*/ ) throw ( uno::RuntimeException ) { /* // default diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 7a20841ec9b5..76ac70c627b4 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -856,7 +856,7 @@ double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR; } -ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ) +ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& /*xContext*/, const css::uno::Reference< css::drawing::XShape >& xShape ) { m_pShapeHelper.reset( new ShapeHelper( xShape ) ); } @@ -901,7 +901,6 @@ void setCursorHelper( const uno::Reference< frame::XModel >& xModel, const Point } else { - const uno::Reference< frame::XModel > xModel( xModel2, uno::UNO_QUERY ); if ( xModel.is() ) { const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx index fba919ddfebb..ca271d10cb4c 100644 --- a/vbahelper/source/vbahelper/vbashapes.cxx +++ b/vbahelper/source/vbahelper/vbashapes.cxx @@ -373,7 +373,7 @@ ScVbaShapes::AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _n } uno::Any -ScVbaShapes::AddTextboxInWriter( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) +ScVbaShapes::AddTextboxInWriter( sal_Int32 /*_nOrientation*/, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) { rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ); sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft ); From e787f1d25468ea1f0de99907eb73ad5ae778573f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Fri, 25 Sep 2009 09:02:17 +0000 Subject: [PATCH 026/117] #b6875455# try another heuristics for the default control font --- svx/source/form/formcontrolfactory.cxx | 134 ++++++++++--------------- 1 file changed, 54 insertions(+), 80 deletions(-) diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 30be3e46e160..170604b49dd8 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -55,13 +55,17 @@ #include #include #include +#include +#include /** === end UNO includes === **/ #include #include +#include #include #include #include +#include #include @@ -100,6 +104,7 @@ namespace svxform using ::com::sun::star::util::XNumberFormats; using ::com::sun::star::util::XNumberFormatTypes; using ::com::sun::star::awt::FontDescriptor; + using ::com::sun::star::lang::Locale; /** === end UNO using === **/ namespace FormComponentType = ::com::sun::star::form::FormComponentType; namespace ScrollBarOrientation = ::com::sun::star::awt::ScrollBarOrientation; @@ -110,6 +115,7 @@ namespace svxform namespace WritingMode2 = ::com::sun::star::text::WritingMode2; namespace FontEmphasis = ::com::sun::star::text::FontEmphasis; namespace FontEmphasisMark = ::com::sun::star::awt::FontEmphasisMark; + namespace ScriptType = ::com::sun::star::i18n::ScriptType; //==================================================================== //= FormControlFactory_Data @@ -478,44 +484,6 @@ namespace svxform } } - //.................................................................... - /// translates a css.text.FontEmphasis into a css.awt.FontEmphasisMark - Any lcl_translateFontEmphasis( const Any& _rTextFontEmphasis ) - { - sal_Int16 nTextFontEmphasis( FontEmphasis::NONE ); - OSL_VERIFY( _rTextFontEmphasis >>= nTextFontEmphasis ); - - sal_Int16 nFontEmphasisMark = FontEmphasisMark::NONE; - switch ( nTextFontEmphasis ) - { - case FontEmphasis::NONE : nFontEmphasisMark = FontEmphasisMark::NONE; break; - case FontEmphasis::DOT_ABOVE : nFontEmphasisMark = FontEmphasisMark::DOT | FontEmphasisMark::ABOVE; break; - case FontEmphasis::CIRCLE_ABOVE : nFontEmphasisMark = FontEmphasisMark::CIRCLE | FontEmphasisMark::ABOVE; break; - case FontEmphasis::DISK_ABOVE : nFontEmphasisMark = FontEmphasisMark::DISC | FontEmphasisMark::ABOVE; break; - case FontEmphasis::ACCENT_ABOVE : nFontEmphasisMark = FontEmphasisMark::ACCENT | FontEmphasisMark::ABOVE; break; - case FontEmphasis::DOT_BELOW : nFontEmphasisMark = FontEmphasisMark::DOT | FontEmphasisMark::BELOW; break; - case FontEmphasis::CIRCLE_BELOW : nFontEmphasisMark = FontEmphasisMark::CIRCLE | FontEmphasisMark::BELOW; break; - case FontEmphasis::DISK_BELOW : nFontEmphasisMark = FontEmphasisMark::DISC | FontEmphasisMark::BELOW; break; - case FontEmphasis::ACCENT_BELOW : nFontEmphasisMark = FontEmphasisMark::ACCENT | FontEmphasisMark::BELOW; break; - default: - OSL_ENSURE( false, "lcl_translateFontEmphasis: invalid text emphasis!" ); - break; - } - return makeAny( nFontEmphasisMark ); - } - - //.................................................................... - template< typename SIMPLE_TYPE > - void lcl_transferPropertyValue( const Reference< XPropertySet >& _rxSource, const Reference< XPropertySetInfo >& _rxCachedPSI, - const sal_Char* _pAsciiPropertyName, SIMPLE_TYPE& _out_rDest ) - { - const ::rtl::OUString sPropertyName( ::rtl::OUString::createFromAscii( _pAsciiPropertyName ) ); - if ( !_rxCachedPSI->hasPropertyByName( sPropertyName ) ) - return; - Any aValue = _rxSource->getPropertyValue( sPropertyName ); - OSL_VERIFY( aValue >>= _out_rDest ); - } - //.................................................................... static void lcl_initializeControlFont( const Reference< XPropertySet >& _rxModel ) { @@ -523,46 +491,57 @@ namespace svxform { Reference< XPropertySet > xStyle( lcl_getDefaultDocumentTextStyle_throw( _rxModel ), UNO_SET_THROW ); Reference< XPropertySetInfo > xStylePSI( xStyle->getPropertySetInfo(), UNO_SET_THROW ); - FontDescriptor aFont; - lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontName", aFont.Name ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontStyleName", aFont.StyleName ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontFamily", aFont.Family ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontCharSet", aFont.CharSet ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontPitch", aFont.Pitch ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharUnderline", aFont.Underline ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharWeight", aFont.Weight ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharPosture", aFont.Slant ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharStrikeout", aFont.Strikeout ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharWordMode", aFont.WordLineMode ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharFontType", aFont.Type ); - lcl_transferPropertyValue( xStyle, xStylePSI, "CharAutoKerning", aFont.Kerning ); + // determine the script type associated with the system locale + const LocaleDataWrapper& rSysLocaleData = SvtSysLocale().GetLocaleData(); + const sal_Int16 eSysLocaleScriptType = MsLangId::getScriptType( MsLangId::convertLocaleToLanguage( rSysLocaleData.getLocale() ) ); - short nCharScaleWidth = 100; - lcl_transferPropertyValue( xStyle, xStylePSI, "CharScaleWidth", nCharScaleWidth ); - if ( nCharScaleWidth ) - aFont.CharacterWidth = (float)nCharScaleWidth; + // depending on this script type, use the right property from the document's style which controls the + // default locale for document content + const sal_Char* pCharLocalePropertyName = "CharLocale"; + switch ( eSysLocaleScriptType ) + { + case ScriptType::LATIN: + // already defaulted above + break; + case ScriptType::ASIAN: + pCharLocalePropertyName = "CharLocaleAsian"; + break; + case ScriptType::COMPLEX: + pCharLocalePropertyName = "CharLocaleComplex"; + break; + default: + OSL_ENSURE( false, "lcl_initializeControlFont: unexpected script type for system locale!" ); + break; + } - float nCharHeight = 0; - lcl_transferPropertyValue( xStyle, xStylePSI, "CharHeight", nCharHeight ); - aFont.Height = (short)nCharHeight; + ::rtl::OUString sCharLocalePropertyName = ::rtl::OUString::createFromAscii( pCharLocalePropertyName ); + Locale aDocumentCharLocale; + if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) + { + OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); + } + // fall back to CharLocale property at the style + if ( !aDocumentCharLocale.Language.getLength() ) + { + sCharLocalePropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ); + if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) + { + OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); + } + } + // fall back to the system locale + if ( !aDocumentCharLocale.Language.getLength() ) + { + aDocumentCharLocale = rSysLocaleData.getLocale(); + } + // retrieve a default font for this locale, and set it at the control + Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS, MsLangId::convertLocaleToLanguage( aDocumentCharLocale ), DEFAULTFONT_FLAGS_ONLYONE ); + FontDescriptor aFontDesc = VCLUnoHelper::CreateFontDescriptor( aFont ); _rxModel->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontDescriptor" ) ), - makeAny( aFont ) - ); - - _rxModel->setPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontEmphasisMark" ) ), - lcl_translateFontEmphasis( xStyle->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEmphasis" ) ) ) ) - ); - _rxModel->setPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontRelief" ) ), - xStyle->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharRelief" ) ) ) - ); - _rxModel->setPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextLineColor" ) ), - xStyle->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderlineColor" ) ) ) + makeAny( aFontDesc ) ); } catch( const Exception& ) @@ -646,14 +625,9 @@ namespace svxform break; } - // let the control have the same font as the host document uses by default - // #b6875455# / 2009-09-23 / frank.schoenheit@sun.com - if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReferenceDevice" ) ) ) - && ControlLayouter::useDocumentReferenceDevice( _eDocType ) - ) - // the above is a somewhat weak heuristics for "when to use the document font", admittedly. - // However, /me thinks this can only be solved with real "Form Control Styles" in each application. - lcl_initializeControlFont( _rxControlModel ); + // some default font, to not rely on the implicit font, which differs across platforms and desktop + // themes + lcl_initializeControlFont( _rxControlModel ); // initial default label for the control if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) ) From 3ed9bf8421dcb5fe574b9985bf102798d7e7cf73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Fri, 25 Sep 2009 10:07:49 +0000 Subject: [PATCH 027/117] moved the code for initializing a new control model\'s font from the FormControlFactory to the ControlLayouter --- svx/source/form/fmcontrollayout.cxx | 193 +++++++++++++++++++++++-- svx/source/form/formcontrolfactory.cxx | 162 +-------------------- svx/source/inc/fmcontrollayout.hxx | 11 ++ 3 files changed, 194 insertions(+), 172 deletions(-) diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx index 8cf6ccd2a84d..74bb7f41ba40 100644 --- a/svx/source/form/fmcontrollayout.cxx +++ b/svx/source/form/fmcontrollayout.cxx @@ -30,17 +30,28 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + #include "fmcontrollayout.hxx" -#ifndef _SVX_FMPROP_HRC #include "fmprop.hrc" -#endif /** === begin UNO includes === **/ #include #include +#include +#include +#include +#include +#include +#include /** === end UNO includes === **/ -#include + #include +#include +#include +#include +#include +#include +#include //........................................................................ namespace svxform @@ -48,14 +59,170 @@ namespace svxform //........................................................................ using namespace ::utl; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::form; + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::beans::XPropertySet; + using ::com::sun::star::beans::XPropertySetInfo; + using ::com::sun::star::lang::Locale; + using ::com::sun::star::awt::FontDescriptor; + using ::com::sun::star::style::XStyleFamiliesSupplier; + using ::com::sun::star::lang::XServiceInfo; + using ::com::sun::star::container::XNameAccess; + using ::com::sun::star::container::XChild; + /** === end UNO using === **/ + namespace FormComponentType = ::com::sun::star::form::FormComponentType; + namespace VisualEffect = ::com::sun::star::awt::VisualEffect; + namespace ScriptType = ::com::sun::star::i18n::ScriptType; + + //-------------------------------------------------------------------- + namespace + { + //.................................................................... + template< class INTERFACE_TYPE > + Reference< INTERFACE_TYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode ) + { + Reference< INTERFACE_TYPE > xTypedNode( _rxModelNode, UNO_QUERY ); + if ( xTypedNode.is() ) + return xTypedNode; + else + { + Reference< XChild > xChild( _rxModelNode, UNO_QUERY ); + if ( xChild.is() ) + return getTypedModelNode< INTERFACE_TYPE >( xChild->getParent() ); + else + return NULL; + } + } + + //.................................................................... + static bool lcl_getDocumentDefaultStyleAndFamily( const Reference< XInterface >& _rxDocument, ::rtl::OUString& _rFamilyName, ::rtl::OUString& _rStyleName ) SAL_THROW(( Exception )) + { + bool bSuccess = true; + Reference< XServiceInfo > xDocumentSI( _rxDocument, UNO_QUERY ); + if ( xDocumentSI.is() ) + { + if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) + || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) + ) + { + _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) ); + _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); + } + else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) ) + { + _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) ); + _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) ); + } + else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) + || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) + ) + { + _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ); + _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ); + } + else + bSuccess = false; + } + return bSuccess; + } + + //.................................................................... + static void lcl_initializeControlFont( const Reference< XPropertySet >& _rxModel ) + { + try + { + Reference< XPropertySet > xStyle( ControlLayouter::getDefaultDocumentTextStyle( _rxModel ), UNO_SET_THROW ); + Reference< XPropertySetInfo > xStylePSI( xStyle->getPropertySetInfo(), UNO_SET_THROW ); + + // determine the script type associated with the system locale + const LocaleDataWrapper& rSysLocaleData = SvtSysLocale().GetLocaleData(); + const sal_Int16 eSysLocaleScriptType = MsLangId::getScriptType( MsLangId::convertLocaleToLanguage( rSysLocaleData.getLocale() ) ); + + // depending on this script type, use the right property from the document's style which controls the + // default locale for document content + const sal_Char* pCharLocalePropertyName = "CharLocale"; + switch ( eSysLocaleScriptType ) + { + case ScriptType::LATIN: + // already defaulted above + break; + case ScriptType::ASIAN: + pCharLocalePropertyName = "CharLocaleAsian"; + break; + case ScriptType::COMPLEX: + pCharLocalePropertyName = "CharLocaleComplex"; + break; + default: + OSL_ENSURE( false, "lcl_initializeControlFont: unexpected script type for system locale!" ); + break; + } + + ::rtl::OUString sCharLocalePropertyName = ::rtl::OUString::createFromAscii( pCharLocalePropertyName ); + Locale aDocumentCharLocale; + if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) + { + OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); + } + // fall back to CharLocale property at the style + if ( !aDocumentCharLocale.Language.getLength() ) + { + sCharLocalePropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ); + if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) + { + OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); + } + } + // fall back to the system locale + if ( !aDocumentCharLocale.Language.getLength() ) + { + aDocumentCharLocale = rSysLocaleData.getLocale(); + } + + // retrieve a default font for this locale, and set it at the control + Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS, MsLangId::convertLocaleToLanguage( aDocumentCharLocale ), DEFAULTFONT_FLAGS_ONLYONE ); + FontDescriptor aFontDesc = VCLUnoHelper::CreateFontDescriptor( aFont ); + _rxModel->setPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontDescriptor" ) ), + makeAny( aFontDesc ) + ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } //==================================================================== //= ControlLayouter //==================================================================== + //-------------------------------------------------------------------- + Reference< XPropertySet > ControlLayouter::getDefaultDocumentTextStyle( const Reference< XPropertySet >& _rxModel ) + { + // the style family collection + Reference< XStyleFamiliesSupplier > xSuppStyleFamilies( getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() ), UNO_SET_THROW ); + Reference< XNameAccess > xStyleFamilies( xSuppStyleFamilies->getStyleFamilies(), UNO_SET_THROW ); + + // the names of the family, and the style - depends on the document type we live in + ::rtl::OUString sFamilyName, sStyleName; + if ( !lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName ) ) + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unknown document type!" ) ), NULL ); + + // the concrete style + Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY_THROW ); + return Reference< XPropertySet >( xStyleFamily->getByName( sStyleName ), UNO_QUERY_THROW ); + } + //-------------------------------------------------------------------- void ControlLayouter::initializeControlLayout( const Reference< XPropertySet >& _rxControlModel, DocumentType _eDocType ) { @@ -65,10 +232,7 @@ namespace svxform try { - Reference< XPropertySetInfo > xPSI( _rxControlModel->getPropertySetInfo() ); - if ( !xPSI.is() ) - // can't do anything - return; + Reference< XPropertySetInfo > xPSI( _rxControlModel->getPropertySetInfo(), UNO_SET_THROW ); // the control type sal_Int16 nClassId = FormComponentType::CONTROL; @@ -114,6 +278,13 @@ namespace svxform if ( xPSI->hasPropertyByName( FM_PROP_VISUALEFFECT ) ) _rxControlModel->setPropertyValue( FM_PROP_VISUALEFFECT, makeAny( nVisualEffect ) ); } + + // the font (only if we use the document's ref devices for rendering control text, otherwise, the + // default font of VCL controls is assumed to be fine) + if ( useDocumentReferenceDevice( _eDocType ) + && xPSI->hasPropertyByName( FM_PROP_FONT ) + ) + lcl_initializeControlFont( _rxControlModel ); } catch( const Exception& ) { diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 170604b49dd8..c440ffd0608b 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -43,29 +43,21 @@ #include #include #include -#include -#include #include #include #include -#include #include #include #include #include -#include #include -#include -#include /** === end UNO includes === **/ #include #include -#include #include #include #include -#include #include @@ -94,9 +86,6 @@ namespace svxform using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::container::XChild; using ::com::sun::star::form::XGridColumnFactory; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::style::XStyleFamiliesSupplier; - using ::com::sun::star::container::XNameAccess; using ::com::sun::star::style::VerticalAlignment_MIDDLE; using ::com::sun::star::beans::Property; using ::com::sun::star::uno::TypeClass_DOUBLE; @@ -113,9 +102,6 @@ namespace svxform namespace DataType = ::com::sun::star::sdbc::DataType; namespace ColumnValue = ::com::sun::star::sdbc::ColumnValue; namespace WritingMode2 = ::com::sun::star::text::WritingMode2; - namespace FontEmphasis = ::com::sun::star::text::FontEmphasis; - namespace FontEmphasisMark = ::com::sun::star::awt::FontEmphasisMark; - namespace ScriptType = ::com::sun::star::i18n::ScriptType; //==================================================================== //= FormControlFactory_Data @@ -247,65 +233,6 @@ namespace svxform } return aInfo; } - /* - ATTENTION! - Broken for solaris? It seems that the old used template argument TYPE was already - defined as a macro ... which expand to ... "TYPE "!? - All platforms are OK - excepting Solaris. There the line "template< class TYPE >" - was expanded to "template < class TYPE " where the closing ">" was missing. - */ - #ifdef MYTYPE - #error "Who defines the macro MYTYPE, which is used as template argument here?" - #endif - - //.................................................................... - template< class MYTYPE > - Reference< MYTYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode ) - { - Reference< MYTYPE > xTypedNode( _rxModelNode, UNO_QUERY ); - if ( xTypedNode.is() ) - return xTypedNode; - else - { - Reference< XChild > xChild( _rxModelNode, UNO_QUERY ); - if ( xChild.is() ) - return getTypedModelNode< MYTYPE >( xChild->getParent() ); - else - return NULL; - } - } - - //.................................................................... - static bool lcl_getDocumentDefaultStyleAndFamily( const Reference< XInterface >& _rxDocument, ::rtl::OUString& _rFamilyName, ::rtl::OUString& _rStyleName ) SAL_THROW(( Exception )) - { - bool bSuccess = true; - Reference< XServiceInfo > xDocumentSI( _rxDocument, UNO_QUERY ); - if ( xDocumentSI.is() ) - { - if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) - || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) - ) - { - _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) ); - _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); - } - else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) ) - { - _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) ); - _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) ); - } - else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) - || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) - ) - { - _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ); - _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ); - } - else - bSuccess = false; - } - return bSuccess; - } //.................................................................... static const sal_Char* aCharacterAndParagraphProperties[] = @@ -438,29 +365,12 @@ namespace svxform NULL }; - //.................................................................... - Reference< XPropertySet > lcl_getDefaultDocumentTextStyle_throw( const Reference< XPropertySet >& _rxModel ) - { - // the style family collection - Reference< XStyleFamiliesSupplier > xSuppStyleFamilies( getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() ), UNO_SET_THROW ); - Reference< XNameAccess > xStyleFamilies( xSuppStyleFamilies->getStyleFamilies(), UNO_SET_THROW ); - - // the names of the family, and the style - depends on the document type we live in - ::rtl::OUString sFamilyName, sStyleName; - if ( !lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName ) ) - throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unknown document type!" ) ), NULL ); - - // the concrete style - Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY_THROW ); - return Reference< XPropertySet >( xStyleFamily->getByName( sStyleName ), UNO_QUERY_THROW ); - } - //.................................................................... static void lcl_initializeCharacterAttributes( const Reference< XPropertySet >& _rxModel ) { try { - Reference< XPropertySet > xStyle( lcl_getDefaultDocumentTextStyle_throw( _rxModel ), UNO_SET_THROW ); + Reference< XPropertySet > xStyle( ControlLayouter::getDefaultDocumentTextStyle( _rxModel ), UNO_SET_THROW ); // transfer all properties which are described by the style Reference< XPropertySetInfo > xSourcePropInfo( xStyle->getPropertySetInfo(), UNO_SET_THROW ); @@ -483,72 +393,6 @@ namespace svxform DBG_UNHANDLED_EXCEPTION(); } } - - //.................................................................... - static void lcl_initializeControlFont( const Reference< XPropertySet >& _rxModel ) - { - try - { - Reference< XPropertySet > xStyle( lcl_getDefaultDocumentTextStyle_throw( _rxModel ), UNO_SET_THROW ); - Reference< XPropertySetInfo > xStylePSI( xStyle->getPropertySetInfo(), UNO_SET_THROW ); - - // determine the script type associated with the system locale - const LocaleDataWrapper& rSysLocaleData = SvtSysLocale().GetLocaleData(); - const sal_Int16 eSysLocaleScriptType = MsLangId::getScriptType( MsLangId::convertLocaleToLanguage( rSysLocaleData.getLocale() ) ); - - // depending on this script type, use the right property from the document's style which controls the - // default locale for document content - const sal_Char* pCharLocalePropertyName = "CharLocale"; - switch ( eSysLocaleScriptType ) - { - case ScriptType::LATIN: - // already defaulted above - break; - case ScriptType::ASIAN: - pCharLocalePropertyName = "CharLocaleAsian"; - break; - case ScriptType::COMPLEX: - pCharLocalePropertyName = "CharLocaleComplex"; - break; - default: - OSL_ENSURE( false, "lcl_initializeControlFont: unexpected script type for system locale!" ); - break; - } - - ::rtl::OUString sCharLocalePropertyName = ::rtl::OUString::createFromAscii( pCharLocalePropertyName ); - Locale aDocumentCharLocale; - if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) - { - OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); - } - // fall back to CharLocale property at the style - if ( !aDocumentCharLocale.Language.getLength() ) - { - sCharLocalePropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ); - if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) - { - OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); - } - } - // fall back to the system locale - if ( !aDocumentCharLocale.Language.getLength() ) - { - aDocumentCharLocale = rSysLocaleData.getLocale(); - } - - // retrieve a default font for this locale, and set it at the control - Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS, MsLangId::convertLocaleToLanguage( aDocumentCharLocale ), DEFAULTFONT_FLAGS_ONLYONE ); - FontDescriptor aFontDesc = VCLUnoHelper::CreateFontDescriptor( aFont ); - _rxModel->setPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontDescriptor" ) ), - makeAny( aFontDesc ) - ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } } //-------------------------------------------------------------------- @@ -625,10 +469,6 @@ namespace svxform break; } - // some default font, to not rely on the implicit font, which differs across platforms and desktop - // themes - lcl_initializeControlFont( _rxControlModel ); - // initial default label for the control if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) ) { diff --git a/svx/source/inc/fmcontrollayout.hxx b/svx/source/inc/fmcontrollayout.hxx index c370e8547f0e..c5abe43f3228 100644 --- a/svx/source/inc/fmcontrollayout.hxx +++ b/svx/source/inc/fmcontrollayout.hxx @@ -67,6 +67,17 @@ namespace svxform */ static bool useDocumentReferenceDevice( DocumentType _eDocType ); + /** gets the "default" style in a document which can be used if some default text format is needed + + It depends on the type document type which concrete kind of style is returned, but it is expected to support + the css.style.CharacterProperties service. + + @param _rxModel + a form component. + */ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + getDefaultDocumentTextStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + private: ControlLayouter(); // never implemented From f523884a3b6f29784ae88c6b86bc1e1d8217d04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Fri, 25 Sep 2009 10:47:45 +0000 Subject: [PATCH 028/117] don't use document's reference device for form documents --- officecfg/registry/data/org/openoffice/Office/Common.xcu | 3 +++ 1 file changed, 3 insertions(+) diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index aa5af16a7eae..a638a78d069d 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -521,6 +521,9 @@ true + + false + From f2eeb84bfca2f47336dd05164c76d35638d8f9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Fri, 25 Sep 2009 10:50:32 +0000 Subject: [PATCH 029/117] merging changes from m60 herein --- configmgr/source/tree/localizedtreeactions.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configmgr/source/tree/localizedtreeactions.cxx b/configmgr/source/tree/localizedtreeactions.cxx index 8cd40c4da79f..b2ed23a730b3 100644 --- a/configmgr/source/tree/localizedtreeactions.cxx +++ b/configmgr/source/tree/localizedtreeactions.cxx @@ -178,8 +178,11 @@ namespace // -- ----------------------------- OSL_ENSURE( aValueType != uno::Type(), "VOID result type found"); - OSL_ENSURE( aValueType == parseTemplateName(_aSubtree.getElementTemplateName()), +#if OSL_DEBUG_LEVEL > 0 + uno::Type aTemplateType = parseTemplateName( _aSubtree.getElementTemplateName() ); + OSL_ENSURE( ( aValueType == aTemplateType ) || ( aTemplateType.getTypeClass() == uno::TypeClass_ANY ), "ERROR: Found Value Type doesn't match encoded value type in pseudo template name"); +#endif OSL_POSTCOND( static_cast(*pResult).getValueType() == aValueType, "ERROR: Resulting Value Type doesn't match original value type" ); From b5fb85c6253501f340a669ff02f64553a6e09ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Fri, 25 Sep 2009 11:43:51 +0000 Subject: [PATCH 030/117] do not assert when we do not have an ObjectShell, this is valid in clipboard scenarios --- svx/source/form/fmcontrollayout.cxx | 2 ++ svx/source/form/fmmodel.cxx | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx index 74bb7f41ba40..9748426c0b26 100644 --- a/svx/source/form/fmcontrollayout.cxx +++ b/svx/source/form/fmcontrollayout.cxx @@ -315,6 +315,8 @@ namespace svxform //-------------------------------------------------------------------- bool ControlLayouter::useDocumentReferenceDevice( DocumentType _eDocType ) { + if ( _eDocType == eUnknownDocumentType ) + return false; OConfigurationNode aConfig = getLayoutSettings( _eDocType ); Any aUseRefDevice = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentTextMetrics" ) ) ); bool bUseRefDevice = false; diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx index 15932d4d93cc..a09d0f78173a 100644 --- a/svx/source/form/fmmodel.cxx +++ b/svx/source/form/fmmodel.cxx @@ -318,7 +318,6 @@ sal_Bool FmFormModel::ControlsUseRefDevice() const { if ( !m_pImpl->aControlsUseRefDevice ) { - OSL_PRECOND( m_pObjShell, "FmFormModel::ControlsUseRefDevice: no object shell -> no document -> no document type -> no way!" ); DocumentType eDocType = eUnknownDocumentType; if ( m_pObjShell ) eDocType = DocumentClassification::classifyHostDocument( m_pObjShell->GetModel() ); From f212afb71b988cb4ca694aac303f6e4edf5ee1a6 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Tue, 29 Sep 2009 14:47:18 +0000 Subject: [PATCH 031/117] tweak VBAGlobals creation/insertion, also restore overwritten visibility controls bits to moved ( erm delete and created in another director ) file. Add missing bits to enable Application.Quit and use preprocessor to include some uncompiled code --- basic/source/classes/sbxmod.cxx | 39 +++++++++++++++++++++++++ vbahelper/source/msforms/vbacontrol.cxx | 11 ++++--- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index b8c8447bf4af..2d5f4f7cdf89 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -119,6 +119,33 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ ) return 0L; } +#if 0 +bool UnlockControllerHack( StarBASIC* pBasic ) +{ + bool bRes = false; + if ( pBasic && pBasic->IsDocBasic() ) + { + uno::Any aUnoVar; + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) ); + SbUnoObject* pGlobs = dynamic_cast( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) ); + if ( pGlobs ) + aUnoVar = pGlobs->getUnoAny(); + uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY); + if ( xModel.is() ) + { + try + { + xModel->unlockControllers(); + bRes = true; + } + catch( uno::Exception& ) + { + } + } + } + return bRes; +} +#endif ///////////////////////////////////////////////////////////////////////////// // Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen @@ -730,6 +757,13 @@ USHORT SbModule::Run( SbMethod* pMeth ) pINST->nCallLvl--; // Call-Level wieder runter StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); } + + // VBA always ensure screenupdating is enabled after completing + StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); +#if 0 + if ( pBasic && pBasic->IsDocBasic() && !pINST ) + UnlockControllerHack( pBasic ); +#endif if( bDelInst ) { // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, @@ -739,6 +773,11 @@ USHORT SbModule::Run( SbMethod* pMeth ) delete pINST; pINST = NULL; } + if ( pBasic && pBasic->IsDocBasic() && pBasic->IsQuitApplication() && !pINST ) + { + Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ), NULL ); + } + return nRes; } diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 3a6c6ec8d1b5..c0169f7a490c 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -189,14 +189,17 @@ void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeE sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException) { - uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW ); - return xWindow2->isVisible(); + sal_Bool bVisible( sal_True ); + m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) )) >>= bVisible; + return bVisible; } void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) { - uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW ); - xWindow2->setVisible( bVisible ); + uno::Any aValue( bVisible ); + m_xProps->setPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ), aValue); } double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException) { From fcac7b7672113ec68f90ab4443bc8a920a59ab34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Wed, 7 Oct 2009 06:16:52 +0000 Subject: [PATCH 032/117] #i10000# --- svx/source/form/formcontrolfactory.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 5fa145f61e59..da3c2634b63c 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -95,6 +95,8 @@ namespace svxform using ::com::sun::star::util::XNumberFormatTypes; using ::com::sun::star::awt::FontDescriptor; using ::com::sun::star::lang::Locale; + using ::com::sun::star::lang::XServiceInfo; + using ::com::sun::star::container::XNameAccess; /** === end UNO using === **/ namespace FormComponentType = ::com::sun::star::form::FormComponentType; namespace ScrollBarOrientation = ::com::sun::star::awt::ScrollBarOrientation; From 8dc5bfac10ba6616dc1269ae4102c3bb4ef21d46 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 7 Oct 2009 14:45:16 +0000 Subject: [PATCH 033/117] warning as error fixes --- svx/source/msfilter/msvbahelper.cxx | 1 + vbahelper/source/msforms/makefile.mk | 3 ++- vbahelper/source/msforms/service.cxx | 6 +++--- vbahelper/source/vbahelper/vbaapplicationbase.cxx | 2 +- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx | 6 +++--- vbahelper/source/vbahelper/vbacommandbarcontrols.cxx | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/svx/source/msfilter/msvbahelper.cxx b/svx/source/msfilter/msvbahelper.cxx index bd8eb9852169..5b24af6bcc2f 100644 --- a/svx/source/msfilter/msvbahelper.cxx +++ b/svx/source/msfilter/msvbahelper.cxx @@ -28,6 +28,7 @@ * ************************************************************************/ +#include "precompiled_svx.hxx" #include #include #include diff --git a/vbahelper/source/msforms/makefile.mk b/vbahelper/source/msforms/makefile.mk index ad5e7b4685b3..1d550c8409c2 100644 --- a/vbahelper/source/msforms/makefile.mk +++ b/vbahelper/source/msforms/makefile.mk @@ -33,7 +33,8 @@ PRJ=..$/.. PRJNAME=vbahelper TARGET=msforms -ENABLE_EXCEPTIONS := TRUE +ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE # --- Settings ----------------------------------------------------- diff --git a/vbahelper/source/msforms/service.cxx b/vbahelper/source/msforms/service.cxx index 20a5a727515a..395256bcf61a 100644 --- a/vbahelper/source/msforms/service.cxx +++ b/vbahelper/source/msforms/service.cxx @@ -53,14 +53,14 @@ extern sdecl::ServiceDecl const serviceDecl; extern "C" { - void SAL_CALL component_getImplementationEnvironment( + SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { OSL_TRACE("In component_getImplementationEnv"); *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - sal_Bool SAL_CALL component_writeInfo( + SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) { OSL_TRACE("In component_writeInfo"); @@ -70,7 +70,7 @@ extern "C" controlprovider::serviceDecl, userform::serviceDecl ); } - void * SAL_CALL component_getFactory( + SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) { diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 409e33f19167..9f5c78e71858 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -179,7 +179,7 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u float SAL_CALL VbaApplicationBase::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException) { // i cm = 28.35 points - static const float rate = 28.35; + static const float rate = 28.35f; return ( _Centimeters * rate ); } diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx index 6c0b3b4e7f2c..a10767998b28 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx @@ -124,7 +124,7 @@ ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException) { // currently only the menu in the MenuBat support Enable/Disable // FIXME: how to support the menu item in Toolbar - bEnabled = m_xParentMenu->isItemEnabled( m_xParentMenu->getItemId( m_nPosition ) ); + bEnabled = m_xParentMenu->isItemEnabled( m_xParentMenu->getItemId( sal::static_int_cast< sal_Int16 >( m_nPosition ) ) ); } else { @@ -140,7 +140,7 @@ ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeExcep if( m_xParentMenu.is() ) { // currently only the menu in the MenuBat support Enable/Disable - m_xParentMenu->enableItem( m_xParentMenu->getItemId( m_nPosition ), _enabled ); + m_xParentMenu->enableItem( m_xParentMenu->getItemId( sal::static_int_cast< sal_Int16 >( m_nPosition ) ), _enabled ); } else { @@ -173,7 +173,7 @@ ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicE uno::Reference< awt::XMenu > xMenu; if( m_xParentMenu.is() ) { - sal_Int32 nItemId = m_xParentMenu->getItemId( m_nPosition ); + sal_Int16 nItemId = m_xParentMenu->getItemId( sal::static_int_cast< sal_Int16 >( m_nPosition ) ); xMenu.set( m_xParentMenu->getPopupMenu( nItemId ), uno::UNO_QUERY ); } diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx index 3c0b022ebe3c..f4f29ccb04d4 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx @@ -207,7 +207,7 @@ ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const un // create control uno::Sequence< beans::PropertyValue > aProps; rtl::OUString sHelpUrl; - sal_Int32 nItemType = 0; + sal_uInt16 nItemType = 0; if( IsMenu() ) { aProps = CreateMenuItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu ); From f9baeb9ab8ef6239238d440f53721107bdb2c297 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Thu, 8 Oct 2009 09:35:29 +0000 Subject: [PATCH 034/117] visibility=true ( fixes wae in vbashape.cxx ) --- vbahelper/source/vbahelper/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk index bd57415ddec8..a8a4167948f4 100644 --- a/vbahelper/source/vbahelper/makefile.mk +++ b/vbahelper/source/vbahelper/makefile.mk @@ -34,7 +34,7 @@ PRJNAME=vbahelper TARGET=vbahelperbits ENABLE_EXCEPTIONS := TRUE - +VISIBILITY_HIDDEN=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk From 7611eaa1ef0cf89e96e1c30c92b10a7e2737b7ee Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Fri, 9 Oct 2009 08:46:48 +0000 Subject: [PATCH 035/117] #i105716# end chars with 0 --- connectivity/source/drivers/file/quotedstring.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx index abd2d3b51e44..765c42eeeae2 100644 --- a/connectivity/source/drivers/file/quotedstring.cxx +++ b/connectivity/source/drivers/file/quotedstring.cxx @@ -152,7 +152,6 @@ namespace connectivity // Vorzeitiger Abbruch der Schleife moeglich, denn // wir haben, was wir wollten. nStartPos = i+1; - *pData = 0; break; } else @@ -161,6 +160,7 @@ namespace connectivity } } } // for( xub_StrLen i = nStartPos; i < nLen; ++i ) + *pData = 0; _rStr.ReleaseBufferAccess(xub_StrLen(pData - pStart)); } } From 8be417c210fdb1597079fe8eb8232c8c15c6531a Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 9 Oct 2009 11:16:17 +0200 Subject: [PATCH 036/117] #i105649#: SfxDocumentInfoItem::UpdateDocumentInfo(): do not remove non-removeable properties --- sfx2/source/dialog/dinfdlg.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 484e953f1cf4..e0a57c2e5e9e 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -269,8 +269,12 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const String& rFile, for ( sal_Int32 i = 0; i < nCount; ++i ) { // "fix" property? => not a custom property => ignore it! - if ( !(pProps[i].Attributes & ::com::sun::star::beans::PropertyAttribute::REMOVABLE) ) + if (!(pProps[i].Attributes & + ::com::sun::star::beans::PropertyAttribute::REMOVABLE)) + { + DBG_ASSERT(false, "non-removable user-defined property?"); continue; + } uno::Any aValue = xSet->getPropertyValue(pProps[i].Name); CustomProperty* pProp = new CustomProperty( pProps[i].Name, aValue ); @@ -424,7 +428,13 @@ void SfxDocumentInfoItem::UpdateDocumentInfo( const beans::Property* pProps = lProps.getConstArray(); sal_Int32 nCount = lProps.getLength(); for ( sal_Int32 j = 0; j < nCount; ++j ) - xContainer->removeProperty( pProps[j].Name ); + { + if ((pProps[j].Attributes & + ::com::sun::star::beans::PropertyAttribute::REMOVABLE)) + { + xContainer->removeProperty( pProps[j].Name ); + } + } for ( sal_uInt32 k = 0; k < m_aCustomProperties.size(); ++k ) { From 4b3b7e709bf9b3aa3504685c6688470ca97d4db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Mon, 12 Oct 2009 11:24:28 +0000 Subject: [PATCH 037/117] #i105806# getPropertyValue: throw an UnknownPropertyException for, well, unknown properties --- xmloff/source/forms/gridcolumnproptranslator.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xmloff/source/forms/gridcolumnproptranslator.cxx b/xmloff/source/forms/gridcolumnproptranslator.cxx index 766c2dd2483f..7e2476e6f054 100644 --- a/xmloff/source/forms/gridcolumnproptranslator.cxx +++ b/xmloff/source/forms/gridcolumnproptranslator.cxx @@ -235,9 +235,15 @@ namespace xmloff } //-------------------------------------------------------------------- - void SAL_CALL OGridColumnPropertyTranslator::setPropertyValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) + void SAL_CALL OGridColumnPropertyTranslator::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { - Sequence< ::rtl::OUString > aNames( &aPropertyName, 1 ); + // we implement this by delegating it to setPropertyValues, which is to ignore unknown properties. On the other hand, our + // contract requires us to throw a UnknownPropertyException for unknown properties, so check this first. + + if ( !getPropertySetInfo()->hasPropertyByName( _rPropertyName ) ) + throw UnknownPropertyException( _rPropertyName, *this ); + + Sequence< ::rtl::OUString > aNames( &_rPropertyName, 1 ); Sequence< Any > aValues( &aValue, 1 ); setPropertyValues( aNames, aValues ); } From ae6f81cd682da97b159a1dbef44e9dcee6c4f38c Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 12 Oct 2009 19:16:31 +0200 Subject: [PATCH 038/117] #i105826#: SfxDocumentMetaData.cxx: fix re-initialization of user-defined props --- sfx2/source/doc/SfxDocumentMetaData.cxx | 66 +++++++++++++++---------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 1423e712242e..ef36831ab681 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -79,6 +79,7 @@ #include "comphelper/storagehelper.hxx" #include "comphelper/mediadescriptor.hxx" #include "comphelper/sequenceasvector.hxx" +#include "comphelper/stlunosequence.hxx" #include "sot/storage.hxx" #include "sfx2/docfile.hxx" #include "sax/tools/converter.hxx" @@ -322,7 +323,7 @@ private: /// standard meta data (multiple occurrences) std::map< ::rtl::OUString, std::vector > > m_metaList; - /// user-defined meta data (meta:user-defined) + /// user-defined meta data (meta:user-defined) @ATTENTION may be null! css::uno::Reference m_xUserDefined; // now for some meta-data attributes; these are not updated directly in the // DOM because updates (detecting "empty" elements) would be quite messy @@ -998,9 +999,12 @@ SfxDocumentMetaData::updateElement(const char *i_name, void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes() { createUserDefined(); - css::uno::Reference xPSet(m_xUserDefined,css::uno::UNO_QUERY_THROW); - std::pair, AttrVector> udStringsAttrs = propsToStrings(xPSet); - (void) setMetaList("meta:user-defined", udStringsAttrs.first,&udStringsAttrs.second); + const css::uno::Reference xPSet(m_xUserDefined, + css::uno::UNO_QUERY_THROW); + const std::pair, AttrVector> + udStringsAttrs( propsToStrings(xPSet) ); + (void) setMetaList("meta:user-defined", udStringsAttrs.first, + &udStringsAttrs.second); // update elements with attributes std::vector > attributes; @@ -1217,15 +1221,13 @@ void SAL_CALL SfxDocumentMetaData::init( std::vector > & vec = m_metaList[::rtl::OUString::createFromAscii("meta:user-defined")]; - // user-defined meta data: create PropertyBag which only accepts property - // values of allowed types + m_xUserDefined.clear(); // #i105826#: reset (may be re-initialization) if ( !vec.empty() ) { createUserDefined(); } // user-defined meta data: initialize PropertySet from DOM nodes - for (std::vector >::iterator it = vec.begin(); it != vec.end(); ++it) { css::uno::Reference xElem(*it, @@ -1301,10 +1303,14 @@ void SAL_CALL SfxDocumentMetaData::init( //////////////////////////////////////////////////////////////////////////// SfxDocumentMetaData::SfxDocumentMetaData( - css::uno::Reference< css::uno::XComponentContext > const & context) : - BaseMutex(), SfxDocumentMetaData_Base(m_aMutex), - m_xContext(context), m_NotifyListeners(m_aMutex), - m_isInitialized(false), m_isModified(false) + css::uno::Reference< css::uno::XComponentContext > const & context) + : BaseMutex() + , SfxDocumentMetaData_Base(m_aMutex) + , m_xContext(context) + , m_NotifyListeners(m_aMutex) + , m_isInitialized(false) + , m_isModified(false) + , m_AutoloadSecs(0) { DBG_ASSERT(context.is(), "SfxDocumentMetaData: context is null"); DBG_ASSERT(context->getServiceManager().is(), @@ -2168,7 +2174,7 @@ void SAL_CALL SfxDocumentMetaData::setModified( ::sal_Bool bModified ) ::osl::MutexGuard g(m_aMutex); checkInit(); m_isModified = bModified; - if ( !bModified ) + if ( !bModified && m_xUserDefined.is() ) { xMB.set(m_xUserDefined, css::uno::UNO_QUERY); DBG_ASSERT(xMB.is(), @@ -2241,6 +2247,8 @@ void SAL_CALL SfxDocumentMetaData::serialize( void SfxDocumentMetaData::createUserDefined() { + // user-defined meta data: create PropertyBag which only accepts property + // values of allowed types if ( !m_xUserDefined.is() ) { css::uno::Sequence types(10); @@ -2258,29 +2266,37 @@ void SfxDocumentMetaData::createUserDefined() args[0] <<= css::beans::NamedValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AllowedTypes")), css::uno::makeAny(types)); - // #i94175#: ODF 1.1 allows empty user-defined property names! - args[1] <<= css::beans::NamedValue( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AllowEmptyPropertyName")), + // #i94175#: ODF allows empty user-defined property names! + args[1] <<= css::beans::NamedValue( ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("AllowEmptyPropertyName")), css::uno::makeAny(sal_True)); - css::uno::Reference xMsf (m_xContext->getServiceManager()); + const css::uno::Reference xMsf( + m_xContext->getServiceManager()); m_xUserDefined.set( - xMsf->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.PropertyBag")), m_xContext), + xMsf->createInstanceWithContext( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.beans.PropertyBag")), m_xContext), css::uno::UNO_QUERY_THROW); - css::uno::Reference xInit(m_xUserDefined, - css::uno::UNO_QUERY); + const css::uno::Reference xInit( + m_xUserDefined, css::uno::UNO_QUERY); if (xInit.is()) { xInit->initialize(args); } - css::uno::Reference xMB(m_xUserDefined,css::uno::UNO_QUERY); + const css::uno::Reference xMB( + m_xUserDefined, css::uno::UNO_QUERY); if (xMB.is()) { - css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > aListener = m_NotifyListeners.getElements(); - const css::uno::Reference< css::uno::XInterface >* pIter = aListener.getConstArray(); - const css::uno::Reference< css::uno::XInterface >* pEnd = pIter + aListener.getLength(); - for(;pIter != pEnd;++pIter ) - xMB->addModifyListener(css::uno::Reference< css::util::XModifyListener >(*pIter,css::uno::UNO_QUERY)); + const css::uno::Sequence > + listeners(m_NotifyListeners.getElements()); + for (css::uno::Reference< css::uno::XInterface > const * iter = + ::comphelper::stl_begin(listeners); + iter != ::comphelper::stl_end(listeners); ++iter) { + xMB->addModifyListener( + css::uno::Reference< css::util::XModifyListener >(*iter, + css::uno::UNO_QUERY)); + } } } } From ad7c9894af526fead64f1d134ec38172b105546f Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Tue, 13 Oct 2009 06:40:52 +0000 Subject: [PATCH 039/117] #i105825# throw exception when database was written by newer version --- .../source/drivers/hsqldb/HDriver.cxx | 43 +++++++++++++++++++ .../source/drivers/hsqldb/makefile.mk | 1 + .../source/inc/resource/hsqldb_res.hrc | 1 + .../source/resource/conn_shared_res.src | 5 +++ 4 files changed, 50 insertions(+) diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 1e80a96cf682..4c9577497525 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include "resource/hsqldb_res.hrc" #include "resource/sharedresources.hxx" @@ -70,6 +71,8 @@ namespace connectivity using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::embed; + using namespace ::com::sun::star::io; + using namespace ::com::sun::star::task; using namespace ::com::sun::star::reflection; namespace hsqldb @@ -260,6 +263,46 @@ namespace connectivity ); aProperties.put( "SystemProperties", Sequence< NamedValue >( &aPermittedClasses, 1 ) ); + ::rtl::OUString sProperties( RTL_CONSTASCII_USTRINGPARAM( "properties" ) ); + try + { + if ( !bIsNewDatabase && xStorage->isStreamElement(sProperties) ) + { + Reference xStream = xStorage->openStreamElement(sProperties,ElementModes::READ); + if ( xStream.is() ) + { + ::std::auto_ptr pStream( ::utl::UcbStreamHelper::CreateStream(xStream) ); + if ( pStream.get() ) + { + ByteString sLine; + while ( pStream->ReadLine(sLine) ) + { + if ( sLine.Equals("version=",0,sizeof("version=")-1) ) + { + sLine = sLine.GetToken(1,'='); + const sal_Int32 nMajor = sLine.GetToken(0,'.').ToInt32(); + const sal_Int32 nMinor = sLine.GetToken(1,'.').ToInt32(); + const sal_Int32 nMicro = sLine.GetToken(2,'.').ToInt32(); + if ( nMajor > 1 + || ( nMajor == 1 && nMinor > 8 ) + || ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) ) + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION); + ::dbtools::throwGenericSQLException(sMessage ,*this); + } + break; + } + } + } + } // if ( xStream.is() ) + ::comphelper::disposeComponent(xStream); + } + } + catch(Exception&) + { + } + // readonly? Reference xProp(xStorage,UNO_QUERY); if ( xProp.is() ) diff --git a/connectivity/source/drivers/hsqldb/makefile.mk b/connectivity/source/drivers/hsqldb/makefile.mk index 9ed5acb17d4c..c61e4b297ba4 100644 --- a/connectivity/source/drivers/hsqldb/makefile.mk +++ b/connectivity/source/drivers/hsqldb/makefile.mk @@ -102,6 +102,7 @@ SHL1STDLIBS=\ $(DBTOOLSLIB) \ $(JVMFWKLIB) \ $(COMPHELPERLIB) \ + $(TOOLSLIB) \ $(UNOTOOLSLIB) diff --git a/connectivity/source/inc/resource/hsqldb_res.hrc b/connectivity/source/inc/resource/hsqldb_res.hrc index 3b7b9ef15c0a..b9066488d425 100644 --- a/connectivity/source/inc/resource/hsqldb_res.hrc +++ b/connectivity/source/inc/resource/hsqldb_res.hrc @@ -44,6 +44,7 @@ #define STR_NO_TABLE_EDITOR_DIALOG ( STR_HSQLDB_BASE + 3 ) #define STR_NO_TABLENAME ( STR_HSQLDB_BASE + 4 ) #define STR_NO_DOCUMENTUI ( STR_HSQLDB_BASE + 5 ) +#define STR_ERROR_NEW_VERSION ( STR_HSQLDB_BASE + 6 ) #endif // CONNECTIVITY_RESOURCE_HSQLDB_HRC diff --git a/connectivity/source/resource/conn_shared_res.src b/connectivity/source/resource/conn_shared_res.src index d143dad1ba0f..48ab06f0f635 100644 --- a/connectivity/source/resource/conn_shared_res.src +++ b/connectivity/source/resource/conn_shared_res.src @@ -645,3 +645,8 @@ String STR_NO_DOCUMENTUI { Text [ en-US ] = "The provided DocumentUI is not allowed to be NULL."; }; +String STR_ERROR_NEW_VERSION +{ + Text = "The connection could not be established. The database was created by a newer version of %PRODUCTNAME."; +}; + From 62ca52de9fdef795974d38073a36d64ed75f0991 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 13 Oct 2009 17:06:46 +0000 Subject: [PATCH 040/117] #i105753# fix quickstart mode on Mac --- desktop/source/app/app.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index d4e0a91c1d17..efc689b54ff8 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1738,8 +1738,15 @@ sal_Bool Desktop::InitializeQuickstartMode( Reference< XMultiServiceFactory >& r aSeq[0] <<= bQuickstart; // Try to instanciate quickstart service. This service is not mandatory, so - // do nothing if service is not available. + // do nothing if service is not available + + // #i105753# the following if was invented for performance + // unfortunately this broke the QUARTZ behavior which is to always run + // in quickstart mode since Mac applications do not usually quit + // when the last document closes + #ifndef QUARTZ if ( bQuickstart ) + #endif { Reference < XComponent > xQuickstart( rSMgr->createInstanceWithArguments( DEFINE_CONST_UNICODE( "com.sun.star.office.Quickstart" ), aSeq ), From 804477d542dbd713a74e9f70997620c403321f2f Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 15 Oct 2009 09:48:47 +0200 Subject: [PATCH 041/117] #i105815# define default fonts for sinhala-script --- .../registry/data/org/openoffice/VCL.xcu | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index 9d145fbcc831..cc5bd13ae7d1 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -1022,6 +1022,26 @@ + + + LKLUG;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + From 8023c47ecd9ad61c677978351ff1ef08f3796ae5 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 15 Oct 2009 09:50:10 +0200 Subject: [PATCH 042/117] #i105815# define default fonts for some indic scripts (thanks dtardon!) --- .../registry/data/org/openoffice/VCL.xcu | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index cc5bd13ae7d1..48f6fdf8d187 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -825,6 +825,46 @@ Lohit Nepali;Kalimati;Samanata;Sans + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + Lohit Hindi;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif @@ -865,6 +905,86 @@ Lohit Gujarati;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + + + Meera;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + utkal;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif @@ -925,6 +1045,26 @@ Lohit Tamil;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + From 9168edda9d8de34b2fe84aa77d51520ef6f5f811 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 15 Oct 2009 09:56:01 +0200 Subject: [PATCH 043/117] #i105914# define default fonts for some indic scripts (thanks dtardon!) --- .../registry/data/org/openoffice/VCL.xcu | 140 ------------------ 1 file changed, 140 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index 48f6fdf8d187..cc5bd13ae7d1 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -825,46 +825,6 @@ Lohit Nepali;Kalimati;Samanata;Sans - - - Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif - - - Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - - - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif - - - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - Lohit Hindi;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif @@ -905,86 +865,6 @@ Lohit Gujarati;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif - - - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - - - Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif - - - Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - - - Meera;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif - - - Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - - - Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif - - - Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - utkal;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif @@ -1045,26 +925,6 @@ Lohit Tamil;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif - - - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - - From 1d2669b5859875b91dfbe916855adeef2552bf95 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 15 Oct 2009 09:56:33 +0200 Subject: [PATCH 044/117] #i105914# define default fonts for some indic scripts (thanks dtardon!) --- .../registry/data/org/openoffice/VCL.xcu | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index cc5bd13ae7d1..48f6fdf8d187 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -825,6 +825,46 @@ Lohit Nepali;Kalimati;Samanata;Sans + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + Lohit Hindi;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif @@ -865,6 +905,86 @@ Lohit Gujarati;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + + + Meera;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + utkal;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif @@ -925,6 +1045,26 @@ Lohit Tamil;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + From 548995fefe670c546f314750560989f4253226bb Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 15 Oct 2009 11:45:27 +0200 Subject: [PATCH 045/117] #i105914# #i105815# extend indic default fonts with WIN fonts --- .../registry/data/org/openoffice/VCL.xcu | 103 +++++++++--------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index 48f6fdf8d187..3ce6c64d0907 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: VCL.xcu,v $ - * $Revision: 1.62.116.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -827,7 +824,7 @@ - Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU Lohit Assamese;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS @@ -847,82 +844,82 @@ - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + Lohit Bengali;Vrinda;Lucidasans;Lucida Sans;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Bengali;Vrinda;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Bengali;Vrinda;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Bengali;Vrinda;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Bengali;Vrinda;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Bengali;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Bengali;Vrinda;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Hindi;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + Lohit Hindi;Mangal;Lucidasans;Lucida Sans;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU - Lohit Hindi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Hindi;Mangal;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Hindi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Hindi;Mangal;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Hindi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Hindi;Mangal;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Hindi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Hindi;Mangal;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Hindi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Hindi;Mangal;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Gujarati;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + Lohit Gujarati;Shruti;Lucidasans;Lucida Sans;Arial Unicode MS;Lucida Sans Unicode;clearlyU - Lohit Gujarati;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Gujarati;Shruti;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Gujarati;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Gujarati;Shruti;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Gujarati;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Gujarati;Shruti;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Gujarati;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Gujarati;Shruti;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Gujarati;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Gujarati;Shruti;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + Lohit Kannada;Tunga;Lucidasans;Lucida Sans;Arial Unicode MS;Lucida Sans Unicode;clearlyU - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Kannada;Tunga;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Kannada;Tunga;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Kannada;Tunga;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Kannada;Tunga;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Kannada;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Kannada;Tunga;Lucidasans;Lucida Sans;Arial Unicode MS @@ -947,7 +944,7 @@ - Meera;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + Meera;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU Meera;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS @@ -967,7 +964,7 @@ - Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU Lohit Marathi;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS @@ -987,22 +984,22 @@ - utkal;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + utkal;Kalinga;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU - utkal;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS - utkal;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS - utkal;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS - utkal;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS - utkal;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS @@ -1027,42 +1024,42 @@ - Lohit Tamil;Tahoma;Sans Serif + Lohit Tamil;Latha;Sans Serif - Lohit Tamil;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Tamil;Latha;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Tamil;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Tamil;Latha;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Tamil;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Tamil;Latha;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Tamil;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Tamil;Latha;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Tamil;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Tamil;Latha;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + Lohit Telugu;Gautami;Lucidasans;Lucida Sans;Arial Unicode MS;Lucida Sans Unicode;clearlyU - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Telugu;Gautami;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Telugu;Gautami;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Telugu;Gautami;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Telugu;Gautami;Lucidasans;Lucida Sans;Arial Unicode MS - Lohit Telugu;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Lohit Telugu;Gautami;Lucidasans;Lucida Sans;Arial Unicode MS @@ -1167,19 +1164,19 @@ LKLUG;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif - LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Iskoola Pota;LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Iskoola Pota;LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Iskoola Pota;LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Iskoola Pota;LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS - LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + Iskoola Pota;LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS From 7b2ea69d78dda0f2c7af5f892efd5b7561b8faa8 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 15 Oct 2009 11:52:24 +0200 Subject: [PATCH 046/117] #i105815# extend sinhala default fonts with WIN fonts --- officecfg/registry/data/org/openoffice/VCL.xcu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index 3ce6c64d0907..c2c6926382c1 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -1161,7 +1161,7 @@ - LKLUG;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + LKLUG;Iskoola Pota;Lucidasans;Lucida Sans;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU Iskoola Pota;LKLUG;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS From 4d00cd23c9ba13a9a6d3901178a066fa6940e7d2 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 15 Oct 2009 13:17:23 +0200 Subject: [PATCH 047/117] #i105914# add default fonts for Urdu --- .../registry/data/org/openoffice/VCL.xcu | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index c2c6926382c1..b30a43202300 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -924,7 +924,7 @@ - Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU;Interface User;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Helmet;Interface System;Sans Serif + Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU Lohit Maithili;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS @@ -984,22 +984,22 @@ - utkal;Kalinga;Tahoma;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;clearlyU + utkal;Kalinga;Lohit Oriya;Samyak Oriya;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS;Lucida Sans Unicode;clearlyU - utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lohit Oriya;Samyak Oriya;Lucidasans;Lucida Sans;Arial Unicode MS - utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lohit Oriya;Samyak Oriya;Lucidasans;Lucida Sans;Arial Unicode MS - utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lohit Oriya;Samyak Oriya;Lucidasans;Lucida Sans;Arial Unicode MS - utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lohit Oriya;Samyak Oriya;Lucidasans;Lucida Sans;Arial Unicode MS - utkal;Kalinga;Lucidasans;Lucida Sans;Arial Unicode MS + utkal;Kalinga;Lohit Oriya;Samyak Oriya;Lucidasans;Lucida Sans;Arial Unicode MS @@ -1062,6 +1062,26 @@ Lohit Telugu;Gautami;Lucidasans;Lucida Sans;Arial Unicode MS + + + PakTypeNaqsh;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS;Lucida Sans Unicode;clearlyU + + + PakTypeNaqsh;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + PakTypeNaqsh;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + PakTypeNaqsh;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + PakTypeNaqsh;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + + PakTypeNaqsh;Tahoma;Lucidasans;Lucida Sans;Arial Unicode MS + + From 2eb7dd0deb70e9f120a2a38b56b9a38891c3ae83 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 15 Oct 2009 13:52:22 +0200 Subject: [PATCH 048/117] #i105377# redirect output into correct metafile --- .../processor2d/vclmetafileprocessor2d.hxx | 2 +- .../processor2d/vclmetafileprocessor2d.cxx | 44 +++++++++++-------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx index f0d0ff881bc5..38e7e5143b8a 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx @@ -97,7 +97,7 @@ namespace drawinglayer basegfx::B2DPolyPolygon maClipPolyPolygon; // the target MetaFile - GDIMetaFile& mrMetaFile; + GDIMetaFile* mpMetaFile; // do not allow embedding SvtGraphicFills into each other, // use a counter to prevent that diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 1c040545eedd..d1190c2d9179 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -113,6 +113,7 @@ namespace drawinglayer { // Prepare VDev, MetaFile and connections OutputDevice* pLastOutputDevice = mpOutputDevice; + GDIMetaFile* pLastMetafile = mpMetaFile; basegfx::B2DRange aPrimitiveRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rContent, getViewInformation2D())); // transform primitive range with current transformation (e.g shadow offset) @@ -125,6 +126,7 @@ namespace drawinglayer MapMode aNewMapMode(pLastOutputDevice->GetMapMode()); mpOutputDevice = &aContentVDev; + mpMetaFile = &o_rContentMetafile; aContentVDev.EnableOutput(false); aContentVDev.SetMapMode(pLastOutputDevice->GetMapMode()); o_rContentMetafile.Record(&aContentVDev); @@ -145,6 +147,7 @@ namespace drawinglayer o_rContentMetafile.SetPrefMapMode(aNewMapMode); o_rContentMetafile.SetPrefSize(aPrimitiveRectangle.GetSize()); mpOutputDevice = pLastOutputDevice; + mpMetaFile = pLastMetafile; return aPrimitiveRectangle; } @@ -219,7 +222,7 @@ namespace drawinglayer SvMemoryStream aMemStm; aMemStm << *pSvtGraphicFill; - mrMetaFile.AddAction(new MetaCommentAction("XPATHFILL_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END))); + mpMetaFile->AddAction(new MetaCommentAction("XPATHFILL_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END))); mnSvtGraphicFillCount++; } } @@ -229,7 +232,7 @@ namespace drawinglayer if(pSvtGraphicFill && mnSvtGraphicFillCount) { mnSvtGraphicFillCount--; - mrMetaFile.AddAction(new MetaCommentAction("XPATHFILL_SEQ_END")); + mpMetaFile->AddAction(new MetaCommentAction("XPATHFILL_SEQ_END")); delete pSvtGraphicFill; } } @@ -372,7 +375,7 @@ namespace drawinglayer SvMemoryStream aMemStm; aMemStm << *pSvtGraphicStroke; - mrMetaFile.AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END))); + mpMetaFile->AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END))); mnSvtGraphicStrokeCount++; } } @@ -382,7 +385,7 @@ namespace drawinglayer if(pSvtGraphicStroke && mnSvtGraphicStrokeCount) { mnSvtGraphicStrokeCount--; - mrMetaFile.AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_END")); + mpMetaFile->AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_END")); delete pSvtGraphicStroke; } } @@ -392,7 +395,7 @@ namespace drawinglayer VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev) : VclProcessor2D(rViewInformation, rOutDev), - mrMetaFile(*rOutDev.GetConnectMetaFile()), + mpMetaFile(rOutDev.GetConnectMetaFile()), mnSvtGraphicFillCount(0), mnSvtGraphicStrokeCount(0), mfCurrentUnifiedTransparence(0.0), @@ -816,19 +819,19 @@ namespace drawinglayer { default : // case drawinglayer::primitive2d::FIELD_TYPE_COMMON : { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringCommon)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringCommon)); break; } case drawinglayer::primitive2d::FIELD_TYPE_PAGE : { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringPage)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringPage)); break; } case drawinglayer::primitive2d::FIELD_TYPE_URL : { const rtl::OUString& rURL = rFieldPrimitive.getString(); const String aOldString(rURL); - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringCommon, 0, reinterpret_cast< const BYTE* >(aOldString.GetBuffer()), 2 * aOldString.Len())); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringCommon, 0, reinterpret_cast< const BYTE* >(aOldString.GetBuffer()), 2 * aOldString.Len())); break; } } @@ -838,7 +841,7 @@ namespace drawinglayer process(rContent); // for the end comment the type is not relevant yet, they are all the same. Just add. - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringEnd)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringEnd)); if(mpPDFExtOutDevData && drawinglayer::primitive2d::FIELD_TYPE_URL == rFieldPrimitive.getType()) { @@ -863,7 +866,7 @@ namespace drawinglayer // process recursively and add MetaFile comment process(rLinePrimitive.get2DDecomposition(getViewInformation2D())); - mrMetaFile.AddAction(new MetaCommentAction(aCommentString)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); break; } @@ -876,7 +879,7 @@ namespace drawinglayer // process recursively and add MetaFile comment process(rBulletPrimitive.get2DDecomposition(getViewInformation2D())); - mrMetaFile.AddAction(new MetaCommentAction(aCommentString)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); break; } @@ -893,7 +896,7 @@ namespace drawinglayer // process recursively and add MetaFile comment process(rParagraphPrimitive.get2DDecomposition(getViewInformation2D())); - mrMetaFile.AddAction(new MetaCommentAction(aCommentString)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); if(mpPDFExtOutDevData) { @@ -910,9 +913,9 @@ namespace drawinglayer static const ByteString aCommentStringB("XTEXT_PAINTSHAPE_END"); // add MetaFile comment, process recursively and add MetaFile comment - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringA)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringA)); process(rBlockPrimitive.get2DDecomposition(getViewInformation2D())); - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringB)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringB)); break; } @@ -965,17 +968,17 @@ namespace drawinglayer // create the entries for the respective break positions if(i == nNextCellBreak) { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringA, i - nTextPosition)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringA, i - nTextPosition)); nNextCellBreak = mxBreakIterator->nextCharacters(rTxt, i, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); } if(i == nNextWordBoundary.endPos) { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringB, i - nTextPosition)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringB, i - nTextPosition)); nNextWordBoundary = mxBreakIterator->getWordBoundary(rTxt, i + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True); } if(i == nNextSentenceBreak) { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringC, i - nTextPosition)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringC, i - nTextPosition)); nNextSentenceBreak = mxBreakIterator->endOfSentence(rTxt, i + 1, rLocale); } } @@ -1057,7 +1060,7 @@ namespace drawinglayer { const Polygon aToolsPolygon(aCandidate); - mrMetaFile.AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo)); + mpMetaFile->AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo)); } } @@ -1500,7 +1503,10 @@ namespace drawinglayer // svae old mfCurrentUnifiedTransparence and set new one // so that contained SvtGraphicStroke may use the current one const double fLastCurrentUnifiedTransparence(mfCurrentUnifiedTransparence); - mfCurrentUnifiedTransparence = rUniAlphaCandidate.getAlpha(); + // #i105377# paint the content metafile opaque as the transparency gets + // split of into the gradient below + // mfCurrentUnifiedTransparence = rUniAlphaCandidate.getAlpha(); + mfCurrentUnifiedTransparence = 0; // various content, create content-metafile GDIMetaFile aContentMetafile; From 5cf5683f944d08fdb9ac22c4a21b095ec1af2ac5 Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Tue, 20 Oct 2009 05:35:27 +0000 Subject: [PATCH 050/117] #i106041# check the dispatch in impl_select not before --- framework/source/helper/popupmenucontrollerbase.cxx | 6 ++++-- framework/source/uielement/fontmenucontroller.cxx | 4 +++- framework/source/uielement/fontsizemenucontroller.cxx | 4 +++- framework/source/uielement/headermenucontroller.cxx | 4 +++- framework/source/uielement/objectmenucontroller.cxx | 4 +++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/framework/source/helper/popupmenucontrollerbase.cxx b/framework/source/helper/popupmenucontrollerbase.cxx index 7a768b11a32d..af46386edb35 100644 --- a/framework/source/helper/popupmenucontrollerbase.cxx +++ b/framework/source/helper/popupmenucontrollerbase.cxx @@ -186,7 +186,9 @@ void SAL_CALL PopupMenuControllerBase::highlight( const css::awt::MenuEvent& ) t void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL) { Sequence aArgs; - _xDispatch->dispatch( aURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"PopupMenuControllerBase::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aURL, aArgs ); } void SAL_CALL PopupMenuControllerBase::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) @@ -204,7 +206,7 @@ void SAL_CALL PopupMenuControllerBase::select( const css::awt::MenuEvent& rEvent xServiceManager = m_xServiceManager; aLock.unlock(); - if ( xPopupMenu.is() && xDispatch.is() ) + if ( xPopupMenu.is() ) { VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu ); if ( pPopupMenu ) diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index ee1014f25b77..e12843f7514d 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -188,7 +188,9 @@ void FontMenuController::impl_select(const Reference< XDispatch >& _xDispatch,co m_xFrame, aTargetURL, Sequence()); - _xDispatch->dispatch( aTargetURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"FontMenuController::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aTargetURL, aArgs ); } void SAL_CALL FontMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index bbf3915d2e06..2f7bce27d151 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -326,7 +326,9 @@ void FontSizeMenuController::impl_select(const Reference< XDispatch >& _xDispatc Sequence aArgs; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# UiEventLogHelper(::rtl::OUString::createFromAscii("FontSizeMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs); - _xDispatch->dispatch( aTargetURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"FontSizeMenuController::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aTargetURL, aArgs ); } // XPopupMenuController diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx index 4e90d86fe0c9..56f45c5c52c2 100644 --- a/framework/source/uielement/headermenucontroller.cxx +++ b/framework/source/uielement/headermenucontroller.cxx @@ -254,7 +254,9 @@ void HeaderMenuController::impl_select(const Reference< XDispatch >& _xDispatch, Sequence aArgs; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# UiEventLogHelper(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(m_bFooter ? "FooterMenuController" : "HeaderMenuController"))).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs); - _xDispatch->dispatch( aTargetURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"HeaderMenuController::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aTargetURL, aArgs ); } void SAL_CALL HeaderMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException) diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx index 9f7d3bb64f5e..937fb7ded0dc 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -160,7 +160,9 @@ void ObjectMenuController::impl_select(const Reference< XDispatch >& _xDispatch, Sequence aArgs; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# UiEventLogHelper(::rtl::OUString::createFromAscii("ObjectMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs); - _xDispatch->dispatch( aTargetURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"ObjectMenuController::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aTargetURL, aArgs ); } } From 630c13b2536453d67fe5b9b253ed9f80987aec2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 20 Oct 2009 08:55:11 +0000 Subject: [PATCH 051/117] CWS-TOOLING: rebase CWS cmcfixes64 to trunk@277035 (milestone: DEV300:m62) --- .../inc/connectivity/DriversConfig.hxx | 179 ++- connectivity/inc/connectivity/dbmetadata.hxx | 6 + .../source/commontools/DriversConfig.cxx | 60 +- .../source/commontools/dbmetadata.cxx | 16 + connectivity/source/drivers/jdbc/jdbc.xcu | 2 +- formula/prj/CVS/Entries | 4 - formula/prj/CVS/Repository | 1 - formula/prj/CVS/Root | 1 - formula/prj/CVS/Tag | 1 - formula/prj/CVS/Template | 42 - .../moduleuiconfigurationmanager.hxx | 92 +- .../uiconfigurationmanager.hxx | 81 +- framework/source/jobs/job.cxx | 2 - framework/source/uiconfiguration/makefile.mk | 1 - .../moduleuiconfigurationmanager.cxx | 1428 ++++++++++++++++- .../uiconfigurationmanager.cxx | 1157 ++++++++++++- .../uiconfigurationmanagerimpl.cxx | 8 +- framework/util/makefile.mk | 1 - oovbaapi/ooo/vba/constants/makefile.mk | 2 +- oovbaapi/ooo/vba/makefile.mk | 3 +- sfx2/source/view/viewimp.hxx | 10 +- sfx2/source/view/viewsh.cxx | 53 +- svx/inc/svx/msdffimp.hxx | 1 + .../contact/viewobjectcontactofunocontrol.hxx | 48 +- .../sdr/primitive2d/sdrdecompositiontools.hxx | 3 +- .../sdr/primitive2d/sdrtextprimitive2d.hxx | 5 +- svx/source/fmcomp/gridctrl.cxx | 15 +- svx/source/form/fmtextcontrolshell.cxx | 2 +- svx/source/msfilter/msdffimp.cxx | 70 +- svx/source/outliner/outliner.cxx | 27 +- svx/source/outliner/outlvw.cxx | 8 + .../sdr/contact/viewcontactofgraphic.cxx | 1 + .../sdr/contact/viewcontactofunocontrol.cxx | 38 +- .../contact/viewobjectcontactofunocontrol.cxx | 161 +- .../sdr/primitive2d/sdrcaptionprimitive2d.cxx | 1 + .../primitive2d/sdrconnectorprimitive2d.cxx | 2 +- .../primitive2d/sdrcustomshapeprimitive2d.cxx | 5 +- .../sdr/primitive2d/sdrdecompositiontools.cxx | 6 +- .../sdr/primitive2d/sdrellipseprimitive2d.cxx | 4 +- .../sdr/primitive2d/sdrgrafprimitive2d.cxx | 2 +- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 1 + .../sdr/primitive2d/sdrole2primitive2d.cxx | 2 +- .../sdr/primitive2d/sdrpathprimitive2d.cxx | 2 +- .../primitive2d/sdrrectangleprimitive2d.cxx | 2 +- .../sdr/primitive2d/sdrtextprimitive2d.cxx | 12 +- svx/source/svdraw/svdfppt.cxx | 12 +- svx/source/svdraw/svdotextdecomposition.cxx | 41 +- svx/source/table/viewcontactoftableobj.cxx | 2 +- xmloff/source/core/xmlimp.cxx | 20 +- 49 files changed, 3164 insertions(+), 479 deletions(-) delete mode 100644 formula/prj/CVS/Entries delete mode 100644 formula/prj/CVS/Repository delete mode 100644 formula/prj/CVS/Root delete mode 100644 formula/prj/CVS/Tag delete mode 100644 formula/prj/CVS/Template diff --git a/connectivity/inc/connectivity/DriversConfig.hxx b/connectivity/inc/connectivity/DriversConfig.hxx index bd86e9ce4397..da68443bb68e 100755 --- a/connectivity/inc/connectivity/DriversConfig.hxx +++ b/connectivity/inc/connectivity/DriversConfig.hxx @@ -1,92 +1,95 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: makefile,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: st $ $Date: 2000/11/22 02:32:00 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED -#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED - -#include -#include -#include -#include -#include "connectivity/dbtoolsdllapi.hxx" -#include -#include -#include - -namespace connectivity -{ - typedef struct - { - ::comphelper::NamedValueCollection aProperties; - ::comphelper::NamedValueCollection aFeatures; - ::comphelper::NamedValueCollection aMetaData; - ::rtl::OUString sDriverFactory; - ::rtl::OUString sDriverTypeDisplayName; - } TInstalledDriver; - DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers); - +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: makefile,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: st $ $Date: 2000/11/22 02:32:00 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED +#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED + +#include +#include +#include +#include +#include "connectivity/dbtoolsdllapi.hxx" +#include +#include +#include + +namespace connectivity +{ + typedef struct + { + ::comphelper::NamedValueCollection aProperties; + ::comphelper::NamedValueCollection aFeatures; + ::comphelper::NamedValueCollection aMetaData; + ::rtl::OUString sDriverFactory; + ::rtl::OUString sDriverTypeDisplayName; + } TInstalledDriver; + DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers); + class DriversConfigImpl { - ::utl::OConfigurationTreeRoot m_aInstalled; + mutable ::utl::OConfigurationTreeRoot m_aInstalled; + mutable TInstalledDrivers m_aDrivers; + void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const; public: DriversConfigImpl(); - void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,TInstalledDrivers& _rDrivers); - }; - // - // Allows to access all driver which are located in the configuration - // - class OOO_DLLPUBLIC_DBTOOLS DriversConfig - { - typedef salhelper::SingletonRef OSharedConfigNode; - - const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const; - public: - DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - ~DriversConfig(); - - DriversConfig( const DriversConfig& ); - DriversConfig& operator=( const DriversConfig& ); - - ::rtl::OUString getDriverFactoryName(const ::rtl::OUString& _sUrl) const; - ::rtl::OUString getDriverTypeDisplayName(const ::rtl::OUString& _sUrl) const; - const ::comphelper::NamedValueCollection& getProperties(const ::rtl::OUString& _sURL) const; - const ::comphelper::NamedValueCollection& getFeatures(const ::rtl::OUString& _sURL) const; - const ::comphelper::NamedValueCollection& getMetaData(const ::rtl::OUString& _sURL) const; - ::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const; - private: - TInstalledDrivers m_aDrivers; - OSharedConfigNode m_aNode; - }; -} -#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED + + const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const { Load(_rxORB); return m_aDrivers; } + }; + // + // Allows to access all driver which are located in the configuration + // + class OOO_DLLPUBLIC_DBTOOLS DriversConfig + { + typedef salhelper::SingletonRef OSharedConfigNode; + + const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const; + public: + DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + ~DriversConfig(); + + DriversConfig( const DriversConfig& ); + DriversConfig& operator=( const DriversConfig& ); + + ::rtl::OUString getDriverFactoryName(const ::rtl::OUString& _sUrl) const; + ::rtl::OUString getDriverTypeDisplayName(const ::rtl::OUString& _sUrl) const; + const ::comphelper::NamedValueCollection& getProperties(const ::rtl::OUString& _sURL) const; + const ::comphelper::NamedValueCollection& getFeatures(const ::rtl::OUString& _sURL) const; + const ::comphelper::NamedValueCollection& getMetaData(const ::rtl::OUString& _sURL) const; + ::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const; + private: + OSharedConfigNode m_aNode; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + }; +} +#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED diff --git a/connectivity/inc/connectivity/dbmetadata.hxx b/connectivity/inc/connectivity/dbmetadata.hxx index 32662c5c157a..1ee1718247ae 100644 --- a/connectivity/inc/connectivity/dbmetadata.hxx +++ b/connectivity/inc/connectivity/dbmetadata.hxx @@ -177,6 +177,12 @@ namespace dbtools /** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed */ bool displayEmptyTableFolders() const; + + /** determines that threads are supported. + * + * \return when threads are supported, otherwise + */ + bool supportsThreads() const; }; //........................................................................ diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index a72816d6427b..30c822b6f169 100755 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -112,32 +112,35 @@ DriversConfigImpl::DriversConfigImpl() { } // ----------------------------------------------------------------------------- -void DriversConfigImpl::Load(const uno::Reference< lang::XMultiServiceFactory >& _rxORB,TInstalledDrivers& _rDrivers) +void DriversConfigImpl::Load(const uno::Reference< lang::XMultiServiceFactory >& _rxORB) const { - if ( !m_aInstalled.isValid() ) + if ( m_aDrivers.empty() ) { - static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess.Drivers/Installed")); ///Installed - m_aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY); - } - - if ( m_aInstalled.isValid() ) - { - const uno::Sequence< ::rtl::OUString > aURLPatterns = m_aInstalled.getNodeNames(); - const ::rtl::OUString* pPatternIter = aURLPatterns.getConstArray(); - const ::rtl::OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength(); - for (;pPatternIter != pPatternEnd ; ++pPatternIter) + if ( !m_aInstalled.isValid() ) { - TInstalledDriver aInstalledDriver; - lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver); - if ( aInstalledDriver.sDriverFactory.getLength() ) - _rDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver)); + static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess.Drivers/Installed")); ///Installed + m_aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY); } + + if ( m_aInstalled.isValid() ) + { + const uno::Sequence< ::rtl::OUString > aURLPatterns = m_aInstalled.getNodeNames(); + const ::rtl::OUString* pPatternIter = aURLPatterns.getConstArray(); + const ::rtl::OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength(); + for (;pPatternIter != pPatternEnd ; ++pPatternIter) + { + TInstalledDriver aInstalledDriver; + lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver); + if ( aInstalledDriver.sDriverFactory.getLength() ) + m_aDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver)); + } + } // if ( m_aInstalled.isValid() ) } } // ----------------------------------------------------------------------------- DriversConfig::DriversConfig(const uno::Reference< lang::XMultiServiceFactory >& _rxORB) +:m_xORB(_rxORB) { - m_aNode->Load(_rxORB,m_aDrivers); } // ----------------------------------------------------------------------------- @@ -156,7 +159,6 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs ) { if ( this != &_rhs ) { - m_aDrivers = _rhs.m_aDrivers; m_aNode = _rhs.m_aNode; } return *this; @@ -165,10 +167,11 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs ) // ----------------------------------------------------------------------------- ::rtl::OUString DriversConfig::getDriverFactoryName(const ::rtl::OUString& _sURL) const { + const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); ::rtl::OUString sRet; ::rtl::OUString sOldPattern; - TInstalledDrivers::const_iterator aIter = m_aDrivers.begin(); - TInstalledDrivers::const_iterator aEnd = m_aDrivers.end(); + TInstalledDrivers::const_iterator aIter = rDrivers.begin(); + TInstalledDrivers::const_iterator aEnd = rDrivers.end(); for(;aIter != aEnd;++aIter) { WildCard aWildCard(aIter->first); @@ -184,10 +187,11 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs ) // ----------------------------------------------------------------------------- ::rtl::OUString DriversConfig::getDriverTypeDisplayName(const ::rtl::OUString& _sURL) const { + const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); ::rtl::OUString sRet; ::rtl::OUString sOldPattern; - TInstalledDrivers::const_iterator aIter = m_aDrivers.begin(); - TInstalledDrivers::const_iterator aEnd = m_aDrivers.end(); + TInstalledDrivers::const_iterator aIter = rDrivers.begin(); + TInstalledDrivers::const_iterator aEnd = rDrivers.end(); for(;aIter != aEnd;++aIter) { WildCard aWildCard(aIter->first); @@ -218,10 +222,11 @@ const ::comphelper::NamedValueCollection& DriversConfig::getMetaData(const ::rtl // ----------------------------------------------------------------------------- const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const { + const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); const ::comphelper::NamedValueCollection* pRet = NULL; ::rtl::OUString sOldPattern; - TInstalledDrivers::const_iterator aIter = m_aDrivers.begin(); - TInstalledDrivers::const_iterator aEnd = m_aDrivers.end(); + TInstalledDrivers::const_iterator aIter = rDrivers.begin(); + TInstalledDrivers::const_iterator aEnd = rDrivers.end(); for(;aIter != aEnd;++aIter) { WildCard aWildCard(aIter->first); @@ -252,10 +257,11 @@ const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const ::rtl::O // ----------------------------------------------------------------------------- uno::Sequence< ::rtl::OUString > DriversConfig::getURLs() const { - uno::Sequence< ::rtl::OUString > aRet(m_aDrivers.size()); + const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); + uno::Sequence< ::rtl::OUString > aRet(rDrivers.size()); ::rtl::OUString* pIter = aRet.getArray(); - TInstalledDrivers::const_iterator aIter = m_aDrivers.begin(); - TInstalledDrivers::const_iterator aEnd = m_aDrivers.end(); + TInstalledDrivers::const_iterator aIter = rDrivers.begin(); + TInstalledDrivers::const_iterator aEnd = rDrivers.end(); for(;aIter != aEnd;++aIter,++pIter) { *pIter = aIter->first; diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx index 70220b1cd563..c5b65a9d113b 100644 --- a/connectivity/source/commontools/dbmetadata.cxx +++ b/connectivity/source/commontools/dbmetadata.cxx @@ -407,6 +407,22 @@ namespace dbtools #endif return doDisplay; } + //-------------------------------------------------------------------- + bool DatabaseMetaData::supportsThreads() const + { + bool bSupported( true ); + try + { + Reference< XDatabaseMetaData > xMeta( m_pImpl->xConnectionMetaData, UNO_SET_THROW ); + ::rtl::OUString sConnectionURL( xMeta->getURL() ); + bSupported = sConnectionURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:mysqlc" ) ) != 0; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return bSupported; + } //........................................................................ } // namespace dbtools diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu index 73fe2e9adc55..ae1bbad227e7 100755 --- a/connectivity/source/drivers/jdbc/jdbc.xcu +++ b/connectivity/source/drivers/jdbc/jdbc.xcu @@ -174,7 +174,7 @@ - false + true diff --git a/formula/prj/CVS/Entries b/formula/prj/CVS/Entries deleted file mode 100644 index 3ae75e3153ff..000000000000 --- a/formula/prj/CVS/Entries +++ /dev/null @@ -1,4 +0,0 @@ -/build.lst/1.10/Wed Aug 20 14:15:04 2008//Tcws_dev300_frmdlg -/d.lst/1.6/Fri Aug 17 11:27:10 2007//Tcws_dev300_frmdlg -/rpt.xml/1.2/Mon Jul 09 11:56:12 2007//Tcws_dev300_frmdlg -D diff --git a/formula/prj/CVS/Repository b/formula/prj/CVS/Repository deleted file mode 100644 index 573341612fc8..000000000000 --- a/formula/prj/CVS/Repository +++ /dev/null @@ -1 +0,0 @@ -/cvs/dba/reportdesign/prj diff --git a/formula/prj/CVS/Root b/formula/prj/CVS/Root deleted file mode 100644 index ed0df2a21830..000000000000 --- a/formula/prj/CVS/Root +++ /dev/null @@ -1 +0,0 @@ -:pserver:oj@so-cvs-tunnel.germany.sun.com:/cvs diff --git a/formula/prj/CVS/Tag b/formula/prj/CVS/Tag deleted file mode 100644 index 9ff93ee1efdd..000000000000 --- a/formula/prj/CVS/Tag +++ /dev/null @@ -1 +0,0 @@ -Tcws_dev300_frmdlg diff --git a/formula/prj/CVS/Template b/formula/prj/CVS/Template deleted file mode 100644 index eec9bab36d48..000000000000 --- a/formula/prj/CVS/Template +++ /dev/null @@ -1,42 +0,0 @@ -Issue number: -Submitted by: -Reviewed by: -CVS: ---------------------------------------------------------------------- -CVS: Issue number: -CVS: If this change addresses one or more issues, -CVS: then enter the issue number(s) here. -CVS: Submitted by: -CVS: If this code has been contributed to the project by someone else; i.e., -CVS: they sent us a patch or a set of diffs, then include their name/email -CVS: address here. If this is your work then delete this line. -CVS: Reviewed by: -CVS: If we are doing pre-commit code reviews and someone else has -CVS: reviewed your changes, include their name(s) here. -CVS: If you have not had it reviewed then delete this line. -CVS: ---------------------------------------------------------------------- -CVS: Committers, -CVS: -CVS: Please follow these protocols: -CVS: -CVS: * Please include in the log message -CVS: reference(s) by ID / number and/or URL -CVS: to any and all relevant OpenOffice.org issue(s). -CVS: -CVS: * If the code is contributed from outside Sun -CVS: then please verify using the list at the following URL -CVS: http://www.openoffice.org/copyright/copyrightapproved.html -CVS: that Sun has received a signed Copyright Assignment Form -CVS: from the submitter. -CVS: -CVS: Otherwise, -CVS: please send an email TO: the submitter; and CC: OOCRequest@eng.sun.com -CVS: the letter (CopyRightRequest.txt) to request assignment of copyright to Sun -CVS: (http://www.openoffice.org/copyright/assign_copyright.html). -CVS: -CVS: Please do NOT commit code until you have verified (as detailed above) that -CVS: Sun has received a signed Copyright Assignment Form from the submitter. -CVS: -CVS: * Please send an email TO: the submitter -CVS: (particularly, if from outside Sun) -CVS: advising that the code has been committed, -CVS: and gratefully recognizing the contribution. diff --git a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx index 62c0477a5169..a0dc92ae50d3 100644 --- a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx +++ b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx @@ -38,7 +38,6 @@ #include #include #include -#include //_________________________________________________________________________________________________________________ // my own includes @@ -78,7 +77,6 @@ namespace framework { - class UIConfigurationManagerImpl; class ModuleUIConfigurationManager : public com::sun::star::lang::XTypeProvider , public com::sun::star::lang::XServiceInfo , public com::sun::star::lang::XComponent , @@ -87,6 +85,7 @@ namespace framework public ::com::sun::star::ui::XUIConfigurationManager , public ::com::sun::star::ui::XModuleUIConfigurationManager , public ::com::sun::star::ui::XUIConfigurationPersistence , + private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. public ::cppu::OWeakObject { public: @@ -135,7 +134,94 @@ namespace framework virtual sal_Bool SAL_CALL isReadOnly() throw (::com::sun::star::uno::RuntimeException); private: - ::std::auto_ptr m_pImpl; + // private data types + enum Layer + { + LAYER_DEFAULT, + LAYER_USERDEFINED, + LAYER_COUNT + }; + + enum NotifyOp + { + NotifyOp_Remove, + NotifyOp_Insert, + NotifyOp_Replace + }; + + struct UIElementInfo + { + UIElementInfo( const rtl::OUString& rResourceURL, const rtl::OUString& rUIName ) : + aResourceURL( rResourceURL), aUIName( rUIName ) {} + rtl::OUString aResourceURL; + rtl::OUString aUIName; + }; + + struct UIElementData + { + UIElementData() : bModified( false ), bDefault( true ), bDefaultNode( true ) {}; + + rtl::OUString aResourceURL; + rtl::OUString aName; + bool bModified; // has been changed since last storing + bool bDefault; // default settings + bool bDefaultNode; // this is a default layer element data + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > xSettings; + }; + + struct UIElementType; + friend struct UIElementType; + typedef ::std::hash_map< rtl::OUString, UIElementData, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementDataHashMap; + + struct UIElementType + { + UIElementType() : bModified( false ), + bLoaded( false ), + bDefaultLayer( false ), + nElementType( ::com::sun::star::ui::UIElementType::UNKNOWN ) {} + + + bool bModified; + bool bLoaded; + bool bDefaultLayer; + sal_Int16 nElementType; + UIElementDataHashMap aElementsHashMap; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage; + }; + + typedef ::std::vector< UIElementType > UIElementTypesVector; + typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer; + typedef ::std::hash_map< rtl::OUString, UIElementInfo, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementInfoHashMap; + + // private methods + void impl_Initialize(); + void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp ); + void impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType ); + void impl_preloadUIElementTypeList( Layer eLayer, sal_Int16 nElementType ); + UIElementData* impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad = true ); + void impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData ); + void impl_storeElementTypeData( com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage, UIElementType& rElementType, bool bResetModifyState = true ); + void impl_resetElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer ); + void impl_reloadElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer ); + + UIElementTypesVector m_aUIElements[LAYER_COUNT]; + PresetHandler* m_pStorageHandler[::com::sun::star::ui::UIElementType::COUNT]; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDefaultConfigStorage; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserConfigStorage; + bool m_bReadOnly; + bool m_bInitialized; + bool m_bModified; + bool m_bConfigRead; + bool m_bDisposed; + rtl::OUString m_aXMLPostfix; + rtl::OUString m_aPropUIName; + rtl::OUString m_aPropResourceURL; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aModuleShortName; + com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit; + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager; }; } diff --git a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx index 39f1d9503513..e7ecec183570 100644 --- a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx +++ b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx @@ -38,7 +38,6 @@ #include #include #include -#include //_________________________________________________________________________________________________________________ // my own includes @@ -78,7 +77,6 @@ namespace framework { - class UIConfigurationManagerImpl; class UIConfigurationManager : public com::sun::star::lang::XTypeProvider , public com::sun::star::lang::XServiceInfo , public com::sun::star::lang::XComponent , @@ -86,6 +84,7 @@ namespace framework public ::com::sun::star::ui::XUIConfigurationManager , public ::com::sun::star::ui::XUIConfigurationPersistence , public ::com::sun::star::ui::XUIConfigurationStorage , + private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. public ::cppu::OWeakObject { public: @@ -131,7 +130,83 @@ namespace framework virtual sal_Bool SAL_CALL hasStorage() throw (::com::sun::star::uno::RuntimeException); private: - ::std::auto_ptr m_pImpl; + // private data types + enum NotifyOp + { + NotifyOp_Remove, + NotifyOp_Insert, + NotifyOp_Replace + }; + + struct UIElementInfo + { + UIElementInfo( const rtl::OUString& rResourceURL, const rtl::OUString& rUIName ) : + aResourceURL( rResourceURL), aUIName( rUIName ) {} + rtl::OUString aResourceURL; + rtl::OUString aUIName; + }; + + struct UIElementData + { + UIElementData() : bModified( false ), bDefault( true ) {}; + + rtl::OUString aResourceURL; + rtl::OUString aName; + bool bModified; // has been changed since last storing + bool bDefault; // default settings + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > xSettings; + }; + + struct UIElementType; + friend struct UIElementType; + typedef ::std::hash_map< rtl::OUString, UIElementData, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementDataHashMap; + + struct UIElementType + { + UIElementType() : bModified( false ), + bLoaded( false ), + bDefaultLayer( false ), + nElementType( ::com::sun::star::ui::UIElementType::UNKNOWN ) {} + + + bool bModified; + bool bLoaded; + bool bDefaultLayer; + sal_Int16 nElementType; + UIElementDataHashMap aElementsHashMap; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage; + }; + + typedef ::std::vector< UIElementType > UIElementTypesVector; + typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer; + typedef ::std::hash_map< rtl::OUString, UIElementInfo, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementInfoHashMap; + + // private methods + void impl_Initialize(); + void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp ); + void impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType ); + void impl_preloadUIElementTypeList( sal_Int16 nElementType ); + UIElementData* impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad = true ); + void impl_requestUIElementData( sal_Int16 nElementType, UIElementData& aUIElementData ); + void impl_storeElementTypeData( com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage, UIElementType& rElementType, bool bResetModifyState = true ); + void impl_resetElementTypeData( UIElementType& rDocElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer ); + void impl_reloadElementTypeData( UIElementType& rDocElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer ); + + UIElementTypesVector m_aUIElements; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDocConfigStorage; + bool m_bReadOnly; + bool m_bInitialized; + bool m_bModified; + bool m_bConfigRead; + bool m_bDisposed; + rtl::OUString m_aXMLPostfix; + rtl::OUString m_aPropUIName; + rtl::OUString m_aPropResourceURL; + rtl::OUString m_aModuleIdentifier; + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xImageManager; + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xAccConfig; }; } diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx index 40d36f9a65f8..c0c5c90d45b3 100644 --- a/framework/source/jobs/job.cxx +++ b/framework/source/jobs/job.cxx @@ -51,7 +51,6 @@ // includes of other projects #include #include -#include //________________________________ // namespace @@ -238,7 +237,6 @@ void Job::execute( /*IN*/ const css::uno::Sequence< css::beans::NamedValue >& lD // Otherwhise we might die by ref count ... css::uno::Reference< css::task::XJobListener > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); - if ( ::comphelper::UiEventsLogger::isEnabled() ) try { // create the job diff --git a/framework/source/uiconfiguration/makefile.mk b/framework/source/uiconfiguration/makefile.mk index c7d6eb435d4f..3ef9006072a2 100644 --- a/framework/source/uiconfiguration/makefile.mk +++ b/framework/source/uiconfiguration/makefile.mk @@ -43,7 +43,6 @@ ENABLE_EXCEPTIONS= TRUE SLOFILES= \ $(SLO)$/uiconfigurationmanager.obj \ - $(SLO)$/uiconfigurationmanagerimpl.obj \ $(SLO)$/moduleuiconfigurationmanager.obj \ $(SLO)$/moduleuicfgsupplier.obj \ $(SLO)$/windowstateconfiguration.obj \ diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 04c87a2c3946..663c2d0d6dd8 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #ifndef __FRAMEWORK_XML_STATUSBARCONFIGURATION_HXX_ #include @@ -114,127 +113,1292 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ModuleUIConfigurationManager DEFINE_INIT_SERVICE ( ModuleUIConfigurationManager, {} ) -ModuleUIConfigurationManager::ModuleUIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) -: m_pImpl( new UIConfigurationManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),true) ) +// important: The order and position of the elements must match the constant +// definition of "::com::sun::star::ui::UIElementType" +static const char* UIELEMENTTYPENAMES[] = { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::ModuleUIConfigurationManager" ); + "", // Dummy value for unknown! + UIELEMENTTYPE_MENUBAR_NAME, + UIELEMENTTYPE_POPUPMENU_NAME, + UIELEMENTTYPE_TOOLBAR_NAME, + UIELEMENTTYPE_STATUSBAR_NAME, + UIELEMENTTYPE_FLOATINGWINDOW_NAME, + UIELEMENTTYPE_PROGRESSBAR_NAME +}; + +static const char RESOURCEURL_PREFIX[] = "private:resource/"; +static const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17; +static const char RESOURCEURL_CUSTOM_ELEMENT[] = "custom_"; + +static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL ) +{ + + if (( aResourceURL.indexOf( OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) && + ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) + { + OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ); + sal_Int32 nIndex = aTmpStr.indexOf( '/' ); + if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex )) + { + OUString aTypeStr( aTmpStr.copy( 0, nIndex )); + for ( int i = 0; i < UIElementType::COUNT; i++ ) + { + if ( aTypeStr.equalsAscii( UIELEMENTTYPENAMES[i] )) + return sal_Int16( i ); + } + } + } + + return UIElementType::UNKNOWN; +} + +static OUString RetrieveNameFromResourceURL( const rtl::OUString& aResourceURL ) +{ + if (( aResourceURL.indexOf( OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) && + ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) + { + sal_Int32 nIndex = aResourceURL.lastIndexOf( '/' ); + if (( nIndex > 0 ) && (( nIndex+1 ) < aResourceURL.getLength())) + return aResourceURL.copy( nIndex+1 ); + } + + return OUString(); +} + +void ModuleUIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType ) +{ + // preload list of element types on demand + impl_preloadUIElementTypeList( LAYER_USERDEFINED, nElementType ); + impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType ); + + UIElementDataHashMap& rUserElements = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap; + UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin(); + + OUString aCustomUrlPrefix( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_CUSTOM_ELEMENT )); + while ( pUserIter != rUserElements.end() ) + { + sal_Int32 nIndex = pUserIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE ); + if ( nIndex > RESOURCEURL_PREFIX_SIZE ) + { + // Performance: Retrieve user interface name only for custom user interface elements. + // It's only used by them! + UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType ); + if ( pDataSettings ) + { + // Retrieve user interface name from XPropertySet interface + rtl::OUString aUIName; + Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY ); + if ( xPropSet.is() ) + { + Any a = xPropSet->getPropertyValue( m_aPropUIName ); + a >>= aUIName; + } + + UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName ); + aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo )); + } + } + else + { + // The user interface name for standard user interface elements is stored in the WindowState.xcu file + UIElementInfo aInfo( pUserIter->second.aResourceURL, OUString() ); + aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo )); + } + ++pUserIter; + } + + UIElementDataHashMap& rDefaultElements = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap; + UIElementDataHashMap::const_iterator pDefIter = rDefaultElements.begin(); + + while ( pDefIter != rDefaultElements.end() ) + { + UIElementInfoHashMap::const_iterator pIterInfo = aUIElementInfoCollection.find( pDefIter->second.aResourceURL ); + if ( pIterInfo == aUIElementInfoCollection.end() ) + { + sal_Int32 nIndex = pDefIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE ); + if ( nIndex > RESOURCEURL_PREFIX_SIZE ) + { + // Performance: Retrieve user interface name only for custom user interface elements. + // It's only used by them! + UIElementData* pDataSettings = impl_findUIElementData( pDefIter->second.aResourceURL, nElementType ); + if ( pDataSettings ) + { + // Retrieve user interface name from XPropertySet interface + rtl::OUString aUIName; + Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY ); + if ( xPropSet.is() ) + { + Any a = xPropSet->getPropertyValue( m_aPropUIName ); + a >>= aUIName; + } + + UIElementInfo aInfo( pDefIter->second.aResourceURL, aUIName ); + aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo )); + } + } + else + { + // The user interface name for standard user interface elements is stored in the WindowState.xcu file + UIElementInfo aInfo( pDefIter->second.aResourceURL, OUString() ); + aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo )); + } + } + + ++pDefIter; + } +} + +void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer, sal_Int16 nElementType ) +{ + UIElementType& rElementTypeData = m_aUIElements[eLayer][nElementType]; + + if ( !rElementTypeData.bLoaded ) + { + Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage; + if ( xElementTypeStorage.is() ) + { + rtl::OUStringBuffer aBuf( RESOURCEURL_PREFIX_SIZE ); + aBuf.appendAscii( RESOURCEURL_PREFIX ); + aBuf.appendAscii( UIELEMENTTYPENAMES[ nElementType ] ); + aBuf.appendAscii( "/" ); + OUString aResURLPrefix( aBuf.makeStringAndClear() ); + + UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap; + Reference< XNameAccess > xNameAccess( xElementTypeStorage, UNO_QUERY ); + Sequence< OUString > aUIElementNames = xNameAccess->getElementNames(); + for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ ) + { + UIElementData aUIElementData; + + // Resource name must be without ".xml" + sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' ); + if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() )) + { + OUString aExtension( aUIElementNames[n].copy( nIndex+1 )); + OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex )); + + if (( aUIElementName.getLength() > 0 ) && + ( aExtension.equalsIgnoreAsciiCaseAsciiL( "xml", 3 ))) + { + aUIElementData.aResourceURL = aResURLPrefix + aUIElementName; + aUIElementData.aName = aUIElementNames[n]; + + if ( eLayer == LAYER_USERDEFINED ) + { + aUIElementData.bModified = false; + aUIElementData.bDefault = false; + aUIElementData.bDefaultNode = false; + } + + // Create hash_map entries for all user interface elements inside the storage. We don't load the + // settings to speed up the process. + rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData )); + } + } + } + } + } + + rElementTypeData.bLoaded = true; +} + +void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData ) +{ + UIElementType& rElementTypeData = m_aUIElements[eLayer][nElementType]; + + Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage; + if ( xElementTypeStorage.is() && aUIElementData.aName.getLength() ) + { + try + { + Reference< XStream > xStream = xElementTypeStorage->openStreamElement( aUIElementData.aName, ElementModes::READ ); + Reference< XInputStream > xInputStream = xStream->getInputStream(); + + if ( xInputStream.is() ) + { + switch ( nElementType ) + { + case ::com::sun::star::ui::UIElementType::UNKNOWN: + break; + + case ::com::sun::star::ui::UIElementType::MENUBAR: + { + try + { + MenuConfiguration aMenuCfg( m_xServiceManager ); + Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream )); + RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer ); + if ( pRootItemContainer ) + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY ); + else + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xContainer, sal_True ) ), UNO_QUERY ); + return; + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + } + break; + + case ::com::sun::star::ui::UIElementType::POPUPMENU: + { + break; + } + + case ::com::sun::star::ui::UIElementType::TOOLBAR: + { + try + { + Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); + ToolBoxConfiguration::LoadToolBox( m_xServiceManager, xInputStream, xIndexContainer ); + RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer ); + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY ); + return; + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + + break; + } + + case ::com::sun::star::ui::UIElementType::STATUSBAR: + { + try + { + Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); + StatusBarConfiguration::LoadStatusBar( m_xServiceManager, xInputStream, xIndexContainer ); + RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer ); + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY ); + return; + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + + break; + } + + case ::com::sun::star::ui::UIElementType::FLOATINGWINDOW: + { + break; + } + } + } + } + catch ( ::com::sun::star::embed::InvalidStorageException& ) + { + } + catch ( ::com::sun::star::lang::IllegalArgumentException& ) + { + } + catch ( ::com::sun::star::io::IOException& ) + { + } + catch ( ::com::sun::star::embed::StorageWrappedTargetException& ) + { + } + } + + // At least we provide an empty settings container! + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer() ), UNO_QUERY ); +} + +ModuleUIConfigurationManager::UIElementData* ModuleUIConfigurationManager::impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad ) +{ + // preload list of element types on demand + impl_preloadUIElementTypeList( LAYER_USERDEFINED, nElementType ); + impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType ); + + // first try to look into our user-defined vector/hash_map combination + UIElementDataHashMap& rUserHashMap = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap; + UIElementDataHashMap::iterator pIter = rUserHashMap.find( aResourceURL ); + if ( pIter != rUserHashMap.end() ) + { + // Default data settings data must be retrieved from the default layer! + if ( !pIter->second.bDefault ) + { + if ( !pIter->second.xSettings.is() && bLoad ) + impl_requestUIElementData( nElementType, LAYER_USERDEFINED, pIter->second ); + return &(pIter->second); + } + } + + // Not successfull, we have to look into our default vector/hash_map combination + UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap; + pIter = rDefaultHashMap.find( aResourceURL ); + if ( pIter != rDefaultHashMap.end() ) + { + if ( !pIter->second.xSettings.is() && bLoad ) + impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second ); + return &(pIter->second); + } + + // Nothing has been found! + return NULL; +} + +void ModuleUIConfigurationManager::impl_storeElementTypeData( Reference< XStorage > xStorage, UIElementType& rElementType, bool bResetModifyState ) +{ + UIElementDataHashMap& rHashMap = rElementType.aElementsHashMap; + UIElementDataHashMap::iterator pIter = rHashMap.begin(); + + while ( pIter != rHashMap.end() ) + { + UIElementData& rElement = pIter->second; + if ( rElement.bModified ) + { + if ( rElement.bDefault ) + { + xStorage->removeElement( rElement.aName ); + rElement.bModified = sal_False; // mark as not modified + } + else + { + Reference< XStream > xStream( xStorage->openStreamElement( rElement.aName, ElementModes::WRITE|ElementModes::TRUNCATE ), UNO_QUERY ); + Reference< XOutputStream > xOutputStream( xStream->getOutputStream() ); + + if ( xOutputStream.is() ) + { + switch( rElementType.nElementType ) + { + case ::com::sun::star::ui::UIElementType::MENUBAR: + { + try + { + MenuConfiguration aMenuCfg( m_xServiceManager ); + aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream ); + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + } + break; + + case ::com::sun::star::ui::UIElementType::TOOLBAR: + { + try + { + ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings ); + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + } + break; + + case ::com::sun::star::ui::UIElementType::STATUSBAR: + { + try + { + StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings ); + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + } + break; + + default: + break; + } + } + + // mark as not modified if we store to our own storage + if ( bResetModifyState ) + rElement.bModified = sal_False; + } + } + + ++pIter; + } + + // commit element type storage + Reference< XTransactedObject > xTransactedObject( xStorage, UNO_QUERY ); + if ( xTransactedObject.is() ) + xTransactedObject->commit(); + + // mark UIElementType as not modified if we store to our own storage + if ( bResetModifyState ) + rElementType.bModified = sal_False; +} + +// This is only allowed to be called on the LAYER_USER_DEFINED! +void ModuleUIConfigurationManager::impl_resetElementTypeData( + UIElementType& rUserElementType, + UIElementType& rDefaultElementType, + ConfigEventNotifyContainer& rRemoveNotifyContainer, + ConfigEventNotifyContainer& rReplaceNotifyContainer ) +{ + UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap; + UIElementDataHashMap::iterator pIter = rHashMap.begin(); + + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY ); + sal_Int16 nType = rUserElementType.nElementType; + + // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling + // our listeners! + while ( pIter != rHashMap.end() ) + { + UIElementData& rElement = pIter->second; + if ( !rElement.bDefault ) + { + if ( xDefaultNameAccess->hasByName( rElement.aName )) + { + // Replace settings with data from default layer + Reference< XIndexAccess > xOldSettings( rElement.xSettings ); + impl_requestUIElementData( nType, LAYER_DEFAULT, rElement ); + + ConfigurationEvent aReplaceEvent; + aReplaceEvent.ResourceURL = rElement.aResourceURL; + aReplaceEvent.Accessor <<= xThis; + aReplaceEvent.Source = xIfac; + aReplaceEvent.ReplacedElement <<= xOldSettings; + aReplaceEvent.Element <<= rElement.xSettings; + + rReplaceNotifyContainer.push_back( aReplaceEvent ); + + // Mark element as default and not modified. That means "not active" + // in the user layer anymore. + rElement.bModified = false; + rElement.bDefault = true; + } + else + { + // Remove user-defined settings from user layer + ConfigurationEvent aEvent; + aEvent.ResourceURL = rElement.aResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.Element <<= rElement.xSettings; + + rRemoveNotifyContainer.push_back( aEvent ); + + // Mark element as default and not modified. That means "not active" + // in the user layer anymore. + rElement.bModified = false; + rElement.bDefault = true; + } + } + + ++pIter; + } + + // Remove all settings from our user interface elements + rHashMap.clear(); +} + +void ModuleUIConfigurationManager::impl_reloadElementTypeData( + UIElementType& rUserElementType, + UIElementType& rDefaultElementType, + ConfigEventNotifyContainer& rRemoveNotifyContainer, + ConfigEventNotifyContainer& rReplaceNotifyContainer ) +{ + UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap; + UIElementDataHashMap::iterator pIter = rHashMap.begin(); + Reference< XStorage > xUserStorage( rUserElementType.xStorage ); + Reference< XStorage > xDefaultStorage( rDefaultElementType.xStorage ); + Reference< XNameAccess > xUserNameAccess( rUserElementType.xStorage, UNO_QUERY ); + Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY ); + + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + sal_Int16 nType = rUserElementType.nElementType; + + while ( pIter != rHashMap.end() ) + { + UIElementData& rElement = pIter->second; + if ( rElement.bModified ) + { + if ( xUserNameAccess->hasByName( rElement.aName )) + { + // Replace settings with data from user layer + Reference< XIndexAccess > xOldSettings( rElement.xSettings ); + + impl_requestUIElementData( nType, LAYER_USERDEFINED, rElement ); + + ConfigurationEvent aReplaceEvent; + + aReplaceEvent.ResourceURL = rElement.aResourceURL; + aReplaceEvent.Accessor <<= xThis; + aReplaceEvent.Source = xIfac; + aReplaceEvent.ReplacedElement <<= xOldSettings; + aReplaceEvent.Element <<= rElement.xSettings; + rReplaceNotifyContainer.push_back( aReplaceEvent ); + + rElement.bModified = false; + } + else if ( xDefaultNameAccess->hasByName( rElement.aName )) + { + // Replace settings with data from default layer + Reference< XIndexAccess > xOldSettings( rElement.xSettings ); + + impl_requestUIElementData( nType, LAYER_DEFAULT, rElement ); + + ConfigurationEvent aReplaceEvent; + + aReplaceEvent.ResourceURL = rElement.aResourceURL; + aReplaceEvent.Accessor <<= xThis; + aReplaceEvent.Source = xIfac; + aReplaceEvent.ReplacedElement <<= xOldSettings; + aReplaceEvent.Element <<= rElement.xSettings; + rReplaceNotifyContainer.push_back( aReplaceEvent ); + + // Mark element as default and not modified. That means "not active" + // in the user layer anymore. + rElement.bModified = false; + rElement.bDefault = true; + } + else + { + // Element settings are not in any storage => remove + ConfigurationEvent aRemoveEvent; + + aRemoveEvent.ResourceURL = rElement.aResourceURL; + aRemoveEvent.Accessor <<= xThis; + aRemoveEvent.Source = xIfac; + aRemoveEvent.Element <<= rElement.xSettings; + + rRemoveNotifyContainer.push_back( aRemoveEvent ); + + // Mark element as default and not modified. That means "not active" + // in the user layer anymore. + rElement.bModified = false; + rElement.bDefault = true; + } + } + ++pIter; + } + + rUserElementType.bModified = sal_False; +} + +void ModuleUIConfigurationManager::impl_Initialize() +{ + // Initialize the top-level structures with the storage data + if ( m_xUserConfigStorage.is() ) + { + // Try to access our module sub folder + for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; + i++ ) + { + Reference< XStorage > xElementTypeStorage; + try + { + if ( m_pStorageHandler[i] ) + xElementTypeStorage = m_pStorageHandler[i]->getWorkingStorageUser(); + } + catch ( com::sun::star::container::NoSuchElementException& ) + { + } + catch ( ::com::sun::star::embed::InvalidStorageException& ) + { + } + catch ( ::com::sun::star::lang::IllegalArgumentException& ) + { + } + catch ( ::com::sun::star::io::IOException& ) + { + } + catch ( ::com::sun::star::embed::StorageWrappedTargetException& ) + { + } + + m_aUIElements[LAYER_USERDEFINED][i].nElementType = i; + m_aUIElements[LAYER_USERDEFINED][i].bModified = false; + m_aUIElements[LAYER_USERDEFINED][i].xStorage = xElementTypeStorage; + m_aUIElements[LAYER_USERDEFINED][i].bDefaultLayer = false; + } + } + + if ( m_xDefaultConfigStorage.is() ) + { + Reference< XNameAccess > xNameAccess( m_xDefaultConfigStorage, UNO_QUERY_THROW ); + + // Try to access our module sub folder + for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; + i++ ) + { + Reference< XStorage > xElementTypeStorage; + try + { + Any a = xNameAccess->getByName( OUString::createFromAscii( UIELEMENTTYPENAMES[i] )); + a >>= xElementTypeStorage; + } + catch ( com::sun::star::container::NoSuchElementException& ) + { + } + + m_aUIElements[LAYER_DEFAULT][i].nElementType = i; + m_aUIElements[LAYER_DEFAULT][i].bModified = false; + m_aUIElements[LAYER_DEFAULT][i].xStorage = xElementTypeStorage; + m_aUIElements[LAYER_DEFAULT][i].bDefaultLayer = true; + } + } +} + +ModuleUIConfigurationManager::ModuleUIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) : + ThreadHelpBase( &Application::GetSolarMutex() ) + , m_xDefaultConfigStorage( 0 ) + , m_xUserConfigStorage( 0 ) + , m_bReadOnly( true ) + , m_bInitialized( false ) + , m_bModified( false ) + , m_bConfigRead( false ) + , m_bDisposed( false ) + , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" )) + , m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" )) + , m_aPropResourceURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" )) + , m_xServiceManager( xServiceManager ) + , m_aListenerContainer( m_aLock.getShareableOslMutex() ) +{ + for ( int i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + m_pStorageHandler[i] = 0; + + // Make sure we have a default initialized entry for every layer and user interface element type! + // The following code depends on this! + m_aUIElements[LAYER_DEFAULT].resize( ::com::sun::star::ui::UIElementType::COUNT ); + m_aUIElements[LAYER_USERDEFINED].resize( ::com::sun::star::ui::UIElementType::COUNT ); } ModuleUIConfigurationManager::~ModuleUIConfigurationManager() { + for ( int i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + delete m_pStorageHandler[i]; } // XComponent void SAL_CALL ModuleUIConfigurationManager::dispose() throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::dispose" ); - m_pImpl->dispose(); + Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + + css::lang::EventObject aEvent( xThis ); + m_aListenerContainer.disposeAndClear( aEvent ); + + { + ResetableGuard aGuard( m_aLock ); + try + { + if ( m_xModuleImageManager.is() ) + m_xModuleImageManager->dispose(); + } + catch ( Exception& ) + { + } + + m_xModuleImageManager.clear(); + m_aUIElements[LAYER_USERDEFINED].clear(); + m_aUIElements[LAYER_DEFAULT].clear(); + m_xDefaultConfigStorage.clear(); + m_xUserConfigStorage.clear(); + m_xUserRootCommit.clear(); + m_bConfigRead = false; + m_bModified = false; + m_bDisposed = true; + } } void SAL_CALL ModuleUIConfigurationManager::addEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::addEventListener" ); - m_pImpl->addEventListener(xListener); + { + ResetableGuard aGuard( m_aLock ); + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + if ( m_bDisposed ) + throw DisposedException(); + } + + m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener ); } void SAL_CALL ModuleUIConfigurationManager::removeEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeEventListener" ); - m_pImpl->removeEventListener(xListener); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener ); } // XInitialization void SAL_CALL ModuleUIConfigurationManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::initialize" ); - m_pImpl->initialize(aArguments); + ResetableGuard aLock( m_aLock ); + + if ( !m_bInitialized ) + { + ::comphelper::SequenceAsHashMap lArgs(aArguments); + m_aModuleIdentifier = lArgs.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("ModuleIdentifier"), ::rtl::OUString()); + m_aModuleShortName = lArgs.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("ModuleShortName"), ::rtl::OUString()); + + for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + { + rtl::OUString aResourceType; + if ( i == ::com::sun::star::ui::UIElementType::MENUBAR ) + aResourceType = PresetHandler::RESOURCETYPE_MENUBAR(); + else if ( i == ::com::sun::star::ui::UIElementType::TOOLBAR ) + aResourceType = PresetHandler::RESOURCETYPE_TOOLBAR(); + else if ( i == ::com::sun::star::ui::UIElementType::STATUSBAR ) + aResourceType = PresetHandler::RESOURCETYPE_STATUSBAR(); + + if ( aResourceType.getLength() > 0 ) + { + m_pStorageHandler[i] = new PresetHandler( m_xServiceManager ); + m_pStorageHandler[i]->connectToResource( PresetHandler::E_MODULES, + aResourceType, // this path wont be used later ... seee next lines! + m_aModuleShortName, + css::uno::Reference< css::embed::XStorage >()); // no document root used here! + } + } + + // initialize root storages for all resource types + m_xUserRootCommit = css::uno::Reference< css::embed::XTransactedObject >( + m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getOrCreateRootStorageUser(), css::uno::UNO_QUERY); // can be empty + m_xDefaultConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageShare( + m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageShare()); + m_xUserConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageUser( + m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageUser()); + + if ( m_xUserConfigStorage.is() ) + { + Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY ); + if ( xPropSet.is() ) + { + long nOpenMode = 0; + Any a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ))); + if ( a >>= nOpenMode ) + m_bReadOnly = !( nOpenMode & ElementModes::WRITE ); + } + } + + impl_Initialize(); + + m_bInitialized = true; + } } // XUIConfiguration void SAL_CALL ModuleUIConfigurationManager::addConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::addConfigurationListener" ); - m_pImpl->addConfigurationListener(xListener); + { + ResetableGuard aGuard( m_aLock ); + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + if ( m_bDisposed ) + throw DisposedException(); + } + + m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener ); } void SAL_CALL ModuleUIConfigurationManager::removeConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeConfigurationListener" ); - m_pImpl->removeConfigurationListener(xListener); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener ); } // XUIConfigurationManager void SAL_CALL ModuleUIConfigurationManager::reset() throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::reset" ); - m_pImpl->reset(); + ResetableGuard aGuard( m_aLock ); + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + if ( m_bDisposed ) + throw DisposedException(); + + bool bResetStorage( false ); + + if ( !isReadOnly() ) + { + // Remove all elements from our user-defined storage! + try + { + for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + { + UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i]; + Reference< XStorage > xSubStorage( rElementType.xStorage, UNO_QUERY ); + + if ( xSubStorage.is() ) + { + bool bCommitSubStorage( false ); + Reference< XNameAccess > xSubStorageNameAccess( xSubStorage, UNO_QUERY ); + Sequence< OUString > aUIElementStreamNames = xSubStorageNameAccess->getElementNames(); + for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ ) + { + xSubStorage->removeElement( aUIElementStreamNames[j] ); + bCommitSubStorage = true; + } + + if ( bCommitSubStorage ) + { + Reference< XTransactedObject > xTransactedObject( xSubStorage, UNO_QUERY ); + if ( xTransactedObject.is() ) + xTransactedObject->commit(); + m_pStorageHandler[i]->commitUserChanges(); + } + } + } + + bResetStorage = true; + + // remove settings from user defined layer and notify listener about removed settings data! + ConfigEventNotifyContainer aRemoveEventNotifyContainer; + ConfigEventNotifyContainer aReplaceEventNotifyContainer; + for ( sal_Int16 j = 1; j < ::com::sun::star::ui::UIElementType::COUNT; j++ ) + { + try + { + UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][j]; + UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][j]; + + impl_resetElementTypeData( rUserElementType, rDefaultElementType, aRemoveEventNotifyContainer, aReplaceEventNotifyContainer ); + rUserElementType.bModified = sal_False; + } + catch ( Exception& ) + { + throw IOException(); + } + } + + m_bModified = sal_False; + + // Unlock mutex before notify our listeners + aGuard.unlock(); + + // Notify our listeners + sal_uInt32 k = 0; + for ( k = 0; k < aRemoveEventNotifyContainer.size(); k++ ) + implts_notifyContainerListener( aRemoveEventNotifyContainer[k], NotifyOp_Remove ); + for ( k = 0; k < aReplaceEventNotifyContainer.size(); k++ ) + implts_notifyContainerListener( aReplaceEventNotifyContainer[k], NotifyOp_Replace ); + } + catch ( ::com::sun::star::lang::IllegalArgumentException& ) + { + } + catch ( ::com::sun::star::container::NoSuchElementException& ) + { + } + catch ( ::com::sun::star::embed::InvalidStorageException& ) + { + } + catch ( ::com::sun::star::embed::StorageWrappedTargetException& ) + { + } + } } Sequence< Sequence< PropertyValue > > SAL_CALL ModuleUIConfigurationManager::getUIElementsInfo( sal_Int16 ElementType ) throw ( IllegalArgumentException, RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getUIElementsInfo" ); - return m_pImpl->getUIElementsInfo(ElementType); + if (( ElementType < 0 ) || ( ElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + + ResetableGuard aGuard( m_aLock ); + if ( m_bDisposed ) + throw DisposedException(); + + Sequence< Sequence< PropertyValue > > aElementInfoSeq; + UIElementInfoHashMap aUIElementInfoCollection; + + if ( ElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) + { + for ( sal_Int16 i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, sal_Int16( i ) ); + } + else + impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, ElementType ); + + Sequence< PropertyValue > aUIElementInfo( 2 ); + aUIElementInfo[0].Name = m_aPropResourceURL; + aUIElementInfo[1].Name = m_aPropUIName; + + aElementInfoSeq.realloc( aUIElementInfoCollection.size() ); + UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin(); + + sal_Int32 n = 0; + while ( pIter != aUIElementInfoCollection.end() ) + { + aUIElementInfo[0].Value <<= pIter->second.aResourceURL; + aUIElementInfo[1].Value <<= pIter->second.aUIName; + aElementInfoSeq[n++] = aUIElementInfo; + ++pIter; + } + + return aElementInfoSeq; } Reference< XIndexContainer > SAL_CALL ModuleUIConfigurationManager::createSettings() throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::createSettings" ); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); // Creates an empty item container which can be filled from outside - return m_pImpl->createSettings(); + return Reference< XIndexContainer >( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); } sal_Bool SAL_CALL ModuleUIConfigurationManager::hasSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::hasSettings" ); - return m_pImpl->hasSettings(ResourceURL); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false ); + if ( pDataSettings ) + return sal_True; + } + + return sal_False; } Reference< XIndexAccess > SAL_CALL ModuleUIConfigurationManager::getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getSettings" ); - return m_pImpl->getSettings(ResourceURL,bWriteable); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType ); + if ( pDataSettings ) + { + // Create a copy of our data if someone wants to change the data. + if ( bWriteable ) + return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY ); + else + return pDataSettings->xSettings; + } + } + + throw NoSuchElementException(); } void SAL_CALL ModuleUIConfigurationManager::replaceSettings( const ::rtl::OUString& ResourceURL, const Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::replaceSettings" ); - return m_pImpl->replaceSettings(ResourceURL,aNewData); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else if ( m_bReadOnly ) + throw IllegalAccessException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType ); + if ( pDataSettings ) + { + if ( !pDataSettings->bDefaultNode ) + { + // we have a settings entry in our user-defined layer - replace + Reference< XIndexAccess > xOldSettings = pDataSettings->xSettings; + + // Create a copy of the data if the container is not const + Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); + if ( xReplace.is() ) + pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + else + pDataSettings->xSettings = aNewData; + pDataSettings->bDefault = false; + pDataSettings->bModified = true; + m_bModified = true; + + // Modify type container + UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType]; + rElementType.bModified = true; + + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + + // Create event to notify listener about replaced element settings + ConfigurationEvent aEvent; + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + + aEvent.ResourceURL = ResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.ReplacedElement <<= xOldSettings; + aEvent.Element <<= pDataSettings->xSettings; + + aGuard.unlock(); + + implts_notifyContainerListener( aEvent, NotifyOp_Replace ); + } + else + { + // we have no settings in our user-defined layer - insert + UIElementData aUIElementData; + + aUIElementData.bDefault = false; + aUIElementData.bDefaultNode = false; + aUIElementData.bModified = true; + + // Create a copy of the data if the container is not const + Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); + if ( xReplace.is() ) + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + else + aUIElementData.xSettings = aNewData; + aUIElementData.aName = RetrieveNameFromResourceURL( ResourceURL ) + m_aXMLPostfix; + aUIElementData.aResourceURL = ResourceURL; + m_bModified = true; + + // Modify type container + UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType]; + rElementType.bModified = true; + + UIElementDataHashMap& rElements = rElementType.aElementsHashMap; + + // Check our user element settings hash map as it can already contain settings that have been set to default! + // If no node can be found, we have to insert it. + UIElementDataHashMap::iterator pIter = rElements.find( ResourceURL ); + if ( pIter != rElements.end() ) + pIter->second = aUIElementData; + else + rElements.insert( UIElementDataHashMap::value_type( ResourceURL, aUIElementData )); + + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + + // Create event to notify listener about replaced element settings + ConfigurationEvent aEvent; + + aEvent.ResourceURL = ResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.ReplacedElement <<= pDataSettings->xSettings; + aEvent.Element <<= aUIElementData.xSettings; + + aGuard.unlock(); + + implts_notifyContainerListener( aEvent, NotifyOp_Replace ); + } + } + else + throw NoSuchElementException(); + } } void SAL_CALL ModuleUIConfigurationManager::removeSettings( const ::rtl::OUString& ResourceURL ) throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeSettings" ); - m_pImpl->removeSettings(ResourceURL); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else if ( m_bReadOnly ) + throw IllegalAccessException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType ); + if ( pDataSettings ) + { + // If element settings are default, we don't need to change anything! + if ( pDataSettings->bDefault ) + return; + else + { + Reference< XIndexAccess > xRemovedSettings = pDataSettings->xSettings; + pDataSettings->bDefault = true; + + // check if this is a default layer node + if ( !pDataSettings->bDefaultNode ) + pDataSettings->bModified = true; // we have to remove this node from the user layer! + pDataSettings->xSettings.clear(); + m_bModified = true; // user layer must be written + + // Modify type container + UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType]; + rElementType.bModified = true; + + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + + // Check if we have settings in the default layer which replaces the user-defined one! + UIElementData* pDefaultDataSettings = impl_findUIElementData( ResourceURL, nElementType ); + if ( pDefaultDataSettings ) + { + // Create event to notify listener about replaced element settings + ConfigurationEvent aEvent; + + aEvent.ResourceURL = ResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.Element <<= xRemovedSettings; + aEvent.ReplacedElement <<= pDefaultDataSettings->xSettings; + + aGuard.unlock(); + + implts_notifyContainerListener( aEvent, NotifyOp_Replace ); + } + else + { + // Create event to notify listener about removed element settings + ConfigurationEvent aEvent; + + aEvent.ResourceURL = ResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.Element <<= xRemovedSettings; + + aGuard.unlock(); + + implts_notifyContainerListener( aEvent, NotifyOp_Remove ); + } + } + } + else + throw NoSuchElementException(); + } } void SAL_CALL ModuleUIConfigurationManager::insertSettings( const ::rtl::OUString& NewResourceURL, const Reference< XIndexAccess >& aNewData ) throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, RuntimeException ) { - m_pImpl->insertSettings(NewResourceURL,aNewData); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( NewResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else if ( m_bReadOnly ) + throw IllegalAccessException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + UIElementData* pDataSettings = impl_findUIElementData( NewResourceURL, nElementType ); + if ( !pDataSettings ) + { + UIElementData aUIElementData; + + aUIElementData.bDefault = false; + aUIElementData.bDefaultNode = false; + aUIElementData.bModified = true; + + // Create a copy of the data if the container is not const + Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); + if ( xReplace.is() ) + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + else + aUIElementData.xSettings = aNewData; + aUIElementData.aName = RetrieveNameFromResourceURL( NewResourceURL ) + m_aXMLPostfix; + aUIElementData.aResourceURL = NewResourceURL; + m_bModified = true; + + UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType]; + rElementType.bModified = true; + + UIElementDataHashMap& rElements = rElementType.aElementsHashMap; + rElements.insert( UIElementDataHashMap::value_type( NewResourceURL, aUIElementData )); + + Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings ); + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + + // Create event to notify listener about removed element settings + ConfigurationEvent aEvent; + + aEvent.ResourceURL = NewResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.Element <<= xInsertSettings; + + aGuard.unlock(); + + implts_notifyContainerListener( aEvent, NotifyOp_Insert ); + } + else + throw ElementExistException(); + } } Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager() throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getImageManager" ); - return m_pImpl->getImageManager(); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + if ( !m_xModuleImageManager.is() ) + { + m_xModuleImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ModuleImageManager( m_xServiceManager )), + UNO_QUERY ); + Reference< XInitialization > xInit( m_xModuleImageManager, UNO_QUERY ); + + Sequence< Any > aPropSeq( 3 ); + PropertyValue aPropValue; + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" )); + aPropValue.Value = makeAny( m_xUserConfigStorage ); + aPropSeq[0] = makeAny( aPropValue ); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); + aPropValue.Value = makeAny( m_aModuleIdentifier ); + aPropSeq[1] = makeAny( aPropValue ); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserRootCommit" )); + aPropValue.Value = makeAny( m_xUserRootCommit ); + aPropSeq[2] = makeAny( aPropValue ); + + xInit->initialize( aPropSeq ); + } + + return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY ); + +// return Reference< XInterface >(); } Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getShortCutManager" ); - return m_pImpl->getShortCutManager(); + ResetableGuard aGuard( m_aLock ); + Reference< XMultiServiceFactory > xSMGR = m_xServiceManager; + ::rtl::OUString aModule = /*m_aModuleShortName*/m_aModuleIdentifier; + aGuard.unlock(); + + Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION); + Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW); + + PropertyValue aProp; + aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier"); + aProp.Value <<= aModule; + + Sequence< Any > lArgs(1); + lArgs[0] <<= aProp; + + xInit->initialize(lArgs); + + return xManager; } Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getEventsManager" ); return Reference< XInterface >(); } @@ -242,46 +1406,210 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager( sal_Bool SAL_CALL ModuleUIConfigurationManager::isDefaultSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isDefaultSettings" ); - return m_pImpl->isDefaultSettings(ResourceURL); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false ); + if ( pDataSettings && pDataSettings->bDefaultNode ) + return sal_True; + } + + return sal_False; } Reference< XIndexAccess > SAL_CALL ModuleUIConfigurationManager::getDefaultSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getDefaultSettings" ); - return m_pImpl->getDefaultSettings(ResourceURL); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + // preload list of element types on demand + impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType ); + + // Look into our default vector/hash_map combination + UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap; + UIElementDataHashMap::iterator pIter = rDefaultHashMap.find( ResourceURL ); + if ( pIter != rDefaultHashMap.end() ) + { + if ( !pIter->second.xSettings.is() ) + impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second ); + return pIter->second.xSettings; + } + } + + // Nothing has been found! + throw NoSuchElementException(); } // XUIConfigurationPersistence void SAL_CALL ModuleUIConfigurationManager::reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::reload" ); - m_pImpl->reload(); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly ) + { + // Try to access our module sub folder + ConfigEventNotifyContainer aRemoveNotifyContainer; + ConfigEventNotifyContainer aReplaceNotifyContainer; + for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + { + try + { + UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][i]; + UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][i]; + + if ( rUserElementType.bModified ) + impl_reloadElementTypeData( rUserElementType, rDefaultElementType, aRemoveNotifyContainer, aReplaceNotifyContainer ); + } + catch ( Exception& ) + { + throw IOException(); + } + } + + m_bModified = sal_False; + + // Unlock mutex before notify our listeners + aGuard.unlock(); + + // Notify our listeners + for ( sal_uInt32 j = 0; j < aRemoveNotifyContainer.size(); j++ ) + implts_notifyContainerListener( aRemoveNotifyContainer[j], NotifyOp_Remove ); + for ( sal_uInt32 k = 0; k < aReplaceNotifyContainer.size(); k++ ) + implts_notifyContainerListener( aReplaceNotifyContainer[k], NotifyOp_Replace ); + } } void SAL_CALL ModuleUIConfigurationManager::store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::store" ); - m_pImpl->store(); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly ) + { + // Try to access our module sub folder + for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + { + try + { + UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i]; + Reference< XStorage > xStorage( rElementType.xStorage, UNO_QUERY ); + + if ( rElementType.bModified && xStorage.is() ) + { + impl_storeElementTypeData( xStorage, rElementType ); + m_pStorageHandler[i]->commitUserChanges(); + } + } + catch ( Exception& ) + { + throw IOException(); + } + } + + m_bModified = false; + } } void SAL_CALL ModuleUIConfigurationManager::storeToStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::storeToStorage" ); - m_pImpl->storeToStorage(Storage); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly ) + { + // Try to access our module sub folder + for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + { + try + { + Reference< XStorage > xElementTypeStorage( Storage->openStorageElement( + OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), ElementModes::READWRITE )); + UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i]; + + if ( rElementType.bModified && xElementTypeStorage.is() ) + impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag! + } + catch ( Exception& ) + { + throw IOException(); + } + } + + Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY ); + if ( xTransactedObject.is() ) + xTransactedObject->commit(); + } } sal_Bool SAL_CALL ModuleUIConfigurationManager::isModified() throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isModified" ); - return m_pImpl->isModified(); + ResetableGuard aGuard( m_aLock ); + + return m_bModified; } sal_Bool SAL_CALL ModuleUIConfigurationManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isReadOnly" ); - return m_pImpl->isReadOnly(); + ResetableGuard aGuard( m_aLock ); + + return m_bReadOnly; +} + +void ModuleUIConfigurationManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) ); + if ( pContainer != NULL ) + { + ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); + while ( pIterator.hasMoreElements() ) + { + try + { + switch ( eOp ) + { + case NotifyOp_Replace: + ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent ); + break; + case NotifyOp_Insert: + ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent ); + break; + case NotifyOp_Remove: + ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent ); + break; + } + } + catch( css::uno::RuntimeException& ) + { + pIterator.remove(); + } + } + } } } // namespace framework diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 67049d9eb4dc..3309333fb327 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #ifndef __FRAMEWORK_XML_STATUSBARCONFIGURATION_HXX_ #include @@ -111,9 +110,511 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( UIConfigurationManager DEFINE_INIT_SERVICE ( UIConfigurationManager, {} ) -UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) -: m_pImpl( new UIConfigurationManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),false) ) + +// important: The order and position of the elements must match the constant +// definition of "::com::sun::star::ui::UIElementType" +static const char* UIELEMENTTYPENAMES[] = { + "", // Dummy value for unknown! + UIELEMENTTYPE_MENUBAR_NAME, + UIELEMENTTYPE_POPUPMENU_NAME, + UIELEMENTTYPE_TOOLBAR_NAME, + UIELEMENTTYPE_STATUSBAR_NAME, + UIELEMENTTYPE_FLOATINGWINDOW_NAME, + UIELEMENTTYPE_PROGRESSBAR_NAME +}; + +static const char RESOURCEURL_PREFIX[] = "private:resource/"; +static const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17; + +static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL ) +{ + + if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) && + ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) + { + rtl::OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ); + sal_Int32 nIndex = aTmpStr.indexOf( '/' ); + if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex )) + { + rtl::OUString aTypeStr( aTmpStr.copy( 0, nIndex )); + for ( int i = 0; i < UIElementType::COUNT; i++ ) + { + if ( aTypeStr.equalsAscii( UIELEMENTTYPENAMES[i] )) + return sal_Int16( i ); + } + } + } + + return UIElementType::UNKNOWN; +} + +static rtl::OUString RetrieveNameFromResourceURL( const rtl::OUString& aResourceURL ) +{ + if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) && + ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) + { + sal_Int32 nIndex = aResourceURL.lastIndexOf( '/' ); + if (( nIndex > 0 ) && (( nIndex+1 ) < aResourceURL.getLength())) + return aResourceURL.copy( nIndex+1 ); + } + + return rtl::OUString(); +} + +void UIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType ) +{ + // preload list of element types on demand + impl_preloadUIElementTypeList( nElementType ); + + UIElementDataHashMap& rUserElements = m_aUIElements[nElementType].aElementsHashMap; + UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin(); + + while ( pUserIter != rUserElements.end() ) + { + UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType ); + if ( pDataSettings && !pDataSettings->bDefault ) + { + // Retrieve user interface name from XPropertySet interface + rtl::OUString aUIName; + Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY ); + if ( xPropSet.is() ) + { + Any a = xPropSet->getPropertyValue( m_aPropUIName ); + a >>= aUIName; + } + + UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName ); + aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo )); + } + ++pUserIter; + } +} + +void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementType ) +{ + UIElementType& rElementTypeData = m_aUIElements[nElementType]; + + if ( !rElementTypeData.bLoaded ) + { + Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage; + if ( xElementTypeStorage.is() ) + { + rtl::OUStringBuffer aBuf( RESOURCEURL_PREFIX_SIZE ); + aBuf.appendAscii( RESOURCEURL_PREFIX ); + aBuf.appendAscii( UIELEMENTTYPENAMES[ nElementType ] ); + aBuf.appendAscii( "/" ); + rtl::OUString aResURLPrefix( aBuf.makeStringAndClear() ); + + UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap; + Reference< XNameAccess > xNameAccess( xElementTypeStorage, UNO_QUERY ); + Sequence< rtl::OUString > aUIElementNames = xNameAccess->getElementNames(); + for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ ) + { + UIElementData aUIElementData; + + // Resource name must be without ".xml" + sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' ); + if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() )) + { + rtl::OUString aExtension( aUIElementNames[n].copy( nIndex+1 )); + rtl::OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex )); + + if (( aUIElementName.getLength() > 0 ) && + ( aExtension.equalsIgnoreAsciiCaseAsciiL( "xml", 3 ))) + { + aUIElementData.aResourceURL = aResURLPrefix + aUIElementName; + aUIElementData.aName = aUIElementNames[n]; + aUIElementData.bModified = false; + aUIElementData.bDefault = false; + + // Create hash_map entries for all user interface elements inside the storage. We don't load the + // settings to speed up the process. + rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData )); + } + } + } + } + } + + rElementTypeData.bLoaded = true; +} + +void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, UIElementData& aUIElementData ) +{ + UIElementType& rElementTypeData = m_aUIElements[nElementType]; + + Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage; + if ( xElementTypeStorage.is() && aUIElementData.aName.getLength() ) + { + try + { + Reference< XStream > xStream = xElementTypeStorage->openStreamElement( aUIElementData.aName, ElementModes::READ ); + Reference< XInputStream > xInputStream = xStream->getInputStream(); + + if ( xInputStream.is() ) + { + switch ( nElementType ) + { + case ::com::sun::star::ui::UIElementType::UNKNOWN: + break; + + case ::com::sun::star::ui::UIElementType::MENUBAR: + { + try + { + MenuConfiguration aMenuCfg( m_xServiceManager ); + Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream )); + RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer ); + if ( pRootItemContainer ) + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY ); + else + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xContainer, sal_True ) ), UNO_QUERY ); + return; + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + } + break; + + case ::com::sun::star::ui::UIElementType::POPUPMENU: + { + break; + } + + case ::com::sun::star::ui::UIElementType::TOOLBAR: + { + try + { + Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); + ToolBoxConfiguration::LoadToolBox( m_xServiceManager, xInputStream, xIndexContainer ); + RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer ); + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY ); + return; + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + + break; + } + + case ::com::sun::star::ui::UIElementType::STATUSBAR: + { + try + { + Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); + StatusBarConfiguration::LoadStatusBar( m_xServiceManager, xInputStream, xIndexContainer ); + RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer ); + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY ); + return; + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + + break; + } + + case ::com::sun::star::ui::UIElementType::FLOATINGWINDOW: + { + break; + } + } + } + } + catch ( ::com::sun::star::embed::InvalidStorageException& ) + { + } + catch ( ::com::sun::star::lang::IllegalArgumentException& ) + { + } + catch ( ::com::sun::star::io::IOException& ) + { + } + catch ( ::com::sun::star::embed::StorageWrappedTargetException& ) + { + } + } + + // At least we provide an empty settings container! + aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer()), UNO_QUERY ); +} + +UIConfigurationManager::UIElementData* UIConfigurationManager::impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad ) +{ + // preload list of element types on demand + impl_preloadUIElementTypeList( nElementType ); + + // try to look into our document vector/hash_map combination + UIElementDataHashMap& rUserHashMap = m_aUIElements[nElementType].aElementsHashMap; + UIElementDataHashMap::iterator pIter = rUserHashMap.find( aResourceURL ); + if ( pIter != rUserHashMap.end() ) + { + // Default data settings data means removed! + if ( pIter->second.bDefault ) + return &(pIter->second); + else + { + if ( !pIter->second.xSettings.is() && bLoad ) + impl_requestUIElementData( nElementType, pIter->second ); + return &(pIter->second); + } + } + + // Nothing has been found! + return NULL; +} + +void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& xStorage, UIElementType& rElementType, bool bResetModifyState ) +{ + UIElementDataHashMap& rHashMap = rElementType.aElementsHashMap; + UIElementDataHashMap::iterator pIter = rHashMap.begin(); + + while ( pIter != rHashMap.end() ) + { + UIElementData& rElement = pIter->second; + if ( rElement.bModified ) + { + if ( rElement.bDefault ) + { + xStorage->removeElement( rElement.aName ); + rElement.bModified = sal_False; // mark as not modified + } + else + { + Reference< XStream > xStream( xStorage->openStreamElement( rElement.aName, ElementModes::WRITE|ElementModes::TRUNCATE ), UNO_QUERY ); + Reference< XOutputStream > xOutputStream( xStream->getOutputStream() ); + + if ( xOutputStream.is() ) + { + switch( rElementType.nElementType ) + { + case ::com::sun::star::ui::UIElementType::MENUBAR: + { + try + { + MenuConfiguration aMenuCfg( m_xServiceManager ); + aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream ); + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + } + break; + + case ::com::sun::star::ui::UIElementType::TOOLBAR: + { + try + { + ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings ); + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + } + break; + + case ::com::sun::star::ui::UIElementType::STATUSBAR: + { + try + { + StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings ); + } + catch ( ::com::sun::star::lang::WrappedTargetException& ) + { + } + } + break; + + default: + break; + } + } + + // mark as not modified if we store to our own storage + if ( bResetModifyState ) + rElement.bModified = sal_False; + } + } + + ++pIter; + } + + // commit element type storage + Reference< XTransactedObject > xTransactedObject( xStorage, UNO_QUERY ); + if ( xTransactedObject.is() ) + xTransactedObject->commit(); + + // mark UIElementType as not modified if we store to our own storage + if ( bResetModifyState ) + rElementType.bModified = sal_False; +} + +void UIConfigurationManager::impl_resetElementTypeData( + UIElementType& rDocElementType, + ConfigEventNotifyContainer& rRemoveNotifyContainer ) +{ + UIElementDataHashMap& rHashMap = rDocElementType.aElementsHashMap; + UIElementDataHashMap::iterator pIter = rHashMap.begin(); + + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + + // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling + // our listeners! + while ( pIter != rHashMap.end() ) + { + UIElementData& rElement = pIter->second; + if ( !rElement.bDefault ) + { + // Remove user-defined settings from document + ConfigurationEvent aEvent; + aEvent.ResourceURL = rElement.aResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.Element <<= rElement.xSettings; + + rRemoveNotifyContainer.push_back( aEvent ); + + // Mark element as default. + rElement.bModified = false; + rElement.bDefault = true; + } + else + rElement.bModified = false; + + ++pIter; + } + + // Remove all settings from our user interface elements + rHashMap.clear(); +} + +void UIConfigurationManager::impl_reloadElementTypeData( + UIElementType& rDocElementType, + ConfigEventNotifyContainer& rRemoveNotifyContainer, + ConfigEventNotifyContainer& rReplaceNotifyContainer ) +{ + UIElementDataHashMap& rHashMap = rDocElementType.aElementsHashMap; + UIElementDataHashMap::iterator pIter = rHashMap.begin(); + Reference< XStorage > xElementStorage( rDocElementType.xStorage ); + Reference< XNameAccess > xElementNameAccess( xElementStorage, UNO_QUERY ); + + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + sal_Int16 nType = rDocElementType.nElementType; + + while ( pIter != rHashMap.end() ) + { + UIElementData& rElement = pIter->second; + if ( rElement.bModified ) + { + if ( xElementNameAccess->hasByName( rElement.aName )) + { + // Replace settings with data from user layer + Reference< XIndexAccess > xOldSettings( rElement.xSettings ); + + impl_requestUIElementData( nType, rElement ); + + ConfigurationEvent aReplaceEvent; + + aReplaceEvent.ResourceURL = rElement.aResourceURL; + aReplaceEvent.Accessor <<= xThis; + aReplaceEvent.Source = xIfac; + aReplaceEvent.ReplacedElement <<= xOldSettings; + aReplaceEvent.Element <<= rElement.xSettings; + rReplaceNotifyContainer.push_back( aReplaceEvent ); + + rElement.bModified = false; + } + else + { + // Element settings are not in any storage => remove + ConfigurationEvent aRemoveEvent; + + aRemoveEvent.ResourceURL = rElement.aResourceURL; + aRemoveEvent.Accessor <<= xThis; + aRemoveEvent.Source = xIfac; + aRemoveEvent.Element <<= rElement.xSettings; + + rRemoveNotifyContainer.push_back( aRemoveEvent ); + + // Mark element as default and not modified. That means "not active" in the document anymore + rElement.bModified = false; + rElement.bDefault = true; + } + } + ++pIter; + } + + rDocElementType.bModified = sal_False; +} + +void UIConfigurationManager::impl_Initialize() +{ + // Initialize the top-level structures with the storage data + if ( m_xDocConfigStorage.is() ) + { + long nModes = m_bReadOnly ? ElementModes::READ : ElementModes::READWRITE; + + // Try to access our module sub folder + for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; + i++ ) + { + Reference< XStorage > xElementTypeStorage; + try + { + xElementTypeStorage = m_xDocConfigStorage->openStorageElement( rtl::OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), nModes ); + } + catch ( com::sun::star::container::NoSuchElementException& ) + { + } + catch ( ::com::sun::star::embed::InvalidStorageException& ) + { + } + catch ( ::com::sun::star::lang::IllegalArgumentException& ) + { + } + catch ( ::com::sun::star::io::IOException& ) + { + } + catch ( ::com::sun::star::embed::StorageWrappedTargetException& ) + { + } + + m_aUIElements[i].nElementType = i; + m_aUIElements[i].bModified = false; + m_aUIElements[i].xStorage = xElementTypeStorage; + m_aUIElements[i].bDefaultLayer = false; + } + } + else + { + // We have no storage, just initialize ui element types with empty storage! + for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + m_aUIElements[i].xStorage = m_xDocConfigStorage; + } +} + +UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) : + ThreadHelpBase( &Application::GetSolarMutex() ) + , m_xDocConfigStorage( 0 ) + , m_bReadOnly( true ) + , m_bInitialized( false ) + , m_bModified( false ) + , m_bConfigRead( false ) + , m_bDisposed( false ) + , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" )) + , m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" )) + , m_aPropResourceURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" )) + , m_xServiceManager( xServiceManager ) + , m_aListenerContainer( m_aLock.getShareableOslMutex() ) +{ + // Make sure we have a default initialized entry for every layer and user interface element type! + // The following code depends on this! + m_aUIElements.resize( ::com::sun::star::ui::UIElementType::COUNT ); } UIConfigurationManager::~UIConfigurationManager() @@ -123,86 +624,507 @@ UIConfigurationManager::~UIConfigurationManager() // XComponent void SAL_CALL UIConfigurationManager::dispose() throw (::com::sun::star::uno::RuntimeException) { - m_pImpl->dispose(); + Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + + css::lang::EventObject aEvent( xThis ); + m_aListenerContainer.disposeAndClear( aEvent ); + + { + ResetableGuard aGuard( m_aLock ); + try + { + if ( m_xImageManager.is() ) + m_xImageManager->dispose(); + } + catch ( Exception& ) + { + } + + m_xImageManager.clear(); + m_aUIElements.clear(); + m_xDocConfigStorage.clear(); + m_bConfigRead = false; + m_bModified = false; + m_bDisposed = true; + } } void SAL_CALL UIConfigurationManager::addEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { + { + ResetableGuard aGuard( m_aLock ); - m_pImpl->addEventListener(xListener); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + if ( m_bDisposed ) + throw DisposedException(); + } + + m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener ); } void SAL_CALL UIConfigurationManager::removeEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - m_pImpl->removeEventListener(xListener); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener ); } // XUIConfigurationManager void SAL_CALL UIConfigurationManager::addConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - m_pImpl->addConfigurationListener(xListener); + { + ResetableGuard aGuard( m_aLock ); + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + if ( m_bDisposed ) + throw DisposedException(); + } + + m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener ); } void SAL_CALL UIConfigurationManager::removeConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - m_pImpl->removeConfigurationListener(xListener); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener ); } void SAL_CALL UIConfigurationManager::reset() throw (::com::sun::star::uno::RuntimeException) { - m_pImpl->reset(); + ResetableGuard aGuard( m_aLock ); + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + if ( m_bDisposed ) + throw DisposedException(); + + if ( isReadOnly() ) + return; + + bool bResetStorage( false ); + if ( m_xDocConfigStorage.is() ) + { + try + { + // Remove all elements from our user-defined storage! + bool bCommit( false ); + for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + { + UIElementType& rElementType = m_aUIElements[i]; + Reference< XStorage > xSubStorage( rElementType.xStorage, UNO_QUERY ); + + if ( xSubStorage.is() ) + { + bool bCommitSubStorage( false ); + Reference< XNameAccess > xSubStorageNameAccess( xSubStorage, UNO_QUERY ); + Sequence< rtl::OUString > aUIElementStreamNames = xSubStorageNameAccess->getElementNames(); + for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ ) + { + xSubStorage->removeElement( aUIElementStreamNames[j] ); + bCommitSubStorage = true; + bCommit = true; + } + + if ( bCommitSubStorage ) + { + Reference< XTransactedObject > xTransactedObject( xSubStorage, UNO_QUERY ); + if ( xTransactedObject.is() ) + xTransactedObject->commit(); + } + } + } + + // Commit changes + if ( bCommit ) + { + Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY ); + if ( xTransactedObject.is() ) + xTransactedObject->commit(); + } + bResetStorage = true; + + // remove settings from user defined layer and notify listener about removed settings data! + // Try to access our module sub folder + ConfigEventNotifyContainer aRemoveEventNotifyContainer; + for ( sal_Int16 j = 1; j < ::com::sun::star::ui::UIElementType::COUNT; j++ ) + { + UIElementType& rDocElementType = m_aUIElements[j]; + + impl_resetElementTypeData( rDocElementType, aRemoveEventNotifyContainer ); + rDocElementType.bModified = sal_False; + } + + m_bModified = sal_False; + + // Unlock mutex before notify our listeners + aGuard.unlock(); + + // Notify our listeners + for ( sal_uInt32 k = 0; k < aRemoveEventNotifyContainer.size(); k++ ) + implts_notifyContainerListener( aRemoveEventNotifyContainer[k], NotifyOp_Remove ); + } + catch ( ::com::sun::star::lang::IllegalArgumentException& ) + { + } + catch ( ::com::sun::star::container::NoSuchElementException& ) + { + } + catch ( ::com::sun::star::embed::InvalidStorageException& ) + { + } + catch ( ::com::sun::star::embed::StorageWrappedTargetException& ) + { + } + } } Sequence< Sequence< PropertyValue > > SAL_CALL UIConfigurationManager::getUIElementsInfo( sal_Int16 ElementType ) throw ( IllegalArgumentException, RuntimeException ) { - return m_pImpl->getUIElementsInfo(ElementType); + if (( ElementType < 0 ) || ( ElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + + ResetableGuard aGuard( m_aLock ); + if ( m_bDisposed ) + throw DisposedException(); + + Sequence< Sequence< PropertyValue > > aElementInfoSeq; + UIElementInfoHashMap aUIElementInfoCollection; + + if ( ElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) + { + for ( sal_Int16 i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, sal_Int16( i ) ); + } + else + impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, ElementType ); + + Sequence< PropertyValue > aUIElementInfo( 2 ); + aUIElementInfo[0].Name = m_aPropResourceURL; + aUIElementInfo[1].Name = m_aPropUIName; + + aElementInfoSeq.realloc( aUIElementInfoCollection.size() ); + UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin(); + + sal_Int32 n = 0; + while ( pIter != aUIElementInfoCollection.end() ) + { + aUIElementInfo[0].Value <<= pIter->second.aResourceURL; + aUIElementInfo[1].Value <<= pIter->second.aUIName; + aElementInfoSeq[n++] = aUIElementInfo; + ++pIter; + } + + return aElementInfoSeq; } Reference< XIndexContainer > SAL_CALL UIConfigurationManager::createSettings() throw (::com::sun::star::uno::RuntimeException) { - return m_pImpl->createSettings(); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + // Creates an empty item container which can be filled from outside + return Reference< XIndexContainer >( static_cast< OWeakObject * >( new RootItemContainer()), UNO_QUERY ); } sal_Bool SAL_CALL UIConfigurationManager::hasSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - return m_pImpl->hasSettings(ResourceURL); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else + { + UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false ); + if ( pDataSettings && !pDataSettings->bDefault ) + return sal_True; + } + + return sal_False; } Reference< XIndexAccess > SAL_CALL UIConfigurationManager::getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - return m_pImpl->getSettings(ResourceURL,bWriteable); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType ); + if ( pDataSettings && !pDataSettings->bDefault ) + { + // Create a copy of our data if someone wants to change the data. + if ( bWriteable ) + return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY ); + else + return pDataSettings->xSettings; + } + } + + throw NoSuchElementException(); } void SAL_CALL UIConfigurationManager::replaceSettings( const ::rtl::OUString& ResourceURL, const Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException) { - return m_pImpl->replaceSettings(ResourceURL,aNewData); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else if ( m_bReadOnly ) + throw IllegalAccessException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType ); + if ( pDataSettings && !pDataSettings->bDefault ) + { + // we have a settings entry in our user-defined layer - replace + Reference< XIndexAccess > xOldSettings = pDataSettings->xSettings; + + // Create a copy of the data if the container is not const + Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); + if ( xReplace.is() ) + pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + else + pDataSettings->xSettings = aNewData; + + pDataSettings->bDefault = false; + pDataSettings->bModified = true; + m_bModified = true; + + // Modify type container + UIElementType& rElementType = m_aUIElements[nElementType]; + rElementType.bModified = true; + + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + + // Create event to notify listener about replaced element settings + ConfigurationEvent aEvent; + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + + aEvent.ResourceURL = ResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.ReplacedElement <<= xOldSettings; + aEvent.Element <<= pDataSettings->xSettings; + + aGuard.unlock(); + + implts_notifyContainerListener( aEvent, NotifyOp_Replace ); + } + else + throw NoSuchElementException(); + } } void SAL_CALL UIConfigurationManager::removeSettings( const ::rtl::OUString& ResourceURL ) throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException, RuntimeException) { - m_pImpl->removeSettings(ResourceURL); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else if ( m_bReadOnly ) + throw IllegalAccessException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType ); + if ( pDataSettings ) + { + // If element settings are default, we don't need to change anything! + if ( pDataSettings->bDefault ) + return; + else + { + Reference< XIndexAccess > xRemovedSettings = pDataSettings->xSettings; + pDataSettings->bDefault = true; + + // check if this is a default layer node + pDataSettings->bModified = true; // we have to remove this node from the user layer! + pDataSettings->xSettings.clear(); + m_bModified = true; // user layer must be written + + // Modify type container + UIElementType& rElementType = m_aUIElements[nElementType]; + rElementType.bModified = true; + + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + + // Create event to notify listener about removed element settings + ConfigurationEvent aEvent; + + aEvent.ResourceURL = ResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.Element <<= xRemovedSettings; + + aGuard.unlock(); + + implts_notifyContainerListener( aEvent, NotifyOp_Remove ); + } + } + else + throw NoSuchElementException(); + } } void SAL_CALL UIConfigurationManager::insertSettings( const ::rtl::OUString& NewResourceURL, const Reference< XIndexAccess >& aNewData ) throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, RuntimeException ) { - m_pImpl->insertSettings(NewResourceURL,aNewData); + sal_Int16 nElementType = RetrieveTypeFromResourceURL( NewResourceURL ); + + if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) || + ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT )) + throw IllegalArgumentException(); + else if ( m_bReadOnly ) + throw IllegalAccessException(); + else + { + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + bool bInsertData( false ); + UIElementData aUIElementData; + UIElementData* pDataSettings = impl_findUIElementData( NewResourceURL, nElementType ); + + if ( pDataSettings && !pDataSettings->bDefault ) + throw ElementExistException(); + + if ( !pDataSettings ) + { + pDataSettings = &aUIElementData; + bInsertData = true; + } + + { + pDataSettings->bDefault = false; + pDataSettings->bModified = true; + + // Create a copy of the data if the container is not const + Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); + if ( xReplace.is() ) + pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + else + pDataSettings->xSettings = aNewData; + + m_bModified = true; + + UIElementType& rElementType = m_aUIElements[nElementType]; + rElementType.bModified = true; + + if ( bInsertData ) + { + pDataSettings->aName = RetrieveNameFromResourceURL( NewResourceURL ) + m_aXMLPostfix; + pDataSettings->aResourceURL = NewResourceURL; + + UIElementDataHashMap& rElements = rElementType.aElementsHashMap; + rElements.insert( UIElementDataHashMap::value_type( NewResourceURL, *pDataSettings )); + } + + Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings ); + Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); + + // Create event to notify listener about removed element settings + ConfigurationEvent aEvent; + + aEvent.ResourceURL = NewResourceURL; + aEvent.Accessor <<= xThis; + aEvent.Source = xIfac; + aEvent.Element <<= xInsertSettings; + + aGuard.unlock(); + + implts_notifyContainerListener( aEvent, NotifyOp_Insert ); + } + } } Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager() throw (::com::sun::star::uno::RuntimeException) { - return m_pImpl->getImageManager(); + if ( m_bDisposed ) + throw DisposedException(); + + if ( !m_xImageManager.is() ) + { + m_xImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ImageManager( m_xServiceManager )), + UNO_QUERY ); + Reference< XInitialization > xInit( m_xImageManager, UNO_QUERY ); + + Sequence< Any > aPropSeq( 2 ); + PropertyValue aPropValue; + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" )); + aPropValue.Value = makeAny( m_xDocConfigStorage ); + aPropSeq[0] = makeAny( aPropValue ); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); + aPropValue.Value = makeAny( m_aModuleIdentifier ); + aPropSeq[1] = makeAny( aPropValue ); + + xInit->initialize( aPropSeq ); + } + + return Reference< XInterface >( m_xImageManager, UNO_QUERY ); } Reference< XInterface > SAL_CALL UIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException) { - return m_pImpl->getShortCutManager(); + // SAFE -> + ResetableGuard aGuard( m_aLock ); + + if (m_xAccConfig.is()) + return m_xAccConfig; + + Reference< XMultiServiceFactory > xSMGR = m_xServiceManager; + Reference< XStorage > xDocumentRoot = m_xDocConfigStorage; + + aGuard.unlock(); + // <- SAFE + + Reference< XInterface > xAccConfig = xSMGR->createInstance(SERVICENAME_DOCUMENTACCELERATORCONFIGURATION); + Reference< XInitialization > xInit (xAccConfig, UNO_QUERY_THROW); + + PropertyValue aProp; + aProp.Name = ::rtl::OUString::createFromAscii("DocumentRoot"); + aProp.Value <<= xDocumentRoot; + + Sequence< Any > lArgs(1); + lArgs[0] <<= aProp; + + xInit->initialize(lArgs); + + // SAFE -> + aGuard.lock(); + m_xAccConfig = xAccConfig; + aGuard.unlock(); + // <- SAFE + + return xAccConfig; } Reference< XInterface > SAL_CALL UIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException) @@ -213,38 +1135,223 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getEventsManager() thro // XUIConfigurationStorage void SAL_CALL UIConfigurationManager::setStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException) { - m_pImpl->setStorage(Storage); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + if ( m_xDocConfigStorage.is() ) + { + try + { + // Dispose old storage to be sure that it will be closed + Reference< XComponent > xComponent( m_xDocConfigStorage, UNO_QUERY ); + if ( xComponent.is() ) + xComponent->dispose(); + } + catch ( Exception& ) + { + } + } + + // We store the new storage. Be careful it could be an empty reference! + m_xDocConfigStorage = Storage; + m_bReadOnly = sal_True; + + Reference< XUIConfigurationStorage > xAccUpdate(m_xAccConfig, UNO_QUERY); + if ( xAccUpdate.is() ) + xAccUpdate->setStorage( m_xDocConfigStorage ); + + if ( m_xImageManager.is() ) + { + ImageManager* pImageManager = (ImageManager*)m_xImageManager.get(); + if ( pImageManager ) + pImageManager->setStorage( m_xDocConfigStorage ); + } + + if ( m_xDocConfigStorage.is() ) + { + Reference< XPropertySet > xPropSet( m_xDocConfigStorage, UNO_QUERY ); + if ( xPropSet.is() ) + { + try + { + long nOpenMode = 0; + Any a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ))); + if ( a >>= nOpenMode ) + m_bReadOnly = !( nOpenMode & ElementModes::WRITE ); + } + catch ( com::sun::star::beans::UnknownPropertyException& ) + { + } + catch ( com::sun::star::lang::WrappedTargetException& ) + { + } + } + } + + impl_Initialize(); } sal_Bool SAL_CALL UIConfigurationManager::hasStorage() throw (::com::sun::star::uno::RuntimeException) { - return m_pImpl->hasStorage(); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + return ( m_xDocConfigStorage.is() ); } // XUIConfigurationPersistence void SAL_CALL UIConfigurationManager::reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { - m_pImpl->reload(); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly ) + { + // Try to access our module sub folder + ConfigEventNotifyContainer aRemoveNotifyContainer; + ConfigEventNotifyContainer aReplaceNotifyContainer; + for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + { + try + { + UIElementType& rDocElementType = m_aUIElements[i]; + if ( rDocElementType.bModified ) + impl_reloadElementTypeData( rDocElementType, aRemoveNotifyContainer, aReplaceNotifyContainer ); + } + catch ( Exception& ) + { + throw IOException(); + } + } + + m_bModified = sal_False; + + // Unlock mutex before notify our listeners + aGuard.unlock(); + + // Notify our listeners + for ( sal_uInt32 j = 0; j < aRemoveNotifyContainer.size(); j++ ) + implts_notifyContainerListener( aRemoveNotifyContainer[j], NotifyOp_Remove ); + for ( sal_uInt32 k = 0; k < aReplaceNotifyContainer.size(); k++ ) + implts_notifyContainerListener( aReplaceNotifyContainer[k], NotifyOp_Replace ); + } } void SAL_CALL UIConfigurationManager::store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { - m_pImpl->store(); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly ) + { + // Try to access our module sub folder + for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + { + try + { + UIElementType& rElementType = m_aUIElements[i]; + Reference< XStorage > xStorage( rElementType.xStorage, UNO_QUERY ); + + if ( rElementType.bModified && xStorage.is() ) + impl_storeElementTypeData( xStorage, rElementType ); + } + catch ( Exception& ) + { + throw IOException(); + } + } + + m_bModified = false; + Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY ); + if ( xTransactedObject.is() ) + xTransactedObject->commit(); + } } void SAL_CALL UIConfigurationManager::storeToStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { - m_pImpl->storeToStorage(Storage); + ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly ) + { + // Try to access our module sub folder + for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ ) + { + try + { + Reference< XStorage > xElementTypeStorage( Storage->openStorageElement( + rtl::OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), ElementModes::READWRITE )); + UIElementType& rElementType = m_aUIElements[i]; + + if ( rElementType.bModified && xElementTypeStorage.is() ) + impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag! + } + catch ( Exception& ) + { + throw IOException(); + } + } + + Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY ); + if ( xTransactedObject.is() ) + xTransactedObject->commit(); + } } sal_Bool SAL_CALL UIConfigurationManager::isModified() throw (::com::sun::star::uno::RuntimeException) { - return m_pImpl->isModified(); + ResetableGuard aGuard( m_aLock ); + + return m_bModified; } sal_Bool SAL_CALL UIConfigurationManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException) { - return m_pImpl->isReadOnly(); + ResetableGuard aGuard( m_aLock ); + + return m_bReadOnly; +} + +void UIConfigurationManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) ); + if ( pContainer != NULL ) + { + ::cppu::OInterfaceIteratorHelper pIterator( *pContainer ); + while ( pIterator.hasMoreElements() ) + { + try + { + switch ( eOp ) + { + case NotifyOp_Replace: + ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent ); + break; + case NotifyOp_Insert: + ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent ); + break; + case NotifyOp_Remove: + ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent ); + break; + } + } + catch( css::uno::RuntimeException& ) + { + pIterator.remove(); + } + } + } } } // namespace framework diff --git a/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx b/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx index 5b67b13d8805..40c2c3f10708 100755 --- a/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx @@ -148,12 +148,12 @@ void UIConfigurationManagerImpl::impl_fillSequenceWithElementTypeInfo( UIElement while ( pUserIter != rUserElements.end() ) { sal_Int32 nIndex = pUserIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE ); - if ( !m_bUseDefault && nIndex > RESOURCEURL_PREFIX_SIZE ) + if ( nIndex > RESOURCEURL_PREFIX_SIZE ) { // Performance: Retrieve user interface name only for custom user interface elements. // It's only used by them! UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType ); - if ( pDataSettings && ( !m_bUseDefault || !pDataSettings->bDefault) ) + if ( pDataSettings && ( m_bUseDefault || !pDataSettings->bDefault )) { // Retrieve user interface name from XPropertySet interface rtl::OUString aUIName; @@ -1268,7 +1268,7 @@ throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, if ( m_bDisposed ) throw DisposedException(); - bool bInsertData( m_bUseDefault ); + bool bInsertData( false ); UIElementData aUIElementData; UIElementData* pDataSettings = impl_findUIElementData( NewResourceURL, nElementType ); if ( !m_bUseDefault ) @@ -1281,7 +1281,7 @@ throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, bInsertData = true; } } - if ( !pDataSettings || bInsertData ) + if ( !pDataSettings || !m_bUseDefault ) { aUIElementData.bDefault = false; if ( !m_bUseDefault ) diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index 60a44dba706f..0a07f3cf137d 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -334,7 +334,6 @@ SHL4OBJS= \ $(SLO)$/uicategorydescription.obj \ $(SLO)$/uicommanddescription.obj \ $(SLO)$/uiconfigurationmanager.obj \ - $(SLO)$/uiconfigurationmanagerimpl.obj \ $(SLO)$/uielementfactorymanager.obj \ $(SLO)$/urltransformer.obj \ $(SLO)$/vclstatusindicator.obj \ diff --git a/oovbaapi/ooo/vba/constants/makefile.mk b/oovbaapi/ooo/vba/constants/makefile.mk index 0b092e6f7999..fa9cdaddc1c4 100644 --- a/oovbaapi/ooo/vba/constants/makefile.mk +++ b/oovbaapi/ooo/vba/constants/makefile.mk @@ -55,7 +55,6 @@ MYIDLFILES=$(foreach,i,$(MYTMPIDLFILES) $(MY_GEN_IDL_PATH)$/$(i)) MYURDFILES=$(foreach,i,$(MYIDLFILES) $(MY_GEN_UCR_PATH)$/$(i:b).urd) MYDBTARGET=$(OUT)$/ucr/constants.db .ENDIF -.ENDIF .INCLUDE : target.mk @@ -69,3 +68,4 @@ $(MYDBTARGET) : $(MYURDFILES) $(MYIDLFILES) $(REGMERGE) $(OUT)$/ucr/constants.db /UCR @$(mktmp $(MYURDFILES)) .ENDIF +.ENDIF diff --git a/oovbaapi/ooo/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk index 6f9815bfeb72..99a11e5ac0fa 100644 --- a/oovbaapi/ooo/vba/makefile.mk +++ b/oovbaapi/ooo/vba/makefile.mk @@ -41,7 +41,7 @@ PACKAGE=ooo$/vba .IF "$(ENABLE_VBA)"!="YES" dummy: @echo "not building vba..." -.ENDIF +.ELSE # ------------------------------------------------------------------------ .IF "$(L10N_framework)"="" @@ -62,3 +62,4 @@ IDLFILES=\ # ------------------------------------------------------------------ .ENDIF .INCLUDE : target.mk +.ENDIF diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index f75d68fe1413..97f86ee1f395 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -45,6 +45,8 @@ #include #include +#include + #include // forward --------------------------------------------------------------- @@ -71,6 +73,8 @@ public: void AddRequest( SfxRequest& rReq ); }; +class SfxClipboardChangeListener; + struct SfxViewShell_Impl { ::osl::Mutex aMutex; @@ -96,11 +100,9 @@ struct SfxViewShell_Impl ::svt::AcceleratorExecute* pAccExec; SfxAsyncPrintExec_Impl* pPrinterCommandQueue; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; + ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; - SfxViewShell_Impl() - : aInterceptorContainer( aMutex ) - , pAccExec(0) - {} + SfxViewShell_Impl(); }; #endif diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 299c928c748b..f6053a467ed4 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -131,6 +131,8 @@ class SfxClipboardChangeListener : public ::cppu::WeakImplHelper1< public: SfxClipboardChangeListener( SfxViewShell* pView ); virtual ~SfxClipboardChangeListener(); + + void DisconnectViewShell() { pViewShell = NULL; } }; SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView ) @@ -241,7 +243,12 @@ static ::rtl::OUString RetrieveLabelFromCommand( } //========================================================================= +SfxViewShell_Impl::SfxViewShell_Impl() +: aInterceptorContainer( aMutex ) +, pAccExec(0) +{} +//========================================================================= SFX_IMPL_INTERFACE(SfxViewShell,SfxShell,SfxResId(0)) { SFX_CHILDWINDOW_REGISTRATION( SID_MAIL_CHILDWIN ); @@ -1297,21 +1304,27 @@ SfxViewShell::~SfxViewShell() SfxViewShellArr_Impl &rViewArr = SFX_APP()->GetViewShells_Impl(); rViewArr.Remove( rViewArr.GetPos(pThis) ); + if ( pImp->xClipboardListener.is() ) + { + pImp->xClipboardListener->DisconnectViewShell(); + pImp->xClipboardListener = NULL; + } + if ( pImp->pController ) { pImp->pController->ReleaseShell_Impl(); pImp->pController->release(); + pImp->pController = NULL; } if (pImp->pAccExec) { - delete pImp->pAccExec; - pImp->pAccExec = 0; + DELETEZ( pImp->pAccExec ); } - delete pImp->pPrinterCommandQueue; - delete pImp; - delete pIPClientList; + DELETEZ( pImp->pPrinterCommandQueue ); + DELETEZ( pImp ); + DELETEZ( pIPClientList ); } //-------------------------------------------------------------------- @@ -1997,7 +2010,12 @@ void SfxViewShell::SetController( SfxBaseController* pController ) pImp->pController->acquire(); pImp->bControllerSet = TRUE; - AddRemoveClipboardListener( new SfxClipboardChangeListener( this ), TRUE ); + // there should be no old listener, but if there is one, it should be disconnected + if ( pImp->xClipboardListener.is() ) + pImp->xClipboardListener->DisconnectViewShell(); + + pImp->xClipboardListener = new SfxClipboardChangeListener( this ); + AddRemoveClipboardListener( pImp->xClipboardListener.get(), TRUE ); } Reference < XController > SfxViewShell::GetController() @@ -2205,17 +2223,20 @@ void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransf { try { - uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() ); - if( !xClipboard.is() ) - return; - - uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY ); - if( xClpbrdNtfr.is() ) + if ( GetViewFrame() ) { - if( bAdd ) - xClpbrdNtfr->addClipboardListener( rClp ); - else - xClpbrdNtfr->removeClipboardListener( rClp ); + uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() ); + if( xClipboard.is() ) + { + uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY ); + if( xClpbrdNtfr.is() ) + { + if( bAdd ) + xClpbrdNtfr->addClipboardListener( rClp ); + else + xClpbrdNtfr->removeClipboardListener( rClp ); + } + } } } catch( const uno::Exception& ) diff --git a/svx/inc/svx/msdffimp.hxx b/svx/inc/svx/msdffimp.hxx index 248a31dcf71f..603a6831fe30 100644 --- a/svx/inc/svx/msdffimp.hxx +++ b/svx/inc/svx/msdffimp.hxx @@ -481,6 +481,7 @@ public: MSFilterTracer* mpTracer; sal_Bool mbTracing; + Color MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const; Color MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const; virtual BOOL SeekToShape( SvStream& rSt, void* pClientData, UINT32 nId ) const; FASTBOOL SeekToRec( SvStream& rSt, USHORT nRecId, ULONG nMaxFilePos, DffRecordHeader* pRecHd = NULL, ULONG nSkipCount = 0 ) const; diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx index 27359ebf9738..87a1de55ec0a 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx @@ -65,6 +65,8 @@ namespace sdr { namespace contact { ::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pImpl; public: + ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); + /// determines whether an XControl already exists, and is currently visible bool isControlVisible() const; @@ -98,7 +100,6 @@ namespace sdr { namespace contact { virtual void ActionChanged(); protected: - ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); ~ViewObjectContactOfUnoControl(); // support for Primitive2D @@ -110,36 +111,6 @@ namespace sdr { namespace contact { ViewObjectContactOfUnoControl& operator=( const ViewObjectContactOfUnoControl& ); // never implemented }; - //==================================================================== - //= UnoControlDefaultContact - //==================================================================== - class SVX_DLLPRIVATE UnoControlDefaultContact : public ViewObjectContactOfUnoControl - { - public: - UnoControlDefaultContact( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); - ~UnoControlDefaultContact(); - - private: - UnoControlDefaultContact(); // never implemented - UnoControlDefaultContact( const UnoControlDefaultContact& ); // never implemented - UnoControlDefaultContact& operator=( const UnoControlDefaultContact& ); // never implemented - }; - - //==================================================================== - //= UnoControlWindowContact - //==================================================================== - class SVX_DLLPRIVATE UnoControlWindowContact : public ViewObjectContactOfUnoControl - { - public: - UnoControlWindowContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); - ~UnoControlWindowContact(); - - private: - UnoControlWindowContact(); // never implemented - UnoControlWindowContact( const UnoControlWindowContact& ); // never implemented - UnoControlWindowContact& operator=( const UnoControlWindowContact& ); // never implemented - }; - //==================================================================== //= UnoControlPrintOrPreviewContact //==================================================================== @@ -157,21 +128,6 @@ namespace sdr { namespace contact { virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const; }; - //==================================================================== - //= UnoControlPDFExportContact - //==================================================================== - class SVX_DLLPRIVATE UnoControlPDFExportContact : public ViewObjectContactOfUnoControl - { - public: - UnoControlPDFExportContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); - ~UnoControlPDFExportContact(); - - private: - UnoControlPDFExportContact(); // never implemented - UnoControlPDFExportContact( const UnoControlPDFExportContact& ); // never implemented - UnoControlPDFExportContact& operator=( const UnoControlPDFExportContact& ); // never implemented - }; - //........................................................................ } } // namespace sdr::contact //........................................................................ diff --git a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx index 798e5b53d6de..0f46c2809597 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx @@ -75,7 +75,8 @@ namespace drawinglayer const attribute::SdrTextAttribute& rText, const attribute::SdrLineAttribute* pStroke, bool bCellText, - bool bWordWrap); + bool bWordWrap, + bool bClipOnBounds); Primitive2DSequence createEmbeddedShadowPrimitive( const Primitive2DSequence& rContent, diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx index 132a3ecc2538..059849531566 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -219,6 +219,7 @@ namespace drawinglayer unsigned mbUnlimitedPage : 1; // force layout with no text break unsigned mbCellText : 1; // this is a cell text as block text unsigned mbWordWrap : 1; // for CustomShapes text layout + unsigned mbClipOnBounds : 1; // for CustomShapes text layout protected: // local decomposition. @@ -234,7 +235,8 @@ namespace drawinglayer bool bFixedCellHeight, bool bUnlimitedPage, bool bCellText, - bool bWordWrap); + bool bWordWrap, + bool bClipOnBounds); // get data const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; } @@ -244,6 +246,7 @@ namespace drawinglayer bool getUnlimitedPage() const { return mbUnlimitedPage; } bool getCellText() const { return mbCellText; } bool getWordWrap() const { return mbWordWrap; } + bool getClipOnBounds() const { return mbClipOnBounds; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index f53168a273ac..afff309168ac 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -763,12 +763,18 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) Fraction aZoom = GetZoom(); // not all of these controls need to know the new zoom, but to be sure ... - Font aFont( IsControlFont() ? GetControlFont() : GetPointFont()); + Font aFont( GetSettings().GetStyleSettings().GetFieldFont() ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) { pWindows[i]->SetZoom(aZoom); pWindows[i]->SetZoomedPointFont(aFont); } + + SetZoomedPointFont( aFont ); + // rearrange the controls m_nDefaultWidth = ArrangeControls(); } @@ -1075,18 +1081,13 @@ void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat ) { if ( m_bNavigationBar ) { - m_aBar.SetZoom( GetZoom() ); - Font aFont = m_aBar.GetSettings().GetStyleSettings().GetFieldFont(); if ( IsControlFont() ) - { m_aBar.SetControlFont( GetControlFont() ); - aFont.Merge( GetControlFont() ); - } else m_aBar.SetControlFont(); - m_aBar.SetZoomedPointFont( aFont ); + m_aBar.SetZoom( GetZoom() ); } } diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 10c0978288a6..fc7f1aa78558 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -101,6 +101,7 @@ namespace svx //==================================================================== static SfxSlotId pTextControlSlots[] = { + SID_CLIPBOARD_FORMAT_ITEMS, SID_CUT, SID_COPY, SID_PASTE, @@ -140,7 +141,6 @@ namespace svx // SID_TEXTDIRECTION_TOP_TO_BOTTOM, SID_ATTR_CHAR_SCALEWIDTH, /* 911 */ SID_ATTR_CHAR_RELIEF, - SID_CLIPBOARD_FORMAT_ITEMS, /* 922 */ SID_ATTR_PARA_LEFT_TO_RIGHT, /* 950 */ SID_ATTR_PARA_RIGHT_TO_LEFT, 0 diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx index 0e751e3181e7..c9cfde91547a 100644 --- a/svx/source/msfilter/msdffimp.cxx +++ b/svx/source/msfilter/msdffimp.cxx @@ -3234,6 +3234,8 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const { // MapUnit eMap( rManager.GetModel()->GetScaleUnit() ); + sal_Bool bHasShadow = sal_False; + for ( void* pDummy = ((DffPropertyReader*)this)->First(); pDummy; pDummy = ((DffPropertyReader*)this)->Next() ) { UINT32 nRecType = GetCurKey(); @@ -3305,8 +3307,7 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const break; case DFF_Prop_fshadowObscured : { - sal_Bool bHasShadow = ( nContent & 2 ) != 0; - rSet.Put( SdrShadowItem( bHasShadow ) ); + bHasShadow = ( nContent & 2 ) != 0; if ( bHasShadow ) { if ( !IsProperty( DFF_Prop_shadowOffsetX ) ) @@ -3319,6 +3320,44 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const } } + if ( bHasShadow ) + { + // #160376# sj: activating shadow only if fill and or linestyle is used + // this is required because of the latest drawing layer core changes. + // Issue i104085 is related to this. + UINT32 nLineFlags(GetPropertyValue( DFF_Prop_fNoLineDrawDash )); + if(!IsHardAttribute( DFF_Prop_fLine ) && !IsCustomShapeStrokedByDefault( rObjData.eShapeType )) + nLineFlags &= ~0x08; + UINT32 nFillFlags(GetPropertyValue( DFF_Prop_fNoFillHitTest )); + if(!IsHardAttribute( DFF_Prop_fFilled ) && !IsCustomShapeFilledByDefault( rObjData.eShapeType )) + nFillFlags &= ~0x10; + if ( nFillFlags & 0x10 ) + { + MSO_FillType eMSO_FillType = (MSO_FillType)GetPropertyValue( DFF_Prop_fillType, mso_fillSolid ); + switch( eMSO_FillType ) + { + case mso_fillSolid : + case mso_fillPattern : + case mso_fillTexture : + case mso_fillPicture : + case mso_fillShade : + case mso_fillShadeCenter : + case mso_fillShadeShape : + case mso_fillShadeScale : + case mso_fillShadeTitle : + break; + // case mso_fillBackground : + default: + nFillFlags &=~0x10; // no fillstyle used + break; + } + } + if ( ( ( nLineFlags & 0x08 ) == 0 ) && ( ( nFillFlags & 0x10 ) == 0 ) ) // if there is no fillstyle and linestyle + bHasShadow = sal_False; // we are turning shadow off. + + if ( bHasShadow ) + rSet.Put( SdrShadowItem( bHasShadow ) ); + } ApplyLineAttributes( rSet, rObjData.eShapeType ); // #i28269# ApplyFillAttributes( rIn, rSet, rObjData ); if ( rObjData.eShapeType != mso_sptNil ) @@ -3770,14 +3809,37 @@ FASTBOOL SvxMSDffManager::GetColorFromPalette( USHORT /* nNum */, Color& rColor return TRUE; } +// sj: the documentation is not complete, especially in ppt the normal rgb for text +// color is written as 0xfeRRGGBB, this can't be explained by the documentation, nearly +// every bit in the upper code is set -> so there seems to be a special handling for +// ppt text colors, i decided not to fix this in MSO_CLR_ToColor because of possible +// side effects, instead MSO_TEXT_CLR_ToColor is called for PPT text colors, to map +// the color code to something that behaves like the other standard color codes used by +// fill and line color +Color SvxMSDffManager::MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const +{ + // Fuer Textfarben: Header ist 0xfeRRGGBB + if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) + nColorCode &= 0x00ffffff; + else + { + // for colorscheme colors the color index are the lower three bits of the upper byte + if ( ( nColorCode & 0xf8000000 ) == 0 ) // this must be a colorscheme index + { + nColorCode >>= 24; + nColorCode |= 0x8000000; + } + } + return MSO_CLR_ToColor( nColorCode ); +} Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nContentProperty ) const { Color aColor( mnDefaultColor ); // Fuer Textfarben: Header ist 0xfeRRGGBB - if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) - nColorCode &= 0x00ffffff; + if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) // sj: it needs to be checked if 0xfe is used in + nColorCode &= 0x00ffffff; // other cases than ppt text -> if not this code can be removed sal_uInt8 nUpper = (sal_uInt8)( nColorCode >> 24 ); diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx index 3da9e8dbecac..fc144cf4304f 100644 --- a/svx/source/outliner/outliner.cxx +++ b/svx/source/outliner/outliner.cxx @@ -1867,6 +1867,20 @@ IMPL_LINK( Outliner, EndMovingParagraphsHdl, MoveParagraphsInfo*, pInfos ) return 0; } +static bool isSameNumbering( const SvxNumberFormat& rN1, const SvxNumberFormat& rN2 ) +{ + if( rN1.GetNumberingType() != rN2.GetNumberingType() ) + return false; + + if( rN1.GetNumStr(1) != rN2.GetNumStr(1) ) + return false; + + if( (rN1.GetPrefix() != rN2.GetPrefix()) || (rN1.GetSuffix() != rN2.GetSuffix()) ) + return false; + + return true; +} + sal_uInt16 Outliner::ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pParaFmt ) { sal_uInt16 nNumber = pParaFmt->GetStart() - 1; @@ -1879,8 +1893,8 @@ sal_uInt16 Outliner::ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pPar pPara = pParaList->GetParagraph( nPara ); const sal_Int16 nDepth = pPara->GetDepth(); - // ignore paragraphs that are below our paragraph - if( nDepth > nParaDepth ) + // ignore paragraphs that are below our paragraph or have no numbering + if( (nDepth > nParaDepth) || (nDepth == -1) ) continue; // stop on paragraphs that are above our paragraph @@ -1888,8 +1902,13 @@ sal_uInt16 Outliner::ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pPar break; const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); - if( pFmt == 0 || (*pFmt != *pParaFmt) ) - break; // change in number format, stop here + + if( pFmt == 0 ) + continue; // ignore paragraphs without bullets + + // check if numbering is the same + if( !isSameNumbering( *pFmt, *pParaFmt ) ) + break; const SfxBoolItem& rBulletState = (const SfxBoolItem&) pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ); diff --git a/svx/source/outliner/outlvw.cxx b/svx/source/outliner/outlvw.cxx index 098a4055ce0f..a69776df14e8 100644 --- a/svx/source/outliner/outlvw.cxx +++ b/svx/source/outliner/outlvw.cxx @@ -1010,6 +1010,14 @@ void OutlinerView::PasteSpecial() pOwner->bPasting = TRUE; pEditView->PasteSpecial(); + if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) + { + const USHORT nParaCount = pOwner->pEditEngine->GetParagraphCount(); + + for( USHORT nPara = 0; nPara < nParaCount; nPara++ ) + pOwner->ImplSetLevelDependendStyleSheet( nPara ); + } + pEditView->SetEditEngineUpdateMode( TRUE ); pOwner->UndoActionEnd( OLUNDO_INSERT ); pEditView->ShowCursor( TRUE, TRUE ); diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 6a92cb27ff8c..7527b177b3a4 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -310,6 +310,7 @@ namespace sdr false, false, false, + false, false); // decompose immediately with neutral ViewInformation. This will diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx index 9d6548a1b791..7bea25feeeed 100644 --- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx @@ -121,36 +121,18 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- ViewObjectContact& ViewContactOfUnoControl::CreateObjectSpecificViewObjectContact( ObjectContact& _rObjectContact ) { + // print or print preview requires special handling + const OutputDevice* pDevice = _rObjectContact.TryToGetOutputDevice(); + bool bPrintOrPreview = ( pDevice != NULL ) && ( pDevice->GetOutDevType() == OUTDEV_PRINTER ); + ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &_rObjectContact ); - if ( pPageViewContact ) - { - // special classes for special devices: - // - PDF export - ::vcl::PDFExtOutDevData* pPDFExport = PTR_CAST( ::vcl::PDFExtOutDevData, pPageViewContact->GetPageWindow().GetPaintWindow().GetOutputDevice().GetExtOutDevData() ); - if ( pPDFExport != NULL ) - return *new UnoControlPDFExportContact( *pPageViewContact, *this ); + bPrintOrPreview |= ( pPageViewContact != NULL ) && pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview(); - // - print preview - if ( pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview() ) - return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this ); + if ( bPrintOrPreview ) + return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this ); - OutDevType eDeviceType = pPageViewContact->GetPageWindow().GetPaintWindow().GetOutputDevice().GetOutDevType(); - // - printing - if ( eDeviceType == OUTDEV_PRINTER ) - return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this ); - - // - any other virtual device - if ( eDeviceType == OUTDEV_VIRDEV ) - return *new UnoControlDefaultContact( *pPageViewContact, *this ); - - // - normal windows have special, design-mode dependent handling - if ( eDeviceType == OUTDEV_WINDOW ) - return *new UnoControlWindowContact( *pPageViewContact, *this ); - } - - // if we're not working for a ObjectContactOfPageView, then we can't use a ViewObjectContactOfUnoControl, or any - // of its derivees. Fall back to a "normal" SdrObj's contact object. - return *new ViewObjectContactOfSdrObj( _rObjectContact, *this ); + // all others are nowadays served by the same implementation + return *new ViewObjectContactOfUnoControl( _rObjectContact, *this ); } //-------------------------------------------------------------------- @@ -173,7 +155,7 @@ namespace sdr { namespace contact { aTransform.set(0, 2, aRange.getMinX()); aTransform.set(1, 2, aRange.getMinY()); - // create control primitive WITHOUT evtl. existing XControl; this would be done in + // create control primitive WITHOUT possibly existing XControl; this would be done in // the VOC in createPrimitive2DSequence() const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D( aTransform, xControlModel)); diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 667129e27653..bbfe3eaf65ab 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -402,7 +402,7 @@ namespace sdr { namespace contact { //= InvisibleControlViewAccess //==================================================================== /** is a ->IPageViewAccess implementation which can be used to create an invisble control for - an arbitrary device + an arbitrary window */ class InvisibleControlViewAccess : public IPageViewAccess { @@ -445,6 +445,47 @@ namespace sdr { namespace contact { return false; } + //==================================================================== + //= DummyPageViewAccess + //==================================================================== + /** is a ->IPageViewAccess implementation which can be used to create a control for an arbitrary + non-Window device + + The implementation will report the "PageView" as being in design mode, all layers to be visible, + and will not return any ControlContainer, so all control container related features (notifications etc) + are not available. + */ + class DummyPageViewAccess : public IPageViewAccess + { + public: + DummyPageViewAccess() + { + } + + virtual bool isDesignMode() const; + virtual Reference< XControlContainer > + getControlContainer( const OutputDevice& _rDevice ) const; + virtual bool isLayerVisible( SdrLayerID _nLayerID ) const; + }; + + //-------------------------------------------------------------------- + bool DummyPageViewAccess::isDesignMode() const + { + return true; + } + + //-------------------------------------------------------------------- + Reference< XControlContainer > DummyPageViewAccess::getControlContainer( const OutputDevice& /*_rDevice*/ ) const + { + return NULL; + } + + //-------------------------------------------------------------------- + bool DummyPageViewAccess::isLayerVisible( SdrLayerID /*_nLayerID*/ ) const + { + return true; + } + //==================================================================== //= ViewObjectContactOfUnoControl_Impl //==================================================================== @@ -763,8 +804,9 @@ namespace sdr { namespace contact { This method cares for this, by retrieving the very original OutputDevice. */ - static const OutputDevice& imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ); - const OutputDevice& imp_getPageViewDevice_nothrow() const; + static const OutputDevice& impl_getPageViewOutputDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ); + + const OutputDevice& impl_getOutputDevice_throw() const; private: ViewObjectContactOfUnoControl_Impl(); // never implemented @@ -828,6 +870,13 @@ namespace sdr { namespace contact { static void getTransformation( const ViewContactOfUnoControl& _rVOC, ::basegfx::B2DHomMatrix& _out_Transformation ); + private: + void impl_positionAndZoomControl( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const + { + if ( !_rViewInformation.getViewport().isEmpty() ) + m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() ); + } + private: ::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pVOCImpl; /** The geometry is part of the identity of an primitive, so we cannot calculate it on demand @@ -854,9 +903,15 @@ namespace sdr { namespace contact { DBG_CTOR( ViewObjectContactOfUnoControl_Impl, NULL ); DBG_ASSERT( m_pAntiImpl, "ViewObjectContactOfUnoControl_Impl::ViewObjectContactOfUnoControl_Impl: invalid AntiImpl!" ); - const OutputDevice& rPageViewDevice( imp_getPageViewDevice_nothrow() ); + const OutputDevice& rPageViewDevice( impl_getOutputDevice_throw() ); m_aZoomLevelNormalization = rPageViewDevice.GetInverseViewTransformation(); + #if OSL_DEBUG_LEVEL > 1 + ::basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + m_aZoomLevelNormalization.decompose( aScale, aTranslate, fRotate, fShearX ); + #endif + ::basegfx::B2DHomMatrix aScaleNormalization; MapMode aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() ); aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() ); @@ -953,27 +1008,40 @@ namespace sdr { namespace contact { return false; ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() ); - DBG_ASSERT( pPageViewContact, "ViewObjectContactOfUnoControl_Impl::ensureControl: cannot create a control if I don't have a PageView!" ); - if ( !pPageViewContact ) - return false; + if ( pPageViewContact ) + { + SdrPageViewAccess aPVAccess( pPageViewContact->GetPageWindow().GetPageView() ); + return impl_ensureControl_nothrow( + aPVAccess, + impl_getPageViewOutputDevice_nothrow( *pPageViewContact ) + ); + } - SdrPageViewAccess aPVAccess( pPageViewContact->GetPageWindow().GetPageView() ); + DummyPageViewAccess aNoPageView; return impl_ensureControl_nothrow( - aPVAccess, - imp_getPageViewDevice_nothrow( *pPageViewContact ) + aNoPageView, + impl_getOutputDevice_throw() ); } //-------------------------------------------------------------------- - const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow() const + const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getOutputDevice_throw() const { ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() ); - ENSURE_OR_THROW( pPageViewContact, "need a ObjectContactOfPageView." ); - return imp_getPageViewDevice_nothrow( *pPageViewContact ); + if ( pPageViewContact ) + { + // do not use ObjectContact::TryToGetOutputDevice here, it would not care for the PageWindow's + // OriginalPaintWindow + return impl_getPageViewOutputDevice_nothrow( *pPageViewContact ); + } + + const OutputDevice* pDevice = m_pAntiImpl->GetObjectContact().TryToGetOutputDevice(); + ENSURE_OR_THROW( pDevice, "no output device -> no control" ); + return *pDevice; } //-------------------------------------------------------------------- - const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ) + const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getPageViewOutputDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ) { // if the PageWindow has a patched PaintWindow, use the original PaintWindow // this ensures that our control is _not_ re-created just because somebody @@ -1522,18 +1590,28 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::get2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const { + #if OSL_DEBUG_LEVEL > 1 + ::basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX ); + #endif if ( m_pVOCImpl->hasControl() ) - m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() ); + impl_positionAndZoomControl( _rViewInformation ); return BasePrimitive2D::get2DDecomposition( _rViewInformation ); } //-------------------------------------------------------------------- ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::createLocalDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const { + #if OSL_DEBUG_LEVEL > 1 + ::basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX ); + #endif // force control here to make it a VCL ChildWindow. Will be fetched // and used below by getExistentControl() m_pVOCImpl->ensureControl(); - m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() ); + impl_positionAndZoomControl( _rViewInformation ); // get needed data const ViewContactOfUnoControl& rViewContactOfUnoControl( m_pVOCImpl->getViewContact() ); @@ -1703,40 +1781,6 @@ namespace sdr { namespace contact { } } - //==================================================================== - //= UnoControlDefaultContact - //==================================================================== - DBG_NAME( UnoControlDefaultContact ) - //-------------------------------------------------------------------- - UnoControlDefaultContact::UnoControlDefaultContact( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ) - :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact ) - { - DBG_CTOR( UnoControlDefaultContact, NULL ); - } - - //-------------------------------------------------------------------- - UnoControlDefaultContact::~UnoControlDefaultContact() - { - DBG_DTOR( UnoControlDefaultContact, NULL ); - } - - //==================================================================== - //= UnoControlWindowContact - //==================================================================== - DBG_NAME( UnoControlWindowContact ) - //-------------------------------------------------------------------- - UnoControlWindowContact::UnoControlWindowContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ) - :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact ) - { - DBG_CTOR( UnoControlWindowContact, NULL ); - } - - //-------------------------------------------------------------------- - UnoControlWindowContact::~UnoControlWindowContact() - { - DBG_DTOR( UnoControlWindowContact, NULL ); - } - //==================================================================== //= UnoControlPrintOrPreviewContact //==================================================================== @@ -1762,23 +1806,6 @@ namespace sdr { namespace contact { return ViewObjectContactOfUnoControl::createPrimitive2DSequence( rDisplayInfo ); } - //==================================================================== - //= UnoControlPDFExportContact - //==================================================================== - DBG_NAME( UnoControlPDFExportContact ) - //-------------------------------------------------------------------- - UnoControlPDFExportContact::UnoControlPDFExportContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ) - :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact ) - { - DBG_CTOR( UnoControlPDFExportContact, NULL ); - } - - //-------------------------------------------------------------------- - UnoControlPDFExportContact::~UnoControlPDFExportContact() - { - DBG_DTOR( UnoControlPDFExportContact, NULL ); - } - //........................................................................ } } // namespace sdr::contact //........................................................................ diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index 3c8feb7ff2b2..73d5689350c2 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -123,6 +123,7 @@ namespace drawinglayer *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, + false, false)); } diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index 0edbe1a35046..a04021ae21ad 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -72,7 +72,7 @@ namespace drawinglayer // add text if(getSdrLSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false, false)); } // add shadow diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index 497266433d67..e2dce7b551ed 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -60,8 +60,9 @@ namespace drawinglayer getTextBox(), *getSdrSTAttribute().getText(), 0, - isForceTextClipToTextRange(), // #SJ# use CellText mode; text upper-left - getWordWrap())); + false, + getWordWrap(), + isForceTextClipToTextRange())); } // add shadow diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 09769a2a013e..cd426edfdd05 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -173,7 +173,8 @@ namespace drawinglayer const attribute::SdrTextAttribute& rText, const attribute::SdrLineAttribute* pStroke, bool bCellText, - bool bWordWrap) + bool bWordWrap, + bool bClipOnBounds) { basegfx::B2DHomMatrix aAnchorTransform(rObjectTransform); SdrTextPrimitive2D* pNew = 0; @@ -297,7 +298,8 @@ namespace drawinglayer rText.isFixedCellHeight(), rText.isScroll(), bCellText, - bWordWrap); + bWordWrap, + bClipOnBounds); } } diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index ed3062184f1a..4f7e2c768669 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -94,7 +94,7 @@ namespace drawinglayer // add text if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); } // add shadow @@ -191,7 +191,7 @@ namespace drawinglayer // add text if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); } // add shadow diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index f5f2f4e876dc..63d050a775af 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -104,7 +104,7 @@ namespace drawinglayer // add text if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); } // add shadow diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 94e59f79c3de..f5445cefa5f6 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -134,6 +134,7 @@ namespace drawinglayer pTextAttribute->isScroll(), false, false, + false, false); aTextRange = pBlockText->getB2DRange(aViewInformation); } diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index ab5d23962719..7c44311d3c5a 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -110,7 +110,7 @@ namespace drawinglayer // always supported by the old paints, too if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); } // add shadow diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 91ed0bd2adce..96da706fb66a 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -89,7 +89,7 @@ namespace drawinglayer // add text if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); } // add shadow diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 64ac716b40e9..edb2837ef670 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -110,7 +110,7 @@ namespace drawinglayer // add text if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); } // add shadow diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 748270c36977..47e85894f37e 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -382,7 +382,8 @@ namespace drawinglayer bool bFixedCellHeight, bool bUnlimitedPage, bool bCellText, - bool bWordWrap) + bool bWordWrap, + bool bClipOnBounds) : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform), maSdrTextHorzAdjust(aSdrTextHorzAdjust), @@ -390,7 +391,8 @@ namespace drawinglayer mbFixedCellHeight(bFixedCellHeight), mbUnlimitedPage(bUnlimitedPage), mbCellText(bCellText), - mbWordWrap(bWordWrap) + mbWordWrap(bWordWrap), + mbClipOnBounds(bClipOnBounds) { } @@ -406,7 +408,8 @@ namespace drawinglayer && isFixedCellHeight() == rCompare.isFixedCellHeight() && getUnlimitedPage() == rCompare.getUnlimitedPage() && getCellText() == rCompare.getCellText() - && getWordWrap() == rCompare.getWordWrap()); + && getWordWrap() == rCompare.getWordWrap() + && getClipOnBounds() == rCompare.getClipOnBounds()); } return false; @@ -423,7 +426,8 @@ namespace drawinglayer isFixedCellHeight(), getUnlimitedPage(), getCellText(), - getWordWrap()); + getWordWrap(), + getClipOnBounds()); } // provide unique ID diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx index d0b01f6a820f..af38c34e0749 100644 --- a/svx/source/svdraw/svdfppt.cxx +++ b/svx/source/svdraw/svdfppt.cxx @@ -3972,7 +3972,7 @@ void PPTNumberFormatCreator::ImplGetNumberFormat( SdrPowerPointImport& rManager, aFont.SetFamily( pAtom->eFamily ); aFont.SetPitch( pAtom->ePitch ); } - Color aCol( rManager.MSO_CLR_ToColor( nBulletColor ) ); + Color aCol( rManager.MSO_TEXT_CLR_ToColor( nBulletColor ) ); aFont.SetColor( aCol ); sal_uInt16 nBuChar = (sal_uInt16)nBulletChar; @@ -5886,14 +5886,14 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, U { if ( GetAttrib( PPT_CharAttr_FontColor, nVal, nDestinationInstance ) ) // Textfarbe (4Byte-Arg) { - Color aCol( rManager.MSO_CLR_ToColor( nVal ) ); + Color aCol( rManager.MSO_TEXT_CLR_ToColor( nVal ) ); rSet.Put( SvxColorItem( aCol, EE_CHAR_COLOR ) ); if ( nDestinationInstance == 0xffffffff ) mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ].mnFontColorInStyleSheet = aCol; } else if ( nVal & 0x0f000000 ) // this is not a hard attribute, but maybe the page has a different colerscheme, { // so that in this case we must use a hard color attribute - Color aCol( rManager.MSO_CLR_ToColor( nVal ) ); + Color aCol( rManager.MSO_TEXT_CLR_ToColor( nVal ) ); Color& aColorInSheet = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ].mnFontColorInStyleSheet; if ( aColorInSheet != aCol ) rSet.Put( SvxColorItem( aCol, EE_CHAR_COLOR ) ); @@ -6315,7 +6315,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& nColor = rParaLevel.mnBulletColor; else nColor = rCharLevel.mnFontColor; - aNumberFormat2.SetBulletColor( rManager.MSO_CLR_ToColor( nColor ) ); + aNumberFormat2.SetBulletColor( rManager.MSO_TEXT_CLR_ToColor( nColor ) ); pRule->SetLevel( i, aNumberFormat2 ); } } @@ -7611,8 +7611,8 @@ void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable >& xTabl { Color aLineColor( ((XLineColorItem&)pLine->GetMergedItem( XATTR_LINECOLOR )).GetColorValue() ); aBorderLine.Color = aLineColor.GetColor(); - aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( ((const XLineWidthItem&)(pLine->GetMergedItem(XATTR_LINEWIDTH))).GetValue() ); - aBorderLine.InnerLineWidth = 0; + aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( ((const XLineWidthItem&)(pLine->GetMergedItem(XATTR_LINEWIDTH))).GetValue() / 4 ); + aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( ((const XLineWidthItem&)(pLine->GetMergedItem(XATTR_LINEWIDTH))).GetValue() / 4 ); aBorderLine.LineDistance = 0; } break; diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 93d3651e3f01..e72b606f3b53 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -800,24 +800,32 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( const bool bVerticalWritintg(rSdrBlockTextPrimitive.getOutlinerParaObject().IsVertical()); const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight)); + // check if block text is used (only one of them can be true) + const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg); + const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg); + + // set minimal paper size hor/ver if needed + if(bHorizontalIsBlock) + { + rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0)); + } + else if(bVerticalIsBlock) + { + rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight)); + } + if(bIsCell) { // cell text is formated neither like a text object nor like a object // text, so use a special setup here - rOutliner.SetMinAutoPaperSize(aNullSize); rOutliner.SetMaxAutoPaperSize(aAnchorTextSize); rOutliner.SetPaperSize(aAnchorTextSize); - rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0)); - rOutliner.SetUpdateMode(TRUE); + rOutliner.SetUpdateMode(true); rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); - rOutliner.SetUpdateMode(TRUE); rOutliner.SetControlWord(nOriginalControlWord); } else { - // check if block text is used (only one of them can be true) - const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg); - const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg); if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage()) { @@ -843,16 +851,6 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.SetMaxAutoPaperSize(aMaxAutoPaperSize); } - // set minimal paper size hor/ver if needed - if(bHorizontalIsBlock) - { - rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0)); - } - else if(bVerticalIsBlock) - { - rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight)); - } - rOutliner.SetPaperSize(aNullSize); rOutliner.SetUpdateMode(true); rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); @@ -931,7 +929,8 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( // as the master shape we are working on. For vertical, use the top-right // corner const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX()); - aNewTransformA.translate(fStartInX, aAdjustTranslate.getY()); + const basegfx::B2DTuple aAdjOffset(fStartInX, aAdjustTranslate.getY()); + aNewTransformA.translate(aAdjOffset.getX(), aAdjOffset.getY()); // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y, // move the null point which was top left to bottom right. @@ -948,10 +947,10 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( // #SJ# create ClipRange (if needed) basegfx::B2DRange aClipRange; - if(bIsCell) + if(rSdrBlockTextPrimitive.getClipOnBounds()) { - aClipRange.expand(basegfx::B2DTuple(0.0, 0.0)); - aClipRange.expand(basegfx::B2DTuple(aAnchorTextSize.Width(), aAnchorTextSize.Height())); + aClipRange.expand(-aAdjOffset); + aClipRange.expand(basegfx::B2DTuple(aAnchorTextSize.Width(), aAnchorTextSize.Height()) - aAdjOffset); } // now break up text primitives. diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 45a24211f7b2..e53f41251ff2 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -123,7 +123,7 @@ namespace drawinglayer getTransform(), *getSdrFTAttribute().getText(), 0, - true, false)); + true, false, false)); } } diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index d4dc48ede241..0dece7c6965c 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -1629,6 +1629,7 @@ sal_Bool SvXMLImport::IsODFVersionConsistent( const ::rtl::OUString& aODFVersion if ( aODFVersion.getLength() && aODFVersion.compareTo( ODFVER_012_TEXT ) >= 0 ) { // check the consistency only for the ODF1.2 and later ( according to content.xml ) + // manifest.xml might have no version, it should be checked here and the correct version should be set try { uno::Reference< document::XStorageBasedDocument > xDoc( mxModel, uno::UNO_QUERY_THROW ); @@ -1654,7 +1655,24 @@ sal_Bool SvXMLImport::IsODFVersionConsistent( const ::rtl::OUString& aODFVersion ::rtl::OUString aStorVersion; xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= aStorVersion; - bResult = aODFVersion.equals( aStorVersion ); + + // if the storage version is set in manifest.xml, it must be the same as in content.xml + // if not, set it explicitly to be used further ( it will work even for readonly storage ) + // This workaround is not nice, but I see no other way to handle it, since there are + // ODF1.2 documents without version in manifest.xml + if ( aStorVersion.getLength() ) + bResult = aODFVersion.equals( aStorVersion ); + else + xStorProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), + uno::makeAny( aODFVersion ) ); + + if ( bResult ) + { + sal_Bool bInconsistent = sal_False; + xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsInconsistent" ) ) ) + >>= bInconsistent; + bResult = !bInconsistent; + } } } } From 4a8256a93d4bb2bda592c525613a2fc9cacdb28c Mon Sep 17 00:00:00 2001 From: Sven Jacobi Date: Tue, 20 Oct 2009 11:37:58 +0000 Subject: [PATCH 052/117] #i102257# fixed gpf when loading some types of pict graphics --- svx/source/msfilter/msdffimp.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx index 0e751e3181e7..087e13e88f3c 100644 --- a/svx/source/msfilter/msdffimp.cxx +++ b/svx/source/msfilter/msdffimp.cxx @@ -4954,16 +4954,16 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ApplyAttributes( rSt, aSet, aObjData ); pRet->SetMergedItemSet(aSet); } - else if ( aObjData.eShapeType == mso_sptLine ) - { - basegfx::B2DPolygon aPoly; - aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Left(), aObjData.aBoundRect.Top())); - aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Right(), aObjData.aBoundRect.Bottom())); - pRet = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPoly)); - pRet->SetModel( pSdrModel ); - ApplyAttributes( rSt, aSet, aObjData ); - pRet->SetMergedItemSet(aSet); - } + else if ( aObjData.eShapeType == mso_sptLine ) + { + basegfx::B2DPolygon aPoly; + aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Left(), aObjData.aBoundRect.Top())); + aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Right(), aObjData.aBoundRect.Bottom())); + pRet = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPoly)); + pRet->SetModel( pSdrModel ); + ApplyAttributes( rSt, aSet, aObjData ); + pRet->SetMergedItemSet(aSet); + } else { if ( GetCustomShapeContent( aObjData.eShapeType ) || IsProperty( DFF_Prop_pVertices ) ) @@ -7037,6 +7037,8 @@ BOOL SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, Rect aZCodec.Decompress( rBLIPStream, *pOut ); aZCodec.EndCompression(); pOut->Seek( STREAM_SEEK_TO_BEGIN ); + pOut->SetResizeOffset( 0 ); // sj: #i102257# setting ResizeOffset of 0 prevents from seeking + // behind the stream end (allocating too much memory) pGrStream = pOut; } From 939bb9c884e994788ee563944e22f79a50a56067 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Tue, 20 Oct 2009 11:48:09 +0000 Subject: [PATCH 053/117] #i105856# changed conditions for using the filled TextShape for HitTest to do the same as before primitives --- .../svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx | 9 ++++----- svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 8 +++++++- svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx | 10 +++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx index 650cc1a882c5..23bbc2676f22 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -55,9 +55,8 @@ namespace drawinglayer double mfCornerRadiusY; // [0.0..1.0] relative to 1/2 height // bitfield - // flag which decides if this is a text frame. If Yes, the HitArea - // should be the filled geometry - bool mbTextFrame : 1; + // flag which decides if the HitArea should be the filled geometry + bool mbForceFillForHitTest : 1; protected: // local decomposition. @@ -69,7 +68,7 @@ namespace drawinglayer const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, double fCornerRadiusX, double fCornerRadiusY, - bool bTextFrame); + bool bForceFillForHitTest); // data access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } @@ -77,7 +76,7 @@ namespace drawinglayer double getCornerRadiusX() const { return mfCornerRadiusX; } double getCornerRadiusY() const { return mfCornerRadiusY; } bool isCornerRadiusUsed() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); } - bool getTextFrame() const { return mbTextFrame; } + bool getForceFillForHitTest() const { return mbForceFillForHitTest; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 8ba8ae8ab4c9..cefb3e065165 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -104,6 +105,10 @@ namespace sdr double fCornerRadiusY; drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); + // #i105856# use knowledge about pickthrough from the model + const bool bPickThroughTransparentTextFrames( + GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); + // create primitive const drawinglayer::primitive2d::Primitive2DReference xReference( new drawinglayer::primitive2d::SdrRectanglePrimitive2D( @@ -111,7 +116,8 @@ namespace sdr *pAttribute, fCornerRadiusX, fCornerRadiusY, - GetRectObj().IsTextFrame())); + // #i105856# use fill for HitTest when TextFrame and not PickThrough + GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 64ac716b40e9..7139c9f215e3 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -68,7 +68,7 @@ namespace drawinglayer *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } - else if(getTextFrame()) + else if(getForceFillForHitTest()) { // if no fill and it's a text frame, create a fill for HitTest and // BoundRect fallback @@ -89,7 +89,7 @@ namespace drawinglayer getTransform(), *getSdrLFSTAttribute().getLine())); } - else if(!getTextFrame()) + else if(!getForceFillForHitTest()) { // if initially no line is defined and it's not a text frame, create // a line for HitTest and BoundRect @@ -127,13 +127,13 @@ namespace drawinglayer const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, double fCornerRadiusX, double fCornerRadiusY, - bool bTextFrame) + bool bForceFillForHitTest) : BasePrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), mfCornerRadiusX(fCornerRadiusX), mfCornerRadiusY(fCornerRadiusY), - mbTextFrame(bTextFrame) + mbForceFillForHitTest(bForceFillForHitTest) { } @@ -147,7 +147,7 @@ namespace drawinglayer && getCornerRadiusY() == rCompare.getCornerRadiusY() && getTransform() == rCompare.getTransform() && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute() - && getTextFrame() == rCompare.getTextFrame()); + && getForceFillForHitTest() == rCompare.getForceFillForHitTest()); } return false; From 564876cf54ab4ec1ab49051d925a278d8585e781 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 20 Oct 2009 13:29:06 +0000 Subject: [PATCH 054/117] #i98908# unsorted char attribute array fixed --- svx/source/editeng/editdoc.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/svx/source/editeng/editdoc.cxx b/svx/source/editeng/editdoc.cxx index acf278e2d01f..c43c91a02d1f 100644 --- a/svx/source/editeng/editdoc.cxx +++ b/svx/source/editeng/editdoc.cxx @@ -1427,9 +1427,11 @@ XubString EditDoc::GetParaAsString( ContentNode* pNode, USHORT nStartPos, USHORT else pNextFeature = 0; // Feature interessiert unten nicht - DBG_ASSERT( nEnd >= nIndex, "Ende vorm Index?" ); - aStr += XubString( *pNode, nIndex, nEnd-nIndex ); + //!! beware of sub string length of -1 which is also defined as STRING_LEN and + //!! thus would result in adding the whole sub string up to the end of the node !! + if (nEnd > nIndex) + aStr += XubString( *pNode, nIndex, nEnd - nIndex ); if ( pNextFeature ) { @@ -1790,7 +1792,12 @@ BOOL EditDoc::RemoveAttribs( ContentNode* pNode, USHORT nStart, USHORT nEnd, Edi } if ( bChanged ) + { + // char attributes need to be sorted by start again + pNode->GetCharAttribs().ResortAttribs(); + SetModified( TRUE ); + } return bChanged; } From 924a015ffc8d735430d487b6d48f3cad1f7a3473 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Tue, 20 Oct 2009 15:35:41 +0000 Subject: [PATCH 055/117] #i105065# speedup 3D/FontWork --- .../primitive2d/sdrcustomshapeprimitive2d.hxx | 13 +- .../sdr/primitive2d/sdrmeasureprimitive2d.hxx | 25 +-- svx/inc/svx/svddrgmt.hxx | 20 ++ .../customshapes/EnhancedCustomShape2d.cxx | 71 ++++--- .../customshapes/EnhancedCustomShape3d.cxx | 12 +- svx/source/engine3d/helperhittest3d.cxx | 183 +----------------- .../viewcontactofsdrobjcustomshape.cxx | 11 +- svx/source/sdr/overlay/overlaymanager.cxx | 16 ++ .../primitive2d/sdrcustomshapeprimitive2d.cxx | 24 ++- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 28 +-- svx/source/svdraw/svddrgmt.cxx | 50 ++++- 11 files changed, 210 insertions(+), 243 deletions(-) diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index 4eddc4386a0d..8f7f0eb23cb3 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -56,8 +56,13 @@ namespace drawinglayer // defines if SdrTextWordWrapItem was set at SdrObjCustomShape which means // that the text needs to be block formatted unsigned mbWordWrap : 1; - // #SJ# Allow text clipping against TextBox in special cases (used for SC) - unsigned mbForceTextClipToTextRange : 1; + + // #SJ# Allow text clipping against TextBox in special cases (used for SC) + unsigned mbForceTextClipToTextRange : 1; + + // defines that the object contains/is a 3D AutoShape. Needed for + // making exceptions with shadow generation + unsigned mb3DShape : 1; protected: // local decomposition. @@ -69,7 +74,8 @@ namespace drawinglayer const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, bool bWordWrap, - bool bForceTextClipToTextRange); + bool bForceTextClipToTextRange, + bool b3DShape); // data access const attribute::SdrShadowTextAttribute& getSdrSTAttribute() const { return maSdrSTAttribute; } @@ -77,6 +83,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& getTextBox() const { return maTextBox; } bool getWordWrap() const { return mbWordWrap; } bool isForceTextClipToTextRange() const { return mbForceTextClipToTextRange; } + bool get3DShape() const { return mb3DShape; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 1e68a61432a0..a7084993b5f2 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -39,19 +39,19 @@ ////////////////////////////////////////////////////////////////////////////// // predefines -namespace drawinglayer -{ - namespace primitive2d +namespace drawinglayer { namespace primitive2d { + enum MeasureTextPosition { - enum MeasureTextPosition - { - MEASURETEXTPOSITION_AUTOMATIC, - MEASURETEXTPOSITION_NEGATIVE, - MEASURETEXTPOSITION_CENTERED, - MEASURETEXTPOSITION_POSITIVE - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer + MEASURETEXTPOSITION_AUTOMATIC, + MEASURETEXTPOSITION_NEGATIVE, + MEASURETEXTPOSITION_CENTERED, + MEASURETEXTPOSITION_POSITIVE + }; +}} + +namespace drawinglayer { namespace attribute { + class SdrLineAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -80,6 +80,7 @@ namespace drawinglayer // internal decomposition helper Primitive2DReference impCreatePart( + const attribute::SdrLineAttribute& rLineAttribute, const basegfx::B2DHomMatrix& rObjectMatrix, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, diff --git a/svx/inc/svx/svddrgmt.hxx b/svx/inc/svx/svddrgmt.hxx index fa4e09c9a324..91112a7dd287 100644 --- a/svx/inc/svx/svddrgmt.hxx +++ b/svx/inc/svx/svddrgmt.hxx @@ -107,6 +107,22 @@ public: ////////////////////////////////////////////////////////////////////////////// +class SdrDragEntryPrimitive2DSequence : public SdrDragEntry +{ +private: + drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence; + +public: + SdrDragEntryPrimitive2DSequence( + const drawinglayer::primitive2d::Primitive2DSequence& rSequence, + bool bAddToTransparent); + virtual ~SdrDragEntryPrimitive2DSequence(); + + virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod); +}; + +////////////////////////////////////////////////////////////////////////////// + class SdrDragEntryPointGlueDrag : public SdrDragEntry { private: @@ -138,6 +154,7 @@ protected: void clearSdrDragEntries() { for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++) { delete maSdrDragEntries[a]; } maSdrDragEntries.clear(); } void addSdrDragEntry(SdrDragEntry* pNew) { if(pNew) { maSdrDragEntries.push_back(pNew); }} virtual void createSdrDragEntries(); + virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify); // access for derivated classes to maOverlayObjectList void clearOverlayObjectList() { maOverlayObjectList.clear(); } @@ -236,6 +253,9 @@ private: void ImpCheckSnap(const Point& rPt); +protected: + virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify); + public: TYPEINFO(); SdrDragMove(SdrDragView& rNewView); diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 804db0c58a16..0ef28d7972dc 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -696,7 +696,16 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : ClearItem( SDRATTR_TEXTDIRECTION ); //SJ: vertical writing is not required, by removing this item no outliner is created - // For primitive rendering, shadow handling is done completely based on the geometry, so i removed it here + // #i105323# For 2D AtoShapes, the shadow attirbute does not need to be applied to any + // of the constucted helper SdrObjects. This would lead to problems since the shadow + // of one helper object would fall on one helper object behind it (e.g. with the + // eyes of the smiley shape). This is not wanted; instead a single shadow 'behind' + // the AutoShape visualisation is wanted. This is done with primitive functionailty + // now in SdrCustomShapePrimitive2D::create2DDecomposition, but only for 2D objects + // (see there and in EnhancedCustomShape3d::Create3DObject to read more). + // This exception may be removed later when AutoShapes will create primitives directly. + // So, currently remove the ShadowAttribute from the ItemSet to not apply it to any + // 2D helper shape. ClearItem(SDRATTR_SHADOW); Point aP( pCustomShapeObj->GetSnapRect().Center() ); @@ -731,23 +740,23 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : /*const sal_Int32* pDefData =*/ ApplyShapeAttributes( rGeometryItem ); switch( eSpType ) { - case mso_sptCan : nColorData = 0x20400000; break; - case mso_sptCube : nColorData = 0x302e0000; break; - case mso_sptActionButtonBlank : nColorData = 0x502ce400; break; - case mso_sptActionButtonHome : nColorData = 0x702ce4ce; break; - case mso_sptActionButtonHelp : nColorData = 0x602ce4c0; break; - case mso_sptActionButtonInformation : nColorData = 0x702ce4c5; break; - case mso_sptActionButtonBackPrevious : nColorData = 0x602ce4c0; break; - case mso_sptActionButtonForwardNext : nColorData = 0x602ce4c0; break; - case mso_sptActionButtonBeginning : nColorData = 0x602ce4c0; break; - case mso_sptActionButtonEnd : nColorData = 0x602ce4c0; break; - case mso_sptActionButtonReturn : nColorData = 0x602ce4c0; break; - case mso_sptActionButtonDocument : nColorData = 0x702ce4ec; break; - case mso_sptActionButtonSound : nColorData = 0x602ce4c0; break; - case mso_sptActionButtonMovie : nColorData = 0x602ce4c0; break; - case mso_sptBevel : nColorData = 0x502ce400; break; - case mso_sptFoldedCorner : nColorData = 0x20e00000; break; - case mso_sptSmileyFace : nColorData = 0x20e00000; break; + case mso_sptCan : nColorData = 0x20400000; break; + case mso_sptCube : nColorData = 0x302e0000; break; + case mso_sptActionButtonBlank : nColorData = 0x502ce400; break; + case mso_sptActionButtonHome : nColorData = 0x702ce4ce; break; + case mso_sptActionButtonHelp : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonInformation : nColorData = 0x702ce4c5; break; + case mso_sptActionButtonBackPrevious : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonForwardNext : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonBeginning : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonEnd : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonReturn : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonDocument : nColorData = 0x702ce4ec; break; + case mso_sptActionButtonSound : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonMovie : nColorData = 0x602ce4c0; break; + case mso_sptBevel : nColorData = 0x502ce400; break; + case mso_sptFoldedCorner : nColorData = 0x20e00000; break; + case mso_sptSmileyFace : nColorData = 0x20e00000; break; case mso_sptNil : { if( sShapeType.getLength() > 4 && @@ -1701,19 +1710,19 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm if(aNewB2DPolyPolygon.count()) { - if( !bLineGeometryNeededOnly ) - { - // hack aNewB2DPolyPolygon to fill logic rect - this is - // needed to produce gradient fills that look like mso - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(0,0)); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(), - aLogicRect.GetHeight())); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - } + if( !bLineGeometryNeededOnly ) + { + // hack aNewB2DPolyPolygon to fill logic rect - this is + // needed to produce gradient fills that look like mso + aNewB2DPolygon.clear(); + aNewB2DPolygon.append(basegfx::B2DPoint(0,0)); + aNewB2DPolyPolygon.append(aNewB2DPolygon); + + aNewB2DPolygon.clear(); + aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(), + aLogicRect.GetHeight())); + aNewB2DPolyPolygon.append(aNewB2DPolygon); + } // #i37011# bool bForceCreateTwoObjects(false); diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 2beab9adbe7a..07f7c2ab6bea 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -323,7 +323,17 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con Point aCenter( aSnapRect.Center() ); SfxItemSet aSet( pCustomShape->GetMergedItemSet() ); - aSet.ClearItem( SDRATTR_TEXTDIRECTION ); //SJ: vertical writing is not required, by removing this item no outliner is created + + //SJ: vertical writing is not required, by removing this item no outliner is created + aSet.ClearItem( SDRATTR_TEXTDIRECTION ); + + // #i105323# For 3D AutoShapes, the shadow attribute has to be applied to each + // created visualisation helper model shape individually. The shadow itself + // will then be rendered from the 3D renderer correctly for the whole 3D scene + // (and thus behind all objects of which the visualisation may be built). So, + // dio NOT remove it from the ItemSet here. + // aSet.ClearItem(SDRATTR_SHADOW); + std::vector< E3dCompoundObject* > aPlaceholderObjectList; double fExtrusionBackward, fExtrusionForward; diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index 821c0ba07c32..ad70d3399c8f 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -36,18 +36,10 @@ #include #include #include -#include -#include -#include -#include -#include +#include #include #include -#include -#include -#include #include -#include ////////////////////////////////////////////////////////////////////////////// @@ -80,176 +72,13 @@ public: ////////////////////////////////////////////////////////////////////////////// -namespace drawinglayer -{ - namespace processor3d - { - class CutFindProcessor : public BaseProcessor3D - { - private: - // the start and stop point for the cut vector - basegfx::B3DPoint maFront; - basegfx::B3DPoint maBack; - - // the found cut points - ::std::vector< basegfx::B3DPoint > maResult; - - // #i102956# the transformation change from TransformPrimitive3D processings - // needs to be remembered to be able to transform found cuts to the - // basic coordinate system the processor starts with - basegfx::B3DHomMatrix maCombinedTransform; - - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. - virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); - - public: - CutFindProcessor(const geometry::ViewInformation3D& rViewInformation, - const basegfx::B3DPoint& rFront, - const basegfx::B3DPoint& rBack) - : BaseProcessor3D(rViewInformation), - maFront(rFront), - maBack(rBack), - maResult(), - maCombinedTransform() - {} - - // data access - const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; } - }; - - void CutFindProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) - { - // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch - switch(rCandidate.getPrimitiveID()) - { - case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D : - { - // transform group. - const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate); - - // remember old and transform front, back to object coordinates - const basegfx::B3DPoint aLastFront(maFront); - const basegfx::B3DPoint aLastBack(maBack); - basegfx::B3DHomMatrix aInverseTrans(rPrimitive.getTransformation()); - aInverseTrans.invert(); - maFront *= aInverseTrans; - maBack *= aInverseTrans; - - // remember current and create new transformation; add new object transform from right side - const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D()); - const geometry::ViewInformation3D aNewViewInformation3D( - aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(), - aLastViewInformation3D.getOrientation(), - aLastViewInformation3D.getProjection(), - aLastViewInformation3D.getDeviceToView(), - aLastViewInformation3D.getViewTime(), - aLastViewInformation3D.getExtendedInformationSequence()); - updateViewInformation(aNewViewInformation3D); - - // #i102956# remember needed back-transform for found cuts (combine from right side) - const basegfx::B3DHomMatrix aLastCombinedTransform(maCombinedTransform); - maCombinedTransform = maCombinedTransform * rPrimitive.getTransformation(); - - // let break down - process(rPrimitive.getChildren()); - - // restore transformations and front, back - maCombinedTransform = aLastCombinedTransform; - updateViewInformation(aLastViewInformation3D); - maFront = aLastFront; - maBack = aLastBack; - break; - } - case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D : - { - // PolygonHairlinePrimitive3D, not used for hit test with planes, ignore. This - // means that also thick line expansion will not be hit-tested as - // PolyPolygonMaterialPrimitive3D - break; - } - case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D : - { - // #i97321# - // For HatchTexturePrimitive3D, do not use the decomposition since it will produce - // clipped hatch lines in 3D. It can be used when the hatch also has a filling, but for - // simplicity, just use the children which are the PolyPolygonMaterialPrimitive3D - // which define the hatched areas anyways; for HitTest this is more than adequate - const primitive3d::HatchTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::HatchTexturePrimitive3D& >(rCandidate); - process(rPrimitive.getChildren()); - break; - } - case PRIMITIVE3D_ID_HITTESTPRIMITIVE3D : - { - // HitTestPrimitive3D, force usage due to we are doing a hit test and this - // primitive only gets generated on 3d objects without fill, exactly for this - // purpose - const primitive3d::HitTestPrimitive3D& rPrimitive = static_cast< const primitive3d::HitTestPrimitive3D& >(rCandidate); - process(rPrimitive.getChildren()); - break; - } - case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : - { - // PolyPolygonMaterialPrimitive3D - const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate); - - if(!maFront.equal(maBack)) - { - const basegfx::B3DPolyPolygon& rPolyPolygon = rPrimitive.getB3DPolyPolygon(); - const sal_uInt32 nPolyCount(rPolyPolygon.count()); - - if(nPolyCount) - { - const basegfx::B3DPolygon aPolygon(rPolyPolygon.getB3DPolygon(0)); - const sal_uInt32 nPointCount(aPolygon.count()); - - if(nPointCount > 2) - { - const basegfx::B3DVector aPlaneNormal(aPolygon.getNormal()); - - if(!aPlaneNormal.equalZero()) - { - const basegfx::B3DPoint aPointOnPlane(aPolygon.getB3DPoint(0)); - double fCut(0.0); - - if(basegfx::tools::getCutBetweenLineAndPlane(aPlaneNormal, aPointOnPlane, maFront, maBack, fCut)) - { - const basegfx::B3DPoint aCutPoint(basegfx::interpolate(maFront, maBack, fCut)); - - if(basegfx::tools::isInside(rPolyPolygon, aCutPoint, false)) - { - // #i102956# add result. Do not forget to do this in the coordinate - // system the processor get started with, so use the collected - // combined transformation from processed TransformPrimitive3D's - maResult.push_back(maCombinedTransform * aCutPoint); - } - } - } - } - } - } - - break; - } - default : - { - // process recursively - process(rCandidate.get3DDecomposition(getViewInformation3D())); - break; - } - } - } - } // end of namespace processor3d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - void getAllHit3DObjectWithRelativePoint( const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack, const E3dCompoundObject& rObject, const drawinglayer::geometry::ViewInformation3D& rObjectViewInformation3D, - ::std::vector< basegfx::B3DPoint >& o_rResult) + ::std::vector< basegfx::B3DPoint >& o_rResult, + bool bAnyHit) { o_rResult.clear(); @@ -271,7 +100,7 @@ void getAllHit3DObjectWithRelativePoint( if(aObjectRange.overlaps(aFrontBackRange)) { // bound volumes hit, geometric cut tests needed - drawinglayer::processor3d::CutFindProcessor aCutFindProcessor(rObjectViewInformation3D, rFront, rBack); + drawinglayer::processor3d::CutFindProcessor aCutFindProcessor(rObjectViewInformation3D, rFront, rBack, bAnyHit); aCutFindProcessor.process(aPrimitives); o_rResult = aCutFindProcessor.getCutPoints(); } @@ -388,7 +217,7 @@ SVX_DLLPUBLIC void getAllHit3DObjectsSortedFrontToBack( { // get all hit points with object ::std::vector< basegfx::B3DPoint > aHitsWithObject; - getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject); + getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject, false); for(sal_uInt32 a(0); a < aHitsWithObject.size(); a++) { @@ -452,7 +281,7 @@ bool checkHitSingle3DObject( { // get all hit points with object ::std::vector< basegfx::B3DPoint > aHitsWithObject; - getAllHit3DObjectWithRelativePoint(aFront, aBack, rCandidate, aViewInfo3D, aHitsWithObject); + getAllHit3DObjectWithRelativePoint(aFront, aBack, rCandidate, aViewInfo3D, aHitsWithObject, true); if(aHitsWithObject.size()) { diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 5f632f60ab85..9d19e752396c 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -134,6 +135,7 @@ namespace sdr // create Primitive2DSequence from sub-geometry const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); + bool b3DShape(false); if(pSdrObjRepresentation) { @@ -142,6 +144,12 @@ namespace sdr while(aIterator.IsMore()) { SdrObject& rCandidate = *aIterator.Next(); + + if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) + { + b3DShape = true; + } + const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); } @@ -220,7 +228,8 @@ namespace sdr xGroup, aTextBoxMatrix, bWordWrap, - false)); // #SJ# New parameter to force to clipped BlockText for SC + false, // #SJ# New parameter to force to clipped BlockText for SC + b3DShape)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 79d493b6d9d0..24a5fb56a8cf 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -44,6 +44,10 @@ ////////////////////////////////////////////////////////////////////////////// +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + namespace sdr { namespace overlay @@ -140,6 +144,18 @@ namespace sdr maViewInformation2D(0), mfDiscreteOne(0.0) { + // set Property 'ReducedDisplayQuality' to true to allow simpler interaction + // visualisations + static bool bUseReducedDisplayQualityForDrag(true); + + if(bUseReducedDisplayQualityForDrag) + { + uno::Sequence< beans::PropertyValue > xProperties(1); + xProperties[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedDisplayQuality")); + xProperties[0].Value <<= true; + maViewInformation2D = drawinglayer::geometry::ViewInformation2D(xProperties); + } + if(pOldOverlayManager) { // take over OverlayObjects from given OverlayManager. Copy diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index 497266433d67..7658b2a992c7 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -67,7 +67,20 @@ namespace drawinglayer // add shadow if(aRetval.hasElements() && getSdrSTAttribute().getShadow()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow()); + // #i105323# add generic shadow only for 2D shapes. For + // 3D shapes shadow will be set at the individual created + // visualisation objects and be visualized by the 3d renderer + // as a single shadow. + // + // The shadow for AutoShapes could be handled uniformely by not setting any + // shadow items at the helper model objects and only adding shadow here for + // 2D and 3D (and it works, too), but this would lead to two 3D scenes for + // the 3D object; one for the shadow aond one for the content. The one for the + // shadow will be correct (using ColorModifierStack), but expensive. + if(!get3DShape()) + { + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow()); + } } return aRetval; @@ -78,13 +91,15 @@ namespace drawinglayer const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, bool bWordWrap, - bool bForceTextClipToTextRange) + bool bForceTextClipToTextRange, + bool b3DShape) : BasePrimitive2D(), maSdrSTAttribute(rSdrSTAttribute), maSubPrimitives(rSubPrimitives), maTextBox(rTextBox), mbWordWrap(bWordWrap), - mbForceTextClipToTextRange(bForceTextClipToTextRange) + mbForceTextClipToTextRange(bForceTextClipToTextRange), + mb3DShape(b3DShape) { } @@ -98,7 +113,8 @@ namespace drawinglayer && getSubPrimitives() == rCompare.getSubPrimitives() && getTextBox() == rCompare.getTextBox() && getWordWrap() == rCompare.getWordWrap() - && isForceTextClipToTextRange() == rCompare.isForceTextClipToTextRange()); + && isForceTextClipToTextRange() == rCompare.isForceTextClipToTextRange() + && get3DShape() == rCompare.get3DShape()); } return false; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 94e59f79c3de..4b5dc8a3b48e 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -52,27 +52,29 @@ namespace drawinglayer namespace primitive2d { Primitive2DReference SdrMeasurePrimitive2D::impCreatePart( + const attribute::SdrLineAttribute& rLineAttribute, const basegfx::B2DHomMatrix& rObjectMatrix, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, bool bLeftActive, bool bRightActive) const { + const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); basegfx::B2DPolygon aPolygon; + aPolygon.append(rStart); aPolygon.append(rEnd); - if(!getSdrLSTAttribute().getLineStartEnd() || (!bLeftActive && !bRightActive)) + if(!pLineStartEnd || (!bLeftActive && !bRightActive)) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), 0L); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, 0); } if(bLeftActive && bRightActive) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd()); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, pLineStartEnd); } - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); const basegfx::B2DPolyPolygon aEmpty; const attribute::SdrLineStartEndAttribute aLineStartEnd( bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, @@ -80,7 +82,7 @@ namespace drawinglayer bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), &aLineStartEnd); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd); } Primitive2DSequence SdrMeasurePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const @@ -277,12 +279,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY()); const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainRight, aMainRightRight, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainRight, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(* pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); } } else @@ -293,12 +295,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY()); const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainInnerRight, aMainRight, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainRight, true, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); } } @@ -311,13 +313,13 @@ namespace drawinglayer const basegfx::B2DPoint aLeftUp(0.0, fTopEdge); const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aLeftDown, aLeftUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); // right help line const basegfx::B2DPoint aRightUp(fDistance, fTopEdge); const basegfx::B2DPoint aRightDown(fDistance, fBottomRight); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aRightDown, aRightUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); // text horizontal position if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal) diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index eb6412b20259..a8d588e73fe5 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -206,6 +206,32 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragEntrySdrObject::createPrim //////////////////////////////////////////////////////////////////////////////////////////////////// +SdrDragEntryPrimitive2DSequence::SdrDragEntryPrimitive2DSequence( + const drawinglayer::primitive2d::Primitive2DSequence& rSequence, + bool bAddToTransparent) +: SdrDragEntry(), + maPrimitive2DSequence(rSequence) +{ + // add parts to transparent overlay stuff eventually + setAddToTransparent(bAddToTransparent); +} + +SdrDragEntryPrimitive2DSequence::~SdrDragEntryPrimitive2DSequence() +{ +} + +drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPrimitive2DSequence::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) +{ + drawinglayer::primitive2d::Primitive2DReference aTransformPrimitive2D( + new drawinglayer::primitive2d::TransformPrimitive2D( + rDragMethod.getCurrentTransformation(), + maPrimitive2DSequence)); + + return drawinglayer::primitive2d::Primitive2DSequence(&aTransformPrimitive2D, 1); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + SdrDragEntryPointGlueDrag::SdrDragEntryPointGlueDrag(const std::vector< basegfx::B2DPoint >& rPositions, bool bIsPointDrag) : maPositions(rPositions), mbIsPointDrag(bIsPointDrag) @@ -318,6 +344,13 @@ void SdrDragMethod::createSdrDragEntries() } } +void SdrDragMethod::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify) +{ + // add full obejct drag; Clone() at the object has to work + // for this + addSdrDragEntry(new SdrDragEntrySdrObject(rOriginal, rObjectContact, bModify)); +} + void SdrDragMethod::createSdrDragEntries_SolidDrag() { const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount()); @@ -359,7 +392,7 @@ void SdrDragMethod::createSdrDragEntries_SolidDrag() { // add full obejct drag; Clone() at the object has to work // for this - addSdrDragEntry(new SdrDragEntrySdrObject(*pCandidate, rOC, true)); + createSdrDragEntryForSdrObject(*pCandidate, rOC, true); } if(bAddWireframe) @@ -1358,6 +1391,21 @@ Pointer SdrDragObjOwn::GetSdrDragPointer() const TYPEINIT1(SdrDragMove,SdrDragMethod); +void SdrDragMove::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool /*bModify*/) +{ + // for SdrDragMove, use current Primitive2DSequence of SdrObject visualisation + // in given ObjectContact directly + sdr::contact::ViewContact& rVC = rOriginal.GetViewContact(); + sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(rObjectContact); + sdr::contact::DisplayInfo aDisplayInfo; + + // Do not use the last ViewPort set at the OC from the last ProcessDisplay(), + // here we want the complete primitive sequence without visibility clippings + rObjectContact.resetViewPort(); + + addSdrDragEntry(new SdrDragEntryPrimitive2DSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo), true)); +} + void SdrDragMove::applyCurrentTransformationToSdrObject(SdrObject& rTarget) { rTarget.Move(Size(DragStat().GetDX(), DragStat().GetDY())); From 2a0a3168f4354285e59dd79d4477a4199c2f773b Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Tue, 20 Oct 2009 15:36:32 +0000 Subject: [PATCH 056/117] #i105065# speedup 3D/FontWork --- .../geometry/viewinformation2d.hxx | 7 + .../primitive2d/sceneprimitive2d.hxx | 20 ++- .../processor2d/hittestprocessor2d.hxx | 2 + .../processor2d/vclprocessor2d.hxx | 2 + drawinglayer/prj/d.lst | 2 + .../source/geometry/viewinformation2d.cxx | 40 ++++- .../source/primitive2d/sceneprimitive2d.cxx | 148 ++++++++++++------ .../source/processor2d/contourextractor2d.cxx | 9 +- .../source/processor2d/hittestprocessor2d.cxx | 142 ++++++++++++++--- .../processor2d/vclpixelprocessor2d.cxx | 6 + .../source/processor2d/vclprocessor2d.cxx | 92 +++++++++++ drawinglayer/source/processor3d/makefile.mk | 1 + 12 files changed, 403 insertions(+), 68 deletions(-) diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx index 94a5623a2a77..0a87b268c8b1 100644 --- a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx @@ -149,6 +149,13 @@ namespace drawinglayer /// On-demand prepared Viewport in discrete units for convenience const basegfx::B2DRange& getDiscreteViewport() const; + /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This + is used e.g. to allow to lower display quality for OverlayPrimitives and + may lead to simpler decompositions in the local create2DDecomposition + implementations of the primitives + */ + bool getReducedDisplayQuality() const; + /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation Use this call if You need to extract all contained ViewInformation. The ones diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index d7fbfd4deaee..8ffc9a332e5c 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -41,6 +41,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -70,9 +71,13 @@ namespace drawinglayer double mfOldDiscreteSizeY; basegfx::B2DRange maOldUnitVisiblePart; + // the last created BitmapEx, e.g. for fast HitTest. This does not really need + // memory since BitmapEx is internally RefCounted + BitmapEx maOldRenderedBitmap; + // private helpers bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const; - void calculateDsicreteSizes( + void calculateDiscreteSizes( const geometry::ViewInformation2D& rViewInformation, basegfx::B2DRange& rDiscreteRange, basegfx::B2DRange& rVisibleDiscreteRange, @@ -87,7 +92,18 @@ namespace drawinglayer // Geometry extractor. Shadow will be added as in createLocalDecomposition, but // the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This // helper is useful e.g. for Contour extraction or HitTests. - Primitive2DSequence getGeometry2D(const geometry::ViewInformation2D& rViewInformation) const; + Primitive2DSequence getGeometry2D() const; + Primitive2DSequence getShadow2D(const geometry::ViewInformation2D& rViewInformation) const; + + // Fast HitTest which uses the last buffered BitmapEx from the last + // rendered area if available. The return value describes if the check + // could be done with the current information, so do NOT use o_rResult + // when it returns false. o_rResult will be changed on return true and + // then contains a definitive answer if content of this scene is hit or + // not. On return false, it is normally necessary to use the geometric + // HitTest (see CutFindProcessor usages). The given HitPoint + // has to be in logic coordinates in scene's ObjectCoordinateSystem. + bool tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint& rLogicHitPoint, bool& o_rResult) const; // constructor/destructor ScenePrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx index 1eeaefd2dade..c0ab33052883 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx @@ -43,6 +43,7 @@ namespace basegfx { class B2DPolygon; } namespace basegfx { class B2DPolyPolygon; } +namespace drawinglayer { namespace primitive2d { class ScenePrimitive2D; }} ////////////////////////////////////////////////////////////////////////////// @@ -80,6 +81,7 @@ namespace drawinglayer bool checkFillHitWithTolerance( const basegfx::B2DPolyPolygon& rPolyPolygon, double fDiscreteHitTolerance); + void check3DHit(const primitive2d::ScenePrimitive2D& rCandidate); public: HitTestProcessor2D( diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index e29b413190ab..66ca140c2e56 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -51,6 +51,7 @@ namespace drawinglayer { namespace primitive2d { class BitmapPrimitive2D; class FillBitmapPrimitive2D; class PolyPolygonGradientPrimitive2D; + class PolyPolygonBitmapPrimitive2D; class PolyPolygonColorPrimitive2D; class MetafilePrimitive2D; class MaskPrimitive2D; @@ -100,6 +101,7 @@ namespace drawinglayer void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate); void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate); void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate); + void RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate); void RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate); void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate); void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate); diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index 0068b32c24ae..1ba3c2e7b614 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -90,6 +90,8 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor2d mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor3d ..\inc\drawinglayer\processor3d\baseprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\baseprocessor3d.hxx +..\inc\drawinglayer\processor3d\cutfindprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\cutfindprocessor3d.hxx +..\inc\drawinglayer\processor3d\defaultprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\defaultprocessor3d.hxx ..\inc\drawinglayer\processor3d\zbufferprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\zbufferprocessor3d.hxx ..\inc\drawinglayer\processor3d\tbufferprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\tbufferprocessor3d.hxx diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index 372de9936935..e03c946edf9e 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -81,12 +81,18 @@ namespace drawinglayer basegfx::B2DRange maDiscreteViewport; // the DrawPage which is target of visualisation. This is needed e.g. for - // the view-dependent decomposition of PageNumber TextFields + // the view-dependent decomposition of PageNumber TextFields. + // This parameter is buffered here, but mainly resides in mxExtendedInformation, + // so it will be interpreted, but held there. It will also not be added + // to mxExtendedInformation in impFillViewInformationFromContent (it's there already) uno::Reference< drawing::XDrawPage > mxVisualizedPage; // the point in time double mfViewTime; + // bitfield + bool mbReducedDisplayQuality : 1; + // the complete PropertyValue representation (if already created) uno::Sequence< beans::PropertyValue > mxViewInformation; @@ -125,6 +131,12 @@ namespace drawinglayer return s_sNameProperty; } + const ::rtl::OUString& getNamePropertyReducedDisplayQuality() + { + static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("ReducedDisplayQuality")); + return s_sNameProperty; + } + void impInterpretPropertyValues(const uno::Sequence< beans::PropertyValue >& rViewParameters) { if(rViewParameters.hasElements()) @@ -139,7 +151,17 @@ namespace drawinglayer { const beans::PropertyValue& rProp = rViewParameters[a]; - if(rProp.Name == getNamePropertyObjectTransformation()) + if(rProp.Name == getNamePropertyReducedDisplayQuality()) + { + // extra information; add to filtered information + mxExtendedInformation[nExtendedInsert++] = rProp; + + // for performance reasons, also cache content locally + sal_Bool bSalBool; + rProp.Value >>= bSalBool; + mbReducedDisplayQuality = bSalBool; + } + else if(rProp.Name == getNamePropertyObjectTransformation()) { com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D; rProp.Value >>= aAffineMatrix2D; @@ -185,6 +207,7 @@ namespace drawinglayer const bool bViewportUsed(!maViewport.isEmpty()); const bool bTimeUsed(0.0 < mfViewTime); const bool bVisualizedPageUsed(mxVisualizedPage.is()); + const bool bReducedDisplayQualityUsed(true == mbReducedDisplayQuality); const bool bExtraInformation(mxExtendedInformation.hasElements()); sal_uInt32 nIndex(0); const sal_uInt32 nCount( @@ -193,6 +216,7 @@ namespace drawinglayer (bViewportUsed ? 1 : 0) + (bTimeUsed ? 1 : 0) + (bVisualizedPageUsed ? 1 : 0) + + (bReducedDisplayQualityUsed ? 1 : 0) + (bExtraInformation ? mxExtendedInformation.getLength() : 0)); mxViewInformation.realloc(nCount); @@ -265,6 +289,7 @@ namespace drawinglayer maDiscreteViewport(), mxVisualizedPage(rxDrawPage), mfViewTime(fViewTime), + mbReducedDisplayQuality(false), mxViewInformation(), mxExtendedInformation() { @@ -281,6 +306,7 @@ namespace drawinglayer maDiscreteViewport(), mxVisualizedPage(), mfViewTime(), + mbReducedDisplayQuality(false), mxViewInformation(rViewParameters), mxExtendedInformation() { @@ -355,6 +381,11 @@ namespace drawinglayer return mxVisualizedPage; } + bool getReducedDisplayQuality() const + { + return mbReducedDisplayQuality; + } + const uno::Sequence< beans::PropertyValue >& getViewInformationSequence() const { if(!mxViewInformation.hasElements()) @@ -501,6 +532,11 @@ namespace drawinglayer return mpViewInformation2D->getDiscreteViewport(); } + bool ViewInformation2D::getReducedDisplayQuality() const + { + return mpViewInformation2D->getReducedDisplayQuality(); + } + const uno::Sequence< beans::PropertyValue >& ViewInformation2D::getViewInformationSequence() const { return mpViewInformation2D->getViewInformationSequence(); diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index f52af2da6a6d..ad36a40ea996 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -100,7 +100,7 @@ namespace drawinglayer return maShadowPrimitives.hasElements(); } - void ScenePrimitive2D::calculateDsicreteSizes( + void ScenePrimitive2D::calculateDiscreteSizes( const geometry::ViewInformation2D& rViewInformation, basegfx::B2DRange& rDiscreteRange, basegfx::B2DRange& rVisibleDiscreteRange, @@ -110,23 +110,12 @@ namespace drawinglayer rDiscreteRange = basegfx::B2DRange(0.0, 0.0, 1.0, 1.0); rDiscreteRange.transform(rViewInformation.getObjectToViewTransformation() * getObjectTransformation()); - // force to discrete expanded bounds (it grows, so expanding works perfectly well) - rDiscreteRange.expand(basegfx::B2DTuple(floor(rDiscreteRange.getMinX()), floor(rDiscreteRange.getMinY()))); - rDiscreteRange.expand(basegfx::B2DTuple(ceil(rDiscreteRange.getMaxX()), ceil(rDiscreteRange.getMaxY()))); - // clip it against discrete Viewport (if set) rVisibleDiscreteRange = rDiscreteRange; if(!rViewInformation.getViewport().isEmpty()) { rVisibleDiscreteRange.intersect(rViewInformation.getDiscreteViewport()); - - if(!rVisibleDiscreteRange.isEmpty()) - { - // force to discrete expanded bounds, too - rVisibleDiscreteRange.expand(basegfx::B2DTuple(floor(rVisibleDiscreteRange.getMinX()), floor(rVisibleDiscreteRange.getMinY()))); - rVisibleDiscreteRange.expand(basegfx::B2DTuple(ceil(rVisibleDiscreteRange.getMaxX()), ceil(rVisibleDiscreteRange.getMaxY()))); - } } if(rVisibleDiscreteRange.isEmpty()) @@ -177,11 +166,11 @@ namespace drawinglayer } } - // get the involved ranges (see helper method calculateDsicreteSizes for details) + // get the involved ranges (see helper method calculateDiscreteSizes for details) basegfx::B2DRange aDiscreteRange; basegfx::B2DRange aVisibleDiscreteRange; basegfx::B2DRange aUnitVisibleRange; - calculateDsicreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); + calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); if(!aVisibleDiscreteRange.isEmpty()) { @@ -200,6 +189,31 @@ namespace drawinglayer fViewSizeY *= fReduceFactor; } + if(rViewInformation.getReducedDisplayQuality()) + { + // when reducing the visualisation is allowed (e.g. an OverlayObject + // only needed for dragging), reduce resolution extra + // to speed up dragging interactions + const double fArea(fViewSizeX * fViewSizeY); + double fReducedVisualisationFactor(1.0 / (sqrt(fArea) * (1.0 / 170.0))); + + if(fReducedVisualisationFactor > 1.0) + { + fReducedVisualisationFactor = 1.0; + } + else if(fReducedVisualisationFactor < 0.20) + { + fReducedVisualisationFactor = 0.20; + } + + if(fReducedVisualisationFactor != 1.0) + { + fReduceFactor *= fReducedVisualisationFactor; + fViewSizeX *= fReducedVisualisationFactor; + fViewSizeY *= fReducedVisualisationFactor; + } + } + // calculate logic render size in world coordinates for usage in renderer basegfx::B2DVector aLogicRenderSize( aDiscreteRange.getWidth() * fReduceFactor, @@ -207,9 +221,8 @@ namespace drawinglayer aLogicRenderSize *= rViewInformation.getInverseObjectToViewTransformation(); // determine the oversample value - static bool bDoOversample(false); static sal_uInt16 nDefaultOversampleValue(3); - const sal_uInt16 nOversampleValue((bDoOversample || aDrawinglayerOpt.IsAntiAliasing()) ? nDefaultOversampleValue : 0); + const sal_uInt16 nOversampleValue(aDrawinglayerOpt.IsAntiAliasing() ? nDefaultOversampleValue : 0); // use default 3D primitive processor to create BitmapEx for aUnitVisiblePart and process processor3d::ZBufferProcessor3D aZBufferProcessor3D( @@ -224,18 +237,16 @@ namespace drawinglayer aZBufferProcessor3D.processNonTransparent(getChildren3D()); aZBufferProcessor3D.processTransparent(getChildren3D()); - const BitmapEx aNewBitmap(aZBufferProcessor3D.getBitmapEx()); - const Size aBitmapSizePixel(aNewBitmap.GetSizePixel()); + const_cast< ScenePrimitive2D* >(this)->maOldRenderedBitmap = aZBufferProcessor3D.getBitmapEx(); + const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); if(aBitmapSizePixel.getWidth() && aBitmapSizePixel.getHeight()) { // create transform for the created bitmap in discrete coordinates first. - // #i97772# Do not forget to apply evtl. render size reduction to scaling basegfx::B2DHomMatrix aNew2DTransform; - const double fSizeReductionFactor(1.0 / fReduceFactor); - aNew2DTransform.set(0, 0, (double)(aBitmapSizePixel.getWidth() - 1) * fSizeReductionFactor); - aNew2DTransform.set(1, 1, (double)(aBitmapSizePixel.getHeight() - 1) * fSizeReductionFactor); + aNew2DTransform.set(0, 0, aVisibleDiscreteRange.getWidth()); + aNew2DTransform.set(1, 1, aVisibleDiscreteRange.getHeight()); aNew2DTransform.set(0, 2, aVisibleDiscreteRange.getMinX()); aNew2DTransform.set(1, 2, aVisibleDiscreteRange.getMinY()); @@ -243,7 +254,7 @@ namespace drawinglayer aNew2DTransform *= rViewInformation.getInverseObjectToViewTransformation(); // create bitmap primitive and add - const Primitive2DReference xRef(new BitmapPrimitive2D(aNewBitmap, aNew2DTransform)); + const Primitive2DReference xRef(new BitmapPrimitive2D(maOldRenderedBitmap, aNew2DTransform)); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRef); // test: Allow to add an outline in the debugger when tests are needed @@ -262,17 +273,10 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence ScenePrimitive2D::getGeometry2D(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence ScenePrimitive2D::getGeometry2D() const { Primitive2DSequence aRetval; - // create 2D shadows from contained 3D primitives - if(impGetShadow3D(rViewInformation)) - { - // add extracted 2d shadows (before 3d scene creations itself) - aRetval = maShadowPrimitives; - } - // create 2D projected geometry from 3D geometry if(getChildren3D().hasElements()) { @@ -284,14 +288,68 @@ namespace drawinglayer // process local primitives aGeometryProcessor.process(getChildren3D()); - // fetch result and append - Primitive2DSequence a2DExtractedPrimitives(aGeometryProcessor.getPrimitive2DSequence()); - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, a2DExtractedPrimitives); + // fetch result + aRetval = aGeometryProcessor.getPrimitive2DSequence(); } return aRetval; } + Primitive2DSequence ScenePrimitive2D::getShadow2D(const geometry::ViewInformation2D& rViewInformation) const + { + Primitive2DSequence aRetval; + + // create 2D shadows from contained 3D primitives + if(impGetShadow3D(rViewInformation)) + { + // add extracted 2d shadows (before 3d scene creations itself) + aRetval = maShadowPrimitives; + } + + return aRetval; + } + + bool ScenePrimitive2D::tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint& rLogicHitPoint, bool& o_rResult) const + { + if(!maOldRenderedBitmap.IsEmpty() && !maOldUnitVisiblePart.isEmpty()) + { + basegfx::B2DHomMatrix aInverseSceneTransform(getObjectTransformation()); + aInverseSceneTransform.invert(); + const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rLogicHitPoint); + + if(maOldUnitVisiblePart.isInside(aRelativePoint)) + { + // calculate coordinates relative to visualized part + double fDivisorX(maOldUnitVisiblePart.getWidth()); + double fDivisorY(maOldUnitVisiblePart.getHeight()); + + if(basegfx::fTools::equalZero(fDivisorX)) + { + fDivisorX = 1.0; + } + + if(basegfx::fTools::equalZero(fDivisorY)) + { + fDivisorY = 1.0; + } + + const double fRelativeX((aRelativePoint.getX() - maOldUnitVisiblePart.getMinX()) / fDivisorX); + const double fRelativeY((aRelativePoint.getY() - maOldUnitVisiblePart.getMinY()) / fDivisorY); + + // combine with real BitmapSizePixel to get bitmap coordinates + const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); + const sal_Int32 nX(basegfx::fround(fRelativeX * aBitmapSizePixel.Width())); + const sal_Int32 nY(basegfx::fround(fRelativeY * aBitmapSizePixel.Height())); + + // try to get a statement about transparency in that pixel + o_rResult = (0xff != maOldRenderedBitmap.GetTransparency(nX, nY)); + return true; + } + } + + return false; + } + ScenePrimitive2D::ScenePrimitive2D( const primitive3d::Primitive3DSequence& rxChildren3D, const attribute::SdrSceneAttribute& rSdrSceneAttribute, @@ -308,7 +366,8 @@ namespace drawinglayer mbShadow3DChecked(false), mfOldDiscreteSizeX(0.0), mfOldDiscreteSizeY(0.0), - maOldUnitVisiblePart() + maOldUnitVisiblePart(), + maOldRenderedBitmap() { } @@ -359,7 +418,7 @@ namespace drawinglayer { ::osl::MutexGuard aGuard( m_aMutex ); - // get the involved ranges (see helper method calculateDsicreteSizes for details) + // get the involved ranges (see helper method calculateDiscreteSizes for details) basegfx::B2DRange aDiscreteRange; basegfx::B2DRange aUnitVisibleRange; bool bNeedNewDecomposition(false); @@ -368,21 +427,22 @@ namespace drawinglayer if(getLocalDecomposition().hasElements()) { basegfx::B2DRange aVisibleDiscreteRange; - calculateDsicreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); + calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); bDiscreteSizesAreCalculated = true; - // display has changed and cannot be reused when resolution did change - if(!basegfx::fTools::equal(aDiscreteRange.getWidth(), mfOldDiscreteSizeX) || - !basegfx::fTools::equal(aDiscreteRange.getHeight(), mfOldDiscreteSizeY)) + // needs to be painted when the new part is not part of the last + // decomposition + if(!maOldUnitVisiblePart.isInside(aUnitVisibleRange)) { bNeedNewDecomposition = true; } + // display has changed and cannot be reused when resolution got bigger. It + // can be reused when resolution got smaller, though. if(!bNeedNewDecomposition) { - // needs to be painted when the new part is not part of the last - // decomposition - if(!maOldUnitVisiblePart.isInside(aUnitVisibleRange)) + if(basegfx::fTools::more(aDiscreteRange.getWidth(), mfOldDiscreteSizeX) || + basegfx::fTools::more(aDiscreteRange.getHeight(), mfOldDiscreteSizeY)) { bNeedNewDecomposition = true; } @@ -400,7 +460,7 @@ namespace drawinglayer if(!bDiscreteSizesAreCalculated) { basegfx::B2DRange aVisibleDiscreteRange; - calculateDsicreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); + calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); } // remember last used NewDiscreteSize and NewUnitVisiblePart diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx index b7931aed5c27..1f629cb25c9c 100644 --- a/drawinglayer/source/processor2d/contourextractor2d.cxx +++ b/drawinglayer/source/processor2d/contourextractor2d.cxx @@ -162,7 +162,8 @@ namespace drawinglayer { // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); - const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D(getViewInformation2D())); + const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D()); + const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rScenePrimitive2DCandidate.getShadow2D(getViewInformation2D())); // proccess content if(xExtracted2DSceneGeometry.hasElements()) @@ -170,6 +171,12 @@ namespace drawinglayer process(xExtracted2DSceneGeometry); } + // proccess content + if(xExtracted2DSceneShadow.hasElements()) + { + process(xExtracted2DSceneShadow); + } + break; } case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D : diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index 8a2d732cbb2f..cf10c9defd8a 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -48,6 +48,8 @@ #include #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -164,6 +166,119 @@ namespace drawinglayer return bRetval; } + void HitTestProcessor2D::check3DHit(const primitive2d::ScenePrimitive2D& rCandidate) + { + // calculate relative point in unified 2D scene + const basegfx::B2DPoint aLogicHitPosition(getViewInformation2D().getInverseObjectToViewTransformation() * getDiscreteHitPosition()); + + // use bitmap check in ScenePrimitive2D + bool bTryFastResult(false); + + if(rCandidate.tryToCheckLastVisualisationDirectHit(aLogicHitPosition, bTryFastResult)) + { + mbHit = bTryFastResult; + } + else + { + basegfx::B2DHomMatrix aInverseSceneTransform(rCandidate.getObjectTransformation()); + aInverseSceneTransform.invert(); + const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * aLogicHitPosition); + + // check if test point is inside scene's unified area at all + if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 + && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0) + { + // get 3D view information + const geometry::ViewInformation3D& rObjectViewInformation3D = rCandidate.getViewInformation3D(); + + // create HitPoint Front and Back, transform to object coordinates + basegfx::B3DHomMatrix aViewToObject(rObjectViewInformation3D.getObjectToView()); + aViewToObject.invert(); + const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0)); + const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0)); + + if(!aFront.equal(aBack)) + { + const primitive3d::Primitive3DSequence& rPrimitives = rCandidate.getChildren3D(); + + if(rPrimitives.hasElements()) + { + // make BoundVolume empty and overlapping test for speedup + const basegfx::B3DRange aObjectRange( + drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence( + rPrimitives, rObjectViewInformation3D)); + + if(!aObjectRange.isEmpty()) + { + const basegfx::B3DRange aFrontBackRange(aFront, aBack); + + if(aObjectRange.overlaps(aFrontBackRange)) + { + // bound volumes hit, geometric cut tests needed + drawinglayer::processor3d::CutFindProcessor aCutFindProcessor( + rObjectViewInformation3D, + aFront, + aBack, + true); + aCutFindProcessor.process(rPrimitives); + + mbHit = (0 != aCutFindProcessor.getCutPoints().size()); + } + } + } + } + } + + // This is needed to check hit with 3D shadows, too. HitTest is without shadow + // to keep compatible with previous versions. Keeping here as reference + // + // if(!getHit()) + // { + // // if scene has shadow, check hit with shadow, too + // const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rCandidate.getShadow2D(getViewInformation2D())); + // + // if(xExtracted2DSceneShadow.hasElements()) + // { + // // proccess extracted 2D content + // process(xExtracted2DSceneShadow); + // } + // } + + if(!getHit()) + { + // empty 3D scene; Check for border hit + basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aOutline.transform(rCandidate.getObjectTransformation()); + + mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); + } + + // This is what the previous version did. Keeping it here for reference + // + // // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates + // // This may be refined later to an own 3D HitTest renderer which processes the 3D + // // geometry directly + // const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); + // const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D()); + // const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rScenePrimitive2DCandidate.getShadow2D(getViewInformation2D())); + // + // if(xExtracted2DSceneGeometry.hasElements() || xExtracted2DSceneShadow.hasElements()) + // { + // // proccess extracted 2D content + // process(xExtracted2DSceneGeometry); + // process(xExtracted2DSceneShadow); + // } + // else + // { + // // empty 3D scene; Check for border hit + // const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); + // basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + // + // mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); + // } + } + } + void HitTestProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) { if(getHit()) @@ -334,25 +449,8 @@ namespace drawinglayer { if(!getHitTextOnly()) { - // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates - // This may be refined later to an own 3D HitTest renderer which processes the 3D - // geometry directly - const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); - const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D(getViewInformation2D())); - - if(xExtracted2DSceneGeometry.hasElements()) - { - // proccess extracted 2D content - process(xExtracted2DSceneGeometry); - } - else - { - // empty 3D scene; Check for border hit - const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); - - mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); - } + const primitive2d::ScenePrimitive2D& rCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); + check3DHit(rCandidate); } break; @@ -365,6 +463,12 @@ namespace drawinglayer // ignorable primitives break; } + case PRIMITIVE2D_ID_SHADOWPRIMITIVE2D : + { + // Ignore shadows; we do not want to have shadows hittable. + // Remove this one to make shadows hittable on demand. + break; + } case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D : case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D : { diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 8e2f89bb82a6..ef351002a1ea 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -218,6 +218,12 @@ namespace drawinglayer } break; } + case PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D : + { + // direct draw of bitmap + RenderPolyPolygonBitmapPrimitive2D(static_cast< const primitive2d::PolyPolygonBitmapPrimitive2D& >(rCandidate)); + break; + } case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D : { // direct draw of PolyPolygon with color diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index e5a88812dd10..ede5aee730cf 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -565,6 +565,98 @@ namespace drawinglayer } } + // direct draw of bitmap + void VclProcessor2D::RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate) + { + bool bDone(false); + const basegfx::B2DPolyPolygon& rPolyPolygon = rPolygonCandidate.getB2DPolyPolygon(); + + if(rPolyPolygon.count()) + { + const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPolygonCandidate.getFillBitmap(); + const Bitmap& rBitmap = rFillBitmapAttribute.getBitmap(); + + if(rBitmap.IsEmpty()) + { + // empty bitmap, done + bDone = true; + } + else + { + // try to catch cases where the bitmap will be color-modified to a single + // color (e.g. shadow). This would NOT be optimizable with an alpha channel + // at the Bitmap which we do not have here. When this should change, this + // optimization has to be reworked accordingly. + const sal_uInt32 nBColorModifierStackCount(maBColorModifierStack.count()); + + if(nBColorModifierStackCount) + { + const basegfx::BColorModifier& rTopmostModifier = maBColorModifierStack.getBColorModifier(nBColorModifierStackCount - 1); + + if(basegfx::BCOLORMODIFYMODE_REPLACE == rTopmostModifier.getMode()) + { + // the bitmap fill is in unified color, so we can replace it with + // a single polygon fill. The form of the fill depends on tiling + if(rFillBitmapAttribute.getTiling()) + { + // with tiling, fill the whole PolyPolygon with the modifier color + basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolyPolygon); + + aLocalPolyPolygon.transform(maCurrentTransformation); + mpOutputDevice->SetLineColor(); + mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor())); + mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); + } + else + { + // without tiling, only the area common to the bitmap tile and the + // PolyPolygon is filled. Create the bitmap tile area in object + // coordinates. For this, the object transformation needs to be created + // from the already scaled PolyPolygon. The tile area in object + // coordinates wil always be non-rotated, so it's not necessary to + // work with a polygon here + basegfx::B2DRange aTileRange(rFillBitmapAttribute.getTopLeft(), + rFillBitmapAttribute.getTopLeft() + rFillBitmapAttribute.getSize()); + const basegfx::B2DRange aPolyPolygonRange(rPolyPolygon.getB2DRange()); + basegfx::B2DHomMatrix aNewObjectTransform; + + aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth()); + aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight()); + aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX()); + aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY()); + aTileRange.transform(aNewObjectTransform); + + // now clip the object polyPolygon against the tile range + // to get the common area (OR) + basegfx::B2DPolyPolygon aTarget = basegfx::tools::clipPolyPolygonOnRange(rPolyPolygon, aTileRange, true, false); + + if(aTarget.count()) + { + aTarget.transform(maCurrentTransformation); + mpOutputDevice->SetLineColor(); + mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor())); + mpOutputDevice->DrawPolyPolygon(aTarget); + } + } + + bDone = true; + } + } + } + } + else + { + // empty polyPolygon, done + bDone = true; + } + + if(!bDone) + { + // use default decomposition + process(rPolygonCandidate.get2DDecomposition(getViewInformation2D())); + } + } + // direct draw of PolyPolygon with color void VclProcessor2D::RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate) { diff --git a/drawinglayer/source/processor3d/makefile.mk b/drawinglayer/source/processor3d/makefile.mk index 8ca0097c435a..2ae2ae52f2f2 100644 --- a/drawinglayer/source/processor3d/makefile.mk +++ b/drawinglayer/source/processor3d/makefile.mk @@ -46,6 +46,7 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES= \ $(SLO)$/baseprocessor3d.obj \ + $(SLO)$/cutfindprocessor3d.obj \ $(SLO)$/defaultprocessor3d.obj \ $(SLO)$/shadow3dextractor.obj \ $(SLO)$/geometry2dextractor.obj \ From ca42fba5120c7de4ba7ab5321ba61cc1e092ef55 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Tue, 20 Oct 2009 15:37:20 +0000 Subject: [PATCH 057/117] #i105065# speedup 3D/FontWork --- .../processor3d/cutfindprocessor3d.hxx | 86 ++++++++ .../source/processor3d/cutfindprocessor3d.cxx | 199 ++++++++++++++++++ 2 files changed, 285 insertions(+) create mode 100644 drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx create mode 100644 drawinglayer/source/processor3d/cutfindprocessor3d.cxx diff --git a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx new file mode 100644 index 000000000000..8a800d6d24b1 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: zbufferprocessor3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-06-24 15:30:18 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + class CutFindProcessor : public BaseProcessor3D + { + private: + // the start and stop point for the cut vector + basegfx::B3DPoint maFront; + basegfx::B3DPoint maBack; + + // the found cut points + ::std::vector< basegfx::B3DPoint > maResult; + + // #i102956# the transformation change from TransformPrimitive3D processings + // needs to be remembered to be able to transform found cuts to the + // basic coordinate system the processor starts with + basegfx::B3DHomMatrix maCombinedTransform; + + // bitfield + bool mbAnyHit : 1; + + // as tooling, the process() implementation takes over API handling and calls this + // virtual render method when the primitive implementation is BasePrimitive3D-based. + virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); + + public: + CutFindProcessor(const geometry::ViewInformation3D& rViewInformation, + const basegfx::B3DPoint& rFront, + const basegfx::B3DPoint& rBack, + bool bAnyHit); + + // data access + const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; } + bool getAnyHit() const { return mbAnyHit; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX + +// eof diff --git a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx new file mode 100644 index 000000000000..99f5801c60e3 --- /dev/null +++ b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: zbufferprocessor3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + CutFindProcessor::CutFindProcessor(const geometry::ViewInformation3D& rViewInformation, + const basegfx::B3DPoint& rFront, + const basegfx::B3DPoint& rBack, + bool bAnyHit) + : BaseProcessor3D(rViewInformation), + maFront(rFront), + maBack(rBack), + maResult(), + maCombinedTransform(), + mbAnyHit(bAnyHit) + { + } + + void CutFindProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) + { + if(getAnyHit() && maResult.size()) + { + // stop processing as soon as a hit was recognized + return; + } + + // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch + switch(rCandidate.getPrimitiveID()) + { + case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D : + { + // transform group. + const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate); + + // remember old and transform front, back to object coordinates + const basegfx::B3DPoint aLastFront(maFront); + const basegfx::B3DPoint aLastBack(maBack); + basegfx::B3DHomMatrix aInverseTrans(rPrimitive.getTransformation()); + aInverseTrans.invert(); + maFront *= aInverseTrans; + maBack *= aInverseTrans; + + // remember current and create new transformation; add new object transform from right side + const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D()); + const geometry::ViewInformation3D aNewViewInformation3D( + aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(), + aLastViewInformation3D.getOrientation(), + aLastViewInformation3D.getProjection(), + aLastViewInformation3D.getDeviceToView(), + aLastViewInformation3D.getViewTime(), + aLastViewInformation3D.getExtendedInformationSequence()); + updateViewInformation(aNewViewInformation3D); + + // #i102956# remember needed back-transform for found cuts (combine from right side) + const basegfx::B3DHomMatrix aLastCombinedTransform(maCombinedTransform); + maCombinedTransform = maCombinedTransform * rPrimitive.getTransformation(); + + // let break down + process(rPrimitive.getChildren()); + + // restore transformations and front, back + maCombinedTransform = aLastCombinedTransform; + updateViewInformation(aLastViewInformation3D); + maFront = aLastFront; + maBack = aLastBack; + break; + } + case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D : + { + // PolygonHairlinePrimitive3D, not used for hit test with planes, ignore. This + // means that also thick line expansion will not be hit-tested as + // PolyPolygonMaterialPrimitive3D + break; + } + case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D : + { + // #i97321# + // For HatchTexturePrimitive3D, do not use the decomposition since it will produce + // clipped hatch lines in 3D. It can be used when the hatch also has a filling, but for + // simplicity, just use the children which are the PolyPolygonMaterialPrimitive3D + // which define the hatched areas anyways; for HitTest this is more than adequate + const primitive3d::HatchTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::HatchTexturePrimitive3D& >(rCandidate); + process(rPrimitive.getChildren()); + break; + } + case PRIMITIVE3D_ID_HITTESTPRIMITIVE3D : + { + // HitTestPrimitive3D, force usage due to we are doing a hit test and this + // primitive only gets generated on 3d objects without fill, exactly for this + // purpose + const primitive3d::HitTestPrimitive3D& rPrimitive = static_cast< const primitive3d::HitTestPrimitive3D& >(rCandidate); + process(rPrimitive.getChildren()); + break; + } + case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : + { + // PolyPolygonMaterialPrimitive3D + const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate); + + if(!maFront.equal(maBack)) + { + const basegfx::B3DPolyPolygon& rPolyPolygon = rPrimitive.getB3DPolyPolygon(); + const sal_uInt32 nPolyCount(rPolyPolygon.count()); + + if(nPolyCount) + { + const basegfx::B3DPolygon aPolygon(rPolyPolygon.getB3DPolygon(0)); + const sal_uInt32 nPointCount(aPolygon.count()); + + if(nPointCount > 2) + { + const basegfx::B3DVector aPlaneNormal(aPolygon.getNormal()); + + if(!aPlaneNormal.equalZero()) + { + const basegfx::B3DPoint aPointOnPlane(aPolygon.getB3DPoint(0)); + double fCut(0.0); + + if(basegfx::tools::getCutBetweenLineAndPlane(aPlaneNormal, aPointOnPlane, maFront, maBack, fCut)) + { + const basegfx::B3DPoint aCutPoint(basegfx::interpolate(maFront, maBack, fCut)); + + if(basegfx::tools::isInside(rPolyPolygon, aCutPoint, false)) + { + // #i102956# add result. Do not forget to do this in the coordinate + // system the processor get started with, so use the collected + // combined transformation from processed TransformPrimitive3D's + maResult.push_back(maCombinedTransform * aCutPoint); + } + } + } + } + } + } + + break; + } + default : + { + // process recursively + process(rCandidate.get3DDecomposition(getViewInformation3D())); + break; + } + } + } + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof From c86788a9514535d2868356b52fc0df4f444136d3 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 20 Oct 2009 23:12:55 +0200 Subject: [PATCH 058/117] #i106113# update from shtylman and kendy (thanks !) --- fpicker/source/unx/kde4/KDE4FPEntry.cxx | 6 +- fpicker/source/unx/kde4/KDE4FilePicker.cxx | 116 +++++++++++++++------ shell/source/backends/kdebe/makefile.mk | 4 +- 3 files changed, 88 insertions(+), 38 deletions(-) diff --git a/fpicker/source/unx/kde4/KDE4FPEntry.cxx b/fpicker/source/unx/kde4/KDE4FPEntry.cxx index 268c01b600b3..46e09bfe5359 100644 --- a/fpicker/source/unx/kde4/KDE4FPEntry.cxx +++ b/fpicker/source/unx/kde4/KDE4FPEntry.cxx @@ -84,12 +84,12 @@ static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiS // the three uno functions that will be exported extern "C" { - void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) + void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey ) + sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey ) { sal_Bool bRetVal = sal_True; @@ -110,7 +110,7 @@ extern "C" return bRetVal; } - void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey ) + void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* ) { void* pRet = 0; diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx index 09e33a225977..96a14dbcef11 100644 --- a/fpicker/source/unx/kde4/KDE4FilePicker.cxx +++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx @@ -111,6 +111,8 @@ using namespace ::com::sun::star::uno; // helper functions ////////////////////////////////////////////////////////////////////////// +#include + namespace { // controling event notifications @@ -157,14 +159,15 @@ KDE4FilePicker::KDE4FilePicker( const uno::Reference _resMgr( CREATEVERSIONRESMGR( fps_office ) ) { _extraControls = new QWidget(); - _layout = new QGridLayout(_extraControls); - _dialog = new KFileDialog(KUrl(""), QString(""), 0, _extraControls); + _dialog = new KFileDialog(KUrl("~"), QString(""), 0, _extraControls); _dialog->setMode(KFile::File | KFile::LocalOnly); //default mode _dialog->setOperationMode(KFileDialog::Opening); + + _dialog->setStyleSheet("color: black;"); } KDE4FilePicker::~KDE4FilePicker() @@ -207,21 +210,12 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute() } } + _dialog->clearFilter(); _dialog->setFilter(_filter); - _dialog->exec(); - - //nasty hack to get a local qt event loop going to process the dialog - //otherwise the dialog returns immediately - while (_dialog->isVisible()) - { - kapp->processEvents(QEventLoop::WaitForMoreEvents); - } //block and wait for user input - if (_dialog->result() == KFileDialog::Accepted) - { + if (_dialog->exec() == KFileDialog::Accepted) return ExecutableDialogResults::OK; - } return ExecutableDialogResults::CANCEL; } @@ -230,13 +224,9 @@ void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool multiSelect ) throw( uno::RuntimeException ) { if (multiSelect) - { _dialog->setMode(KFile::Files | KFile::LocalOnly); - } else - { _dialog->setMode(KFile::File | KFile::LocalOnly); - } } void SAL_CALL KDE4FilePicker::setDefaultName( const ::rtl::OUString &name ) @@ -250,7 +240,7 @@ void SAL_CALL KDE4FilePicker::setDisplayDirectory( const rtl::OUString &dir ) throw( uno::RuntimeException ) { const QString url = toQString(dir); - _dialog->setStartDir(KUrl(url)); + _dialog->setUrl(KUrl(url)); } rtl::OUString SAL_CALL KDE4FilePicker::getDisplayDirectory() @@ -263,16 +253,63 @@ rtl::OUString SAL_CALL KDE4FilePicker::getDisplayDirectory() uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() throw( uno::RuntimeException ) { - QStringList files = _dialog->selectedFiles(); + QStringList rawFiles = _dialog->selectedFiles(); + QStringList files; - uno::Sequence< ::rtl::OUString > seq(files.size()); - - for (int i=0 ; ioperationMode() == KFileDialog::Saving ) { - const QString fileName = "file:" + files[i]; - seq[i] = toOUString(fileName); + QCheckBox *cb = dynamic_cast ( + _customWidgets[ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ]); + + if (cb->isChecked()) + { + extension = _dialog->currentFilter(); // assuming filter value is like this *.ext + extension.replace("*",""); + } } + // Workaround for the double click selection KDE4 bug + // kde file picker returns the file and directories for selectedFiles() + // when a file is double clicked + // make a true list of files + const QString dir = "file://" + KUrl(rawFiles[0]).directory(); + + bool singleFile = true; + if (rawFiles.size() > 1) + { + singleFile = false; + //for multi file sequences, oo expects the first param to be the directory + //can't treat all cases like multi file because in some instances (inserting image) + //oo WANTS only one entry in the final list + files.append(dir); + } + + for (USHORT i = 0; i < rawFiles.size(); ++i) + { + // if the raw file is not the base directory (see above kde bug) + // we add the file to list of avail files + if ((dir + "/") != ("file://" + rawFiles[i])) + { + QString filename = KUrl(rawFiles[i]).fileName(); + + if (singleFile) + filename.prepend(dir + "/"); + + //prevent extension append if we already have one + if (filename.endsWith(extension)) + files.append(filename); + else + files.append(filename + extension); + } + } + + // add all files and leading directory to outgoing OO sequence + uno::Sequence< ::rtl::OUString > seq(files.size()); + for (int i = 0; i < files.size(); ++i) + seq[i] = toOUString(files[i]); + return seq; } @@ -283,9 +320,7 @@ void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &title, const QString f = toQString(filter); if (!_filter.isNull()) - { _filter.append("\n"); - } //add to hash map for reverse lookup in getCurrentFilter _filters.insert(f, t); @@ -294,15 +329,18 @@ void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &title, const //see the docs t.replace("/", "\\/"); + // openoffice gives us filters separated by ';' qt dialogs just want space separated + f.replace(";", " "); + _filter.append(QString("%1|%2").arg(f).arg(t)); } void SAL_CALL KDE4FilePicker::setCurrentFilter( const rtl::OUString &title ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { - QString filter = toQString(title); - filter.replace("/", "\\/"); - _dialog->filterWidget()->setCurrentFilter(filter); + QString t = toQString(title); + t.replace("/", "\\/"); + _dialog->filterWidget()->setCurrentFilter(t); } rtl::OUString SAL_CALL KDE4FilePicker::getCurrentFilter() @@ -312,17 +350,29 @@ rtl::OUString SAL_CALL KDE4FilePicker::getCurrentFilter() //default if not found if (filter.isNull()) - { filter = "ODF Text Document (.odt)"; - } return toOUString(filter); } -void SAL_CALL KDE4FilePicker::appendFilterGroup( const rtl::OUString&, const uno::Sequence& ) +void SAL_CALL KDE4FilePicker::appendFilterGroup( const rtl::OUString& , const uno::Sequence& filters) throw( lang::IllegalArgumentException, uno::RuntimeException ) { - //TODO + if (!_filter.isNull()) + _filter.append(QString("\n")); + + const USHORT length = filters.getLength(); + for (USHORT i = 0; i < length; ++i) + { + beans::StringPair aPair = filters[i]; + + _filter.append(QString("%1|%2").arg( + toQString(aPair.Second).replace(";", " ")).arg( + toQString(aPair.First).replace("/","\\/"))); + + if (i != length - 1) + _filter.append('\n'); + } } void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16, const uno::Any &value ) diff --git a/shell/source/backends/kdebe/makefile.mk b/shell/source/backends/kdebe/makefile.mk index 8bc0b475be8e..6159be6be151 100644 --- a/shell/source/backends/kdebe/makefile.mk +++ b/shell/source/backends/kdebe/makefile.mk @@ -77,11 +77,11 @@ SHL1OBJS=$(SLOFILES) SHL1DEF=$(MISC)$/$(SHL1TARGET).def SHL1IMPLIB=i$(SHL1TARGET) +SHL1LINKFLAGS+=$(KDE_LIBS) -lkio SHL1STDLIBS= \ $(CPPUHELPERLIB) \ $(CPPULIB) \ - $(SALLIB) \ - $(KDE_LIBS) -lkio + $(SALLIB) SHL1VERSIONMAP=exports.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def From 79486067e5a4294eb101ee5c8f08877e4f634b2a Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 21 Oct 2009 09:51:34 +0000 Subject: [PATCH 059/117] fix a compile problem --- drawinglayer/source/geometry/viewinformation2d.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index e03c946edf9e..706684c5f7d8 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -157,7 +157,7 @@ namespace drawinglayer mxExtendedInformation[nExtendedInsert++] = rProp; // for performance reasons, also cache content locally - sal_Bool bSalBool; + sal_Bool bSalBool = sal_True; rProp.Value >>= bSalBool; mbReducedDisplayQuality = bSalBool; } From 3b28ed8f3566afd5ad70156ee1148b76f64861fb Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 21 Oct 2009 09:55:42 +0000 Subject: [PATCH 060/117] fix a compile problem --- drawinglayer/source/processor2d/hittestprocessor2d.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index cf10c9defd8a..d038c61541ac 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -449,8 +449,8 @@ namespace drawinglayer { if(!getHitTextOnly()) { - const primitive2d::ScenePrimitive2D& rCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); - check3DHit(rCandidate); + const primitive2d::ScenePrimitive2D& rSceneCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); + check3DHit(rSceneCandidate); } break; From e7c5b7ea5bdba58b299b58aebe3bf61cb52705f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Wed, 21 Oct 2009 11:06:55 +0000 Subject: [PATCH 061/117] #i105992# position the control in isPrimitiveVisible, not in get2DDecomposition. The latter might not be called in some situations, the former (hopefully) always is --- .../contact/viewobjectcontactofunocontrol.cxx | 91 +++++++++++++------ 1 file changed, 65 insertions(+), 26 deletions(-) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index bbfe3eaf65ab..fd93a16d0743 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -75,6 +75,52 @@ #include #include +/* + +Form controls (more precise: UNO Controls) in the drawing layer are ... prone to breakage, since they have some +specialities which the drawing layer currently doesn't capture too well. In particular, having a living VCL +window as child of the document window, and coupling this Window to a drawing layer object, makes things +difficult sometimes. + +Below is a list of issues which existed in the past. Whenever you change code here, you're encouraged to +verify those issues are still fixed. (Whenever you have some additional time, you're encouraged to write +an automatic test for one or more of those issues for which this is possible :) + +http://www.openoffice.org/issues/show_bug.cgi?id=105992 +zooming documents containg (alive) form controls improperly positions the controls + +http://www.openoffice.org/issues/show_bug.cgi?id=104362 +crash when copy a control + +http://www.openoffice.org/issues/show_bug.cgi?id=104544 +Gridcontrol duplicated after design view on/off + +http://www.openoffice.org/issues/show_bug.cgi?id=102089 +print preview shows control elements with property printable=false + +http://www.openoffice.org/issues/show_bug.cgi?id=102090 +problem with setVisible on TextControl + +http://www.openoffice.org/issues/show_bug.cgi?id=103138 +loop when insert a control in draw + +http://www.openoffice.org/issues/show_bug.cgi?id=101398 +initially-displaying a document with many controls is very slow + +http://www.openoffice.org/issues/show_bug.cgi?id=72429 +repaint error in form wizard in bugdoc database + +http://www.openoffice.org/issues/show_bug.cgi?id=72694 +form control artifacts when scrolling a text fast + + +issues in the old (Sun-internal) bug tracking system: + +#110592# +form controls being in redlining or in hidden section are visible in alive-mode + +*/ + //........................................................................ namespace sdr { namespace contact { //........................................................................ @@ -840,11 +886,6 @@ namespace sdr { namespace contact { typedef ::drawinglayer::primitive2d::BasePrimitive2D BasePrimitive2D; protected: - virtual ::drawinglayer::primitive2d::Primitive2DSequence - get2DDecomposition( - const ::drawinglayer::geometry::ViewInformation2D& rViewInformation - ) const; - virtual ::drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition( const ::drawinglayer::geometry::ViewInformation2D& rViewInformation @@ -1056,10 +1097,10 @@ namespace sdr { namespace contact { namespace { - static void lcl_resetFlag( bool& rbFlag ) - { - rbFlag = false; - } + static void lcl_resetFlag( bool& rbFlag ) + { + rbFlag = false; + } } //-------------------------------------------------------------------- @@ -1082,8 +1123,8 @@ namespace sdr { namespace contact { } m_bCreatingControl = true; - ::comphelper::ScopeGuard aGuard( ::boost::bind( lcl_resetFlag, ::boost::ref( m_bCreatingControl ) ) ); - + ::comphelper::ScopeGuard aGuard( ::boost::bind( lcl_resetFlag, ::boost::ref( m_bCreatingControl ) ) ); + if ( m_aControl.is() ) { if ( m_pOutputDeviceForWindow == &_rDevice ) @@ -1587,19 +1628,6 @@ namespace sdr { namespace contact { return aRange; } - //-------------------------------------------------------------------- - ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::get2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const - { - #if OSL_DEBUG_LEVEL > 1 - ::basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX ); - #endif - if ( m_pVOCImpl->hasControl() ) - impl_positionAndZoomControl( _rViewInformation ); - return BasePrimitive2D::get2DDecomposition( _rViewInformation ); - } - //-------------------------------------------------------------------- ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::createLocalDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const { @@ -1737,12 +1765,23 @@ namespace sdr { namespace contact { // our control already died. // TODO: Is it worth re-creating the control? Finally, this is a pathological situation, it means some instance // disposed the control though it doesn't own it. So, /me thinks we should not bother here. - return drawinglayer::primitive2d::Primitive2DSequence(); - + return drawinglayer::primitive2d::Primitive2DSequence(); + ::drawinglayer::primitive2d::Primitive2DReference xPrimitive( new LazyControlCreationPrimitive2D( m_pImpl ) ); return ::drawinglayer::primitive2d::Primitive2DSequence( &xPrimitive, 1 ); } + //-------------------------------------------------------------------- + bool ViewObjectContactOfUnoControl::isPrimitiveVisible( const DisplayInfo& _rDisplayInfo ) const + { + VOCGuard aGuard( *m_pImpl ); + + if ( m_pImpl->hasControl() ) + m_pImpl->positionAndZoomControl( GetObjectContact().getViewInformation2D().getObjectToViewTransformation() ); + + return ViewObjectContactOfSdrObj::isPrimitiveVisible( _rDisplayInfo ); + } + //-------------------------------------------------------------------- void ViewObjectContactOfUnoControl::propertyChange() { From f4b4813b43761307a9c0d26bda165a7204a41358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Wed, 21 Oct 2009 11:17:51 +0000 Subject: [PATCH 062/117] reintroduced the fix for issue #i102090#, which got lost since 3.1.1, during one of the many merges/changes --- svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index fd93a16d0743..e8a5a9c85467 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1767,6 +1767,12 @@ namespace sdr { namespace contact { // disposed the control though it doesn't own it. So, /me thinks we should not bother here. return drawinglayer::primitive2d::Primitive2DSequence(); + // ignore existing controls which are in alive mode and manually switched to "invisible" + // #102090# / 2009-06-05 / frank.schoenheit@sun.com + const ControlHolder& rControl( m_pImpl->getExistentControl() ); + if ( rControl.is() && !rControl.isDesignMode() && !rControl.isVisible() ) + return drawinglayer::primitive2d::Primitive2DSequence(); + ::drawinglayer::primitive2d::Primitive2DReference xPrimitive( new LazyControlCreationPrimitive2D( m_pImpl ) ); return ::drawinglayer::primitive2d::Primitive2DSequence( &xPrimitive, 1 ); } From ebe6566a5d2e1360ac03da8e03f17a8be6290ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Wed, 21 Oct 2009 11:35:35 +0000 Subject: [PATCH 063/117] #i105992# --- svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx index 87a1de55ec0a..f6cc2abf32f6 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx @@ -105,8 +105,11 @@ namespace sdr { namespace contact { // support for Primitive2D virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; + // visibility check + virtual bool isPrimitiveVisible( const DisplayInfo& _rDisplayInfo ) const; + private: - ViewObjectContactOfUnoControl(); // never implemented + ViewObjectContactOfUnoControl(); // never implemented ViewObjectContactOfUnoControl( const ViewObjectContactOfUnoControl& ); // never implemented ViewObjectContactOfUnoControl& operator=( const ViewObjectContactOfUnoControl& ); // never implemented }; From ae7a95208039e7c78ba23fe819c9e0db43e467b5 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 21 Oct 2009 15:49:31 +0200 Subject: [PATCH 064/117] #i103932# allow duplicate field names in PDF export on request --- officecfg/registry/schema/org/openoffice/Office/Common.xcs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 72c0b768ed84..716e1ff4dbbb 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5343,6 +5343,13 @@ Dymamic border coloring means that when the mouse is hovered over a control, and 0 + + + pl + Specifies whether multiple form fields exported are allowed to have the same field name. + + false + FME From 65aca165c2049957833a3f306dc0d0bd86e5c68d Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 22 Oct 2009 09:42:03 +0000 Subject: [PATCH 065/117] #i106146# do not crash if there is no numbering rule in itemset --- svx/source/cui/numpages.cxx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/svx/source/cui/numpages.cxx b/svx/source/cui/numpages.cxx index 0e2840894e9a..59e95b9b1a94 100644 --- a/svx/source/cui/numpages.cxx +++ b/svx/source/cui/numpages.cxx @@ -570,17 +570,12 @@ int SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet) void SvxBulletPickTabPage::Reset( const SfxItemSet& rSet ) { - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + + const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + pSaveNum = new SvxNumRule(*rItem.GetNumRule()); // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); From 2963255c67b41faf76c6c92d9d218ecfe71569ed Mon Sep 17 00:00:00 2001 From: Sven Jacobi Date: Thu, 22 Oct 2009 11:02:37 +0000 Subject: [PATCH 066/117] #i106130# fixed crash accessing already deleted shape --- svx/inc/svx/svdfppt.hxx | 2 +- svx/source/msfilter/msdffimp.cxx | 1 + svx/source/svdraw/svdfppt.cxx | 11 ++++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/svx/inc/svx/svdfppt.hxx b/svx/inc/svx/svdfppt.hxx index 63f196876e93..fb7f75598c4e 100644 --- a/svx/inc/svx/svdfppt.hxx +++ b/svx/inc/svx/svdfppt.hxx @@ -610,7 +610,7 @@ public: UINT32& nMappedFontId, Font& rFont, char nDefault ) const; const PptDocumentAtom& GetDocumentAtom() const { return aDocAtom; } virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const; - SdrObject* CreateTable( SdrObject* pGroupObject, sal_uInt32* pTableArry, SvxMSDffSolverContainer* ) const; + SdrObject* CreateTable( SdrObject* pGroupObject, sal_uInt32* pTableArry, SvxMSDffSolverContainer* ); }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx index 087e13e88f3c..36349e5e592d 100644 --- a/svx/source/msfilter/msdffimp.cxx +++ b/svx/source/msfilter/msdffimp.cxx @@ -8124,6 +8124,7 @@ void SvxMSDffManager::removeShapeId( SdrObject* pShape ) maShapeIdContainer.erase( aIter ); break; } + aIter++; } } diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx index d0b01f6a820f..8a7aa668a660 100644 --- a/svx/source/svdraw/svdfppt.cxx +++ b/svx/source/svdraw/svdfppt.cxx @@ -7662,7 +7662,7 @@ void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable >& xTabl } } -SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTableArry, SvxMSDffSolverContainer* pSolverContainer ) const +SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTableArry, SvxMSDffSolverContainer* pSolverContainer ) { SdrObject* pRet = pGroup; sal_uInt32 nRows = pTableArry[ 1 ]; @@ -7786,6 +7786,15 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab pTable->uno_unlock(); pTable->SetSnapRect( pGroup->GetSnapRect() ); pRet = pTable; + + //Remove Objects from shape map + SdrObjListIter aIter( *pGroup, IM_DEEPWITHGROUPS ); + while( aIter.IsMore() ) + { + SdrObject* pPartObj = aIter.Next(); + removeShapeId( pPartObj ); + } + SdrObject::Free( pGroup ); } catch( Exception& ) From 62434a0674aa83ebda473f5bfceb7b62d0db3504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Thu, 22 Oct 2009 12:57:55 +0000 Subject: [PATCH 067/117] #i10000# wrongly resolved the merge conflict, corrected now --- .../sdr/contact/viewobjectcontactofunocontrol.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index e8a5a9c85467..ec876ec036ac 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1783,7 +1783,17 @@ namespace sdr { namespace contact { VOCGuard aGuard( *m_pImpl ); if ( m_pImpl->hasControl() ) - m_pImpl->positionAndZoomControl( GetObjectContact().getViewInformation2D().getObjectToViewTransformation() ); + { + const ::drawinglayer::geometry::ViewInformation2D& rViewInformation( GetObjectContact().getViewInformation2D() ); + #if OSL_DEBUG_LEVEL > 1 + ::basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX ); + #endif + + if ( !rViewInformation.getViewport().isEmpty() ) + m_pImpl->positionAndZoomControl( rViewInformation.getObjectToViewTransformation() ); + } return ViewObjectContactOfSdrObj::isPrimitiveVisible( _rDisplayInfo ); } From 5074096e42b7b91f50d8e9f1be02e87233d8e60f Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 22 Oct 2009 16:23:16 +0200 Subject: [PATCH 068/117] #i105747# grab focus to first button if backing window gets focused --- framework/source/services/backingwindow.cxx | 7 +++++++ framework/source/services/backingwindow.hxx | 1 + 2 files changed, 8 insertions(+) diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 40e4a9f7a6b9..c5d845a9d333 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -231,6 +231,13 @@ BackingWindow::~BackingWindow() delete mpAccExec; } +void BackingWindow::GetFocus() +{ + if( IsVisible() ) + maWriterButton.GrabFocus(); + Window::GetFocus(); +} + class ImageContainerRes : public Resource { public: diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index 63cfa0742e35..0b9afa6d38de 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -173,6 +173,7 @@ namespace framework virtual void DataChanged( const DataChangedEvent& rDCEvt ); virtual Window* GetParentLabelFor( const Window* pLabel ) const; virtual Window* GetParentLabeledBy( const Window* pLabeled ) const; + virtual void GetFocus(); void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame ); }; From 69381ee62ac4365ced337f380a6b0dc22dd93780 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Fri, 23 Oct 2009 11:15:57 +0000 Subject: [PATCH 069/117] #i105892# Windows 64 Bit support --- shell/source/win32/shlxthandler/makefile.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/source/win32/shlxthandler/makefile.mk b/shell/source/win32/shlxthandler/makefile.mk index 07eea87f0263..158e296c120a 100644 --- a/shell/source/win32/shlxthandler/makefile.mk +++ b/shell/source/win32/shlxthandler/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -123,17 +123,16 @@ SHL1STDLIBS_X64+=\ $(SHELL32LIB_X64)\ $(KERNEL32LIB_X64)\ $(GDI32LIB_X64)\ - $(MSVCRT_X64) \ - $(MSVCPRT_X64) \ $(USER32LIB_X64) \ - $(OLDNAMESLIB_X64) \ - $(GDIPLUSLIB_X64) + $(GDIPLUSLIB_X64) \ + $(MSVCRT_X64) \ + $(MSVCPRT_X64) \ + $(OLDNAMESLIB_X64) SHL1LIBS_X64+=$(SLB_X64)$/util.lib\ $(SLB_X64)$/ooofilereader.lib SHL1OBJS_X64=$(SLOFILES_X64) SHL1DEF_X64=$(MISC_X64)$/$(SHL1TARGET).def -SHL1RES_X64=$(RES_X64)$/$(TARGET)_x64.res DEF1NAME_X64=$(SHL1TARGET_X64) DEF1EXPORTFILE_X64=exports.dxp @@ -144,3 +143,4 @@ DEF1EXPORTFILE_X64=exports.dxp .INCLUDE : set_wntx64.mk .INCLUDE : target.mk .INCLUDE : tg_wntx64.mk + From 7f9b3c7cef71b9b01d5c1576c5955637a478dc30 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 23 Oct 2009 11:17:53 +0000 Subject: [PATCH 070/117] #i57928# added drawing layer support for formatpaintbrush feature --- svx/source/svdraw/selectioncontroller.cxx | 11 ++ svx/source/svdraw/svdedxv.cxx | 226 +++++++++++++++++++++- 2 files changed, 236 insertions(+), 1 deletion(-) diff --git a/svx/source/svdraw/selectioncontroller.cxx b/svx/source/svdraw/selectioncontroller.cxx index 0c954e4a9e10..ed25ae0e1ffe 100644 --- a/svx/source/svdraw/selectioncontroller.cxx +++ b/svx/source/svdraw/selectioncontroller.cxx @@ -31,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" +#include #include namespace sdr @@ -103,4 +104,14 @@ bool SelectionController::PasteObjModel( const SdrModel& /*rModel*/ ) return false; } +bool SelectionController::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& /*rFormatSet*/ ) +{ + return false; +} + +bool SelectionController::ApplyFormatPaintBrush( SfxItemSet& /*rFormatSet*/, bool /*bNoCharacterFormats*/, bool /*bNoParagraphFormats*/ ) +{ + return false; +} + } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 901bc0e7e5b6..08dd4b33781a 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -30,6 +30,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + +#include + #include #include @@ -46,6 +49,7 @@ #include #include +#include #include #include #include @@ -60,7 +64,6 @@ #include "svx/svdetc.hxx" // fuer GetDraftFillColor #include "svx/svdotable.hxx" #include - #ifdef DBG_UTIL #include #endif @@ -69,6 +72,7 @@ #include // fuer SetSolidDragging() #include "svdstr.hrc" // Namen aus der Resource #include "svdglob.hxx" // StringCache +#include "globl3d.hxx" #include #include @@ -1923,3 +1927,223 @@ void SdrObjEditView::OnEndPasteOrDrop( PasteOrDropInfos* ) // applications can derive from these virtual methods to do something before a drop or paste operation } +bool SdrObjEditView::SupportsFormatPaintbrush( UINT32 nObjectInventor, UINT16 nObjectIdentifier ) const +{ + if( nObjectInventor != SdrInventor && nObjectInventor != E3dInventor ) + return false; + switch(nObjectIdentifier) + { + case OBJ_NONE: + case OBJ_GRUP: + return false; + case OBJ_LINE: + case OBJ_RECT: + case OBJ_CIRC: + case OBJ_SECT: + case OBJ_CARC: + case OBJ_CCUT: + case OBJ_POLY: + case OBJ_PLIN: + case OBJ_PATHLINE: + case OBJ_PATHFILL: + case OBJ_FREELINE: + case OBJ_FREEFILL: + case OBJ_SPLNLINE: + case OBJ_SPLNFILL: + case OBJ_TEXT: + case OBJ_TEXTEXT: + case OBJ_TITLETEXT: + case OBJ_OUTLINETEXT: + case OBJ_GRAF: + case OBJ_OLE2: + case OBJ_TABLE: + return true; + case OBJ_EDGE: + case OBJ_CAPTION: + return false; + case OBJ_PATHPOLY: + case OBJ_PATHPLIN: + return true; + case OBJ_PAGE: + case OBJ_MEASURE: + case OBJ_DUMMY: + case OBJ_FRAME: + case OBJ_UNO: + return false; + case OBJ_CUSTOMSHAPE: + return true; + default: + return false; + } +} + +static const USHORT* GetFormatRangeImpl( bool bTextOnly ) +{ + static const USHORT gRanges[] = { + SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, + SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST, + SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST, + XATTR_LINE_FIRST, XATTR_LINE_LAST, + XATTR_FILL_FIRST, XATTRSET_FILL, + EE_PARA_START, EE_PARA_END, + EE_CHAR_START, EE_CHAR_END, + 0,0 + }; + return &gRanges[ bTextOnly ? 10 : 0]; +} + +bool SdrObjEditView::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet ) +{ + if( mxSelectionController.is() && mxSelectionController->TakeFormatPaintBrush(rFormatSet) ) + return true; + + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if( rMarkList.GetMarkCount() >= 1 ) + { + OutlinerView* pOLV = GetTextEditOutlinerView(); + + rFormatSet.reset( new SfxItemSet( GetModel()->GetItemPool(), GetFormatRangeImpl( pOLV != NULL ) ) ); + if( pOLV ) + { + rFormatSet->Put( pOLV->GetAttribs() ); + } + else + { + const BOOL bOnlyHardAttr = FALSE; + rFormatSet->Put( GetAttrFromMarked(bOnlyHardAttr) ); + } + return true; + } + + return false; +} + +static SfxItemSet CreatePaintSet( const USHORT *pRanges, SfxItemPool& rPool, const SfxItemSet& rSourceSet, const SfxItemSet& rTargetSet, bool bNoCharacterFormats, bool bNoParagraphFormats ) +{ + SfxItemSet aPaintSet( rPool, pRanges ); + + while( *pRanges ) + { + USHORT nWhich = *pRanges++; + const USHORT nLastWhich = *pRanges++; + + if( bNoCharacterFormats && (nWhich == EE_CHAR_START) ) + continue; + + if( bNoParagraphFormats && (nWhich == EE_PARA_START ) ) + continue; + + for( ; nWhich < nLastWhich; nWhich++ ) + { + const SfxPoolItem* pSourceItem = rSourceSet.GetItem( nWhich ); + const SfxPoolItem* pTargetItem = rTargetSet.GetItem( nWhich ); + + if( (pSourceItem && !pTargetItem) || (pSourceItem && pTargetItem && !((*pSourceItem) == (*pTargetItem)) ) ) + { + aPaintSet.Put( *pSourceItem ); + } + } + } + return aPaintSet; +} + +void SdrObjEditView::ApplyFormatPaintBrushToText( SfxItemSet& rFormatSet, SdrTextObj& rTextObj, SdrText* pText, bool bNoCharacterFormats, bool bNoParagraphFormats ) +{ + OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0; + if(pParaObj) + { + SdrOutliner& rOutliner = rTextObj.ImpGetDrawOutliner(); + rOutliner.SetText(*pParaObj); + + sal_uInt32 nParaCount(rOutliner.GetParagraphCount()); + + if(nParaCount) + { + for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++) + { + if( !bNoCharacterFormats ) + rOutliner.QuickRemoveCharAttribs( nPara, /* remove all */0 ); + + SfxItemSet aSet(rOutliner.GetParaAttribs(nPara)); + aSet.Put(CreatePaintSet( GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) ); + rOutliner.SetParaAttribs(nPara, aSet); + } + + OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount); + rOutliner.Clear(); + + rTextObj.NbcSetOutlinerParaObjectForText(pTemp,pText); + } + } +} + +void SdrObjEditView::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ) +{ + if( !mxSelectionController.is() || !mxSelectionController->ApplyFormatPaintBrush( rFormatSet, bNoCharacterFormats, bNoParagraphFormats ) ) + { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + OutlinerView* pOLV = GetTextEditOutlinerView(); + + const SfxItemSet& rShapeSet = pObj->GetMergedItemSet(); + + if( !pOLV ) + { + // if not in text edit mode (aka the user selected text or clicked on a word) + // apply formating attributes to selected shape + // All formating items (see ranges above) that are unequal in selected shape and + // the format paintbrush are hard set on the selected shape. + + const USHORT* pRanges = rFormatSet.GetRanges(); + bool bTextOnly = true; + + while( *pRanges ) + { + if( (*pRanges != EE_PARA_START) && (*pRanges != EE_CHAR_START) ) + { + bTextOnly = false; + break; + } + pRanges += 2; + } + + if( !bTextOnly ) + { + SfxItemSet aPaintSet( CreatePaintSet( GetFormatRangeImpl(false), *rShapeSet.GetPool(), rFormatSet, rShapeSet, bNoCharacterFormats, bNoParagraphFormats ) ); + const BOOL bReplaceAll = FALSE; + SetAttrToMarked(aPaintSet, bReplaceAll); + } + + // now apply character and paragraph formating to text, if the shape has any + SdrTextObj* pTextObj = dynamic_cast(pObj); + if( pTextObj ) + { + sal_Int32 nText = pTextObj->getTextCount(); + + while( --nText >= 0 ) + { + SdrText* pText = pTextObj->getText( nText ); + ApplyFormatPaintBrushToText( rFormatSet, *pTextObj, pText, bNoCharacterFormats, bNoParagraphFormats ); + } + } + } + else + { + ::Outliner* pOutliner = pOLV->GetOutliner(); + if( pOutliner ) + { + const EditEngine& rEditEngine = pOutliner->GetEditEngine(); + + ESelection aSel( pOLV->GetSelection() ); + if( !aSel.HasRange() ) + pOLV->SetSelection( rEditEngine.GetWord( aSel, com::sun::star::i18n::WordType::DICTIONARY_WORD ) ); + + const BOOL bRemoveParaAttribs = !bNoParagraphFormats; + pOLV->RemoveAttribsKeepLanguages( bRemoveParaAttribs ); + SfxItemSet aSet( pOLV->GetAttribs() ); + SfxItemSet aPaintSet( CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) ); + pOLV->SetAttribs( aPaintSet ); + } + } + } +} From 55a71014f4214faa8a42d855e776eeddb4e17871 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 23 Oct 2009 11:18:28 +0000 Subject: [PATCH 071/117] #i57928# added drawing layer support for formatpaintbrush feature --- svx/source/table/tablecontroller.cxx | 82 ++++++++++++++++++++++++++++ svx/source/table/tablecontroller.hxx | 4 ++ 2 files changed, 86 insertions(+) diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index d7f64c852fc6..b1d4171c459a 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2514,6 +2514,88 @@ bool SvxTableController::PasteObject( SdrTableObj* pPasteTableObj ) return true; } +bool SvxTableController::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& /*rFormatSet*/ ) +{ + // SdrView::TakeFormatPaintBrush() is enough + return false; +} + +bool SvxTableController::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ) +{ + if( mbCellSelectionMode ) + { + SdrTextObj* pTableObj = dynamic_cast( mxTableObj.get() ); + if( !pTableObj ) + return false; + + const bool bUndo = mpModel && mpModel->IsUndoEnabled(); + + if( bUndo ) + mpModel->BegUndo( ImpGetResStr(STR_TABLE_NUMFORMAT) ); + + CellPos aStart, aEnd; + getSelectedCells( aStart, aEnd ); + + SfxItemSet aAttr(*rFormatSet.GetPool(), rFormatSet.GetRanges()); + aAttr.Put(rFormatSet, TRUE); + + const bool bFrame = (rFormatSet.GetItemState( SDRATTR_TABLE_BORDER ) == SFX_ITEM_SET) || (rFormatSet.GetItemState( SDRATTR_TABLE_BORDER_INNER ) == SFX_ITEM_SET); + + if( bFrame ) + { + aAttr.ClearItem( SDRATTR_TABLE_BORDER ); + aAttr.ClearItem( SDRATTR_TABLE_BORDER_INNER ); + } + + const USHORT* pRanges = rFormatSet.GetRanges(); + bool bTextOnly = true; + + while( *pRanges ) + { + if( (*pRanges != EE_PARA_START) && (*pRanges != EE_CHAR_START) ) + { + bTextOnly = true; + break; + } + pRanges += 2; + } + + const bool bReplaceAll = false; + for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ ) + { + for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) + { + CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + if( xCell.is() ) + { + if( bUndo ) + xCell->AddUndo(); + if( !bTextOnly ) + xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll); + + SdrText* pText = static_cast< SdrText* >( xCell.get() ); + mpView->ApplyFormatPaintBrushToText( rFormatSet, *pTableObj, pText, bNoCharacterFormats, bNoParagraphFormats ); + } + } + } + + if( bFrame ) + { + ApplyBorderAttr( rFormatSet ); + } + + UpdateTableShape(); + + if( bUndo ) + mpModel->EndUndo(); + + return true; + + } + return false; +} + + // -------------------------------------------------------------------- IMPL_LINK( SvxTableController, UpdateHdl, void *, EMPTYARG ) diff --git a/svx/source/table/tablecontroller.hxx b/svx/source/table/tablecontroller.hxx index e13fad84179e..0ad7c157e7f6 100644 --- a/svx/source/table/tablecontroller.hxx +++ b/svx/source/table/tablecontroller.hxx @@ -57,6 +57,7 @@ public: SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrObject* pObj ); SVX_DLLPRIVATE virtual ~SvxTableController(); + // from sdr::SelectionController SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, Window* pWin); SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, Window* pWin); SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, Window* pWin); @@ -72,6 +73,9 @@ public: SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const; SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ); + SVX_DLLPRIVATE virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet ); + SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ); + // slots SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 ); SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId ); From 03862b6c452dffbc29f0cde95f87b2fec9bda3c8 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 23 Oct 2009 11:19:23 +0000 Subject: [PATCH 072/117] #i57928# added drawing layer support for formatpaintbrush feature --- svx/inc/svx/selectioncontroller.hxx | 11 +++++++++++ svx/inc/svx/svdedxv.hxx | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/svx/inc/svx/selectioncontroller.hxx b/svx/inc/svx/selectioncontroller.hxx index 5cf8c294a1bb..b9c04b54c0dc 100644 --- a/svx/inc/svx/selectioncontroller.hxx +++ b/svx/inc/svx/selectioncontroller.hxx @@ -33,6 +33,8 @@ #include "svx/svxdllapi.h" +#include + #include class KeyEvent; @@ -70,6 +72,15 @@ public: virtual bool GetMarkedObjModel( SdrPage* pNewPage ); virtual bool PasteObjModel( const SdrModel& rModel ); + + /** returns a format paint brush set from the current selection */ + virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet ); + + /** applies a format paint brush set from the current selection. + if bNoCharacterFormats is true, no character attributes are changed. + if bNoParagraphFormats is true, no paragraph attributes are changed. + */ + virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ); }; } diff --git a/svx/inc/svx/svdedxv.hxx b/svx/inc/svx/svdedxv.hxx index 17333ad74459..293e50896044 100644 --- a/svx/inc/svx/svdedxv.hxx +++ b/svx/inc/svx/svdedxv.hxx @@ -41,6 +41,8 @@ // Vorausdeklarationen //************************************************************ +#include + class SdrOutliner; class OutlinerView; class EditStatus; @@ -282,6 +284,21 @@ public: rtl::Reference< sdr::SelectionController > getSelectionController() const { return mxSelectionController; } + /** returns true if the shape identified by its inventor and identifier supports format paint brush operation */ + virtual bool SupportsFormatPaintbrush( UINT32 nObjectInventor, UINT16 nObjectIdentifier ) const; + + /** returns a format paint brush set from the current selection */ + virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet ); + + /** applies a format paint brush set from the current selection. + if bNoCharacterFormats is true, no character attributes are changed. + if bNoParagraphFormats is true, no paragraph attributes are changed. + */ + virtual void ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ); + + /** helper function for selections with multiple SdrText for one SdrTextObj (f.e. tables ) */ + void ApplyFormatPaintBrushToText( SfxItemSet& rFormatSet, SdrTextObj& rTextObj, SdrText* pText, bool bNoCharacterFormats, bool bNoParagraphFormats ); + protected: virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos ); virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos ); From 053cb63bb1f321e63ac4db9a82eae685c6197218 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 23 Oct 2009 13:26:54 +0200 Subject: [PATCH 073/117] #i90373# allow only ascii characters in PDF passwords --- sfx2/inc/sfx2/passwd.hxx | 4 ++-- sfx2/source/dialog/passwd.cxx | 28 +++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/sfx2/inc/sfx2/passwd.hxx b/sfx2/inc/sfx2/passwd.hxx index bb4e1b8c1561..bfe8debecca1 100644 --- a/sfx2/inc/sfx2/passwd.hxx +++ b/sfx2/inc/sfx2/passwd.hxx @@ -68,10 +68,9 @@ private: USHORT mnMinLen; USHORT mnExtras; -//#if 0 // _SOLAR__PRIVATE + bool mbAsciiOnly; DECL_DLLPRIVATE_LINK( EditModifyHdl, Edit* ); DECL_DLLPRIVATE_LINK( OKHdl, OKButton* ); -//#endif public: SfxPasswordDialog( Window* pParent, const String* pGroupText = NULL ); @@ -84,6 +83,7 @@ public: void SetMaxLen( USHORT Len ); void SetEditHelpId( ULONG nId ) { maPasswordED.SetHelpId( nId ); } void ShowExtras( USHORT nExtras ) { mnExtras = nExtras; } + void AllowAsciiOnly( bool i_bAsciiOnly = true ) { mbAsciiOnly = i_bAsciiOnly; } virtual short Execute(); }; diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx index cbe47d39b704..981657d476fa 100644 --- a/sfx2/source/dialog/passwd.cxx +++ b/sfx2/source/dialog/passwd.cxx @@ -43,10 +43,35 @@ #include "dialog.hrc" #include "passwd.hrc" +#include "vcl/sound.hxx" + // ----------------------------------------------------------------------- IMPL_LINK_INLINE_START( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG ) { + if( mbAsciiOnly ) + { + rtl::OUString aTest( maPasswordED.GetText() ); + const sal_Unicode* pTest = aTest.getStr(); + sal_Int32 nLen = aTest.getLength(); + rtl::OUStringBuffer aFilter( nLen ); + bool bReset = false; + for( sal_Int32 i = 0; i < nLen; i++ ) + { + if( *pTest > 0x007f ) + bReset = true; + else + aFilter.append( *pTest ); + pTest++; + } + if( bReset ) + { + Sound::Beep( SOUND_ERROR ); + maPasswordED.SetSelection( Selection( 0, nLen ) ); + maPasswordED.ReplaceSelected( aFilter.makeStringAndClear() ); + } + + } maOKBtn.Enable( maPasswordED.GetText().Len() >= mnMinLen ); return 0; } @@ -88,7 +113,8 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText maConfirmStr ( SfxResId( STR_PASSWD_CONFIRM ) ), mnMinLen ( 5 ), - mnExtras ( 0 ) + mnExtras ( 0 ), + mbAsciiOnly ( false ) { FreeResource(); From 32eb395b850c7cfc53136a03b2bf162eab7222c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Fri, 23 Oct 2009 20:07:54 +0000 Subject: [PATCH 074/117] #i103611# re-introduced the hack for transparent VCL child windows, which got lost since OOo 3.1.x (commit approved by aw) --- .../sdr/overlay/overlaymanagerbuffered.cxx | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 3fedc40f37cf..89ba0eb35b5c 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -370,6 +370,42 @@ namespace sdr OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, getOutputDevice()); } + // VCL hack for transparent child windows + // Problem is e.g. a radiobuttion form control in life mode. The used window + // is a transparence vcl childwindow. This flag only allows the parent window to + // paint into the child windows area, but there is no mechanism which takes + // care for a repaint of the child window. A transparent child window is NOT + // a window which always keeps it's content consistent over the parent, but it's + // more like just a paint flag for the parent. + // To get the update, the windows in question are updated manulally here. + if(bTargetIsWindow) + { + Window& rWindow = static_cast< Window& >(rmOutputDevice); + + if(rWindow.IsChildTransparentModeEnabled() && rWindow.GetChildCount()) + { + const Rectangle aRegionRectanglePixel( + maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(), + maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY()); + + for(sal_uInt16 a(0); a < rWindow.GetChildCount(); a++) + { + Window* pCandidate = rWindow.GetChild(a); + + if(pCandidate && pCandidate->IsPaintTransparent()) + { + const Rectangle aCandidatePosSizePixel(pCandidate->GetPosPixel(), pCandidate->GetSizePixel()); + + if(aCandidatePosSizePixel.IsOver(aRegionRectanglePixel)) + { + pCandidate->Invalidate(INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN); + pCandidate->Update(); + } + } + } + } + } + // #i80730# restore visibility of VCL cursor if(bCursorWasEnabled) { From ab6ea039d3c5a5ba7055b7b7f19d8b7c0d2eb084 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Mon, 26 Oct 2009 17:53:55 +0000 Subject: [PATCH 075/117] #i105856# Corrected error with not taking into account that getB2DRange may be empty for primitives --- .../source/processor2d/hittestprocessor2d.cxx | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index d038c61541ac..4ffef7515389 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -272,9 +272,11 @@ namespace drawinglayer // { // // empty 3D scene; Check for border hit // const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); - // basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); - // - // mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); + // if(!aRange.isEmpty()) + // { + // const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + // mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); + // } // } } } @@ -474,9 +476,12 @@ namespace drawinglayer { // for text use the BoundRect of the primitive itself const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); - mbHit = checkFillHitWithTolerance(basegfx::B2DPolyPolygon(aOutline), getDiscreteHitTolerance()); + if(!aRange.isEmpty()) + { + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + mbHit = checkFillHitWithTolerance(basegfx::B2DPolyPolygon(aOutline), getDiscreteHitTolerance()); + } break; } @@ -496,9 +501,12 @@ namespace drawinglayer // - For Bitamps, the mask and/or alpha information may be used // - For MetaFiles, the MetaFile content may be used const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); - mbHit = checkFillHitWithTolerance(basegfx::B2DPolyPolygon(aOutline), getDiscreteHitTolerance()); + if(!aRange.isEmpty()) + { + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + mbHit = checkFillHitWithTolerance(basegfx::B2DPolyPolygon(aOutline), getDiscreteHitTolerance()); + } } break; From 56c0e48da62ea84c611a3cd313b55f3b04743673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Sch=C3=B6nheit?= Date: Tue, 27 Oct 2009 11:15:40 +0000 Subject: [PATCH 076/117] compiler bug: streaming a volatile double into an Any results in a boolean-Any ... removed the 'volatile', which was nonsense, anyway --- svx/source/fmcomp/gridcell.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index ff7cfd422eb8..b70ba93a00e1 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -2080,7 +2080,7 @@ SpinField* DbCurrencyField::createField( Window* _pParent, WinBits _nFieldStyle, //------------------------------------------------------------------------------ double DbCurrencyField::GetCurrency(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter) const { - volatile double fValue = GetValue(_rxField, xFormatter); + double fValue = GetValue(_rxField, xFormatter); if (m_nScale) { // OSL_TRACE("double = %.64f ",fValue); @@ -2158,7 +2158,7 @@ sal_Bool DbCurrencyField::commitControl() Any aVal; if (aText.Len() != 0) // nicht null { - volatile double fValue = ((LongCurrencyField*)m_pWindow)->GetValue(); + double fValue = ((LongCurrencyField*)m_pWindow)->GetValue(); if (m_nScale) { fValue /= ::rtl::math::pow10Exp(1.0, m_nScale); From 812592a71b1aa1449140c0541c935b83fc96d766 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 27 Oct 2009 11:48:36 +0000 Subject: [PATCH 077/117] #i106261# avoid duplicate initialization --- avmedia/source/quicktime/player.cxx | 75 ++++++++++++++++------------- avmedia/source/quicktime/player.hxx | 2 +- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/avmedia/source/quicktime/player.cxx b/avmedia/source/quicktime/player.cxx index e8289570b5ae..29332698016e 100644 --- a/avmedia/source/quicktime/player.cxx +++ b/avmedia/source/quicktime/player.cxx @@ -100,8 +100,6 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : if ((result == noErr) && (mnVersion >= QT701)) { // we have version 7.01 or later, initialize - mpMovie = [QTMovie movie]; - [mpMovie retain]; mbInitialized = true; } [pool release]; @@ -111,44 +109,58 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : Player::~Player() { - if( mbInitialized ) + if( mpMovie ) { - if( mpMovie ) - { - [mpMovie release]; - mpMovie = nil; - } - + [mpMovie release]; + mpMovie = nil; } } +// ------------------------------------------------------------------------------ +QTMovie* Player::getMovie() +{ + OSL_ASSERT( mpMovie ); + return mpMovie; +} // ------------------------------------------------------------------------------ bool Player::create( const ::rtl::OUString& rURL ) { bool bRet = false; - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - NSString* aNSStr = [[[NSString alloc] initWithCharacters: rURL.getStr() length: rURL.getLength()]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ; -// NSString * aNSStringEscaped = [aNSStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - NSURL* aURL = [NSURL URLWithString:aNSStr ]; - // create the Movie - if( mbInitialized ) { + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - mpMovie = [mpMovie initWithURL:aURL error:nil]; + if( mpMovie ) + { + [mpMovie release]; + mpMovie = nil; + } + + NSString* aNSStr = [[[NSString alloc] initWithCharacters: rURL.getStr() length: rURL.getLength()]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ; + NSURL* aURL = [NSURL URLWithString:aNSStr ]; + + + NSError* pErr = nil; + mpMovie = [QTMovie movieWithURL:aURL error:&pErr]; if(mpMovie) { [mpMovie retain]; maURL = rURL; bRet = true; } + if( pErr ) + { + OSL_TRACE( "NSMovie create failed with error %ld (%s)", + (long)[pErr code], + [[pErr localizedDescription] cString] + ); + } + [pool release]; } - [pool release]; - return bRet; } @@ -159,10 +171,10 @@ void SAL_CALL Player::start( ) { OSL_TRACE ("Player::start"); - if ( mbInitialized && mpMovie ) - { + if( mpMovie ) + { [mpMovie play]; - } + } } // ------------------------------------------------------------------------------ @@ -171,11 +183,10 @@ void SAL_CALL Player::stop( ) throw (uno::RuntimeException) { OSL_TRACE ("Player::stop"); - if ( mpMovie ) + if( mpMovie ) { - [mpMovie stop]; + [mpMovie stop]; } - } // ------------------------------------------------------------------------------ @@ -185,7 +196,7 @@ sal_Bool SAL_CALL Player::isPlaying() { bool bRet = false; - if ( mbInitialized ) + if ( mpMovie ) { if ([mpMovie rate] != 0) { @@ -220,10 +231,10 @@ void SAL_CALL Player::setMediaTime( double fTime ) { OSL_TRACE ("Player::setMediaTime"); - if ( mpMovie ) - { - [mpMovie setCurrentTime: QTMakeTimeWithTimeInterval(fTime)]; - } + if ( mpMovie ) + { + [mpMovie setCurrentTime: QTMakeTimeWithTimeInterval(fTime)]; + } } // ------------------------------------------------------------------------------ @@ -244,7 +255,6 @@ double SAL_CALL Player::getMediaTime( ) stop(); } - return position; } @@ -256,7 +266,6 @@ void SAL_CALL Player::setStopTime( double fTime ) OSL_TRACE ("Player::setStopTime %f", fTime); mnStopTime = fTime; - } // ------------------------------------------------------------------------------ @@ -264,9 +273,7 @@ void SAL_CALL Player::setStopTime( double fTime ) double SAL_CALL Player::getStopTime( ) throw (uno::RuntimeException) { - double fRet = 0.0; - - fRet = mnStopTime; + double fRet = mnStopTime; return fRet; } diff --git a/avmedia/source/quicktime/player.hxx b/avmedia/source/quicktime/player.hxx index b7cab51005f4..c49ccd62915c 100644 --- a/avmedia/source/quicktime/player.hxx +++ b/avmedia/source/quicktime/player.hxx @@ -83,7 +83,7 @@ public: virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - QTMovie* getMovie() { return mpMovie; } + QTMovie* getMovie(); private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; From 4e9f08b232cc91aa70f36a6ad9f4ce4bfc2603de Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 27 Oct 2009 12:29:43 +0000 Subject: [PATCH 078/117] #i106261# do not confuse stop with start --- avmedia/source/viewer/mediawindowbase_impl.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx index 05acc545c77b..2506c179f413 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.cxx +++ b/avmedia/source/viewer/mediawindowbase_impl.cxx @@ -147,9 +147,9 @@ void MediaWindowBaseImpl::stopPlayingInternal( bool bStop ) if( isPlaying() ) { if( bStop ) - mxPlayer->start(); - else mxPlayer->stop(); + else + mxPlayer->start(); } } From 898b0e6106093ab2eca17adb1421967d7bdc2184 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 27 Oct 2009 15:01:25 +0000 Subject: [PATCH 079/117] CWS-TOOLING: integrate CWS impress178 2009-10-16 19:54:41 +0200 sj r276995 : removed warning 2009-10-16 17:46:12 +0200 sj r276993 : #i103757# applied patch (fixed crash if model changes) 2009-10-16 16:06:07 +0200 sj r276985 : CWS-TOOLING: rebase CWS impress178 to branches/OOO320@276942 (milestone: OOO320:m2) 2009-10-08 13:51:23 +0200 sj r276790 : #i105654# fixed closing of line geometry 2009-10-07 17:26:56 +0200 sj r276762 : #i105606# fixed object shadow 2009-10-07 17:25:39 +0200 sj r276761 : minor improvements 2009-10-07 11:48:26 +0200 af r276745 : #i103047# Prevent context menu of LayoutMenu from being shown when user clicks on background. 2009-10-07 11:33:59 +0200 af r276743 : #i99866# Set position of the design control manually. 2009-10-06 17:18:23 +0200 sj r276721 : minor improvements 2009-10-05 18:34:23 +0200 sj r276692 : #105606# fixed fontsize problem 2009-10-05 17:26:21 +0200 af r276691 : #i105354# Never process more than one request in a row. 2009-10-02 13:24:25 +0200 af r276639 : #i94242# Taking insertion position of slide sorter correctly into account. 2009-10-01 13:46:47 +0200 aw r276602 : #i102224# some Polygon/PolyPolygon usages in SVMConverter ignored the possible curve status of tools::Polygon; added at least an AdaptiveSubdivide 2009-10-01 12:33:56 +0200 aw r276588 : #i102224# ImplWritePolyPolygon killed the curve information at the PolyPolygon by NOT copying the flags 2009-09-30 17:48:56 +0200 aw r276567 : #i102224# removed GetSimple() from Polygon and PolyPolygon, replaced completely with AdaptiveSubdivide 2009-09-30 15:45:46 +0200 aw r276559 : #i102048# secured primitive creation for dimension lines with linestyle none 2009-09-30 14:56:41 +0200 af r276556 : #i105471# Reordered statements in ~SdModule. 2009-09-30 14:47:12 +0200 aw r276555 : #i105373# corrected curve ignoring places in MetaFile export --- .../sdr/primitive2d/sdrmeasureprimitive2d.hxx | 25 +++++++++-------- svx/inc/svx/svdoashp.hxx | 2 ++ .../customshapes/EnhancedCustomShape2d.cxx | 13 --------- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 28 ++++++++++--------- svx/source/svdraw/svdoashp.cxx | 6 ++++ 5 files changed, 36 insertions(+), 38 deletions(-) diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 1e68a61432a0..a7084993b5f2 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -39,19 +39,19 @@ ////////////////////////////////////////////////////////////////////////////// // predefines -namespace drawinglayer -{ - namespace primitive2d +namespace drawinglayer { namespace primitive2d { + enum MeasureTextPosition { - enum MeasureTextPosition - { - MEASURETEXTPOSITION_AUTOMATIC, - MEASURETEXTPOSITION_NEGATIVE, - MEASURETEXTPOSITION_CENTERED, - MEASURETEXTPOSITION_POSITIVE - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer + MEASURETEXTPOSITION_AUTOMATIC, + MEASURETEXTPOSITION_NEGATIVE, + MEASURETEXTPOSITION_CENTERED, + MEASURETEXTPOSITION_POSITIVE + }; +}} + +namespace drawinglayer { namespace attribute { + class SdrLineAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -80,6 +80,7 @@ namespace drawinglayer // internal decomposition helper Primitive2DReference impCreatePart( + const attribute::SdrLineAttribute& rLineAttribute, const basegfx::B2DHomMatrix& rObjectMatrix, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx index faf1aa7055aa..f65afc0b4efe 100644 --- a/svx/inc/svx/svdoashp.hxx +++ b/svx/inc/svx/svdoashp.hxx @@ -179,6 +179,8 @@ public: virtual UINT16 GetObjIdentifier() const; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; + virtual void SetModel(SdrModel* pNewModel); + virtual void RecalcSnapRect(); virtual const Rectangle& GetSnapRect() const; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 804db0c58a16..36bb586b01d6 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1701,19 +1701,6 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm if(aNewB2DPolyPolygon.count()) { - if( !bLineGeometryNeededOnly ) - { - // hack aNewB2DPolyPolygon to fill logic rect - this is - // needed to produce gradient fills that look like mso - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(0,0)); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(), - aLogicRect.GetHeight())); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - } // #i37011# bool bForceCreateTwoObjects(false); diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 94e59f79c3de..4b5dc8a3b48e 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -52,27 +52,29 @@ namespace drawinglayer namespace primitive2d { Primitive2DReference SdrMeasurePrimitive2D::impCreatePart( + const attribute::SdrLineAttribute& rLineAttribute, const basegfx::B2DHomMatrix& rObjectMatrix, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, bool bLeftActive, bool bRightActive) const { + const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); basegfx::B2DPolygon aPolygon; + aPolygon.append(rStart); aPolygon.append(rEnd); - if(!getSdrLSTAttribute().getLineStartEnd() || (!bLeftActive && !bRightActive)) + if(!pLineStartEnd || (!bLeftActive && !bRightActive)) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), 0L); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, 0); } if(bLeftActive && bRightActive) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd()); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, pLineStartEnd); } - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); const basegfx::B2DPolyPolygon aEmpty; const attribute::SdrLineStartEndAttribute aLineStartEnd( bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, @@ -80,7 +82,7 @@ namespace drawinglayer bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), &aLineStartEnd); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd); } Primitive2DSequence SdrMeasurePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const @@ -277,12 +279,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY()); const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainRight, aMainRightRight, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainRight, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(* pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); } } else @@ -293,12 +295,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY()); const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainInnerRight, aMainRight, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainRight, true, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); } } @@ -311,13 +313,13 @@ namespace drawinglayer const basegfx::B2DPoint aLeftUp(0.0, fTopEdge); const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aLeftDown, aLeftUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); // right help line const basegfx::B2DPoint aRightUp(fDistance, fTopEdge); const basegfx::B2DPoint aRightDown(fDistance, fBottomRight); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aRightDown, aRightUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); // text horizontal position if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index dab855fa6f41..217916633998 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1673,6 +1673,12 @@ void SdrObjCustomShape::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const } } +void SdrObjCustomShape::SetModel(SdrModel* pNewModel) +{ + SdrTextObj::SetModel(pNewModel); + mXRenderedCustomShape.clear(); +} + UINT16 SdrObjCustomShape::GetObjIdentifier() const { return UINT16(OBJ_CUSTOMSHAPE); From 1d8ff938ffc1a10d7889ff29f13f7e87a221d84e Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Tue, 27 Oct 2009 15:25:59 +0000 Subject: [PATCH 080/117] #i103454# need to set all PaperSizes (three) at the Outliner to get the right layout --- svx/source/svdraw/svdotextdecomposition.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index e72b606f3b53..934b0f78ca3e 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -818,15 +818,16 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( { // cell text is formated neither like a text object nor like a object // text, so use a special setup here + // #i106214# To work with an unchangeable PaperSize (CellSize in + // this case) Set(Min|Max)AutoPaperSize and SetPaperSize have to be used rOutliner.SetMaxAutoPaperSize(aAnchorTextSize); + rOutliner.SetMinAutoPaperSize(aAnchorTextSize); rOutliner.SetPaperSize(aAnchorTextSize); rOutliner.SetUpdateMode(true); rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); - rOutliner.SetControlWord(nOriginalControlWord); } else { - if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage()) { // #i103454# maximal paper size hor/ver needs to be limited to text @@ -854,9 +855,10 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.SetPaperSize(aNullSize); rOutliner.SetUpdateMode(true); rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); - rOutliner.SetControlWord(nOriginalControlWord); } + rOutliner.SetControlWord(nOriginalControlWord); + // now get back the layouted text size from outliner const Size aOutlinerTextSiz(rOutliner.GetPaperSize()); const basegfx::B2DVector aOutlinerScale(aOutlinerTextSiz.Width(), aOutlinerTextSiz.Height()); From 81c1316709e2f29670e9d5aaebe9b29bc92f2a5d Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 27 Oct 2009 16:20:25 +0000 Subject: [PATCH 081/117] CWS-TOOLING: integrate CWS ooo32gsl01 2009-10-13 15:59:25 +0200 hdu r276868 : #i100000# fix remaining merge conflict 2009-10-12 16:08:38 +0200 hdu r276837 : CWS-TOOLING: rebase CWS ooo32gsl01 to branches/OOO320@276773 (milestone: OOO320:m1) 2009-09-15 10:09:52 +0200 hdu r276150 : #i104861# adjust metrics to pseudo-emUnits==1000 expectation for better precision allow non-integer charwidth/stemwidth 2009-09-15 09:58:00 +0200 hdu r276149 : #i104861# prepare to fix by updating cff.cxx to latest version from CWS vcl105 2009-09-14 16:06:46 +0200 hdu r276130 : #i104221# treat judeo-spanish varika as diacritic also in problematic fonts (thanks yoramg) 2009-09-14 15:27:14 +0200 hdu r276126 : #i104221# fix regression with he/ar diacritics 2009-09-10 15:39:58 +0200 aw r276038 : #i104867# added a GraphicVersion number to EmbeddedObjectRef to allow Grahic chamge checks without fetching the graphic 2009-09-10 15:38:41 +0200 aw r276037 : #i104867# added GraphicVersionNumber to SdrOleContentPrimitive to detect OLE content change without getting the Graphic 2009-09-09 17:16:43 +0200 hdu r276006 : #i104886# Aqua: fix for 101491 only applies to non-hairlines 2009-09-09 16:39:05 +0200 hdu r276002 : #i99849# don't give up on ScriptItemize too early --- svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx | 7 +++++++ svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 5 +++++ svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx index 70e28d599a44..9ee4f3f69417 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx @@ -53,6 +53,11 @@ namespace drawinglayer SdrObjectWeakRef mpSdrOle2Obj; basegfx::B2DHomMatrix maObjectTransform; + // #i104867# The GraphicVersion number to identify in operator== if + // the graphic has changed, but without fetching it (which may + // be expensive, e.g. triggering chart creation) + sal_uInt32 mnGraphicVersion; + // bitfield unsigned mbHighContrast : 1; @@ -64,6 +69,7 @@ namespace drawinglayer SdrOleContentPrimitive2D( const SdrOle2Obj& rSdrOle2Obj, const basegfx::B2DHomMatrix& rObjectTransform, + sal_uInt32 nGraphicVersion, bool bHighContrast); // compare operator @@ -74,6 +80,7 @@ namespace drawinglayer // data access const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; } + sal_uInt32 getGraphicVersion() const { return mnGraphicVersion; } bool getHighContrast() const { return mbHighContrast; } // provide unique ID diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 3c239b12113c..a054e881b7c3 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -113,6 +113,11 @@ namespace sdr new drawinglayer::primitive2d::SdrOleContentPrimitive2D( GetOle2Obj(), aObjectMatrix, + + // #i104867# add GraphicVersion number to be able to check for + // content change in the primitive later + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), + bHighContrast)); // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index 67fee9215b73..e682c0e04b55 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -157,10 +157,12 @@ namespace drawinglayer SdrOleContentPrimitive2D::SdrOleContentPrimitive2D( const SdrOle2Obj& rSdrOle2Obj, const basegfx::B2DHomMatrix& rObjectTransform, + sal_uInt32 nGraphicVersion, bool bHighContrast) : BasePrimitive2D(), mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)), maObjectTransform(rObjectTransform), + mnGraphicVersion(nGraphicVersion), mbHighContrast(bHighContrast) { } @@ -176,6 +178,11 @@ namespace drawinglayer return ((bBothNot || bBothAndEqual) && getObjectTransform() == rCompare.getObjectTransform() + + // #i104867# to find out if the Graphic content of the + // OLE has changed, use GraphicVersion number + && getGraphicVersion() == rCompare.getGraphicVersion() + && getHighContrast() == rCompare.getHighContrast()); } From 9543c83ef655a978a66634e71267c26837a122cf Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Wed, 28 Oct 2009 07:12:38 +0000 Subject: [PATCH 082/117] #i105825# try catch in the wrong place --- connectivity/source/drivers/hsqldb/HDriver.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 4c9577497525..7e97d27e1d86 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -263,7 +263,8 @@ namespace connectivity ); aProperties.put( "SystemProperties", Sequence< NamedValue >( &aPermittedClasses, 1 ) ); - ::rtl::OUString sProperties( RTL_CONSTASCII_USTRINGPARAM( "properties" ) ); + const ::rtl::OUString sProperties( RTL_CONSTASCII_USTRINGPARAM( "properties" ) ); + ::rtl::OUString sMessage; try { if ( !bIsNewDatabase && xStorage->isStreamElement(sProperties) ) @@ -288,8 +289,7 @@ namespace connectivity || ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) ) { ::connectivity::SharedResources aResources; - const ::rtl::OUString sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION); - ::dbtools::throwGenericSQLException(sMessage ,*this); + sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION); } break; } @@ -302,6 +302,10 @@ namespace connectivity catch(Exception&) { } + if ( sMessage.getLength() ) + { + ::dbtools::throwGenericSQLException(sMessage ,*this); + } // readonly? Reference xProp(xStorage,UNO_QUERY); From a71e992f009725cab57f0b43627d91bfa1456942 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 28 Oct 2009 12:52:06 +0000 Subject: [PATCH 083/117] #i106146# fixed also the other 5 occourences of the same buggy code --- svx/source/cui/numpages.cxx | 77 +++++++++++++------------------------ 1 file changed, 26 insertions(+), 51 deletions(-) diff --git a/svx/source/cui/numpages.cxx b/svx/source/cui/numpages.cxx index 59e95b9b1a94..6454b3dd7c2a 100644 --- a/svx/source/cui/numpages.cxx +++ b/svx/source/cui/numpages.cxx @@ -378,18 +378,12 @@ int SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) void SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet ) { - const SfxPoolItem* pItem; -// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + + const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + pSaveNum = new SvxNumRule(*rItem.GetNumRule()); if(!pActNum) pActNum = new SvxNumRule(*pSaveNum); @@ -795,17 +789,12 @@ int SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) void SvxNumPickTabPage::Reset( const SfxItemSet& rSet ) { - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + + const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + pSaveNum = new SvxNumRule(*rItem.GetNumRule()); // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); if(!pActNum) @@ -1100,17 +1089,12 @@ BOOL SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet ) void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet ) { - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + + const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + pSaveNum = new SvxNumRule(*rItem.GetNumRule()); if(!pActNum) pActNum = new SvxNumRule(*pSaveNum); @@ -1532,17 +1516,12 @@ BOOL SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet ) --------------------------------------------------*/ void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) { - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + + const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + pSaveNum = new SvxNumRule(*rItem.GetNumRule()); // Ebenen einfuegen if(!aLevelLB.GetEntryCount()) @@ -1586,6 +1565,7 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) pPreviewWIN->SetNumRule(pActNum); aSameLevelCB.Check(pActNum->IsContinuousNumbering()); + const SfxPoolItem* pItem = 0; //ColorListBox bei Bedarf fuellen if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) ) { @@ -3429,17 +3409,12 @@ BOOL SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet ) --------------------------------------------------*/ void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet ) { - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); + nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + + const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + pSaveNum = new SvxNumRule(*rItem.GetNumRule()); // Ebenen einfuegen if(!aLevelLB.GetEntryCount()) From 399c758fd565fa692bf34eb542121827d5ad0f98 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Wed, 28 Oct 2009 16:00:22 +0000 Subject: [PATCH 084/117] #i106183# added fix as described tin task --- svx/source/svdraw/svdpage.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 05b5b5e5aca6..55e0347e6522 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -671,7 +671,13 @@ const Rectangle& SdrObjList::GetAllObjSnapRect() const const Rectangle& SdrObjList::GetAllObjBoundRect() const { - if (bRectsDirty) { + // #i106183# for deep group hierarchies like in chart2, the invalidates + // through the hierarchy are not correct; use a 2nd hint for the needed + // recalculation. Future versions will have no bool flag at all, but + // just aOutRect in empty state to representate an invalid state, thus + // it's a step in the right direction. + if (bRectsDirty || aOutRect.IsEmpty()) + { ((SdrObjList*)this)->RecalcRects(); ((SdrObjList*)this)->bRectsDirty=FALSE; } From d7c1cd7976cc346a7c9384dff41f06376126b38a Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 29 Oct 2009 13:22:30 +0000 Subject: [PATCH 085/117] CWS-TOOLING: integrate CWS c07v026_OOO320 2009-10-19 10:26:11 +0200 mav r277008 : #b6886425# use standard solution to encode the URL for the Gnome 2009-10-19 08:38:28 +0200 mav r276998 : #b6886425# encode the URL correctly for the Gnome 2009-10-07 12:49:32 +0200 os r276749 : #b6887668# resize items depending on the item text length 2009-09-28 18:42:32 +0200 dr r276499 : #b6883075# shrink print ranges to Excel sheet limits 2009-09-28 16:50:25 +0200 od r276497 : #b6882166# method - assure notification on position changes, otherwise the layout will not be correct. 2009-09-15 18:31:37 +0200 dr r276185 : #b6872823# check cursor before using, patch by aw 2009-09-09 10:52:52 +0200 od r275975 : #b6879723# correct handling of new list level attributes regarding paragraph indent values, especially in case of OOo 2.0 and former hidden compatibility option "Ignore first line indent on numbering" 2009-09-08 11:10:31 +0200 od r275918 : #b6876367# method - do not reset list attributes at paragraph, if its applied list style will not change due to the newly applied paragraph style. 2009-09-07 12:48:58 +0200 obo r275890 : Merge from c07v025 into this CWS --- fpicker/source/unx/gnome/SalGtkPicker.cxx | 13 +++++++++++-- sfx2/inc/sfx2/filedlghelper.hxx | 3 +++ svx/source/sdr/overlay/overlaymanagerbuffered.cxx | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx index b6b9d2bb36ab..cde61d801495 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -73,6 +73,8 @@ rtl::OUString SalGtkPicker::uritounicode(const gchar* pIn) INetURLObject aURL(sURL); if (INET_PROT_FILE == aURL.GetProtocol()) { + // all the URLs are handled by office in UTF-8 + // so the Gnome FP related URLs should be converted accordingly gchar *pEncodedFileName = g_filename_from_uri(pIn, NULL, NULL); if ( pEncodedFileName ) { @@ -94,12 +96,19 @@ rtl::OUString SalGtkPicker::uritounicode(const gchar* pIn) rtl::OString SalGtkPicker::unicodetouri(const rtl::OUString &rURL) { + // all the URLs are handled by office in UTF-8 ( and encoded with "%xx" codes based on UTF-8 ) + // so the Gnome FP related URLs should be converted accordingly OString sURL = OUStringToOString(rURL, RTL_TEXTENCODING_UTF8); INetURLObject aURL(rURL); if (INET_PROT_FILE == aURL.GetProtocol()) { - rtl::OUString sOUURL = aURL.getExternalURL(INetURLObject::DECODE_WITH_CHARSET, osl_getThreadTextEncoding()); - sURL = OUStringToOString( sOUURL, osl_getThreadTextEncoding()); + OUString aNewURL = Reference(Reference(comphelper::getProcessServiceFactory(), UNO_QUERY_THROW)->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uri.ExternalUriReferenceTranslator"))), UNO_QUERY_THROW)->translateToExternal( rURL ); + + if( aNewURL.getLength() ) + { + // At this point the URL should contain ascii characters only actually + sURL = OUStringToOString( aNewURL, osl_getThreadTextEncoding() ); + } } return sURL; } diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index e6dc185ef919..91be281e9617 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -240,6 +240,9 @@ public: /** Provides the selected files with full path information */ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const; + /** Provides the selected files with full path information */ + ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const; + void AddFilter( const String& rFilterName, const String& rExtension ); void SetCurrentFilter( const String& rFilter ); diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 3fedc40f37cf..13a83f0fc235 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -370,6 +370,9 @@ namespace sdr OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, getOutputDevice()); } + // #i80730# removed: VCL hack for transparent child windows + // No longer needed, checked in DEV300 m54 + // #i80730# restore visibility of VCL cursor if(bCursorWasEnabled) { From c2553d20b70d349d221bce57367dc8519c435998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20V=C3=B6lzke?= Date: Thu, 29 Oct 2009 14:49:54 +0000 Subject: [PATCH 086/117] #i106129# Some changes to support 64Bit Windows --- shell/inc/internal/config.hxx | 5 +++++ shell/inc/internal/utilities.hxx | 20 +++++++++++++++++++ .../win32/shlxthandler/infotips/infotips.cxx | 2 ++ shell/source/win32/shlxthandler/makefile.mk | 1 + .../shlxthandler/propsheets/propsheets.cxx | 3 --- .../source/win32/shlxthandler/res/makefile.mk | 10 ++++++++++ .../shlxthandler/thumbviewer/thumbviewer.cxx | 18 ++++++++++------- .../win32/shlxthandler/util/utilities.cxx | 15 +++----------- 8 files changed, 52 insertions(+), 22 deletions(-) diff --git a/shell/inc/internal/config.hxx b/shell/inc/internal/config.hxx index 47394730c761..e9b3e0fd59ac 100644 --- a/shell/inc/internal/config.hxx +++ b/shell/inc/internal/config.hxx @@ -39,8 +39,13 @@ #include #endif +#ifdef _AMD64_ +#define MODULE_NAME TEXT("shlxthdl_x64.dll") +#define MODULE_NAME_FILTER TEXT("ooofilt_x64.dll") +#else #define MODULE_NAME TEXT("shlxthdl.dll") #define MODULE_NAME_FILTER TEXT("ooofilt.dll") +#endif #define COLUMN_HANDLER_DESCRIPTIVE_NAME TEXT("OpenOffice.org Column Handler") #define INFOTIP_HANDLER_DESCRIPTIVE_NAME TEXT("OpenOffice.org Infotip Handler") diff --git a/shell/inc/internal/utilities.hxx b/shell/inc/internal/utilities.hxx index a552516400bc..f0f7022dc02c 100644 --- a/shell/inc/internal/utilities.hxx +++ b/shell/inc/internal/utilities.hxx @@ -47,6 +47,7 @@ #include "internal/types.hxx" #include +#include //--------------------------------- /** Convert a string to a wstring @@ -89,4 +90,23 @@ bool HasOnlySpaces(const std::wstring& String); LCID LocaleSetToLCID( const LocaleSet_t & Locale ); #endif +//---------------------------------------------------------- +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCSTR pFormat, ... ) +{ + CHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintfA( buffer, sizeof(buffer), pFormat, args ); + OutputDebugStringA( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCSTR, ... ) +{ +} +#endif +//---------------------------------------------------------- + + #endif diff --git a/shell/source/win32/shlxthandler/infotips/infotips.cxx b/shell/source/win32/shlxthandler/infotips/infotips.cxx index 304bff841dbd..da6974d4399d 100644 --- a/shell/source/win32/shlxthandler/infotips/infotips.cxx +++ b/shell/source/win32/shlxthandler/infotips/infotips.cxx @@ -45,6 +45,8 @@ #include #include #include + + #define MAX_STRING 80 #define KB 1024.0 const std::wstring WSPACE = std::wstring(SPACE); diff --git a/shell/source/win32/shlxthandler/makefile.mk b/shell/source/win32/shlxthandler/makefile.mk index 158e296c120a..479f8c0b6cd9 100644 --- a/shell/source/win32/shlxthandler/makefile.mk +++ b/shell/source/win32/shlxthandler/makefile.mk @@ -133,6 +133,7 @@ SHL1LIBS_X64+=$(SLB_X64)$/util.lib\ $(SLB_X64)$/ooofilereader.lib SHL1OBJS_X64=$(SLOFILES_X64) SHL1DEF_X64=$(MISC_X64)$/$(SHL1TARGET).def +SHL1RES_X64=$(RES_X64)$/$(TARGET).res DEF1NAME_X64=$(SHL1TARGET_X64) DEF1EXPORTFILE_X64=exports.dxp diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx index 171bc287715f..d854694d8394 100644 --- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx +++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx @@ -177,7 +177,6 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize( HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) { - PROPSHEETPAGE psp; // add the summary property page @@ -309,7 +308,6 @@ BOOL CALLBACK CPropertySheet::PropPageStatisticsProc(HWND hwnd, UINT uiMsg, WPAR //################################## void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/) { - CMetaInfoReader metaInfo(m_szFileName); SetWindowText(GetDlgItem(hwnd,IDC_TITLE), metaInfo.getTagData( META_INFO_TITLE ).c_str() ); @@ -335,7 +333,6 @@ void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/) */ void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/) { - CMetaInfoReader metaInfo(m_szFileName); document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, &metaInfo); diff --git a/shell/source/win32/shlxthandler/res/makefile.mk b/shell/source/win32/shlxthandler/res/makefile.mk index 08893506b2d2..8f8c77638387 100644 --- a/shell/source/win32/shlxthandler/res/makefile.mk +++ b/shell/source/win32/shlxthandler/res/makefile.mk @@ -53,9 +53,19 @@ ULFDIR:=$(COMMONMISC)$/$(TARGET) .ELSE # "$(WITH_LANG)"!="" ULFDIR:=. .ENDIF # "$(WITH_LANG)"!="" + # --- Targets ------------------------------------------------------ +.IF "$(BUILD_X64)"!="" +$(RES)$/x64$/$(TARGET).res : $(RES)$/$(TARGET).res + -$(MKDIR) $(RES)$/x64 + @@cp $< $@ +.ENDIF # "$(BUILD_X64)"!="" + +.INCLUDE : set_wntx64.mk .INCLUDE : target.mk +.INCLUDE : tg_wntx64.mk + # Generate the native Windows resource file diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx index 35d155b6c22d..6315a719a62e 100644 --- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx +++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx @@ -30,19 +30,21 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_shell.hxx" + #include "internal/global.hxx" #ifndef INFOTIPS_HXX_INCLUDED #include "internal/thumbviewer.hxx" #endif #include "internal/shlxthdl.hxx" -#include "internal/utilities.hxx" #include "internal/registry.hxx" #include "internal/fileextensions.hxx" #include "internal/config.hxx" #include "internal/zipfile.hxx" +#include "internal/utilities.hxx" #include "internal/resource.h" + #include #include #include @@ -212,15 +214,15 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Read(void *pv, ULONG cb, ULONG *pcb HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *) { - size_t size = ref_zip_buffer_.size(); - size_t p = 0; + __int64 size = (__int64) ref_zip_buffer_.size(); + __int64 p = 0; switch (dwOrigin) { case STREAM_SEEK_SET: break; case STREAM_SEEK_CUR: - p = pos_; + p = (__int64) pos_; break; case STREAM_SEEK_END: p = size - 1; @@ -229,10 +231,11 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Seek(LARGE_INTEGER dlibMove, DWORD HRESULT hr = STG_E_INVALIDFUNCTION; - p += dlibMove.LowPart; - if (p < size) + p += dlibMove.QuadPart; + + if ( ( p >= 0 ) && (p < size) ) { - pos_ = p; + pos_ = (size_t) p; hr = S_OK; } return hr; @@ -468,6 +471,7 @@ HRESULT STDMETHODCALLTYPE CThumbviewer::Extract(HBITMAP *phBmpImage) } catch(std::exception&) { + OutputDebugStringFormat( "CThumbviewer Extract ERROR!\n" ); hr = E_FAIL; } return hr; diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx index 36c19dd0c500..f2ae6238715a 100644 --- a/shell/source/win32/shlxthandler/util/utilities.cxx +++ b/shell/source/win32/shlxthandler/util/utilities.cxx @@ -32,12 +32,9 @@ #include "precompiled_shell.hxx" -#include "internal/utilities.hxx" #include "internal/config.hxx" #include "internal/dbgmacros.hxx" - - - +#include "internal/utilities.hxx" //----------------------------- // constants @@ -87,15 +84,9 @@ std::wstring GetResString(int ResId) { wchar_t szResStr[MAX_RES_STRING]; - #if OSL_DEBUG_LEVEL > 0 - int rc = - #endif - LoadStringW( - GetModuleHandleW(MODULE_NAME), - ResId, - szResStr, - sizeof(szResStr)); + int rc = LoadStringW( GetModuleHandleW(MODULE_NAME), ResId, szResStr, sizeof(szResStr) ); + OutputDebugStringFormat( "GetResString: read %d chars\n", rc ); ENSURE(rc, "String resource not found"); return std::wstring(szResStr); From fc02f9b3673187ccada1a09f79ad042065578af0 Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Fri, 30 Oct 2009 13:46:50 +0000 Subject: [PATCH 087/117] #i105959# replace boolean_term with search_condition and add extra () --- connectivity/source/parse/sqlnode.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index a1fd44014314..8d869c2dea0a 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -2074,18 +2074,18 @@ void OSQLParseNode::absorptions(OSQLParseNode*& pSearchCondition) if ( SQL_ISRULE(p2ndSearch,boolean_primary) ) p2ndSearch = p2ndSearch->getChild(1); - if ( *p2ndSearch->getChild(0) == *pSearchCondition->getChild(2-nPos) ) + if ( *p2ndSearch->getChild(0) == *pSearchCondition->getChild(2-nPos) ) // a and ( a or b) -> a or b { pNewNode = pSearchCondition->removeAt((sal_uInt32)0); replaceAndReset(pSearchCondition,pNewNode); } - else if ( *p2ndSearch->getChild(2) == *pSearchCondition->getChild(2-nPos) ) + else if ( *p2ndSearch->getChild(2) == *pSearchCondition->getChild(2-nPos) ) // a and ( b or a) -> a or b { pNewNode = pSearchCondition->removeAt((sal_uInt32)2); replaceAndReset(pSearchCondition,pNewNode); } - else if ( p2ndSearch->getByRule(OSQLParseNode::boolean_term) ) + else if ( p2ndSearch->getByRule(OSQLParseNode::search_condition) ) { // a and ( b or c ) -> ( a and b ) or ( a and c ) // ( b or c ) and a -> ( a and b ) or ( a and c ) @@ -2096,7 +2096,13 @@ void OSQLParseNode::absorptions(OSQLParseNode*& pSearchCondition) OSQLParseNode* p1stAnd = MakeANDNode(pA,pB); OSQLParseNode* p2ndAnd = MakeANDNode(new OSQLParseNode(*pA),pC); pNewNode = MakeORNode(p1stAnd,p2ndAnd); - replaceAndReset(pSearchCondition,pNewNode); + OSQLParseNode* pNode = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); + pNode->append(new OSQLParseNode(::rtl::OUString::createFromAscii("("),SQL_NODE_PUNCTUATION)); + pNode->append(pNewNode); + pNode->append(new OSQLParseNode(::rtl::OUString::createFromAscii(")"),SQL_NODE_PUNCTUATION)); + OSQLParseNode::eraseBraces(p1stAnd); + OSQLParseNode::eraseBraces(p2ndAnd); + replaceAndReset(pSearchCondition,pNode); } } // a or a and b || a or b and a From e79a80fe458991d9e6061b54bf8748486c416b4f Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Sun, 1 Nov 2009 07:56:23 +0000 Subject: [PATCH 088/117] #105892# deliver new x64 libs to solver and made the client name of the ooofiltproxy depends to x86/x64 builds --- shell/prj/d.lst | 3 +++ .../source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/prj/d.lst b/shell/prj/d.lst index 98d4a6215faf..d623a55c2d6c 100644 --- a/shell/prj/d.lst +++ b/shell/prj/d.lst @@ -4,6 +4,9 @@ ..\%__SRC%\lib\*.uno.so %_DEST%\lib%_EXT%\*.uno.so ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll ..\%__SRC%\bin\*.exe %_DEST%\bin%_EXT%\*.exe +..\%__SRC%\bin\x64\shlxthdl.dll %_DEST%\bin%_EXT%\shlxthdl_x64.dll +..\%__SRC%\bin\x64\ooofiltproxy.dll %_DEST%\bin%_EXT%\ooofiltproxy_x64.dll +..\%__SRC%\bin\x64\ooofilt.dll %_DEST%\bin%_EXT%\ooofilt_x64.dll ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a diff --git a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx index 879cf8c0115b..218ba500d368 100644 --- a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx +++ b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx @@ -42,6 +42,7 @@ #ifdef __MINGW32__ #include #endif +#include "internal/config.hxx" /* @@ -88,7 +89,8 @@ void Init() TCHAR buff[MAX_PATH]; GetModuleFileName(hThisLibrary, buff, (sizeof(buff)/sizeof(TCHAR))); PathTruncateFileName(buff); - lstrcat(buff, TEXT("ooofilt.dll")); + + lstrcat(buff, MODULE_NAME_FILTER); hOoofilt = LoadLibraryEx(buff, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); From 9af74059bc2da889f2f17e5c69c61e213158c4ec Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 2 Nov 2009 11:06:59 +0100 Subject: [PATCH 089/117] sb117: #160937# removed unused special configuration data settings --- .../registry/data/org/openoffice/Inet.xcu | 5 ---- .../data/org/openoffice/Office/Writer.xcu | 27 ------------------- .../data/org/openoffice/Office/makefile.mk | 2 -- .../registry/data/org/openoffice/makefile.mk | 1 - 4 files changed, 35 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/Inet.xcu b/officecfg/registry/data/org/openoffice/Inet.xcu index bb3fa8e1a618..58c0df52dd4c 100644 --- a/officecfg/registry/data/org/openoffice/Inet.xcu +++ b/officecfg/registry/data/org/openoffice/Inet.xcu @@ -35,11 +35,6 @@ 1 - - - Google - - diff --git a/officecfg/registry/data/org/openoffice/Office/Writer.xcu b/officecfg/registry/data/org/openoffice/Office/Writer.xcu index d0eb8273fde3..0e01200a0215 100644 --- a/officecfg/registry/data/org/openoffice/Office/Writer.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Writer.xcu @@ -702,33 +702,6 @@ - - - - true - - - 3 - - - - - - Arial - - - Arial - - - Arial - - - Arial - - - Arial - - diff --git a/officecfg/registry/data/org/openoffice/Office/makefile.mk b/officecfg/registry/data/org/openoffice/Office/makefile.mk index 50b67954aeef..e8753721d678 100644 --- a/officecfg/registry/data/org/openoffice/Office/makefile.mk +++ b/officecfg/registry/data/org/openoffice/Office/makefile.mk @@ -89,8 +89,6 @@ MODULEFILES= \ Paths-macosx.xcu \ Paths-unxwnt.xcu \ Writer-cjk.xcu \ - Writer-defaultfontarial.xcu \ - Writer-directcursor.xcu \ Writer-javamail.xcu \ Impress-ogltrans.xcu \ Embedding-calc.xcu \ diff --git a/officecfg/registry/data/org/openoffice/makefile.mk b/officecfg/registry/data/org/openoffice/makefile.mk index 6d5a1b264d8c..b953c9b1cd63 100644 --- a/officecfg/registry/data/org/openoffice/makefile.mk +++ b/officecfg/registry/data/org/openoffice/makefile.mk @@ -47,7 +47,6 @@ XCUFILES= \ UserProfile.xcu MODULEFILES= \ - Inet-defaultsearchengine.xcu \ Setup-brand.xcu \ Setup-writer.xcu \ Setup-calc.xcu \ From b9f41c75e4e70579e49c4dfefb37b1f953a77cd0 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Mon, 2 Nov 2009 16:16:04 +0100 Subject: [PATCH 090/117] ause109: #i106513# - fix dependency for classfiles that can't be build here --- xmlhelp/source/com/sun/star/help/makefile.mk | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/xmlhelp/source/com/sun/star/help/makefile.mk b/xmlhelp/source/com/sun/star/help/makefile.mk index 1e1a2c518fa0..db6e619b31e3 100644 --- a/xmlhelp/source/com/sun/star/help/makefile.mk +++ b/xmlhelp/source/com/sun/star/help/makefile.mk @@ -58,8 +58,6 @@ CFLAGS+=-DSYSTEM_EXPAT JAVACLASSFILES = \ - $(SOLARBINDIR)$/help$/$(PACKAGE)$/HelpIndexerTool.class \ - $(SOLARBINDIR)$/help$/$(PACKAGE)$/HelpFileDocument.class \ $(CLASSDIR)$/$(PACKAGE)$/HelpSearch.class \ $(CLASSDIR)$/$(PACKAGE)$/HelpComponent.class \ $(CLASSDIR)$/$(PACKAGE)$/HelpIndexer.class @@ -75,9 +73,7 @@ TRANSEX3FILES = \ ADDFILES = $(subst,$(SOLARBINDIR)$/help,$(CLASSDIR) $(TRANSEX3FILES)) -#JAVAFILES = $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) - -JARFILES = ridl.jar jurt.jar unoil.jar juh.jar HelpIndexerTool.jar +JARFILES = ridl.jar jurt.jar unoil.jar juh.jar .IF "$(SYSTEM_LUCENE)" == "YES" XCLASSPATH!:=$(XCLASSPATH)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR) COMP=fix_system_lucene @@ -96,6 +92,7 @@ CUSTOMMANIFESTFILE = MANIFEST.MF ALLTAR : $(ADDFILES) .IF "$(JARTARGETN)"!="" +$(JAVATARGET) : $(ADDFILES) $(JARTARGETN) : $(ADDFILES) $(JARTARGETN) : $(COMP) .ENDIF From aa6853dcd64446f8e246484c1227192825d33ecb Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 3 Nov 2009 18:12:19 +0100 Subject: [PATCH 091/117] #i104678# use high contrast mode setting instead of IsDark (paradigm shift begun with issue i35482) --- .../deployment/gui/dp_gui_extlistbox.cxx | 2 +- .../source/deployment/gui/license_dialog.cxx | 2 +- fpicker/source/office/iodlg.cxx | 4 ++-- fpicker/source/office/iodlgimp.cxx | 4 ++-- sfx2/source/appl/newhelp.cxx | 6 +++--- sfx2/source/dialog/templdlg.cxx | 4 ++-- sfx2/source/doc/docvor.cxx | 6 +++--- sfx2/source/menu/mnuitem.cxx | 4 ++-- sfx2/source/menu/virtmenu.cxx | 6 +----- sfx2/source/toolbox/imgmgr.cxx | 4 ++-- sfx2/source/toolbox/tbxitem.cxx | 6 +++--- svx/source/cui/SpellDialog.cxx | 6 +++--- svx/source/cui/align.cxx | 2 +- svx/source/cui/border.cxx | 8 ++++---- svx/source/cui/cfg.cxx | 11 ++++------- svx/source/cui/labdlg.cxx | 2 +- svx/source/cui/macropg.cxx | 4 +--- svx/source/cui/optcolor.cxx | 2 +- svx/source/cui/optsave.cxx | 2 +- svx/source/cui/readonlyimage.cxx | 2 +- svx/source/cui/tphatch.cxx | 4 ++-- svx/source/cui/tpline.cxx | 2 +- svx/source/cui/treeopt.cxx | 4 ++-- svx/source/dialog/_bmpmask.cxx | 2 +- svx/source/dialog/_contdlg.cxx | 2 +- svx/source/dialog/connctrl.cxx | 2 +- svx/source/dialog/dlgctrl.cxx | 6 +++--- svx/source/dialog/docrecovery.cxx | 4 +--- svx/source/dialog/fontwork.cxx | 4 +--- svx/source/dialog/frmsel.cxx | 2 +- svx/source/dialog/hyprlink.cxx | 5 +---- svx/source/dialog/imapdlg.cxx | 2 +- svx/source/dialog/langbox.cxx | 2 +- svx/source/dialog/measctrl.cxx | 4 ++-- svx/source/dialog/swframeexample.cxx | 2 +- svx/source/form/datanavi.cxx | 6 +++--- svx/source/form/fmshimp.cxx | 4 ++-- svx/source/form/tbxform.cxx | 2 +- svx/source/gallery2/galbrws2.cxx | 2 +- svx/source/stbctrls/xmlsecctrl.cxx | 8 ++++---- svx/source/stbctrls/zoomsliderctrl.cxx | 8 ++++---- svx/source/tbxctrls/extrusioncontrols.cxx | 18 +++++++++--------- svx/source/tbxctrls/fontworkgallery.cxx | 8 ++++---- svx/source/tbxctrls/itemwin.cxx | 4 ++-- svx/source/tbxctrls/tbcontrl.cxx | 2 +- svx/source/tbxctrls/tbxcolorupdate.cxx | 6 +++--- 46 files changed, 93 insertions(+), 109 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index f4473c2c6fd8..36f08dbf5b32 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -1141,7 +1141,7 @@ void ExtensionBox_Impl::checkEntries() //------------------------------------------------------------------------------ bool ExtensionBox_Impl::isHCMode() { - return (bool)GetDisplayBackground().GetColor().IsDark(); + return (bool)GetSettings().GetStyleSettings().GetHighContrastMode(); } //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index bbc6a983c1fd..555b7578b327 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -215,7 +215,7 @@ LicenseDialogImpl::LicenseDialogImpl( { - if (GetBackground().GetColor().IsDark()) + if (GetSettings().GetStyleSettings().GetHighContrastMode()) { // high contrast mode needs other images m_fiArrow1.SetImage(Image(DpGuiResId(IMG_LICENCE_ARROW_HC))); diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 1b9494bdae22..5470df6fe409 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -560,7 +560,7 @@ void SvtFileDialog::Init_Impl WinBits nStyle ) { - sal_Bool bIsHighContrast = GetDisplayBackground().GetColor().IsDark(); + sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); m_aImages = ImageList( SvtResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) ); _pImp->_nStyle = nStyle; @@ -2683,7 +2683,7 @@ void SvtFileDialog::implUpdateImages( ) { // determine high contrast mode { - sal_Bool bIsHighContrast = GetDisplayBackground().GetColor().IsDark(); + sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); m_aImages = ImageList( SvtResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) ); } diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index 3a34c1da7be6..4d217f518547 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -231,7 +231,7 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu ) ::svtools::VolumeInfo aVolInfo( sal_True /* volume */, sal_False /* remote */, sal_False /* removable */, sal_False /* floppy */, sal_False /* compact disk */ ); - sal_Bool bIsHighContrast = pBox->GetDisplayBackground().GetColor().IsDark(); + sal_Bool bIsHighContrast = pBox->GetSettings().GetStyleSettings().GetHighContrastMode(); Image aVolumeImage( SvFileInformationManager::GetFolderImage( aVolInfo, bIsHighContrast ) ); while ( nCount >= 1 ) @@ -319,7 +319,7 @@ void SvtTravelButton_Impl::FillURLMenu( PopupMenu* _pMenu ) _pMenu->Clear(); - sal_Bool bIsHighContrast = GetDialogParent()->GetView()->GetDisplayBackground().GetColor().IsDark(); + sal_Bool bIsHighContrast = GetDialogParent()->GetView()->GetSettings().GetStyleSettings().GetHighContrastMode(); USHORT nItemId = 1; String sDisplayName; diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 5051f71ab78e..df47180c9f77 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -296,7 +296,7 @@ ContentListBox_Impl::ContentListBox_Impl( Window* pParent, const ResId& rResId ) aDocumentImage ( SfxResId( IMG_HELP_CONTENT_DOC ) ) { - if ( GetSettings().GetStyleSettings().GetWindowColor().IsDark() ) + if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) { aOpenBookImage = Image( SfxResId( IMG_HELP_CONTENT_BOOK_OPEN_HC ) ); aClosedBookImage = Image( SfxResId( IMG_HELP_CONTENT_BOOK_CLOSED_HC ) ); @@ -2178,7 +2178,7 @@ sal_Bool SfxHelpTextWindow_Impl::HasSelection() const void SfxHelpTextWindow_Impl::InitToolBoxImages() { sal_Bool bLarge = SvtMiscOptions().AreCurrentSymbolsLarge(); - sal_Bool bHiContrast = GetBackground().GetColor().IsDark(); + sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); aIndexOnImage = Image( SfxResId( bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_INDEX_ON : IMG_HELP_TOOLBOX_L_INDEX_ON @@ -2584,7 +2584,7 @@ long SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt ) if ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU && pCmdWin != this && pCmdWin != &aToolBox ) { - sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetMenuColor().IsDark(); + sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); Point aPos; if ( pCmdEvt->IsMouseEvent() ) aPos = pCmdEvt->GetMousePosPixel(); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 706739cd0571..fb21ff8463a1 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -2407,7 +2407,7 @@ void SfxTemplateDialog_Impl::updateFamilyImages() return; // let the families collection update the images - sal_Bool bIsHighContrast = m_pFloat->GetDisplayBackground().GetColor().IsDark(); + sal_Bool bIsHighContrast = m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode(); pStyleFamilies->updateImages( *m_pStyleFamiliesId, bIsHighContrast ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL ); // and set the new images on our toolbox @@ -2424,7 +2424,7 @@ void SfxTemplateDialog_Impl::updateFamilyImages() void SfxTemplateDialog_Impl::updateNonFamilyImages() { m_aActionTbR.SetImageList( ImageList( SfxResId( - m_pFloat->GetDisplayBackground().GetColor().IsDark() ? IMG_LST_STYLE_DESIGNER_HC + m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_LST_STYLE_DESIGNER_HC : DLG_STYLE_DESIGNER ) ) ); } diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx index e70824869070..d0c10556abd3 100644 --- a/sfx2/source/doc/docvor.cxx +++ b/sfx2/source/doc/docvor.cxx @@ -1188,7 +1188,7 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry ) // einfuegen BmpColorMode eColorMode = BMP_COLOR_NORMAL; - if ( GetDisplayBackground().GetColor().IsDark() ) + if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) eColorMode = BMP_COLOR_HIGHCONTRAST; @@ -1480,7 +1480,7 @@ const Image &SfxOrganizeListBox_Impl::GetClosedBmp(USHORT nLevel) const */ { - BOOL bHC = GetBackground().GetColor().IsDark(); + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); const Image* pRet = NULL; switch( nLevel ) @@ -1514,7 +1514,7 @@ const Image &SfxOrganizeListBox_Impl::GetOpenedBmp(USHORT nLevel) const */ { - BOOL bHC = GetBackground().GetColor().IsDark(); + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); const Image* pRet = NULL; switch( nLevel ) diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index 988bbf3b4118..6619c17d3077 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -451,7 +451,7 @@ SfxAppMenuControl_Impl::SfxAppMenuControl_Impl( // Determine the current background color setting for menus const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); m_nSymbolsStyle = rSettings.GetSymbolsStyle(); - m_bWasHiContrastMode = rSettings.GetMenuColor().IsDark(); + m_bWasHiContrastMode = rSettings.GetHighContrastMode(); m_bShowMenuImages = rSettings.GetUseImagesInMenus(); Reference aXMultiServiceFactory(::comphelper::getProcessServiceFactory()); @@ -477,7 +477,7 @@ IMPL_LINK( SfxAppMenuControl_Impl, Activate, Menu *, pActMenu ) { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); ULONG nSymbolsStyle = rSettings.GetSymbolsStyle(); - BOOL bIsHiContrastMode = rSettings.GetMenuColor().IsDark(); + BOOL bIsHiContrastMode = rSettings.GetHighContrastMode(); BOOL bShowMenuImages = rSettings.GetUseImagesInMenus(); if (( nSymbolsStyle != m_nSymbolsStyle ) || diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index 88c9ba8aa757..e0b6f6f32bf2 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -336,11 +336,7 @@ SfxVirtualMenu::~SfxVirtualMenu() BOOL SfxVirtualMenu::IsHiContrastMode() const { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - Color aMenuColor = rSettings.GetMenuColor(); - if ( aMenuColor.IsDark() ) - return TRUE; - else - return FALSE; + return rSettings.GetHighContrastMode(); } //-------------------------------------------------------------------- diff --git a/sfx2/source/toolbox/imgmgr.cxx b/sfx2/source/toolbox/imgmgr.cxx index 6f00ae5b7681..0d659826d453 100644 --- a/sfx2/source/toolbox/imgmgr.cxx +++ b/sfx2/source/toolbox/imgmgr.cxx @@ -229,7 +229,7 @@ void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize ) if ( pInf->nFlags & SFX_TOOLBOX_CHANGESYMBOLSET ) { ToolBox *pBox = pInf->pToolBox; - BOOL bHiContrast = pBox->GetBackground().GetColor().IsDark(); + BOOL bHiContrast = pBox->GetSettings().GetStyleSettings().GetHighContrastMode(); USHORT nCount = pBox->GetItemCount(); for ( USHORT nPos=0; nPosm_nSymbolsSize == SFX_SYMBOLS_SIZE_LARGE ); - BOOL bHiContrast = rToolBox.GetBackground().GetColor().IsDark(); + BOOL bHiContrast = rToolBox.GetSettings().GetStyleSettings().GetHighContrastMode(); SetImagesForceSize( rToolBox, bHiContrast, bLarge ); } diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 6a776f6a211e..b6e69156214d 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -1529,7 +1529,7 @@ SfxAppToolBoxControl_Impl::SfxAppToolBoxControl_Impl( USHORT nSlotId, USHORT nId // Determine the current background color of the menus const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); m_nSymbolsStyle = rSettings.GetSymbolsStyle(); - m_bWasHiContrastMode = rSettings.GetMenuColor().IsDark(); + m_bWasHiContrastMode = rSettings.GetHighContrastMode(); m_bShowMenuImages = rSettings.GetUseImagesInMenus(); SetImage( String() ); @@ -1654,7 +1654,7 @@ void SfxAppToolBoxControl_Impl::SetImage( const String &rURL ) aURL = sFallback; BOOL bBig = SvtMiscOptions().AreCurrentSymbolsLarge(); - BOOL bHC = GetToolBox().GetBackground().GetColor().IsDark(); + BOOL bHC = GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode(); Image aImage = SvFileInformationManager::GetImageNoDefault( INetURLObject( aURL ), bBig, bHC ); if ( !aImage ) aImage = !!aMenuImage ? aMenuImage : @@ -1805,7 +1805,7 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); ULONG nSymbolsStyle = rSettings.GetSymbolsStyle(); - BOOL bIsHiContrastMode = rSettings.GetMenuColor().IsDark(); + BOOL bIsHiContrastMode = rSettings.GetHighContrastMode(); BOOL bShowMenuImages = rSettings.GetUseImagesInMenus(); if (( nSymbolsStyle != m_nSymbolsStyle ) || diff --git a/svx/source/cui/SpellDialog.cxx b/svx/source/cui/SpellDialog.cxx index 3febb657ded2..86dbf966619a 100644 --- a/svx/source/cui/SpellDialog.cxx +++ b/svx/source/cui/SpellDialog.cxx @@ -914,7 +914,7 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang) const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); if( pSpellErrorDescription && pSpellErrorDescription->sServiceName.getLength() ) { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); ::rtl::OUString sSuggestionImageUrl = SvtLinguConfig().GetSpellAndGrammarDialogImage( pSpellErrorDescription->sServiceName, bHighContrast ); aVendorImageFI.SetImage( lcl_GetImageFromPngUrl( sSuggestionImageUrl ) ); @@ -924,7 +924,7 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang) } else { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); aVendorImageFI.SetImage( bHighContrast ? aVendorImageHC : aVendorImage ); } @@ -935,7 +935,7 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang) } else { - //bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + //bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); sTitle = m_sTitleSpellingGrammar; } } diff --git a/svx/source/cui/align.cxx b/svx/source/cui/align.cxx index e6e65efc31f2..641ee0717b96 100644 --- a/svx/source/cui/align.cxx +++ b/svx/source/cui/align.cxx @@ -248,7 +248,7 @@ void AlignmentTabPage::InitVsRefEgde() // remember selection - is deleted in call to ValueSet::Clear() USHORT nSel = maVsRefEdge.GetSelectItemId(); - ResId aResId( GetBackground().GetColor().IsDark() ? IL_LOCK_BMPS_HC : IL_LOCK_BMPS, DIALOG_MGR() ); + ResId aResId( GetSettings().GetStyleSettings().GetHighContrastMode() ? IL_LOCK_BMPS_HC : IL_LOCK_BMPS, DIALOG_MGR() ); ImageList aImageList( aResId ); Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() ); diff --git a/svx/source/cui/border.cxx b/svx/source/cui/border.cxx index b2ed7bc9ef02..101afc828371 100644 --- a/svx/source/cui/border.cxx +++ b/svx/source/cui/border.cxx @@ -1033,8 +1033,8 @@ USHORT SvxBorderTabPage::GetPresetStringId( USHORT nValueSetIdx ) const void SvxBorderTabPage::FillPresetVS() { // find correct image list - bool bDark = aWndPresets.GetDisplayBackground().GetColor().IsDark(); - ImageList& rImgList = bDark ? aBorderImgLstH : aBorderImgLst; + bool bHC = aWndPresets.GetSettings().GetStyleSettings().GetHighContrastMode(); + ImageList& rImgList = bHC ? aBorderImgLstH : aBorderImgLst; Size aImgSize( rImgList.GetImage( IID_PRE_CELL_NONE ).GetSizePixel() ); // basic initialization of the ValueSet @@ -1060,8 +1060,8 @@ void SvxBorderTabPage::FillPresetVS() void SvxBorderTabPage::FillShadowVS() { // find correct image list - bool bDark = aWndShadows.GetDisplayBackground().GetColor().IsDark(); - ImageList& rImgList = bDark ? aShadowImgLstH : aShadowImgLst; + bool bHC = aWndPresets.GetSettings().GetStyleSettings().GetHighContrastMode(); + ImageList& rImgList = bHC ? aShadowImgLstH : aShadowImgLst; Size aImgSize( rImgList.GetImage( IID_SHADOWNONE ).GetSizePixel() ); // basic initialization of the ValueSet diff --git a/svx/source/cui/cfg.cxx b/svx/source/cui/cfg.cxx index 346fb0bb5d1e..5df1e03edb53 100644 --- a/svx/source/cui/cfg.cxx +++ b/svx/source/cui/cfg.cxx @@ -403,7 +403,7 @@ void InitImageType() Window* topwin = Application::GetActiveTopWindow(); if ( topwin != NULL && - topwin->GetDisplayBackground().GetColor().IsDark() ) + topwin->GetSettings().GetStyleSettings().GetHighContrastMode() ) { theImageType |= css::ui::ImageType::COLOR_HIGHCONTRAST; } @@ -5114,7 +5114,7 @@ SvxToolbarEntriesListBox::SvxToolbarEntriesListBox( BuildCheckBoxButtonImages( m_pButtonData ); EnableCheckButton( m_pButtonData ); - m_bHiContrastMode = GetDisplayBackground().GetColor().IsDark(); + m_bHiContrastMode = GetSettings().GetStyleSettings().GetHighContrastMode(); } // -------------------------------------------------------- @@ -5189,11 +5189,8 @@ void SvxToolbarEntriesListBox::DataChanged( const DataChangedEvent& rDCEvt ) if (( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE )) { - if ( m_bHiContrastMode != GetDisplayBackground().GetColor().IsDark() ) - { - // We have to reset all images because we change to/from high contrast mode - m_bHiContrastMode = GetDisplayBackground().GetColor().IsDark(); - } + // We have to reset all images because we change to/from high contrast mode + m_bHiContrastMode = GetSettings().GetStyleSettings().GetHighContrastMode(); BuildCheckBoxButtonImages( m_pButtonData ); Invalidate(); diff --git a/svx/source/cui/labdlg.cxx b/svx/source/cui/labdlg.cxx index 02a3bd158c79..327300d3a603 100644 --- a/svx/source/cui/labdlg.cxx +++ b/svx/source/cui/labdlg.cxx @@ -574,7 +574,7 @@ void SvxCaptionTabPage::DataChanged( const DataChangedEvent& rDCEvt ) void SvxCaptionTabPage::FillValueSet() { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); Image** ppBitmaps = bHighContrast ? mpBmpCapTypesH : mpBmpCapTypes; aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_1, *(ppBitmaps[0]) ); diff --git a/svx/source/cui/macropg.cxx b/svx/source/cui/macropg.cxx index 0ee76246abe3..bda5aca7372b 100644 --- a/svx/source/cui/macropg.cxx +++ b/svx/source/cui/macropg.cxx @@ -494,9 +494,7 @@ void IconLBoxString::Paint( const Point& aPos, SvLBox& aDevice, sal_Int32 nIndex = aURL.indexOf( aVndSunStarUNO ); bool bUNO = nIndex == 0; - Wallpaper aBackground = aDevice.GetBackground(); - Color aColor = aBackground.GetColor(); - BOOL bHC = aColor.IsDark(); + BOOL bHC = aDevice.GetSettings().GetStyleSettings().GetHighContrastMode(); const Image* pImg; if( bHC ) pImg = bUNO ? m_pComponentImg_h : m_pMacroImg_h; diff --git a/svx/source/cui/optcolor.cxx b/svx/source/cui/optcolor.cxx index 11112dd936cd..e20c2284314c 100644 --- a/svx/source/cui/optcolor.cxx +++ b/svx/source/cui/optcolor.cxx @@ -762,9 +762,9 @@ ColorConfigWindow_Impl::ColorConfigWindow_Impl(Window* pParent, const ResId& rRe Wallpaper aTransparentWall(TempColor); sal_Int32 nWinWidth = GetSizePixel().Width(); sal_Int32 nFTHeight = aChapters[0]->GetSizePixel().Height(); - sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); Color aBackColor; const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode(); if ( bHighContrast ) aBackColor = rStyleSettings.GetShadowColor(); else diff --git a/svx/source/cui/optsave.cxx b/svx/source/cui/optsave.cxx index 29708444fe93..893300d10e01 100644 --- a/svx/source/cui/optsave.cxx +++ b/svx/source/cui/optsave.cxx @@ -233,7 +233,7 @@ SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) : pImpl ( new SvxSaveTabPage_Impl ) { - sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + sal_Bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); aODFWarningFI.SetImage( Image( SVX_RES( bHighContrast ? IMG_ODF_WARNING_HC : IMG_ODF_WARNING ) ) ); diff --git a/svx/source/cui/readonlyimage.cxx b/svx/source/cui/readonlyimage.cxx index a43a87d820c8..b22ee80f3a4c 100644 --- a/svx/source/cui/readonlyimage.cxx +++ b/svx/source/cui/readonlyimage.cxx @@ -46,7 +46,7 @@ ReadOnlyImage::ReadOnlyImage(Window* pParent, const ResId rResId) : FixedImage(pParent, rResId) { - sal_Bool bHighContrast = pParent->GetDisplayBackground().GetColor().IsDark(); + sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode(); SetImage( Image(SVX_RES(bHighContrast ? RID_SVXBMP_LOCK_HC : RID_SVXBMP_LOCK ))); } diff --git a/svx/source/cui/tphatch.cxx b/svx/source/cui/tphatch.cxx index d060031abea2..58c55321195a 100644 --- a/svx/source/cui/tphatch.cxx +++ b/svx/source/cui/tphatch.cxx @@ -164,7 +164,7 @@ SvxHatchTabPage::SvxHatchTabPage aBtnLoad.SetClickHdl( LINK( this, SvxHatchTabPage, ClickLoadHdl_Impl ) ); aBtnSave.SetClickHdl( LINK( this, SvxHatchTabPage, ClickSaveHdl_Impl ) ); - aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + aCtlPreview.SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); } // ----------------------------------------------------------------------- @@ -905,7 +905,7 @@ void SvxHatchTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) void SvxHatchTabPage::DataChanged( const DataChangedEvent& rDCEvt ) { if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + aCtlPreview.SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); SvxTabPage::DataChanged( rDCEvt ); } diff --git a/svx/source/cui/tpline.cxx b/svx/source/cui/tpline.cxx index edbf7247fd47..c6cc30cbb0ba 100644 --- a/svx/source/cui/tpline.cxx +++ b/svx/source/cui/tpline.cxx @@ -299,7 +299,7 @@ void SvxLineTabPage::Construct() void SvxLineTabPage::FillListboxes() { -// aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); +// aCtlPreview.SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); ResMgr& rMgr = DIALOG_MGR(); diff --git a/svx/source/cui/treeopt.cxx b/svx/source/cui/treeopt.cxx index 744f9d5c1dbe..f33efffc2416 100644 --- a/svx/source/cui/treeopt.cxx +++ b/svx/source/cui/treeopt.cxx @@ -1078,7 +1078,7 @@ void OfaTreeOptionsDialog::DataChanged( const DataChangedEvent& rDCEvt ) !aTreeLB.GetParent(pEntry)) { OptionsGroupInfo* pInfo = static_cast(pEntry->GetUserData()); - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages; for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i ) { @@ -1336,7 +1336,7 @@ IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG ) OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pEntry->GetUserData(); if ( pTGInfo->m_sPageURL.getLength() == 0 ) { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages; //hier den Hilfetext anzeigen for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i ) diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 6eac7520fe42..91f6021b92b9 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -1212,7 +1212,7 @@ void SvxBmpMask::DataChanged( const DataChangedEvent& rDCEvt ) void SvxBmpMask::ApplyStyle() { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); aTbxPipette.SetItemImage( TBI_PIPETTE, bHighContrast ? maImgPipetteH : maImgPipette ); } diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx index 1e01b9cfde24..fa07ac74d517 100644 --- a/svx/source/dialog/_contdlg.cxx +++ b/svx/source/dialog/_contdlg.cxx @@ -1133,7 +1133,7 @@ IMPL_LINK( SvxSuperContourDlg, WorkplaceClickHdl, ContourWindow*, pWnd ) void SvxSuperContourDlg::ApplyImageList() { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); ImageList& rImgLst = bHighContrast ? maImageListH : maImageList; diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx index acc101cf4fb3..74fde268f9fa 100644 --- a/svx/source/dialog/connctrl.cxx +++ b/svx/source/dialog/connctrl.cxx @@ -374,7 +374,7 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt ) void SvxXConnectionPreview::SetStyles() { const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) ); } diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 59d0c721b560..d2b01ac62ab4 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1202,7 +1202,7 @@ void HatchingLB::UserDraw( const UserDrawEvent& rUDEvt ) OutputDevice* pDevice = rUDEvt.GetDevice(); ULONG nOldDrawMode = pDevice->GetDrawMode(); - pDevice->SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + pDevice->SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); XHatch& rXHatch = mpList->GetHatch( rUDEvt.GetItemId() )->GetHatch(); MapMode aMode( MAP_100TH_MM ); @@ -1943,7 +1943,7 @@ SvxPreviewBase::SvxPreviewBase( Window* pParent, const ResId& rResId ) { // Draw the control's border as a flat thin black line. SetBorderStyle(WINDOW_BORDER_MONO); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); SetMapMode(MAP_100TH_MM); // init model @@ -2006,7 +2006,7 @@ void SvxPreviewBase::StateChanged(StateChangedType nType) void SvxPreviewBase::DataChanged(const DataChangedEvent& rDCEvt) { - SetDrawMode(GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR); + SetDrawMode(GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR); if((DATACHANGED_SETTINGS == rDCEvt.GetType()) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) { diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 90cbdc27cb1a..a380e480f295 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -917,9 +917,7 @@ void RecovDocListEntry::Paint(const Point& aPos , const String* pTxt = 0; RecovDocList* pList = static_cast< RecovDocList* >(&aDevice); - Wallpaper aBackground = aDevice.GetBackground(); - Color aColor = aBackground.GetColor(); - BOOL bHC = aColor.IsDark(); + BOOL bHC = aDevice.GetSettings().GetStyleSettings().GetHighContrastMode(); TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData(); switch(pInfo->RecoveryState) diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index 54f831f3505a..ffcf8f21b49d 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -1228,9 +1228,7 @@ void SvxFontWorkDialog::DataChanged( const DataChangedEvent& rDCEvt ) ---------------------------------------------------------------------------*/ void SvxFontWorkDialog::ApplyImageList() { - bool bHighContrast = - (GetSettings().GetStyleSettings().GetHighContrastMode() != 0) && - (GetDisplayBackground().GetColor().IsDark() != 0); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); ResMgr* _pMgr = &DIALOG_MGR(); diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 10e53698af7e..fa413d81ed17 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -328,7 +328,7 @@ void FrameSelectorImpl::InitColors() { const StyleSettings& rSett = mrFrameSel.GetSettings().GetStyleSettings(); maBackCol = rSett.GetFieldColor(); - mbHCMode = maBackCol.IsDark(); + mbHCMode = rSett.GetHighContrastMode(); maArrowCol = rSett.GetFieldTextColor(); maMarkCol.operator=( maBackCol ).Merge( maArrowCol, mbHCMode ? 0x80 : 0xC0 ); maHCLineCol = rSett.GetLabelTextColor(); diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx index 86d01aa9fdb8..0cb6cc4d52df 100644 --- a/svx/source/dialog/hyprlink.cxx +++ b/svx/source/dialog/hyprlink.cxx @@ -828,10 +828,7 @@ void SvxHyperlinkDlg::DataChanged( const DataChangedEvent& rDCEvt ) void SvxHyperlinkDlg::SetImages() { - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode() != 0; - - if( bHighContrast ) - bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); SetItemImage( BTN_LINK, mpManager->GetImage( BTN_LINK, bHighContrast ) ); SetItemImage( BTN_INSERT_BOOKMARK, mpManager->GetImage( BTN_INSERT_BOOKMARK, bHighContrast ) ); diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index 5777dc8e7446..a9c43347b7bf 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -1042,7 +1042,7 @@ IMPL_LINK( SvxIMapDlg, MiscHdl, void*, EMPTYARG ) void SvxIMapDlg::ApplyImageList() { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); ImageList& rImgLst = bHighContrast ? maImageListH : maImageList; diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index c196178a4d16..87f1b89bd3f4 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -181,7 +181,7 @@ USHORT SvxLanguageBox::ImplInsertImgEntry( const String& rEntry, USHORT nPos, bo USHORT nRet = 0; if( !bChecked ) nRet = InsertEntry( rEntry, m_aNotCheckedImage, nPos ); - else if( GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) + else if( GetSettings().GetStyleSettings().GetHighContrastMode() ) nRet = InsertEntry( rEntry, m_aCheckedImageHC, nPos ); else nRet = InsertEntry( rEntry, m_aCheckedImage, nPos ); diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx index 2c1747dbc0b4..73e376f9eac1 100644 --- a/svx/source/dialog/measctrl.cxx +++ b/svx/source/dialog/measctrl.cxx @@ -79,7 +79,7 @@ SvxXMeasurePreview::SvxXMeasurePreview //pMeasureObj->SetItemSetAndBroadcast(rInAttrs); pMeasureObj->SetMergedItemSetAndBroadcast(rInAttrs); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); Invalidate(); } @@ -196,7 +196,7 @@ void SvxXMeasurePreview::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) { - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); } } diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx index 67f5ee2ea318..79035bc4b8cb 100644 --- a/svx/source/dialog/swframeexample.cxx +++ b/svx/source/dialog/swframeexample.cxx @@ -76,7 +76,7 @@ void SvxSwFrameExample::InitColors_Impl( void ) const StyleSettings& rSettings = GetSettings().GetStyleSettings(); m_aBgCol = Color( rSettings.GetWindowColor() ); // old: COL_WHITE - BOOL bHC = m_aBgCol.IsDark(); + BOOL bHC = rSettings.GetHighContrastMode(); m_aFrameColor = Color( COL_LIGHTGREEN ); m_aAlignColor = Color( COL_LIGHTRED ); diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 791bebc772c8..ffe012734ae5 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -778,7 +778,7 @@ namespace svxform SvLBoxEntry* XFormsPage::AddEntry( ItemNode* _pNewNode, bool _bIsElement ) { SvLBoxEntry* pParent = m_aItemList.FirstSelected(); - const ImageList& rImageList = GetBackground().GetColor().IsDark() + const ImageList& rImageList = GetSettings().GetStyleSettings().GetHighContrastMode() ? m_pNaviWin->GetItemHCImageList() : m_pNaviWin->GetItemImageList(); USHORT nImageID = ( _bIsElement ) ? IID_ELEMENT : IID_ATTRIBUTE; @@ -988,7 +988,7 @@ namespace svxform SvLBoxEntry* XFormsPage::AddEntry( const Reference< XPropertySet >& _rEntry ) { SvLBoxEntry* pEntry = NULL; - const ImageList& rImageList = GetBackground().GetColor().IsDark() + const ImageList& rImageList = GetSettings().GetStyleSettings().GetHighContrastMode() ? m_pNaviWin->GetItemHCImageList() : m_pNaviWin->GetItemImageList(); Image aImage = rImageList.GetImage( IID_ELEMENT ); @@ -1244,7 +1244,7 @@ namespace svxform m_xUIHelper = Reference< css::xforms::XFormsUIHelper1 >( _xModel, UNO_QUERY ); String sRet; m_bHasModel = true; - const ImageList& rImageList = GetBackground().GetColor().IsDark() + const ImageList& rImageList = GetSettings().GetStyleSettings().GetHighContrastMode() ? m_pNaviWin->GetItemHCImageList() : m_pNaviWin->GetItemImageList(); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 8c5ca61f6691..e4d656a06f28 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -987,7 +987,7 @@ PopupMenu* FmXFormShell::GetConversionMenu() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::GetConversionMenu" ); const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - BOOL bIsHiContrastMode = rSettings.GetMenuColor().IsDark(); + BOOL bIsHiContrastMode = rSettings.GetHighContrastMode(); PopupMenu* pNewMenu = new PopupMenu(SVX_RES( RID_FMSHELL_CONVERSIONMENU )); @@ -2001,7 +2001,7 @@ bool FmXFormShell::setCurrentSelection( const InterfaceBag& _rSelection ) m_aCurrentSelection = _rSelection; - // determine the form which all the selected objécts belong to, if any + // determine the form which all the selected obj�cts belong to, if any Reference< XForm > xNewCurrentForm; for ( InterfaceBag::const_iterator loop = m_aCurrentSelection.begin(); loop != m_aCurrentSelection.end(); diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx index 08c83b571a8f..ee9fd0c165b8 100644 --- a/svx/source/form/tbxform.cxx +++ b/svx/source/form/tbxform.cxx @@ -219,7 +219,7 @@ void SvxFmTbxCtlConfig::StateChanged(USHORT nSID, SfxItemState eState, const Sfx Image aImage = GetImage( m_xFrame, aSlotURL, hasBigImages(), - GetToolBox().GetDisplayBackground().GetColor().IsDark() ); + GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode() ); GetToolBox().SetItemImage( GetId(), aImage ); nLastSlot = nSlot; diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index edc7f253a024..8240f607f5fa 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -1228,7 +1228,7 @@ IMPL_LINK( GalleryBrowser2, SelectTbxHdl, ToolBox*, pBox ) IMPL_LINK( GalleryBrowser2, MiscHdl, void*, EMPTYARG ) { - const sal_Bool bHC = GALLERY_DLG_COLOR.IsDark(); + const sal_Bool bHC = maViewBox.GetSettings().GetStyleSettings().GetHighContrastMode(); maViewBox.SetOutStyle( maMiscOptions.GetToolboxStyle() ); diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx index 890cde02e428..787985d0e7e9 100644 --- a/svx/source/stbctrls/xmlsecctrl.cxx +++ b/svx/source/stbctrls/xmlsecctrl.cxx @@ -97,12 +97,12 @@ XmlSecStatusBarControl::XmlSecStatusBarControl( USHORT _nSlotId, USHORT _nId, S { mpImpl->mnState = (UINT16)SIGNATURESTATE_UNKNOWN; - sal_Bool bIsDark = GetStatusBar().GetBackground().GetColor().IsDark(); - mpImpl->maImage = Image( SVX_RES( bIsDark ? RID_SVXBMP_SIGNET_H : RID_SVXBMP_SIGNET ) ); + sal_Bool bHC = GetStatusBar().GetSettings().GetStyleSettings().GetHighContrastMode(); + mpImpl->maImage = Image( SVX_RES( bHC ? RID_SVXBMP_SIGNET_H : RID_SVXBMP_SIGNET ) ); mpImpl->maImageBroken = - Image( SVX_RES( bIsDark ? RID_SVXBMP_SIGNET_BROKEN_H : RID_SVXBMP_SIGNET_BROKEN ) ); + Image( SVX_RES( bHC ? RID_SVXBMP_SIGNET_BROKEN_H : RID_SVXBMP_SIGNET_BROKEN ) ); mpImpl->maImageNotValidated = - Image( SVX_RES( bIsDark ? RID_SVXBMP_SIGNET_NOTVALIDATED_H : RID_SVXBMP_SIGNET_NOTVALIDATED ) ); + Image( SVX_RES( bHC ? RID_SVXBMP_SIGNET_NOTVALIDATED_H : RID_SVXBMP_SIGNET_NOTVALIDATED ) ); } XmlSecStatusBarControl::~XmlSecStatusBarControl() diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx index 2f3431accf64..70b12ac628a6 100644 --- a/svx/source/stbctrls/zoomsliderctrl.cxx +++ b/svx/source/stbctrls/zoomsliderctrl.cxx @@ -188,10 +188,10 @@ SvxZoomSliderControl::SvxZoomSliderControl( USHORT _nSlotId, USHORT _nId, Statu SfxStatusBarControl( _nSlotId, _nId, _rStb ), mpImpl( new SvxZoomSliderControl_Impl ) { - const sal_Bool bIsDark = GetStatusBar().GetBackground().GetColor().IsDark(); - mpImpl->maSliderButton = Image( SVX_RES( bIsDark ? RID_SVXBMP_SLIDERBUTTON_HC : RID_SVXBMP_SLIDERBUTTON ) ); - mpImpl->maIncreaseButton = Image( SVX_RES( bIsDark ? RID_SVXBMP_SLIDERINCREASE_HC : RID_SVXBMP_SLIDERINCREASE ) ); - mpImpl->maDecreaseButton = Image( SVX_RES( bIsDark ? RID_SVXBMP_SLIDERDECREASE_HC : RID_SVXBMP_SLIDERDECREASE ) ); + const sal_Bool bHC = GetStatusBar().GetSettings().GetStyleSettings().GetHighContrastMode(); + mpImpl->maSliderButton = Image( SVX_RES( bHC ? RID_SVXBMP_SLIDERBUTTON_HC : RID_SVXBMP_SLIDERBUTTON ) ); + mpImpl->maIncreaseButton = Image( SVX_RES( bHC ? RID_SVXBMP_SLIDERINCREASE_HC : RID_SVXBMP_SLIDERINCREASE ) ); + mpImpl->maDecreaseButton = Image( SVX_RES( bHC ? RID_SVXBMP_SLIDERDECREASE_HC : RID_SVXBMP_SLIDERDECREASE ) ); } // ----------------------------------------------------------------------- diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 06fe8c26f0be..f4964d1b1ff1 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -137,7 +137,7 @@ void ExtrusionDirectionWindow::implInit() mpDirectionSet->SetColCount( 3 ); mpDirectionSet->EnableFullItemMode( FALSE ); - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) { @@ -174,7 +174,7 @@ void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); USHORT i; for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) @@ -514,7 +514,7 @@ void ExtrusionDepthWindow::implInit() mpMenu->SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) ); - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); String aEmpty; mpMenu->appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 ); @@ -635,7 +635,7 @@ void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt ) if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); mpMenu->setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 ); mpMenu->setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 ); @@ -882,7 +882,7 @@ void ExtrusionLightingWindow::implInit() mpLightingSet->SetColCount( 3 ); mpLightingSet->EnableFullItemMode( FALSE ); - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ ) { @@ -949,7 +949,7 @@ void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) mnDirection = nDirection; mbDirectionEnabled = bEnabled; - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); if( !bEnabled ) nDirection = FROM_FRONT; @@ -1022,7 +1022,7 @@ void ExtrusionLightingWindow::DataChanged( const DataChangedEvent& rDCEvt ) if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); implSetDirection( mnDirection, mbDirectionEnabled ); mpMenu->setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright ); @@ -1231,7 +1231,7 @@ void ExtrusionSurfaceWindow::implInit() { SetHelpId( HID_POPUP_EXTRUSION_SURFACE ); - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); // mpSurfaceForewarder = new SfxStatusForwarder( SID_EXTRUSION_SURFACE, *this ); @@ -1316,7 +1316,7 @@ void ExtrusionSurfaceWindow::DataChanged( const DataChangedEvent& rDCEvt ) if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); mpMenu->appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); mpMenu->appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index dfa22cc64e23..111f2394836a 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -397,7 +397,7 @@ void FontWorkAlignmentWindow::implInit() { SetHelpId( HID_POPUP_FONTWORK_ALIGN ); - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); mpMenu->SetHelpId( HID_POPUP_FONTWORK_ALIGN ); @@ -477,7 +477,7 @@ void FontWorkAlignmentWindow::DataChanged( const DataChangedEvent& rDCEvt ) if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { - bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); mpMenu->appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); mpMenu->appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); @@ -637,7 +637,7 @@ void FontWorkCharacterSpacingWindow::implInit() { SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); -// bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); +// bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); mpMenu->SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); @@ -754,7 +754,7 @@ void FontWorkCharacterSpacingWindow::DataChanged( const DataChangedEvent& rDCEvt if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { -// bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); +// bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); mpMenu->appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_CHECKABLE ); mpMenu->appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_CHECKABLE ); diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index 030d7e0cf0df..846cb1f81825 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -74,7 +74,7 @@ using namespace ::com::sun::star::beans; SvxLineBox::SvxLineBox( Window* pParent, const Reference< XFrame >& rFrame, WinBits nBits ) : LineLB( pParent, nBits ), - meBmpMode ( GetDisplayBackground().GetColor().IsDark() ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL ), + meBmpMode ( GetSettings().GetStyleSettings().GetHighContrastMode() ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL ), nCurPos ( 0 ), aLogicalSize(40,140), bRelease ( TRUE ), @@ -268,7 +268,7 @@ void SvxLineBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) { - BmpColorMode eMode = GetDisplayBackground().GetColor().IsDark() ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL; + BmpColorMode eMode = GetSettings().GetStyleSettings().GetHighContrastMode() ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL; if( eMode != meBmpMode ) { meBmpMode = eMode; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index efa49025bbc4..d631a2dac467 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -282,7 +282,7 @@ public: inline BOOL SvxFrameWindow_Impl::IsHighContrast( void ) const { - return GetDisplayBackground().GetColor().IsDark(); + return GetSettings().GetStyleSettings().GetHighContrastMode(); } //======================================================================== diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index 4d0ebe5dd6c2..3df0d8487ac2 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -63,7 +63,7 @@ namespace svx if (mnSlotId == SID_BACKGROUND_COLOR) mnDrawMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW; DBG_ASSERT( ptrTbx, "ToolBox not found :-(" ); - mbWasHiContrastMode = ptrTbx ? ( ptrTbx->GetBackground().GetColor().IsDark() ) : FALSE; + mbWasHiContrastMode = ptrTbx ? ( ptrTbx->GetSettings().GetStyleSettings().GetHighContrastMode() ) : FALSE; Update(mnSlotId == SID_ATTR_CHAR_COLOR2 ? COL_BLACK : COL_GRAY); } @@ -79,7 +79,7 @@ namespace svx { Image aImage( mpTbx->GetItemImage( mnBtnId ) ); const bool bSizeChanged = ( maBmpSize != aImage.GetSizePixel() ); - const bool bDisplayModeChanged = ( mbWasHiContrastMode != mpTbx->GetBackground().GetColor().IsDark() ); + const bool bDisplayModeChanged = ( mbWasHiContrastMode != mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode() ); Color aColor( rColor ); // !!! #109290# Workaround for SetFillColor with COL_AUTO @@ -107,7 +107,7 @@ namespace svx else pMskAcc = NULL; - mbWasHiContrastMode = mpTbx->GetBackground().GetColor().IsDark(); + mbWasHiContrastMode = mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode(); if( mnDrawMode == TBX_UPDATER_MODE_CHAR_COLOR_NEW && ( COL_TRANSPARENT != aColor.GetColor() ) ) pBmpAcc->SetLineColor( aColor ); From 1f2e63a3934fb42f6fbbf97f8c4bd3674ca74937 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 4 Nov 2009 11:46:31 +0100 Subject: [PATCH 092/117] #i104768# make autoHC immediately active --- svx/source/cui/optaccessibility.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svx/source/cui/optaccessibility.cxx b/svx/source/cui/optaccessibility.cxx index eb7cac6d8c5d..4f47bbf168ae 100644 --- a/svx/source/cui/optaccessibility.cxx +++ b/svx/source/cui/optaccessibility.cxx @@ -151,8 +151,8 @@ BOOL SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet& ) aMiscSettings.SetEnableATToolSupport( m_aAccessibilityTool.IsChecked() ); #endif aAllSettings.SetMiscSettings(aMiscSettings); - Application::SetSettings(aAllSettings); Application::MergeSystemSettings( aAllSettings ); + Application::SetSettings(aAllSettings); return FALSE; } From 2083665c037ec598c2e20d3c949164d65bc56cad Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 4 Nov 2009 13:58:04 +0100 Subject: [PATCH 093/117] #i105368#: XMLEventExport.cxx: add missing events --- xmloff/source/script/XMLEventExport.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xmloff/source/script/XMLEventExport.cxx b/xmloff/source/script/XMLEventExport.cxx index cf8156ae21e8..c39dda6d4e18 100644 --- a/xmloff/source/script/XMLEventExport.cxx +++ b/xmloff/source/script/XMLEventExport.cxx @@ -341,6 +341,11 @@ const XMLEventNameTranslation aStandardEventTable[] = { "OnSaveToFailed", XML_NAMESPACE_OFFICE, "save-to-failed" }, { "OnSubComponentOpened", XML_NAMESPACE_OFFICE, "subcomponent-opened" }, { "OnSubComponentClosed", XML_NAMESPACE_OFFICE, "subcomponent-closed" }, + { "OnStorageChanged", XML_NAMESPACE_OFFICE, "storage-changed" }, + { "OnMailMergeFinished", XML_NAMESPACE_OFFICE, "mail-merge-finished" }, + { "OnFieldMerge", XML_NAMESPACE_OFFICE, "field-merge" }, + { "OnFieldMergeFinished", XML_NAMESPACE_OFFICE, "field-merge-finished" }, + { "OnLayoutFinished", XML_NAMESPACE_OFFICE, "layout-finished" }, { NULL, 0, 0 } }; From b12639936ccf2e659d3b31a95adc83226fa950ee Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Thu, 5 Nov 2009 18:37:39 +0100 Subject: [PATCH 094/117] ause109: #i106645# make sure multiple xsltproc don't collide in dir creation --- readlicense_oo/util/makefile.pmk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readlicense_oo/util/makefile.pmk b/readlicense_oo/util/makefile.pmk index b5c9099a1aa6..1b2e1de5130f 100755 --- a/readlicense_oo/util/makefile.pmk +++ b/readlicense_oo/util/makefile.pmk @@ -62,6 +62,7 @@ $(MISC)$/readme_text.xsl : virtual .ENDIF # "$(USE_SHELL)"!="4nt" $(MISC)$/$(GUI)$/$(eq,$(GUI),WNT readme README)_%.html : 'virtual' + @@-$(MKDIRHIER) $(@:d) $(XSLTPROC) --nonet -o $@ \ --stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \ --stringparam cp1 $(CPUNAME) --stringparam type html --stringparam lang1 $* \ @@ -71,6 +72,7 @@ $(MISC)$/$(GUI)$/$(eq,$(GUI),WNT readme README)_%.html : 'virtual' .ENDIF # "$(GUI)"=="UNX" $(MISC)$/$(GUI)$/$(eq,$(GUI),OS2 readme README)_%.html : 'virtual' + @@-$(MKDIRHIER) $(@:d) $(XSLTPROC) --nonet -o $@ \ --stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \ --stringparam cp1 $(CPUNAME) --stringparam type html --stringparam lang1 $* \ @@ -78,6 +80,7 @@ $(MISC)$/$(GUI)$/$(eq,$(GUI),OS2 readme README)_%.html : 'virtual' # no percent-rule to avoid ambiguous inference chains for README_.html $(SYSTEXTDOCS) : $(MISC)$/readme_text.xsl + @@-$(MKDIRHIER) $(@:d) $(XSLTPROC) --nonet -o $@ \ --stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \ --stringparam cp1 $(CPUNAME) --stringparam type text --stringparam lang1 $(@:b:s/readme_//:s/README_//) \ From 273b150f8b10b5f438688b4f6f9348b4d088ecb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 6 Nov 2009 11:03:40 +0000 Subject: [PATCH 095/117] cmcfixes66: #i106674# fix remaining new[]/delete mismatches --- svx/source/msfilter/msdffimp.cxx | 22 +++++++++++----------- svx/source/msfilter/msocximex.cxx | 2 +- svx/source/svdraw/svdhdl.cxx | 2 +- ucb/source/ucp/odma/odma_content.cxx | 2 +- ucb/source/ucp/odma/odma_datasupplier.cxx | 8 ++++---- ucb/source/ucp/odma/odma_provider.cxx | 22 +++++++++++----------- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx index c9cfde91547a..fc71feb18740 100644 --- a/svx/source/msfilter/msdffimp.cxx +++ b/svx/source/msfilter/msdffimp.cxx @@ -317,7 +317,7 @@ BOOL Impl_OlePres::Read( SvStream & rStm ) { BYTE * p = new BYTE[ nSize ]; rStm.Read( p, nSize ); - delete p; + delete [] p; return FALSE; } return TRUE; @@ -5016,16 +5016,16 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ApplyAttributes( rSt, aSet, aObjData ); pRet->SetMergedItemSet(aSet); } - else if ( aObjData.eShapeType == mso_sptLine ) - { - basegfx::B2DPolygon aPoly; - aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Left(), aObjData.aBoundRect.Top())); - aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Right(), aObjData.aBoundRect.Bottom())); - pRet = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPoly)); - pRet->SetModel( pSdrModel ); - ApplyAttributes( rSt, aSet, aObjData ); - pRet->SetMergedItemSet(aSet); - } + else if ( aObjData.eShapeType == mso_sptLine ) + { + basegfx::B2DPolygon aPoly; + aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Left(), aObjData.aBoundRect.Top())); + aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Right(), aObjData.aBoundRect.Bottom())); + pRet = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPoly)); + pRet->SetModel( pSdrModel ); + ApplyAttributes( rSt, aSet, aObjData ); + pRet->SetMergedItemSet(aSet); + } else { if ( GetCustomShapeContent( aObjData.eShapeType ) || IsProperty( DFF_Prop_pVertices ) ) diff --git a/svx/source/msfilter/msocximex.cxx b/svx/source/msfilter/msocximex.cxx index 7db08e229536..e16c3c118913 100644 --- a/svx/source/msfilter/msocximex.cxx +++ b/svx/source/msfilter/msocximex.cxx @@ -5299,7 +5299,7 @@ sal_Bool OCX_Image::Read(SotStorageStream *pS) bool result = storePictureInFileSystem( sImageUrl, pImage, nImageLen ); OUString pictName = sImageUrl.copy( sImageUrl.lastIndexOf('/') + 1 ); result = storePictureInDoc( pDocSh, pictName, pImage, nImageLen ); - delete pImage; + delete [] pImage; } return sal_True; } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 936c073f6e84..d3202e389f83 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -2004,7 +2004,7 @@ void SdrHdlList::TravelFocusHdl(sal_Bool bForward) } // #105678# free mem again - delete pHdlAndIndex; + delete [] pHdlAndIndex; } } diff --git a/ucb/source/ucp/odma/odma_content.cxx b/ucb/source/ucp/odma/odma_content.cxx index b2d514e6a424..ef6128a0b75b 100644 --- a/ucb/source/ucp/odma/odma_content.cxx +++ b/ucb/source/ucp/odma/odma_content.cxx @@ -565,7 +565,7 @@ uno::Any SAL_CALL Content::execute( ODM_DELETE, lpszNewDocId); - delete lpszNewDocId; + delete [] lpszNewDocId; } if(bError) ucbhelper::cancelCommandExecution( diff --git a/ucb/source/ucp/odma/odma_datasupplier.cxx b/ucb/source/ucp/odma/odma_datasupplier.cxx index 91c7f61021c8..68ee5f91cbae 100644 --- a/ucb/source/ucp/odma/odma_datasupplier.cxx +++ b/ucb/source/ucp/odma/odma_datasupplier.cxx @@ -329,10 +329,10 @@ sal_Bool DataSupplier::getResult( sal_uInt32 nIndex ) // now close the query odm = NODMQueryClose(ContentProvider::getHandle(), pQueryId); - delete lpszDMSList; - delete pQueryId; - delete lpszDocId; - delete lpszDocName; + delete [] lpszDMSList; + delete [] pQueryId; + delete [] lpszDocId; + delete [] lpszDocName; if ( !bFound ) m_pImpl->m_bCountFinal = sal_True; diff --git a/ucb/source/ucp/odma/odma_provider.cxx b/ucb/source/ucp/odma/odma_provider.cxx index b4b97421d05b..8f4b4603911d 100644 --- a/ucb/source/ucp/odma/odma_provider.cxx +++ b/ucb/source/ucp/odma/odma_provider.cxx @@ -230,7 +230,7 @@ uno::Reference< ucb::XContent > SAL_CALL ContentProvider::queryContent( aProp->m_sContentType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODMA_CONTENT_TYPE)); append(aProp); } - delete lpszDocName; + delete [] lpszDocName; } else // we got an already fetched name here so look for it { @@ -298,11 +298,11 @@ void ContentProvider::saveDocument(const ::rtl::OString& _sDocumentId) OSL_ENSURE(odm == ODM_SUCCESS,"Could not save document!"); if(odm != ODM_SUCCESS) { - delete lpszDocId; + delete [] lpszDocId; throw uno::Exception(); } aIter->second->m_sDocumentId = rtl::OString(lpszDocId); - delete lpszDocId; + delete [] lpszDocId; } } // ----------------------------------------------------------------------------- @@ -414,7 +414,7 @@ void ContentProvider::fillDocumentProperties(const ::rtl::Reference& _rProp) @@ -482,16 +482,16 @@ void ContentProvider::append(const ::rtl::Reference& _rProp) } while(nCount > nMaxCount); - delete lpszDocInfo; - delete lpszDocId; - delete lpszDocName; + delete [] lpszDocInfo; + delete [] lpszDocId; + delete [] lpszDocName; } // now close the query odm = NODMQueryClose(ContentProvider::getHandle(), pQueryId); - delete pQueryId; + delete [] pQueryId; } - delete lpszDMSList; + delete [] lpszDMSList; return aReturn; @@ -547,11 +547,11 @@ void ContentProvider::append(const ::rtl::Reference& _rProp) _rProp->m_bIsOpen = sal_True; break; default: - delete pFileName; + delete [] pFileName; throw uno::Exception(); // TODO give a more precise error message here } - delete pFileName; + delete [] pFileName; } return _rProp->m_sFileURL; } From dcb4a7e7b65bcc6a28616bbd0cf5ab2d1f8f4bc1 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 9 Nov 2009 14:10:33 +0000 Subject: [PATCH 096/117] #i106678# fixed previous fix as writer pool returns wrong which id for slod SID_ATTR_NUMBERING_RULE --- svx/source/cui/numpages.cxx | 111 +++++++++++++++++++++++++++++------- 1 file changed, 91 insertions(+), 20 deletions(-) diff --git a/svx/source/cui/numpages.cxx b/svx/source/cui/numpages.cxx index 6454b3dd7c2a..92b5934baed7 100644 --- a/svx/source/cui/numpages.cxx +++ b/svx/source/cui/numpages.cxx @@ -378,12 +378,24 @@ int SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) void SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; - - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + const SfxPoolItem* pItem; +// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); if(!pActNum) pActNum = new SvxNumRule(*pSaveNum); @@ -564,12 +576,24 @@ int SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet) void SvxBulletPickTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); @@ -789,12 +813,24 @@ int SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) void SvxNumPickTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); if(!pActNum) @@ -1089,12 +1125,24 @@ BOOL SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet ) void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); if(!pActNum) pActNum = new SvxNumRule(*pSaveNum); @@ -1516,12 +1564,24 @@ BOOL SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet ) --------------------------------------------------*/ void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); // Ebenen einfuegen if(!aLevelLB.GetEntryCount()) @@ -1565,7 +1625,6 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) pPreviewWIN->SetNumRule(pActNum); aSameLevelCB.Check(pActNum->IsContinuousNumbering()); - const SfxPoolItem* pItem = 0; //ColorListBox bei Bedarf fuellen if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) ) { @@ -3409,12 +3468,24 @@ BOOL SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet ) --------------------------------------------------*/ void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); // Ebenen einfuegen if(!aLevelLB.GetEntryCount()) From 93bd8f5e46a5452d70c4dc068175a0197d3c4686 Mon Sep 17 00:00:00 2001 From: Martin Hollmichel Date: Tue, 10 Nov 2009 10:40:36 +0000 Subject: [PATCH 097/117] #i105852# reverted back changes with automatically fill the initials field --- desktop/source/migration/pages.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/desktop/source/migration/pages.cxx b/desktop/source/migration/pages.cxx index 80c5849ee4d9..2c85828f540f 100644 --- a/desktop/source/migration/pages.cxx +++ b/desktop/source/migration/pages.cxx @@ -373,9 +373,11 @@ UserPage::UserPage( svt::OWizardMachine* parent, const ResId& resid) SvtUserOptions aUserOpt; m_edFirst.SetText(aUserOpt.GetFirstName()); m_edLast.SetText(aUserOpt.GetLastName()); +#if 0 rtl::OUString aUserName; vos::OSecurity().getUserName( aUserName ); aUserOpt.SetID( aUserName ); +#endif m_edInitials.SetText(aUserOpt.GetID()); if (m_lang == LANGUAGE_RUSSIAN) From 1fe659171d530ab7e08a644ca640c2d3cd56b21e Mon Sep 17 00:00:00 2001 From: Martin Hollmichel Date: Wed, 11 Nov 2009 15:46:33 +0000 Subject: [PATCH 098/117] #i106823# update contributors list --- svx/source/intro/intro_tmpl.hrc | 206 +++++++++++++++++--------------- 1 file changed, 108 insertions(+), 98 deletions(-) diff --git a/svx/source/intro/intro_tmpl.hrc b/svx/source/intro/intro_tmpl.hrc index ad3a628213be..2fb03252ead2 100644 --- a/svx/source/intro/intro_tmpl.hrc +++ b/svx/source/intro/intro_tmpl.hrc @@ -59,6 +59,7 @@ ItemList = \ < "Jost Ammon" ; > ; \ < "Paolo Amodio" ; > ; \ < "Abdullah Anar" ; > ; \ + < "Gene Anaya" ; > ; \ < "Christian Andersen" ; > ; \ < "Frank J. Andersen" ; > ; \ < "Jan Moller Andersen" ; > ; \ @@ -94,7 +95,9 @@ ItemList = \ < "David Bartlett" ; > ; \ < "Sascha Ballach" ; > ; \ < "Stefan Baltzer" ; > ; \ + < "Jayant Balraj Madavi" ; > ; \ < "Claudio Bandaloukas" ; > ; \ + < "Omar Bar-or" ; > ; \ < "Hrega Basu" ; > ; \ < "Mathias Bauer" ; > ; \ < "Martin Baulig" ; > ; \ @@ -119,6 +122,7 @@ ItemList = \ < "Zaheda Bhorat" ; > ; \ < "Andreas Bille" ; > ; \ < "Oliver Bietzer" ; > ; \ + < "Eric Bischoff" ; > ; \ < "Marissa Bishop" ; > ; \ < "Torkil Bladt" ; > ; \ < "Martin Blapp" ; > ; \ @@ -134,6 +138,7 @@ ItemList = \ < "Csaba Borbola" ; > ; \ < "Gregor Bornemann" ; > ; \ < "Thorsten Bosbach" ; > ; \ + < "Eric Bosdonnat" ; > ; \ < "Daniel Boss" ; > ; \ < "David Boswell" ; > ; \ < "Freddy Boswell" ; > ; \ @@ -179,6 +184,8 @@ ItemList = \ < "Kimmy Chen" ; > ; \ < "Robert Chen" ; > ; \ < "Yu Aaron Cheng" ; > ; \ + < "Jian Hong Cheng" ; > ; \ + < "Xiuzhi Cheng" ; > ; \ < "Allan B. Christensen" ; > ; \ < "Steen Christensen" ; > ; \ < "Marco Ciampa" ; > ; \ @@ -190,6 +197,7 @@ ItemList = \ < "Vicky Chan" ; > ; \ < "Michael J. Cole" ; > ; \ < "Urska Colner" ; > ; \ + < "Alexandro Colorado" ; > ; \ < "Compaq Computer Corperation" ; > ; \ < "Karen Conatser" ; > ; \ < "Confucian Pro. Technology" ; > ; \ @@ -197,11 +205,13 @@ ItemList = \ < "Lee Corbin" ; > ; \ < "Dietmar Cordes" ; > ; \ < "Berend Cornelius" ; > ; \ + < "Clayton Cornell" ; > ; \ < "Jesus Corrius" ; > ; \ < "Martin Coxall" ; > ; \ < "Joszef Csongradi" ; > ; \ < "Alessandro Cumin" ; > ; \ < "Johannes Czerwinski" ; > ; \ + < "Michael Cziebalski" ; > ; \ < "Valentina Dagiene" ; > ; \ < "Richard Daley" ; > ; \ < "Viktoras Dagys" ; > ; \ @@ -218,9 +228,11 @@ ItemList = \ < "Francois Dechelle" ; > ; \ < "Andrea Decorte" ; > ; \ < "Martijn Dekkers" ; > ; \ + < "Andrew Dent" ; > ; \ < "Westley Alan Dent" ; > ; \ < "Luiz Augusto Von Dentz" ; > ; \ < "Helge Delfs" ; > ; \ + < "Naren Devaiah" ; > ; \ < "Frederic Juan Diaz" ; > ; \ < "Scott Dietrich" ; > ; \ < "Frederik Dietz" ; > ; \ @@ -230,8 +242,10 @@ ItemList = \ < "Vitor Domingos" ; > ; \ < "Jean-Francois Donikian" ; > ; \ < "Simford Dong" ; > ; \ + < "Nitri Dongre" ; > ; \ < "Thomas Doru" ; > ; \ < "Willem van Dorp" ; > ; \ + < "Radek Doulik" ; > ; \ < "Davide Dozza" ; > ; \ < "Derek Dreger" ; > ; \ < "Carsten Driesner" ; > ; \ @@ -249,9 +263,11 @@ ItemList = \ < "Rene Engelhard" ; > ; \ < "Mina Erickson" ; > ; \ < "Peter Eriksen" ; > ; \ + < "Per Eriksson" ; > ; \ < "Alberto Escudero-Pascual" ; > ; \ < "Fabalabs Software GmbH" ; > ; \ < "Charles Anthony Fannan" ; > ; \ + < "Jean-Baptiste Faure" ; > ; \ < "Ralf-Michael Fehr" ; > ; \ < "Vladimir Fedak" ; > ; \ < "Zoltan Fekete" ; > ; \ @@ -261,6 +277,7 @@ ItemList = \ < "Claudio Ferreira" ; > ; \ < "Raquel Fares Ferreira" ; > ; \ < "Marco Fiemozzi" ; > ; \ + < "Claudio F Filho" ; > ; \ < "Pierre de Filippis" ; > ; \ < "Jan Firich" ; > ; \ < "Andre Fischer" ; > ; \ @@ -271,6 +288,7 @@ ItemList = \ < "Kenneth Foskey" ; > ; \ < "Duncan Foster" ; > ; \ < "Tim Foster" ; > ; \ + < "David Franser" ; > ; \ < "Peter Frandsen" ; > ; \ < "Gary Frederick" ; > ; \ < "Nils Fuhrmann" ; > ; \ @@ -280,8 +298,11 @@ ItemList = \ < "Tom Garland" ; > ; \ < "Wolfram Garten" ; > ; \ < "Martin Gallwey" ; > ; \ + < "Pierre-Andre Galmes" ; > ; \ < "Roberto Galoppini" ; > ; \ < "Tony Galmiche" ; > ; \ + < "Sunil Gandhi" ; > ; \ + < "Zemin Gao" ; > ; \ < "Sophie Gautier" ; > ; \ < "Kathy Gavin" ; > ; \ < "Alexander Gelfenbain" ; > ; \ @@ -327,6 +348,7 @@ ItemList = \ < "Chris Halls" ; > ; \ < "Arne Christian Harseth" ; > ; \ < "Syamsul Anuar Abdul Hamid" ; > ; \ + < "Bo Han" ; > ; \ < "Ove Hanebring" ; > ; \ < "Jens K. Hansen" ; > ; \ < "Martin Willemoes Hansen" ; > ; \ @@ -423,6 +445,9 @@ ItemList = \ < "Byrial Ole Jensen" ; > ; \ < "Ricky Hugh Jensen" ; > ; \ < "Tatjiana Jevsikova" ; > ; \ + < "Berry Jia" ; > ; \ + < "Mingfei Jia" ; > ; \ + < "Chuang Jiang" ; > ; \ < "Jiao Jianhua" ; > ; \ < "Gary Johnston" ; > ; \ < "Dewi Jones" ; > ; \ @@ -430,6 +455,7 @@ ItemList = \ < "Anders Colding Jorgesen" ; > ; \ < "Peter Junge" ; > ; \ < "Christian Junker" ; > ; \ + < "Pascal Junck" ; > ; \ < "Henrik Just" ; > ; \ < "Christian Kaas" ; > ; \ < "Yukata Kachi" ; > ; \ @@ -442,12 +468,16 @@ ItemList = \ < "Mick Kappenburg" ; > ; \ < "Etsushi Kato" ; > ; \ < "Yosuke Kato" ; > ; \ + < "Hirano Kazunari" ; > ; \ + < "Mihaela Kedikova" ; > ; \ < "Juergen Keil" ; > ; \ < "Lina Kemmel" ; > ; \ < "Darren Kenny" ; > ; \ + < "Dhanajay Keskar" ; > ; \ < "Ilja Ketris" ; > ; \ < "Philipp Kewisch Ketris" ; > ; \ < "Ossama Khayat" ; > ; \ + < "Volodymyr Khrystynych" ; > ; \ < "Ilja Ketris" ; > ; \ < "Hermann Kienlein" ; > ; \ < "Artem Khvat" ; > ; \ @@ -462,6 +492,7 @@ ItemList = \ < "Thomas Klarhoefer" ; > ; \ < "Sven Klawitter" ; > ; \ < "Branislav Klocok" ; > ; \ + < "Matthias Klose" ; > ; \ < "Halfdan Holger Knudsen" ; > ; \ < "Rune Tendal Kock" ; > ; \ < "Magdy Samuel Abdel Koddous" ; > ; \ @@ -473,6 +504,7 @@ ItemList = \ < "Uros Kositer" ; > ; \ < "Peter Kosmalla" ; > ; \ < "Nobuhiro Koura" ; > ; \ + < "Lazlo Kovacs" ; > ; \ < "Martin Kretzchmar" ; > ; \ < "Ramesh Krishnamagaru" ; > ; \ < "Jayamohan Krishnasamy" ; > ; \ @@ -498,6 +530,7 @@ ItemList = \ < "Dr. Swapnil Vishnu Lale" ; > ; \ < "Antti Lampinen/Kongo Group" ; > ; \ < "Massimo Lanfranconi" ; > ; \ + < "Marcus Lange" ; > ; \ < "Peter Lange" ; > ; \ < "Thomas Lange" ; > ; \ < "Lars Langhans" ; > ; \ @@ -518,21 +551,36 @@ ItemList = \ < "Yoann Le Bars" ; > ; \ < "Armin Le Grand" ; > ; \ < "Brigitte Le Grand" ; > ; \ + < "Jakob Lechner" ; > ; \ + < "Michael Leibowitz" ; > ; \ < "Serge Le Louarne" ; > ; \ < "Dong Lee" ; > ; \ < "Kenneth Lee" ; > ; \ < "Gregory Leffler" ; > ; \ < "Hercule Li" ; > ; \ + < "Hui Li" ; > ; \ + < "Jian Li" ; > ; \ < "Tommy C. Li" ; > ; \ < "Wind Li" ; > ; \ + < "Xing Li" ; > ; \ + < "Ping Liao" ; > ; \ < "Xin Liao" ; > ; \ + < "Weike Liang" ; > ; \ < "Rony Liemmukda" ; > ; \ + < "Tor Lillqvist" ; > ; \ < "Patranun Limudomporn" ; > ; \ < "Archie Lin" ; > ; \ < "Fong Lin" ; > ; \ < "Martha J. Lindeman" ; > ; \ < "Joachim Lingner" ; > ; \ < "Christian Lippka" ; > ; \ + < "Chen Liu" ; > ; \ + < "Jianli Liu" ; > ; \ + < "Mindy Liu" ; > ; \ + < "Tao Liu" ; > ; \ + < "YiSong Liu" ; > ; \ + < "Yu Liu" ; > ; \ + < "Yuhua Liu" ; > ; \ < "ALT Linux Russia" ; > ; \ < "Jonathan S. Lister" ; > ; \ < "Vedran Ljubovic" ; > ; \ @@ -544,6 +592,7 @@ ItemList = \ < "Anthony Long" ; > ; \ < "Roberto Loprieno" ; > ; \ < "Riccardo Losselli" ; > ; \ + < "Jackson Low" ; > ; \ < "Patrick Luby" ; > ; \ < "Christoph Lukasiak" ; > ; \ < "Robert Ludvik" ; > ; \ @@ -551,17 +600,23 @@ ItemList = \ < "Edgardo Lugaresi" ; > ; \ < "Gavin Lu" ; > ; \ < "Morton Lund" ; > ; \ + < "Jingrong Luo" ; > ; \ < "Zaoliang Luo" ; > ; \ < "Ian Lynch" ; > ; \ + < "Jun Ma" ; > ; \ < "Thomas J.L. MacDermott" ; > ; \ < "Marcio A. Macendo" ; > ; \ < "George Machitidze" ; > ; \ < "Diane Mackay" ; > ; \ + < "Prasad Madhav" ; > ; \ < "Jorgen Madsen" ; > ; \ < "Ove Madsen" ; > ; \ < "Martin Maher" ; > ; \ + < "Babak Mahbod" ; > ; \ + < "Nakata Maho " ; > ; \ < "Wad Mahsckoff" ; > ; \ < "Milena Majorosova" ; > ; \ + < "Yonggang Mao" ; > ; \ < "Libor Maly" ; > ; \ < "Mandrake Soft S.A." ; > ; \ < "Libor Maly" ; > ; \ @@ -600,15 +655,18 @@ ItemList = \ < "Aaron R. Meck" ; > ; \ < "Nirav Mehta" ; > ; \ < "Michael Meeks" ; > ; \ + < "Frederico Mena-Quintero" ; > ; \ < "James Meng" ; > ; \ < "Frank Meies" ; > ; \ < "Antonius Tjipke Meinen" ; > ; \ + < "Ismael Merzaq" ; > ; \ < "Andreas Meyer" ; > ; \ < "Markus Meyer" ; > ; \ < "Rolf Meyer" ; > ; \ < "Djapparova Meruert" ; > ; \ < "Ismael Merzaq" ; > ; \ < "Michael Mi" ; > ; \ + < "Bjoern Michaelsen" ; > ; \ < "Boris Michelsz" ; > ; \ < "Bjoern Milcke" ; > ; \ < "Marcin Milkowski" ; > ; \ @@ -616,6 +674,7 @@ ItemList = \ < "Aleksander Mikhailov-Erlich" ; > ; \ < "Paul A. Miller" ; > ; \ < "Arkadiusz Miskiewicz" ; > ; \ + < "Petr Mladek" ; > ; \ < "Erica Modena" ; > ; \ < "Filip Molcan" ; > ; \ < "Tadeusz Mollun" ; > ; \ @@ -639,6 +698,7 @@ ItemList = \ < "National Centre for Software Technology, India" ; > ; \ < "Takamichi Nara" ; > ; \ < "Peter Naulls" ; > ; \ + < "Jan Navratil" ; > ; \ < "Niklas Nebel" ; > ; \ < "Ales Nehyba" ; > ; \ < "Christoph Neumann" ; > ; \ @@ -650,11 +710,13 @@ ItemList = \ < "Jan Normann Nielsen" ; > ; \ < "Ko-haw Nieh" ; > ; \ < "Peter Van Nieuwenhoven" ; > ; \ + < "Jan Nieuwenhuizen" ; > ; \ < "Dhiraj Nilange" ; > ; \ < "Sofia Nilsson" ; > ; \ < "Kazutoshi Nimura" ; > ; \ < "Jes Drost Nissen" ; > ; \ < "Sofia Nilsson" ; > ; \ + < "Christoph Noack" ; > ; \ < "Bertram Nolte" ; > ; \ < "Niels Nordmann" ; > ; \ < "Michael Novati" ; > ; \ @@ -683,6 +745,7 @@ ItemList = \ < "Subiaco Paola" ; > ; \ < "Kannada Ganaka Parishat" ; > ; \ < "Anna Parovel" ; > ; \ + < "Pierre Pasteau" ; > ; \ < "Shripad Patki" ; > ; \ < "Andreas Pauley" ; > ; \ < "Viktorija Paulikaite" ; > ; \ @@ -719,13 +782,16 @@ ItemList = \ < "Nicola Previati" ; > ; \ < "Rhoslyn Prys" ; > ; \ < "Jaroslaw Jan Pyszny" ; > ; \ + < "Jonathan Pryor" ; > ; \ < "Zhang Qingbin" ; > ; \ + < "Canghua Qu" ; > ; \ < "Volker Quetschke" ; > ; \ < "Tino Rachui" ; > ; \ < "Radostin Radnev" ; > ; \ < "Pramod Raghavendra" ; > ; \ < "Adam Rambousek" ; > ; \ < "Jacqueline Rahemipour" ; > ; \ + < "Goran Rakic" ; > ; \ < "Adam Rambousek" ; > ; \ < "Kay Ramme" ; > ; \ < "Klaus Ramstock" ; > ; \ @@ -748,6 +814,7 @@ ItemList = \ < "Kjell Arne Rekaa" ; > ; \ < "Frco. Javier Rial" ; > ; \ < "Nicholas Richards" ; > ; \ + < "Georg Richter" ; > ; \ < "Jozef Riha" ; > ; \ < "Michael Lee Rilee" ; > ; \ < "Modestas Rimkus" ; > ; \ @@ -822,6 +889,7 @@ ItemList = \ < "Syed Ahmad Shazali" ; > ; \ < "Darragh Sherwin" ; > ; \ < "Gia Shervashidze" ; > ; \ + < "Wei Guo Shi" ; > ; \ < "Norikatsu Shigemura" ; > ; \ < "Bernhard Siaud" ; > ; \ < "Joerg Sievers" ; > ; \ @@ -830,11 +898,13 @@ ItemList = \ < "Keld Jorn Simonsen" ; > ; \ < "Michael Sicotte" ; > ; \ < "Clytie Ann Siddall" ; > ; \ + < "Raul Siddahartha" ; > ; \ < "SIL International (Freddy Boswell)" ; > ; \ < "Mukund Sivaraman" ; > ; \ < "Manoranjan Kr. Singh" ; > ; \ < "G. Roderick Singleton" ; > ; \ < "Joerg Skottke" ; > ; \ + < "Sarah Smith" ; > ; \ < "Timothy P. Smith" ; > ; \ < "Colm Smyth" ; > ; \ < "Javier Sola" ; > ; \ @@ -860,9 +930,11 @@ ItemList = \ < "Erik William Strack" ; > ; \ < "Daniel Strome" ; > ; \ < "Fridrich Strba" ; > ; \ + < "Keith Stribley" ; > ; \ < "Ulf Stroehler" ; > ; \ < "Daniel Strome" ; > ; \ < "Louis Suarez-Potts" ; > ; \ + < "Muthu Subramanian" ; > ; \ < "Matthias Suess" ; > ; \ < "Tae Hoon Suk of Intellikorea Ca., Ltd." ; > ; \ < "Arthit Suriyawongkul" ; > ; \ @@ -880,7 +952,9 @@ ItemList = \ < "Christina Taliaferro" ; > ; \ < "Makoto Takizawa" ; > ; \ < "Masaki Tamakoshi" ; > ; \ + < "Quanfa Tang" ; > ; \ < "Alberto Di Taranto" ; > ; \ + < "David Tardon" ; > ; \ < "Uday K. Tashildar" ; > ; \ < "Stefan Taxhet" ; > ; \ < "William Terry" ; > ; \ @@ -896,6 +970,7 @@ ItemList = \ < "James M. Thompson" ; > ; \ < "Holger Thon" ; > ; \ < "Alexander Thurgood" ; > ; \ + < "Caio Tiago Oliveira" ; > ; \ < "Lukas Tinkl" ; > ; \ < "Gerhard Tonn" ; > ; \ < "Istvan Torda" ; > ; \ @@ -944,6 +1019,7 @@ ItemList = \ < "William Wan" ; > ; \ < "Funda Wang" ; > ; \ < "Polly Wang" ; > ; \ + < "Xu Ming Wang" ; > ; \ < "Yi Wang" ; > ; \ < "Sangay Wangchuk" ; > ; \ < "Matthew Wardrop" ; > ; \ @@ -954,6 +1030,7 @@ ItemList = \ < "Martin Webermann" ; > ; \ < "Donata Wegener" ; > ; \ < "Law Yee Wei" ; > ; \ + < "Zhao Wei" ; > ; \ < "Michel Weimerskirch" ; > ; \ < "Prof. Dr. Eduard Werner" ; > ; \ < "Michael Wever" ; > ; \ @@ -974,19 +1051,25 @@ ItemList = \ < "Eugene T.S. Wong" ; > ; \ < "Pui Lam Wong" ; > ; \ < "Minna Wu" ; > ; \ + < "Yan Wu" ; > ; \ < "Stephan Wunderlich" ; > ; \ < "Simos Xenitellis" ; > ; \ < "Shun Min Serena Xiao" ; > ; \ < "Nat Friedman for Ximian" ; > ; \ + < "Antonio Xu" ; > ; \ + < "Dehua Xu" ; > ; \ < "Gary Yang" ; > ; \ < "Yukiharu Yabuki" ; > ; \ < "Kliment Pavlov Yanev" ; > ; \ < "Taniguchi Yasuaki" ; > ; \ < "Oleg Yegorov" ; > ; \ + < "Steve Yin" ; > ; \ < "Kunihiko Yokota" ; > ; \ < "Kim Il Yong" ; > ; \ < "Kohei Yoshida" ; > ; \ < "Deltasoft Yu" ; > ; \ + < "Guoqiang Yu" ; > ; \ + < "Xiaoyang Yu" ; > ; \ < "Gary Yuen" ; > ; \ < "Christian Zagrodnick" ; > ; \ < "George Zahopulos" ; > ; \ @@ -996,7 +1079,10 @@ ItemList = \ < "Fuxin Zhang" ; > ; \ < "Joy Zhang" ; > ; \ < "Lei Phill Zhang" ; > ; \ + < "Xiaofei Zhang" ; > ; \ + < "Jianwei Zhao" ; > ; \ < "May Zhang" ; > ; \ + < "Jeremy Zheng" ; > ; \ < "Thorsten Ziehm" ; > ; \ < "Stefan Ziel" ; > ; \ < "Jan Zitniak" ; > ; \ @@ -1015,7 +1101,7 @@ ItemList = \ < "" ; > ; \ < "FUNCTIONAL STAFF" ; 8 ; > ; \ < "" ; > ; \ - < "Sabine Schroeder" ; > ; \ + < "Sabine Huetsch" ; > ; \ < "" ; > ; \ < "OpenOffice.org COORDINATION" ; 8 ; > ; \ < "" ; > ; \ @@ -1026,13 +1112,14 @@ ItemList = \ < "Matthias Huetsch" ; > ; \ < "Kay Ramme" ; > ; \ < "" ; > ; \ - < "SUN SIGMA BLACK BELT" ; 8 ; > ; \ - < "" ; > ; \ - < "Stefan Zimmermann" ; > ; \ - < "" ; > ; \ < "PROGRAM MANAGEMENT" ; 8 ; > ; \ < "" ; > ; \ + < "Joost Andrae" ; > ; \ + < "Martin Damboldt" ; > ; \ + < "Martin Hollmichel" ; > ; \ < "Andre Kuemmel" ; > ; \ + < "Marcus Lange" ; > ; \ + < "Uwe Luebbers" ; > ; \ < "" ; > ; \ < "" ; > ; \ < "%PRODUCTNAME DEVELOPMENT" ; 8 ; > ; \ @@ -1047,7 +1134,6 @@ ItemList = \ < "ODF" ; 8 ; > ; \ < "" ; > ; \ < "Svante Schubert" ; > ; \ - < "Lars Behrmann" ; > ; \ < "" ; > ; \ < "DESIGN" ; 8 ; > ; \ < "" ; > ; \ @@ -1068,10 +1154,9 @@ ItemList = \ < "Thomas Lange" ; > ; \ < "Andreas Martens" ; > ; \ < "Frank Meies" ; > ; \ + < "Bjoern Michaelsen" ; > ; \ < "Andreas Schluens" ; > ; \ < "Oliver Specht" ; > ; \ - < "Gunnar Timm" ; > ; \ - < "Daniel Vogelheim" ; > ; \ < "Oliver-Rainer Wittmann" ; > ; \ < "Michael Stahl" ; > ; \ < "Mikhail Voitenko" ; > ; \ @@ -1081,8 +1166,6 @@ ItemList = \ < "Kai Ahrens" ; > ; \ < "" ; > ; \ < "Volker Ahrendt" ; > ; \ - < "Thorsten Behrens" ; > ; \ - < "Michael Buettner" ; > ; \ < "Herbert Duerr" ; > ; \ < "Andre Fischer" ; > ; \ < "Ilko Hoepping" ; > ; \ @@ -1100,9 +1183,9 @@ ItemList = \ < "Kai Sommerfeld" ; > ; \ < "" ; > ; \ < "Stephan Bergmann" ; > ; \ - < "Oliver Braun" ; > ; \ < "Andreas Bregas" ; > ; \ < "Steffen Grund" ; > ; \ + < "Mihaela Kedikova" ; > ; \ < "Tobias Krause" ; > ; \ < "Joachim Lingner" ; > ; \ < "Christoph Neumann" ; > ; \ @@ -1112,7 +1195,7 @@ ItemList = \ < "Dirk Voelzke" ; > ; \ < "" ; > ; \ < "" ; > ; \ - < "%PRODUCTNAME PIM & CALC" ; 8 ; > ; \ + < "%PRODUCTNAME CALC" ; 8 ; > ; \ < "" ; > ; \ < "Stephan Schaefer" ; > ; \ < "" ; > ; \ @@ -1120,32 +1203,16 @@ ItemList = \ < "Daniel Boelzle" ; > ; \ < "Berend Cornelius" ; > ; \ < "Ingrid Halama" ; > ; \ - < "Philipp Kewisch" ; > ; \ < "Bjoern Milcke" ; > ; \ < "Niklas Nebel" ; > ; \ - < "Frank Neumann" ; > ; \ < "Eike Rathke" ; > ; \ < "Daniel Rentz" ; > ; \ < "" ; > ; \ < "" ; > ; \ - < "%PRODUCTNAME CONFIGURATION MANAGER" ; 8 ; > ; \ - < "" ; > ; \ - < "Dirk Grobler" ; > ; \ - < "" ; > ; \ - < "Joerg Barfurth" ; > ; \ - < "Rodrigo Fernandez-Vizarra Bonet" ; > ; \ - < "Katell Galard" ; > ; \ - < "Geoff Higgins" ; > ; \ - < "Stephen Lewis" ; > ; \ - < "Cyrille Moureaux" ; > ; \ - < "Thomas Pfohe" ; > ; \ - < "Klaus Ruehl" ; > ; \ - < "" ; > ; \ - < "" ; > ; \ < "USER EXPERIENCE" ; 8 ; > ; \ < "" ; > ; \ - < "Lutz Hoeger" ; > ; \ < "" ; > ; \ + < "Andreas Bartel" ; > ; \ < "Bettina Haberer" ; > ; \ < "Christian Jansen" ; > ; \ < "Frank Loehmann" ; > ; \ @@ -1156,15 +1223,10 @@ ItemList = \ < "" ; > ; \ < "Nils Fuhrmann" ; > ; \ < "" ; > ; \ - < "PROGRAM MANAGEMENT" ; 8 ; > ; \ < "" ; > ; \ - < "Joost Andrae" ; > ; \ - < "Martin Damboldt" ; > ; \ - < "Martin Hollmichel" ; > ; \ + < "RELEASE ENGINEERING " ; 8 ; > ; \ < "" ; > ; \ - < "RELEASE ENGINEERING & DEVELOPMENT TOOLS" ; 8 ; > ; \ - < "" ; > ; \ - < "Joerg Jahnke" ; > ; \ + < "Ruediger Timm" ; > ; \ < "" ; > ; \ < "RELEASE ENGINEERING" ; 8 ; > ; \ < "" ; > ; \ @@ -1173,11 +1235,12 @@ ItemList = \ < "Ivo Hinkelmann" ; > ; \ < "Hans-Joachim Lankenau" ; > ; \ < "Jens-Heiner Rechtien" ; > ; \ - < "Ruediger Timm" ; > ; \ < "Kurt Zenker" ; > ; \ < "" ; > ; \ < "DEVELOPMENT TOOLS" ; 8 ; > ; \ < "" ; > ; \ + < "Joerg Jahnke" ; > ; \ + < "" ; > ; \ < "Bernd Eilers" ; > ; \ < "Gregor Hartmann" ; > ; \ < "Frank Mau" ; > ; \ @@ -1213,12 +1276,10 @@ ItemList = \ < "Marc Neumann" ; > ; \ < "Wolfram Garten" ; > ; \ < "Christian Guenther" ; > ; \ - < "Fredrik Haegg" ; > ; \ < "" ; > ; \ < "QA %PRODUCTNAME INFRASTRUCTURE" ; 8 ; > ; \ < "" ; > ; \ < "Olaf Felka" ; > ; \ - < "Uwe Luebbers" ; > ; \ < "Thorsten Martens" ; > ; \ < "Joerg W. Skottke" ; > ; \ < "Andreas Treumann" ; > ; \ @@ -1240,82 +1301,31 @@ ItemList = \ < "" ; > ; \ < "GLOBALIZATION" ; 8 ; > ; \ < "" ; > ; \ - < "Management" ; 8 ; > ; \ - < "" ; > ; \ - < "Tom Garland" ; > ; \ - < "Michelle Hills" ; > ; \ - < "Shinobu Matsuzuka" ; > ; \ - < "" ; > ; \ < "PROGRAM MANAGEMENT" ; 8 ; > ; \ < "" ; > ; \ < "Rafaella Braconi" ; > ; \ < "" ; > ; \ - < "Engineering and Testing" ; 8 ; > ; \ - < "" ; > ; \ - < "Ales Cernosek" ; > ; \ - < "Petr Dudacek" ; > ; \ - < "Karl Hong" ; > ; \ - < "Naoyuki Ishimura" ; > ; \ - < "Aijin Kim" ; > ; \ - < "Ian McDonnell" ; > ; \ - < "Kazuhiro Hatake Takabatake " ; > ; \ - < "Lei Phill Zhang" ; > ; \ - < "May Zhang" ; > ; \ - < "" ; > ; \ - < "Translation Management" ; 8 ; > ; \ - < "" ; > ; \ - < "Monica Badia" ; > ; \ - < "Sofia Nilsson" ; > ; \ - < "Kaoru Oguru" ; > ; \ - < "Joy Zhang" ; > ; \ - < "" ; > ; \ - < "Documentation & Tools" ; 8 ; > ; \ - < "" ; > ; \ - < "Yu Aaron Cheng" ; > ; \ - < "Sven Klawitter" ; > ; \ - < "Hiroko Matano" ; > ; \ - < "Boris Steiner" ; > ; \ - < "Michal Touzin" ; > ; \ - < "" ; > ; \ - < "" ; > ; \ < "MARKETING & OPERATIONS" ; 8 ; > ; \ < "" ; > ; \ - < "PRODUCT & PROGRAM MANAGMENT" ; 8 ; > ; \ + < "PRODUCT MANAGMENT" ; 8 ; > ; \ < "" ; > ; \ < "Goetz Wohlberg" ; > ; \ + < "Lutz Hoeger" ; > ; \ < "" ; > ; \ < "MARKETING" ; 8 ; > ; \ < "" ; > ; \ - < "Alexei Koudriachov" ; > ; \ - < "Ashish Mukharji" ; > ; \ - < "Manish Punjabi" ; > ; \ - < "Erwin Tenhumberg" ; > ; \ + < "Rosana Ardila Biela" ; > ; \ + < "Kay Koll" ; > ; \ < "Iyer Venkatesan" ; > ; \ - < "Jennifer Winger" ; > ; \ + < "" ; > ; \ + < "SUN SIGMA BLACK BELT" ; 8 ; > ; \ + < "" ; > ; \ + < "Stefan Zimmermann" ; > ; \ < "" ; > ; \ < "OPERATIONS" ; 8 ; > ; \ < "" ; > ; \ - < "Scott Citta" ; > ; \ - < "Jane Cooley" ; > ; \ - < "Lisa Medlin" ; > ; \ < "Parker Proffitt" ; > ; \ < "" ; > ; \ - < "TECHNICAL TRAINING, MARKET &" ; 8 ; > ; \ - < "BUSINESS DEVELOPMENT" ; 8 ; > ; \ - < "" ; > ; \ - < "Matthew Baier" ; > ; \ - < "Herve Bernard" ; > ; \ - < "Kay Koll" ; > ; \ - < "Ted Tudor" ; > ; \ - < "Jane Worden" ; > ; \ - < "Sophia Zheng " ; > ; \ - < "" ; > ; \ - < "ADDITIONAL FUNCTIONS" ; 8 ; > ; \ - < "" ; > ; \ - < "Bill Lane" ; > ; \ - < "Douglas Lenser" ; > ; \ - < "Frank Psotka" ; > ; \ - < "" ; > ; \ };\ #define TEXT_DEFAULTABOUT \ From efdb9a4a4451e7c87888e6921fab5fd626b4ad26 Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Thu, 12 Nov 2009 06:37:32 +0000 Subject: [PATCH 099/117] #i106766# Disable XCommandProcessor::Abort --- ucb/source/ucp/webdav/NeonSession.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index b455ffebbb9b..5d1ba2d6927c 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -1319,8 +1319,11 @@ void NeonSession::POST( const rtl::OUString & inPath, void NeonSession::ABORT() throw ( DAVException ) { - if (NULL !=m_pHttpSession) - ne_close_connection(m_pHttpSession); + // 11.11.09 (tkr): The following code lines causing crashes if closing a ongoing connection. It turned out that this existing solution doesn't work in multi-threading environments. + // So I disabled them in 3.2. . Issue #73893# should fix it in OOo 3.3. + + //if (NULL !=m_pHttpSession) + // ne_close_connection(m_pHttpSession); } // ------------------------------------------------------------------- From ed74ab411a895f3bf9b60296b8a9ae849165436c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20D=C3=BCsterhoff?= Date: Thu, 12 Nov 2009 14:29:09 +0000 Subject: [PATCH 100/117] #i103745# method - correct handling of restart without start value on list level 1 --- xmloff/source/text/txtparae.cxx | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 2c160eabd334..d46d3a446395 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -807,6 +807,11 @@ void XMLTextParagraphExport::exportListChange( } } + const bool bExportODF = + ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0; + const SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion = + GetExport().getDefaultVersion(); + // start a new list if ( rNextInfo.GetLevel() > 0 ) { @@ -829,10 +834,6 @@ void XMLTextParagraphExport::exportListChange( if ( nListLevelsToBeOpened > 0 ) { - const bool bExportODF = - ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0; - const SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion = - GetExport().getDefaultVersion(); const ::rtl::OUString sListStyleName( rNextInfo.GetNumRulesName() ); // Currently only the text documents support . // Thus, for other document types is empty. @@ -1038,16 +1039,14 @@ void XMLTextParagraphExport::exportListChange( pListElements->Remove( pListElements->Count()-1 ); delete pElem; - if ( rNextInfo.IsRestart() && !rNextInfo.HasStartValue() ) + // --> OD 2009-11-12 #i103745# - only for sub lists + if ( rNextInfo.IsRestart() && !rNextInfo.HasStartValue() && + rNextInfo.GetLevel() != 1 ) + // <-- { // start new sub list respectively list on same list level pElem = (*pListElements)[pListElements->Count()-1]; GetExport().EndElement( *pElem, sal_True ); - if ( rNextInfo.GetLevel() == 1 ) - { - GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, - GetExport().EncodeStyleName( rNextInfo.GetNumRulesName() ) ); - } GetExport().IgnorableWhitespace(); GetExport().StartElement( *pElem, sal_False ); } @@ -1059,8 +1058,18 @@ void XMLTextParagraphExport::exportListChange( OUStringBuffer aBuffer; aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() ); GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, - aBuffer.makeStringAndClear() ); + aBuffer.makeStringAndClear() ); } + // --> OD 2009-11-12 #i103745# - handle restart without start value on list level 1 + else if ( rNextInfo.IsRestart() && /*!rNextInfo.HasStartValue() &&*/ + rNextInfo.GetLevel() == 1 ) + { + OUStringBuffer aBuffer; + aBuffer.append( (sal_Int32)rNextInfo.GetListLevelStartValue() ); + GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, + aBuffer.makeStringAndClear() ); + } + // <-- if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 && GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) { From a8e0ee834b363ae729e2d4a781b05e1dbb2bd03e Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Fri, 13 Nov 2009 06:24:13 +0000 Subject: [PATCH 101/117] #i106859# crash fixed --- svx/source/cui/cuicharmap.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/svx/source/cui/cuicharmap.cxx b/svx/source/cui/cuicharmap.cxx index a66c7b3c10a8..4de8df0e7d7d 100644 --- a/svx/source/cui/cuicharmap.cxx +++ b/svx/source/cui/cuicharmap.cxx @@ -71,11 +71,12 @@ SvxCharacterMap::SvxCharacterMap( Window* pParent, BOOL bOne, const SfxItemSet* if ( pItem ) bOne = pItem->GetValue(); + mpCharMapData = new SvxCharMapData( this, bOne, &DIALOG_MGR() ); + SFX_ITEMSET_ARG( pSet, pCharItem, SfxInt32Item, SID_ATTR_CHAR, FALSE ); if ( pCharItem ) - SetChar( pItem->GetValue() ); + SetChar( pCharItem->GetValue() ); - mpCharMapData = new SvxCharMapData( this, bOne, &DIALOG_MGR() ); SFX_ITEMSET_ARG( pSet, pDisableItem, SfxBoolItem, FN_PARAM_2, FALSE ); if ( pDisableItem && pDisableItem->GetValue() ) From 8a311577cec78769d85c27fbe4b965ed2d3d6d91 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Fri, 13 Nov 2009 09:17:24 +0000 Subject: [PATCH 102/117] #i105238 fix spelling of monospaced bitstream and dejavu fallbacks --- officecfg/registry/data/org/openoffice/VCL.xcu | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index b30a43202300..2a17b4ecdd55 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -1648,9 +1648,9 @@ Default,Serif - + - dejavumono + dejavusansmono;couriernew;liberationmono monospace Normal @@ -2377,7 +2377,7 @@ - cumberland;cumberlandamt;liberationmono;nimbusmonol;courier;lucidatypewriter;lucidasanstypewriter;monaco;monospaced;nimbusmono;nimbusmonol + cumberland;cumberlandamt;liberationmono;dejavusansmono;nimbusmonol;courier;lucidatypewriter;lucidasanstypewriter;monaco;monospaced;nimbusmono;nimbusmonol Courier @@ -2388,7 +2388,7 @@ - cumberlandamt;couriernew;liberationmono;nimbusmonol;courier;lucidatypewriter;lucidasanstypewriter;monaco;monospaced;nimbusmono;nimbusmonol + cumberlandamt;couriernew;liberationmono;dejavusansmono;nimbusmonol;courier;lucidatypewriter;lucidasanstypewriter;monaco;monospaced;nimbusmono;nimbusmonol Courier New @@ -2411,7 +2411,7 @@ - cumberland;couriernew;liberationmono;nimbusmonol;courier;lucidatypewriter;lucidasanstypewriter;monaco;monospaced;nimbusmono;nimbusmonol + cumberland;couriernew;liberationmono;dejavusansmono;nimbusmonol;courier;lucidatypewriter;lucidasanstypewriter;monaco;monospaced;nimbusmono;nimbusmonol Courier New @@ -2498,9 +2498,9 @@ Default,Serif - + - bitstreamveramono + bitstreamverasansmono;couriernew;liberationmono monospace Normal @@ -4739,7 +4739,7 @@ - cumberland;cumberlandamt;couriernew;nimbusmonol;courier;lucidatypewriter;lucidasanstypewriter;monaco;monospaced;nimbusmono;nimbusmonol + cumberland;cumberlandamt;couriernew;dejavusansmono;nimbusmonol;courier;lucidatypewriter;lucidasanstypewriter;monaco;monospaced;nimbusmono;nimbusmonol Courier New From f60167ddb925220edec2b9c0ee4826292d24b355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20D=C3=BCsterhoff?= Date: Fri, 13 Nov 2009 09:38:27 +0000 Subject: [PATCH 103/117] #i106218# method - First collect all paragraph styles chosen for assignment to the outline style. Then perform the intrinsic assignment. Reason: side effect of assignment in Writer. --- xmloff/source/text/txtimp.cxx | 48 +++++++++++++++-------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 613a4688389f..cad922d48fdd 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1508,8 +1508,6 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( return sStyleName; } -// --> OD 2006-10-12 #i69629# -// adjustments to reflect change of internal data structure void XMLTextImportHelper::FindOutlineStyleName( ::rtl::OUString& rStyleName, sal_Int8 nOutlineLevel ) { @@ -1560,9 +1558,7 @@ void XMLTextImportHelper::FindOutlineStyleName( ::rtl::OUString& rStyleName, } // else: we already had a style name, so we let it pass. } -// <-- -// --> OD 2006-10-12 #i69629# void XMLTextImportHelper::AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel, const OUString& rStyleName ) { @@ -1585,16 +1581,13 @@ void XMLTextImportHelper::AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel mpOutlineStylesCandidates[nOutlineLevel-1].push_back( rStyleName ); } } -// <-- -// --> OD 2006-10-12 #i69629# void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) { if ( ( mpOutlineStylesCandidates != NULL || bSetEmptyLevels ) && xChapterNumbering.is() && !IsInsertMode() ) { - // --> OD 2007-12-19 #152540# bool bChooseLastOne( false ); { if ( GetXMLImport().IsTextDocInOOoFileFormat() ) @@ -1607,15 +1600,12 @@ void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) sal_Int32 nBuild( 0 ); if ( GetXMLImport().getBuildIds( nUPD, nBuild ) ) { - // --> OD 2008-03-19 #i86058# // check explicitly on certain versions bChooseLastOne = ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0 ( nUPD == 680 && nBuild <= 9073 ); // OOo 2.0 - OOo 2.0.4 - // <-- } } } - // <-- OUString sOutlineStyleName; { @@ -1624,8 +1614,15 @@ void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) xChapterNumRule->getPropertyValue(sName) >>= sOutlineStyleName; } - OUString sEmpty; - sal_Int32 nCount = xChapterNumbering->getCount(); + const sal_Int32 nCount = xChapterNumbering->getCount(); + // --> OD 2009-11-13 #i106218# + // First collect all paragraph styles choosen for assignment to each + // list level of the outline style, then perform the intrinsic assignment. + // Reason: The assignment of a certain paragraph style to a list level + // of the outline style causes side effects on the children + // paragraph styles in Writer. + ::std::vector sChosenStyles(nCount); + // <-- for( sal_Int32 i=0; i < nCount; ++i ) { if ( bSetEmptyLevels || @@ -1634,17 +1631,12 @@ void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) { // determine, which candidate is one to be assigned to the list // level of the outline style - OUString sChoosenStyle( sEmpty ); if ( mpOutlineStylesCandidates && !mpOutlineStylesCandidates[i].empty() ) { - // --> OD 2007-12-19 #152540# if ( bChooseLastOne ) - // <-- { - // --> OD 2006-11-06 #i71249# - take last added one - sChoosenStyle = mpOutlineStylesCandidates[i].back(); - // <-- + sChosenStyles[i] = mpOutlineStylesCandidates[i].back(); } else { @@ -1655,24 +1647,26 @@ void XMLTextImportHelper::SetOutlineStyles( sal_Bool bSetEmptyLevels ) sNumberingStyleName, sOutlineStyleName ) ) { - sChoosenStyle = mpOutlineStylesCandidates[i][j]; + sChosenStyles[i] = mpOutlineStylesCandidates[i][j]; break; } } } } - - Sequence < PropertyValue > aProps( 1 ); - PropertyValue *pProps = aProps.getArray(); - pProps->Name = sHeadingStyleName; - pProps->Value <<= sChoosenStyle; - - xChapterNumbering->replaceByIndex( i, makeAny( aProps ) ); } } + // --> OD 2009-11-13 #i106218# + Sequence < PropertyValue > aProps( 1 ); + PropertyValue *pProps = aProps.getArray(); + pProps->Name = sHeadingStyleName; + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + pProps->Value <<= sChosenStyles[i]; + xChapterNumbering->replaceByIndex( i, makeAny( aProps ) ); + } + // <-- } } -// <-- void XMLTextImportHelper::SetHyperlink( SvXMLImport& rImport, From 215d2765a7a7147d56e5bd3505ade653700ee4cb Mon Sep 17 00:00:00 2001 From: Martin Hollmichel Date: Fri, 13 Nov 2009 11:32:37 +0000 Subject: [PATCH 104/117] reviewed --- svx/source/intro/intro_tmpl.hrc | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/svx/source/intro/intro_tmpl.hrc b/svx/source/intro/intro_tmpl.hrc index 2fb03252ead2..f724cd476ec2 100644 --- a/svx/source/intro/intro_tmpl.hrc +++ b/svx/source/intro/intro_tmpl.hrc @@ -464,7 +464,6 @@ ItemList = \ < "masahisa kamataki" ; > ; \ < "Tim Kampa" ; > ; \ < "Petr Kania" ; > ; \ - < "Tim Kampa" ; > ; \ < "Mick Kappenburg" ; > ; \ < "Etsushi Kato" ; > ; \ < "Yosuke Kato" ; > ; \ @@ -1211,7 +1210,6 @@ ItemList = \ < "" ; > ; \ < "USER EXPERIENCE" ; 8 ; > ; \ < "" ; > ; \ - < "" ; > ; \ < "Andreas Bartel" ; > ; \ < "Bettina Haberer" ; > ; \ < "Christian Jansen" ; > ; \ @@ -1228,8 +1226,6 @@ ItemList = \ < "" ; > ; \ < "Ruediger Timm" ; > ; \ < "" ; > ; \ - < "RELEASE ENGINEERING" ; 8 ; > ; \ - < "" ; > ; \ < "Oliver Bolte" ; > ; \ < "Vladimir Glazounov" ; > ; \ < "Ivo Hinkelmann" ; > ; \ @@ -1299,9 +1295,7 @@ ItemList = \ < "Martina Waller" ; > ; \ < "" ; > ; \ < "" ; > ; \ - < "GLOBALIZATION" ; 8 ; > ; \ - < "" ; > ; \ - < "PROGRAM MANAGEMENT" ; 8 ; > ; \ + < "GLOBALIZATION PROGRAM MANAGEMENT" ; 8 ; > ; \ < "" ; > ; \ < "Rafaella Braconi" ; > ; \ < "" ; > ; \ @@ -1318,14 +1312,14 @@ ItemList = \ < "Kay Koll" ; > ; \ < "Iyer Venkatesan" ; > ; \ < "" ; > ; \ - < "SUN SIGMA BLACK BELT" ; 8 ; > ; \ - < "" ; > ; \ - < "Stefan Zimmermann" ; > ; \ - < "" ; > ; \ < "OPERATIONS" ; 8 ; > ; \ < "" ; > ; \ < "Parker Proffitt" ; > ; \ < "" ; > ; \ + < "SUN SIGMA BLACK BELT" ; 8 ; > ; \ + < "" ; > ; \ + < "Stefan Zimmermann" ; > ; \ + < "" ; > ; \ };\ #define TEXT_DEFAULTABOUT \ From d2e7f677c5be667944bb2d873ada261dbefd5309 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 16 Nov 2009 13:48:33 +0100 Subject: [PATCH 105/117] validityref: #i103899# manual migration from svn (contribution from PengYunQuan) --- sfx2/inc/sfx2/childwin.hxx | 6 ++++-- sfx2/inc/sfx2/objsh.hxx | 3 +++ sfx2/source/control/bindings.cxx | 5 ++++- sfx2/source/doc/objmisc.cxx | 7 +++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/sfx2/inc/sfx2/childwin.hxx b/sfx2/inc/sfx2/childwin.hxx index 690d8392d056..2c240dae89af 100644 --- a/sfx2/inc/sfx2/childwin.hxx +++ b/sfx2/inc/sfx2/childwin.hxx @@ -205,8 +205,10 @@ public: void SetPosSizePixel(const Point& rPoint, Size& rSize); Point GetPosPixel() { return pWindow->GetPosPixel(); } - void Hide(); - void Show( USHORT nFlags ); +//Modified by PengYunQuan for Validity Cell Range Picker sal_uInt16 GetFlags() const { return GetInfo().nFlags; } sal_Bool CanGetFocus() const; diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 71f1729840c0..7c5cb38dd9b4 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -306,6 +306,9 @@ public: sal_Bool IsReadOnlyUI() const; void SetNoName(); sal_Bool IsInModalMode() const; + //Added by PengYunQuan for Validity Cell Range Picker sal_Bool HasModalViews() const; sal_Bool IsHelpDocument() const; diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 34deb24bcc32..e5d78f560cc9 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -2093,7 +2093,10 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) // modifying the SfxObjectInterface-stack without SfxBindings => nothing to do SfxViewFrame* pFrame = pDispatcher->GetFrame(); - if ( (pFrame && pFrame->GetObjectShell()->IsInModalMode()) || pSfxApp->IsDowning() || !pImp->pCaches->Count() ) + //Modified by PengYunQuan for Validity Cell Range Picker { DBG_PROFSTOP(SfxBindingsNextJob_Impl0); return sal_True; diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index a7910c463cf9..bc0dd3762acd 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -493,6 +493,13 @@ sal_Bool SfxObjectShell::IsInModalMode() const return pImp->bModalMode || pImp->bRunningMacro; } +//Added by PengYunQuan for Validity Cell Range Picker + //------------------------------------------------------------------------- sal_Bool SfxObjectShell::HasModalViews() const From b4083630cb439a9f54340db6840e8bc6cfcc42c8 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Mon, 16 Nov 2009 21:50:44 +0100 Subject: [PATCH 106/117] masterfix: #i10000# missing dependency added --- desktop/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index ce2ed07f57e4..3f51d13cec1b 100644 --- a/desktop/prj/build.lst +++ b/desktop/prj/build.lst @@ -21,7 +21,7 @@ dt desktop\os2\source\applauncher nmake - p dt_applauncher dt_inc NULL dt desktop\unx\source\officeloader nmake - u dt_officeloader_unx dt_inc NULL dt desktop\source\pagein nmake - u dt_pagein dt_inc NULL dt desktop\source\pkgchk\unopkg nmake - all dt_unopkg dt_dp_misc dt_app dt_inc dt_guiloader.w NULL -dt desktop\source\deployment nmake - all dt_deployment dt_dp_manager dt_dp_registry dt_dp_registry_package dt_dp_registry_executable dt_dp_registry_help dt_dp_registry_script dt_dp_registry_sfwk dt_dp_registry_component dt_dp_registry_configuration dt_dp_migration dt_dp_unopkg dt_inc NULL +dt desktop\source\deployment nmake - all dt_deployment dt_dp_manager dt_dp_registry dt_dp_registry_package dt_dp_registry_executable dt_dp_registry_help dt_dp_registry_script dt_dp_registry_sfwk dt_dp_registry_component dt_dp_registry_configuration dt_dp_migration dt_dp_unopkg dt_inc dt_dp_misc NULL dt desktop\source\deployment\misc nmake - all dt_dp_misc dt_inc NULL dt desktop\source\deployment\unopkg nmake - all dt_dp_unopkg dt_inc NULL dt desktop\source\deployment\migration nmake - all dt_dp_migration dt_inc NULL From 9ce205f4769bc01cd271ff9b96c9ec2438162bab Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Tue, 17 Nov 2009 08:00:39 +0000 Subject: [PATCH 107/117] #i106766# ::Abort Method disabled --- ucb/source/ucp/webdav/DAVResourceAccess.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx index 67f8e5a386f0..140b3dd3af94 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx @@ -555,8 +555,9 @@ void DAVResourceAccess::GET( void DAVResourceAccess::ABORT() throw( DAVException ) { - initialize(); - m_xSession->ABORT(); + // 17.11.09 (tkr): abort currently disabled caused by issue i106766 + // initialize(); + // m_xSession->ABORT(); } //========================================================================= namespace { From 70dfafd85a420e77094c5c6e3b50c03c7672b413 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 17 Nov 2009 10:43:07 +0000 Subject: [PATCH 108/117] #i106863# directory can be empty --- fpicker/source/aqua/SalAquaPicker.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fpicker/source/aqua/SalAquaPicker.cxx b/fpicker/source/aqua/SalAquaPicker.cxx index aaf311de020a..0188fc296af0 100644 --- a/fpicker/source/aqua/SalAquaPicker.cxx +++ b/fpicker/source/aqua/SalAquaPicker.cxx @@ -208,7 +208,10 @@ int SalAquaPicker::run() } if (retVal == NSFileHandlingPanelOKButton) { - implsetDisplayDirectory([[NSURL fileURLWithPath:[m_pDialog directory]] OUStringForInfo:FULLPATH]); + NSString* pDir = [m_pDialog directory]; + if (pDir) { + implsetDisplayDirectory([[NSURL fileURLWithPath:pDir] OUStringForInfo:FULLPATH]); + } } DBG_PRINT_EXIT(CLASS_NAME, __func__, retVal); From af7900fab0938db875cea37fa7e5176e872e77a2 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 17 Nov 2009 15:13:56 +0000 Subject: [PATCH 109/117] #i105710# restored bin stream operators for bullet item, still used by outliner clipboard --- svx/inc/svx/numitem.hxx | 30 +-- svx/source/items/numitem.cxx | 466 ++++++++++++++++++----------------- 2 files changed, 251 insertions(+), 245 deletions(-) diff --git a/svx/inc/svx/numitem.hxx b/svx/inc/svx/numitem.hxx index 17eb3d62630c..9840ec1688ac 100644 --- a/svx/inc/svx/numitem.hxx +++ b/svx/inc/svx/numitem.hxx @@ -76,12 +76,6 @@ namespace com{namespace sun{ namespace star{ #define SVX_NO_NUM 200 // Markierung fuer keine Numerierung #define SVX_NO_NUMLEVEL 0x20 -// --> OD 2008-01-10 #newlistlevelattrs# - no longer used -//#define NUMITEM_VERSION_01 0x01 -//#define NUMITEM_VERSION_02 0x02 -//#define NUMITEM_VERSION_03 0x03 -// <-- - #define LINK_TOKEN 0x80 //indicate linked bitmaps - for use in dialog only class SVX_DLLPUBLIC SvxNumberType { @@ -191,14 +185,10 @@ public: SvxNumPositionAndSpaceMode ePositionAndSpaceMode = LABEL_WIDTH_AND_POSITION ); // <-- SvxNumberFormat(const SvxNumberFormat& rFormat); - // --> OD 2008-01-09 #newlistlevelattrs# - no longer used -// SvxNumberFormat(SvStream &rStream); - // <-- + SvxNumberFormat(SvStream &rStream); virtual ~SvxNumberFormat(); - // --> OD 2008-01-09 #newlistlevelattrs# - no longer used -// SvStream& Store(SvStream &rStream, FontToSubsFontConverter pConverter); - // <-- + SvStream& Store(SvStream &rStream, FontToSubsFontConverter pConverter); SvxNumberFormat& operator=( const SvxNumberFormat& ); BOOL operator==( const SvxNumberFormat& ) const; @@ -304,9 +294,7 @@ public: = SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); // <-- SvxNumRule(const SvxNumRule& rCopy); - // --> OD 2008-01-09 #newlistlevelattrs# - no longer used -// SvxNumRule(SvStream &rStream); - // <-- + SvxNumRule(SvStream &rStream); virtual ~SvxNumRule(); int operator==( const SvxNumRule& ) const; @@ -314,9 +302,7 @@ public: SvxNumRule& operator=( const SvxNumRule& ); - // --> OD 2008-01-09 #newlistlevelattrs# - no longer used -// SvStream& Store(SvStream &rStream); - // <-- + SvStream& Store(SvStream &rStream); const SvxNumberFormat* Get(USHORT nLevel)const; const SvxNumberFormat& GetLevel(USHORT nLevel)const; @@ -354,11 +340,9 @@ public: virtual ~SvxNumBulletItem(); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - // --> OD 2008-01-09 #newlistlevelattrs# - no longer used -// virtual SfxPoolItem* Create(SvStream &, USHORT) const; -// virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; -// virtual USHORT GetVersion( USHORT nFileVersion ) const; - // <-- + virtual SfxPoolItem* Create(SvStream &, USHORT) const; + USHORT GetVersion( USHORT nFileVersion ) const; + virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; virtual int operator==( const SfxPoolItem& ) const; SvxNumRule* GetNumRule() const {return pNumRule;} diff --git a/svx/source/items/numitem.cxx b/svx/source/items/numitem.cxx index 0a9b7786a476..2a607ecf9cab 100644 --- a/svx/source/items/numitem.cxx +++ b/svx/source/items/numitem.cxx @@ -62,6 +62,11 @@ #define DEF_WRITER_LSPACE 500 //Standardeinrueckung #define DEF_DRAW_LSPACE 800 //Standardeinrueckung +#define NUMITEM_VERSION_01 0x01 +#define NUMITEM_VERSION_02 0x02 +#define NUMITEM_VERSION_03 0x03 +#define NUMITEM_VERSION_04 0x04 + using namespace ::com::sun::star; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; @@ -224,157 +229,184 @@ SvxNumberFormat::~SvxNumberFormat() /* -----------------08.12.98 11:14------------------- * * --------------------------------------------------*/ -//SvxNumberFormat::SvxNumberFormat(SvStream &rStream) -//{ -// USHORT nVersion; -// rStream >> nVersion; +SvxNumberFormat::SvxNumberFormat(SvStream &rStream) +: mePositionAndSpaceMode( LABEL_WIDTH_AND_POSITION ), + meLabelFollowedBy( LISTTAB ), + mnListtabPos( 0 ), + mnFirstLineIndent( 0 ), + mnIndentAt( 0 ) +{ -// USHORT nUSHORT; -// rStream >> nUSHORT; -// SetNumberingType((sal_Int16)nUSHORT); -// rStream >> nUSHORT; -// eNumAdjust = (SvxAdjust)nUSHORT; -// rStream >> nUSHORT; -// nInclUpperLevels = (BYTE)nUSHORT; -// rStream >> nUSHORT; -// nStart = nUSHORT; -// rStream >> nUSHORT; -// cBullet = nUSHORT; + USHORT nVersion; + rStream >> nVersion; -// short nShort; -// rStream >> nShort; -// nFirstLineOffset = nShort; -// rStream >> nShort; -// nAbsLSpace = nShort; -// rStream >> nShort; -// nLSpace = nShort; + USHORT nUSHORT; + rStream >> nUSHORT; + SetNumberingType((sal_Int16)nUSHORT); + rStream >> nUSHORT; + eNumAdjust = (SvxAdjust)nUSHORT; + rStream >> nUSHORT; + nInclUpperLevels = (BYTE)nUSHORT; + rStream >> nUSHORT; + nStart = nUSHORT; + rStream >> nUSHORT; + cBullet = nUSHORT; -// rStream >> nShort; -// nCharTextDistance = nShort; -// rtl_TextEncoding eEnc = gsl_getSystemTextEncoding(); -// rStream.ReadByteString(sPrefix, eEnc); -// rStream.ReadByteString(sSuffix, eEnc); -// rStream.ReadByteString(sCharStyleName, eEnc); -// rStream >> nUSHORT; -// if(nUSHORT) -// { -// SvxBrushItem aHelper(0); -// pGraphicBrush = (SvxBrushItem*) aHelper.Create( rStream, BRUSH_GRAPHIC_VERSION ); -// } -// else -// pGraphicBrush = 0; + short nShort; + rStream >> nShort; + nFirstLineOffset = nShort; + rStream >> nShort; + nAbsLSpace = nShort; + rStream >> nShort; + nLSpace = nShort; -// rStream >> nUSHORT; -// eVertOrient = (sal_Int16)nUSHORT; + rStream >> nShort; + nCharTextDistance = nShort; + rtl_TextEncoding eEnc = gsl_getSystemTextEncoding(); + rStream.ReadByteString(sPrefix, eEnc); + rStream.ReadByteString(sSuffix, eEnc); + rStream.ReadByteString(sCharStyleName, eEnc); + rStream >> nUSHORT; + if(nUSHORT) + { + SvxBrushItem aHelper(0); + pGraphicBrush = (SvxBrushItem*) aHelper.Create( rStream, BRUSH_GRAPHIC_VERSION ); + } + else + pGraphicBrush = 0; -// rStream >> nUSHORT; -// if(nUSHORT) -// { -// pBulletFont = new Font; -// rStream >> *pBulletFont; -// if(!pBulletFont->GetCharSet()) -// pBulletFont->SetCharSet(rStream.GetStreamCharSet()); -// } -// else -// pBulletFont = 0; -// rStream >> aGraphicSize; + rStream >> nUSHORT; + eVertOrient = (sal_Int16)nUSHORT; -// rStream >> nBulletColor; -// rStream >> nUSHORT; -// nBulletRelSize = nUSHORT; -// rStream >> nUSHORT; -// SetShowSymbol((BOOL)nUSHORT); + rStream >> nUSHORT; + if(nUSHORT) + { + pBulletFont = new Font; + rStream >> *pBulletFont; + if(!pBulletFont->GetCharSet()) + pBulletFont->SetCharSet(rStream.GetStreamCharSet()); + } + else + pBulletFont = 0; + rStream >> aGraphicSize; -// if( nVersion < NUMITEM_VERSION_03 ) -// cBullet = ByteString::ConvertToUnicode( (sal_Char)cBullet, -// (pBulletFont&&pBulletFont->GetCharSet()) ? pBulletFont->GetCharSet() -// : RTL_TEXTENCODING_SYMBOL ); -// if(pBulletFont) -// { -// BOOL bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; -// if(bConvertBulletFont) -// { + rStream >> nBulletColor; + rStream >> nUSHORT; + nBulletRelSize = nUSHORT; + rStream >> nUSHORT; + SetShowSymbol((BOOL)nUSHORT); -// FontToSubsFontConverter pConverter = -// CreateFontToSubsFontConverter(pBulletFont->GetName(), -// FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS); -// if(pConverter) -// { -// cBullet = ConvertFontToSubsFontChar(pConverter, cBullet); -// String sFontName = GetFontToSubsFontName(pConverter); -// pBulletFont->SetName(sFontName); -// DestroyFontToSubsFontConverter(pConverter); -// } -// } -// } -//} + if( nVersion < NUMITEM_VERSION_03 ) + cBullet = ByteString::ConvertToUnicode( (sal_Char)cBullet, + (pBulletFont&&pBulletFont->GetCharSet()) ? pBulletFont->GetCharSet() + : RTL_TEXTENCODING_SYMBOL ); + if(pBulletFont) + { + BOOL bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; + if(bConvertBulletFont) + { + + FontToSubsFontConverter pConverter = + CreateFontToSubsFontConverter(pBulletFont->GetName(), + FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS); + if(pConverter) + { + cBullet = ConvertFontToSubsFontChar(pConverter, cBullet); + String sFontName = GetFontToSubsFontName(pConverter); + pBulletFont->SetName(sFontName); + DestroyFontToSubsFontConverter(pConverter); + } + } + } + + if( NUMITEM_VERSION_04 <= nVersion ) + { + rStream >> nUSHORT; + mePositionAndSpaceMode = (SvxNumPositionAndSpaceMode) nUSHORT; + rStream >> nUSHORT; + meLabelFollowedBy = ( SvxNumLabelFollowedBy ) nUSHORT; + long nLong; + rStream >> nLong; + mnListtabPos = nLong; + rStream >> nLong; + mnFirstLineIndent = nLong; + rStream >> nLong; + mnIndentAt = nLong; + } +} /* -----------------08.12.98 11:14------------------- * * --------------------------------------------------*/ -// --> OD 2008-01-09 #newlistlevelattrs# - no longer used -//SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter) -//{ -// if(pConverter && pBulletFont) -// { -// cBullet = ConvertFontToSubsFontChar(pConverter, cBullet); -// String sFontName = GetFontToSubsFontName(pConverter); -// pBulletFont->SetName(sFontName); -// } +SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter) +{ + if(pConverter && pBulletFont) + { + cBullet = ConvertFontToSubsFontChar(pConverter, cBullet); + String sFontName = GetFontToSubsFontName(pConverter); + pBulletFont->SetName(sFontName); + } -// rStream << (USHORT)NUMITEM_VERSION_03; + rStream << (USHORT)NUMITEM_VERSION_04; -// rStream << (USHORT)GetNumberingType(); -// rStream << (USHORT)eNumAdjust; -// rStream << (USHORT)nInclUpperLevels; -// rStream << nStart; -// rStream << (USHORT)cBullet; + rStream << (USHORT)GetNumberingType(); + rStream << (USHORT)eNumAdjust; + rStream << (USHORT)nInclUpperLevels; + rStream << nStart; + rStream << (USHORT)cBullet; -// rStream << nFirstLineOffset; -// rStream << nAbsLSpace; -// rStream << nLSpace; + rStream << nFirstLineOffset; + rStream << nAbsLSpace; + rStream << nLSpace; -// rStream << nCharTextDistance; -// rtl_TextEncoding eEnc = gsl_getSystemTextEncoding(); -// rStream.WriteByteString(sPrefix, eEnc); -// rStream.WriteByteString(sSuffix, eEnc); -// rStream.WriteByteString(sCharStyleName, eEnc); -// if(pGraphicBrush) -// { -// rStream << (USHORT)1; + rStream << nCharTextDistance; + rtl_TextEncoding eEnc = gsl_getSystemTextEncoding(); + rStream.WriteByteString(sPrefix, eEnc); + rStream.WriteByteString(sSuffix, eEnc); + rStream.WriteByteString(sCharStyleName, eEnc); + if(pGraphicBrush) + { + rStream << (USHORT)1; -// // #75113# in SD or SI force bullet itself to be stored, -// // for that purpose throw away link when link and graphic -// // are present, so Brush save is forced -// if(pGraphicBrush->GetGraphicLink() && pGraphicBrush->GetGraphic()) -// { -// String aEmpty; -// pGraphicBrush->SetGraphicLink(aEmpty); -// } + // #75113# in SD or SI force bullet itself to be stored, + // for that purpose throw away link when link and graphic + // are present, so Brush save is forced + if(pGraphicBrush->GetGraphicLink() && pGraphicBrush->GetGraphic()) + { + String aEmpty; + pGraphicBrush->SetGraphicLink(aEmpty); + } -// pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION); -// } -// else -// rStream << (USHORT)0; + pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION); + } + else + rStream << (USHORT)0; -// rStream << (USHORT)eVertOrient; -// if(pBulletFont) -// { -// rStream << (USHORT)1; -// rStream << *pBulletFont; -// } -// else -// rStream << (USHORT)0; -// rStream << aGraphicSize; + rStream << (USHORT)eVertOrient; + if(pBulletFont) + { + rStream << (USHORT)1; + rStream << *pBulletFont; + } + else + rStream << (USHORT)0; + rStream << aGraphicSize; + + Color nTempColor = nBulletColor; + if(COL_AUTO == nBulletColor.GetColor()) + nTempColor = COL_BLACK; + rStream << nTempColor; + rStream << nBulletRelSize; + rStream << (USHORT)IsShowSymbol(); + + rStream << ( USHORT ) mePositionAndSpaceMode; + rStream << ( USHORT ) meLabelFollowedBy; + rStream << ( long ) mnListtabPos; + rStream << ( long ) mnFirstLineIndent; + rStream << ( long ) mnIndentAt; + + return rStream; +} -// Color nTempColor = nBulletColor; -// if(COL_AUTO == nBulletColor.GetColor()) -// nTempColor = COL_BLACK; -// rStream << nTempColor; -// rStream << nBulletRelSize; -// rStream << (USHORT)IsShowSymbol(); -// return rStream; -//} -// <-- /* -----------------------------23.02.01 11:10-------------------------------- ---------------------------------------------------------------------------*/ @@ -839,80 +871,79 @@ SvxNumRule::SvxNumRule(const SvxNumRule& rCopy) /* -----------------08.12.98 11:07------------------- * * --------------------------------------------------*/ -//SvxNumRule::SvxNumRule(SvStream &rStream) -//{ -// ++nRefCount; -// LanguageType eLang = Application::GetSettings().GetLanguage(); -// aLocale = SvxCreateLocale(eLang); -// USHORT nVersion; -// USHORT nTemp; -// rStream >> nVersion; -// rStream >> nLevelCount; -// rStream >> nTemp; -// nFeatureFlags = nTemp; -// rStream >> nTemp; -// bContinuousNumbering = (BOOL)nTemp; -// rStream >> nTemp; -// eNumberingType = (SvxNumRuleType)nTemp; -// memset( aFmts, 0, sizeof( aFmts )); +SvxNumRule::SvxNumRule(SvStream &rStream) +{ + ++nRefCount; + LanguageType eLang = Application::GetSettings().GetLanguage(); + aLocale = SvxCreateLocale(eLang); + USHORT nVersion; + USHORT nTemp; + rStream >> nVersion; + rStream >> nLevelCount; + rStream >> nTemp; + nFeatureFlags = nTemp; + rStream >> nTemp; + bContinuousNumbering = (BOOL)nTemp; + rStream >> nTemp; + eNumberingType = (SvxNumRuleType)nTemp; + memset( aFmts, 0, sizeof( aFmts )); -// for(USHORT i = 0; i < SVX_MAX_NUM; i++) -// { -// USHORT nSet; -// rStream >> nSet; -// if(nSet) -// aFmts[i] = new SvxNumberFormat(rStream); -// else -// aFmts[i] = 0; -// aFmtsSet[i] = aFmts[i] ? TRUE : FALSE; -// } -// if(NUMITEM_VERSION_02 <= nVersion) -// { -// USHORT nShort; -// rStream >> nShort; -// nFeatureFlags = nShort; -// } -//} + for(USHORT i = 0; i < SVX_MAX_NUM; i++) + { + USHORT nSet; + rStream >> nSet; + if(nSet) + aFmts[i] = new SvxNumberFormat(rStream); + else + aFmts[i] = 0; + aFmtsSet[i] = aFmts[i] ? TRUE : FALSE; + } + if(NUMITEM_VERSION_02 <= nVersion) + { + USHORT nShort; + rStream >> nShort; + nFeatureFlags = nShort; + } +} /* -----------------08.12.98 11:07------------------- * * --------------------------------------------------*/ -// --> OD 2008-01-09 #newlistlevelattrs# - no longer used -//SvStream& SvxNumRule::Store(SvStream &rStream) -//{ -// rStream<<(USHORT)NUMITEM_VERSION_03; -// rStream<GetBulletFont()) -// { -// if(!pConverter) -// pConverter = -// CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetName(), -// FONTTOSUBSFONT_EXPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS); -// } -// aFmts[i]->Store(rStream, pConverter); -// } -// else -// rStream << USHORT(0); -// } -// //second save of nFeatureFlags for new versions -// rStream<<(USHORT)nFeatureFlags; -// if(pConverter) -// DestroyFontToSubsFontConverter(pConverter); + FontToSubsFontConverter pConverter = 0; + BOOL bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; + for(USHORT i = 0; i < SVX_MAX_NUM; i++) + { + if(aFmts[i]) + { + rStream << USHORT(1); + if(bConvertBulletFont && aFmts[i]->GetBulletFont()) + { + if(!pConverter) + pConverter = + CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetName(), + FONTTOSUBSFONT_EXPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS); + } + aFmts[i]->Store(rStream, pConverter); + } + else + rStream << USHORT(0); + } + //second save of nFeatureFlags for new versions + rStream<<(USHORT)nFeatureFlags; + if(pConverter) + DestroyFontToSubsFontConverter(pConverter); -// return rStream; -//} + return rStream; +} /* -----------------27.10.98 10:41------------------- * @@ -1179,32 +1210,23 @@ SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const /* -----------------08.12.98 10:43------------------- * * --------------------------------------------------*/ -// --> OD 2008-01-09 #newlistlevelattrs# - no longer used -//SfxPoolItem* SvxNumBulletItem::Create(SvStream &rStream, USHORT) const -//{ -// SvxNumRule aRule(rStream); -// return new SvxNumBulletItem(aRule, Which() ); -//} -// <-- +SfxPoolItem* SvxNumBulletItem::Create(SvStream &rStream, USHORT) const +{ + SvxNumRule aRule(rStream); + return new SvxNumBulletItem(aRule, Which() ); +} +USHORT SvxNumBulletItem::GetVersion( USHORT /*nFileVersion*/ ) const +{ + return NUMITEM_VERSION_03; +} /* -----------------08.12.98 10:43------------------- * * --------------------------------------------------*/ -// --> OD 2008-01-09 #newlistlevelattrs# - no longer used -//SvStream& SvxNumBulletItem::Store(SvStream &rStream, USHORT /*nItemVersion*/ )const -//{ -// pNumRule->Store(rStream); -// return rStream; -//} -// <-- -/* -----------------08.12.98 10:43------------------- - * - * --------------------------------------------------*/ -// --> OD 2008-01-10 #newlistlevelattrs# - no longer used -//USHORT SvxNumBulletItem::GetVersion( USHORT /*nFileVersion*/ ) const -//{ -// return NUMITEM_VERSION_03; -//} -// <-- +SvStream& SvxNumBulletItem::Store(SvStream &rStream, USHORT /*nItemVersion*/ )const +{ + pNumRule->Store(rStream); + return rStream; +} /* -----------------08.12.98 10:43------------------- * From 3d61d073f6baac393264e3df0408ae60fb6ea782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20V=C3=B6lzke?= Date: Thu, 19 Nov 2009 11:54:29 +0000 Subject: [PATCH 110/117] #i106978# the extension manager should set an interaction handler when looking for updates --- .../deployment/gui/dp_gui_updatedialog.cxx | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 0e1955359bbc..58e2cbd9bd0a 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -284,8 +284,8 @@ private: css::uno::Reference< css::uno::XComponentContext > m_context; UpdateDialog & m_dialog; std::vector< dp_gui::TUpdateListEntry > m_vExtensionList; - css::uno::Reference< css::deployment::XUpdateInformationProvider > - m_updateInformation; + css::uno::Reference< css::deployment::XUpdateInformationProvider > m_updateInformation; + css::uno::Reference< css::task::XInteractionHandler > m_xInteractionHdl; // guarded by Application::GetSolarMutex(): css::uno::Reference< css::task::XAbortChannel > m_abort; @@ -302,7 +302,21 @@ UpdateDialog::Thread::Thread( m_updateInformation( css::deployment::UpdateInformationProvider::create(context)), m_stop(false) -{} +{ + if( m_context.is() ) + { + css::uno::Reference< css::lang::XMultiComponentFactory > xServiceManager( m_context->getServiceManager() ); + + if( xServiceManager.is() ) + { + m_xInteractionHdl = css::uno::Reference< css::task::XInteractionHandler > ( + xServiceManager->createInstanceWithContext( OUSTR( "com.sun.star.task.InteractionHandler" ), m_context), + css::uno::UNO_QUERY ); + if ( m_xInteractionHdl.is() ) + m_updateInformation->setInteractionHandler( m_xInteractionHdl ); + } + } +} void UpdateDialog::Thread::stop() { css::uno::Reference< css::task::XAbortChannel > abort; @@ -327,7 +341,11 @@ UpdateDialog::Thread::Entry::Entry( version(theVersion) {} -UpdateDialog::Thread::~Thread() {} +UpdateDialog::Thread::~Thread() +{ + if ( m_xInteractionHdl.is() ) + m_updateInformation->setInteractionHandler( css::uno::Reference< css::task::XInteractionHandler > () ); +} void UpdateDialog::Thread::execute() { @@ -1260,7 +1278,7 @@ IMPL_LINK( UpdateDialog, hyperlink_clicked, svt::FixedHyperlink*, pHyperlink ) { css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute( m_context->getServiceManager()->createInstanceWithContext( - ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" ), + OUSTR( "com.sun.star.system.SystemShellExecute" ), m_context), css::uno::UNO_QUERY_THROW); //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException xSystemShellExecute->execute( From 72a8d5326343acabb3fe9a2685bce769c8ae759f Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Fri, 20 Nov 2009 10:31:54 +0000 Subject: [PATCH 111/117] ooo32gsl07 #i106214# corrected MinAutoPaperSize for Cell BlockFormatting --- svx/source/svdraw/svdotextdecomposition.cxx | 48 +++++++++++++-------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 934b0f78ca3e..03e43a5eb57c 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -800,34 +800,48 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( const bool bVerticalWritintg(rSdrBlockTextPrimitive.getOutlinerParaObject().IsVertical()); const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight)); - // check if block text is used (only one of them can be true) - const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg); - const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg); - - // set minimal paper size hor/ver if needed - if(bHorizontalIsBlock) - { - rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0)); - } - else if(bVerticalIsBlock) - { - rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight)); - } - if(bIsCell) { // cell text is formated neither like a text object nor like a object // text, so use a special setup here - // #i106214# To work with an unchangeable PaperSize (CellSize in - // this case) Set(Min|Max)AutoPaperSize and SetPaperSize have to be used rOutliner.SetMaxAutoPaperSize(aAnchorTextSize); - rOutliner.SetMinAutoPaperSize(aAnchorTextSize); + + // #i106214# To work with an unchangeable PaperSize (CellSize in + // this case) Set(Min|Max)AutoPaperSize and SetPaperSize have to be used. + // #i106214# This was not completely correct; to still measure the real + // text height to allow vertical adjust (and vice versa for VerticalWritintg) + // only one aspect has to be set, but the other one to zero + if(bVerticalWritintg) + { + // measure the horizontal text size + rOutliner.SetMinAutoPaperSize(Size(0, aAnchorTextSize.Height())); + } + else + { + // measure the vertical text size + rOutliner.SetMinAutoPaperSize(Size(aAnchorTextSize.Width(), 0)); + } + rOutliner.SetPaperSize(aAnchorTextSize); rOutliner.SetUpdateMode(true); rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); } else { + // check if block text is used (only one of them can be true) + const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg); + const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg); + + // set minimal paper size hor/ver if needed + if(bHorizontalIsBlock) + { + rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0)); + } + else if(bVerticalIsBlock) + { + rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight)); + } + if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage()) { // #i103454# maximal paper size hor/ver needs to be limited to text From 893d3ed1b6d83775df277825f07bf3d47f721004 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 23 Nov 2009 16:33:39 +0000 Subject: [PATCH 112/117] CWS-TOOLING: integrate CWS fwk125 2009-11-19 08:11:20 +0100 jsk r277554 : fwk125: #i105760# - removed warnlog, re-enabled autotest e_help.bas 2009-11-16 16:21:49 +0100 tl r277521 : #i106571# fixed locale list for dictionaries to get rid of duplicate entries 2009-11-12 08:47:31 +0100 hde r277469 : rework of hyphenation 2009-11-11 15:25:16 +0100 hde r277462 : rework of hyphenation 2009-11-11 15:24:09 +0100 hde r277461 : rework of hyphenation 2009-11-11 13:52:02 +0100 hde r277453 : new include for hyphenation tools 2009-11-10 12:28:51 +0100 tl r277427 : #i102304# fix for hyphenation dialog 2009-11-10 12:00:10 +0100 mav r277425 : #i10000# A workaround for pch and windows headers conflict 2009-11-10 11:58:32 +0100 mav r277424 : #i10000# A workaround for pch and windows headers conflict 2009-11-09 15:47:59 +0100 kso r277414 : #i16732# fixed url matching. 2009-11-09 11:51:40 +0100 mav r277406 : #i10000# use precompiled headers 2009-11-08 23:53:03 +0100 mav r277399 : #i10000# fix warning 2009-11-08 23:50:23 +0100 mav r277398 : #i10000# adapt for unix 2009-11-08 23:49:52 +0100 mav r277397 : #i10000# adapt for unix 2009-11-08 21:26:06 +0100 mav r277396 : CWS-TOOLING: rebase CWS fwk125 to branches/OOO320@277373 (milestone: OOO320:m4) 2009-11-06 16:30:27 +0100 ab r277394 : #i106100# Hold references to packages to speed up further calls to getDeployedPackages() 2009-11-06 15:58:48 +0100 mav r277392 : #i102464# check the Windows ACL 2009-11-06 15:58:23 +0100 mav r277391 : #i102464# check the Windows ACL 2009-11-04 11:54:06 +0100 tl r277342 : #i106497# incorrectly found 'supported languages' fixed 2009-11-04 10:40:51 +0100 tl r277335 : #i106571# dictionary updates for Polish and Swedish. 2009-10-28 09:54:41 +0100 tl r277236 : #i106100# context menu performance 2009-10-27 15:47:05 +0100 tl r277213 : #i106100# context menu performance 2009-10-23 17:31:56 +0200 mav r277170 : #i106075# use correct path to inprocserv.dll 2009-10-23 16:07:27 +0200 mav r277168 : #i105760# seek the temporary file to beginning also for URL case 2009-10-23 11:03:58 +0200 mav r277134 : CWS-TOOLING: rebase CWS fwk125 to branches/OOO320@276942 (milestone: OOO320:m2) --- linguistic/source/hyphdsp.cxx | 14 ++- linguistic/source/spelldsp.cxx | 11 +- linguistic/source/thesdsp.cxx | 8 +- sfx2/inc/sfx2/mnuitem.hxx | 9 +- sfx2/source/doc/docfile.cxx | 11 ++ sfx2/source/doc/makefile.mk | 8 ++ sfx2/source/doc/sfxacldetect.cxx | 108 ++++++++++++++++++ sfx2/source/menu/mnuitem.cxx | 20 ++++ sfx2/source/menu/virtmenu.cxx | 20 ++-- xmlhelp/source/cxxhelp/provider/databases.cxx | 20 ++++ 10 files changed, 205 insertions(+), 24 deletions(-) create mode 100755 sfx2/source/doc/sfxacldetect.cxx diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index a04d01c0d1a7..e1ebe970a44f 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -275,7 +275,8 @@ Reference< XHyphenatedWord > SAL_CALL return xRes; // search for entry with that language - LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get(); + HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; BOOL bWordModified = FALSE; if (!pEntry || (nMaxLeading < 0 || nMaxLeading > nWordLen)) @@ -418,7 +419,8 @@ Reference< XHyphenatedWord > SAL_CALL return xRes; // search for entry with that language - LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get(); + HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; BOOL bWordModified = FALSE; if (!pEntry || !(0 <= nIndex && nIndex <= nWordLen - 2)) @@ -555,7 +557,8 @@ Reference< XPossibleHyphens > SAL_CALL return xRes; // search for entry with that language - LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get(); + HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (!pEntry) { @@ -713,8 +716,9 @@ Sequence< OUString > // search for entry with that language and use data from that INT16 nLanguage = LocaleToLanguage( rLocale ); - HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this; - const LangSvcEntries_Hyph *pEntry = pThis->aSvcMap[ nLanguage ].get(); + HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this; + const HyphSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) ); + const LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (pEntry) { aRes = pEntry->aSvcImplNames; diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 48e64163dbe4..6009461c7e7c 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -330,7 +330,8 @@ BOOL SpellCheckerDispatcher::isValid_Impl( return bRes; // search for entry with that language - LangSvcEntries_Spell *pEntry = aSvcMap[ nLanguage ].get(); + SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (!pEntry) { @@ -497,7 +498,8 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( return xRes; // search for entry with that language - LangSvcEntries_Spell *pEntry = aSvcMap[ nLanguage ].get(); + SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (!pEntry) { @@ -847,8 +849,9 @@ Sequence< OUString > // search for entry with that language and use data from that INT16 nLanguage = LocaleToLanguage( rLocale ); - SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this; - const LangSvcEntries_Spell *pEntry = pThis->aSvcMap[ nLanguage ].get(); + SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this; + const SpellSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) ); + const LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (pEntry) aRes = pEntry->aSvcImplNames; diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx index cc0623d1dd82..b944e3a44d1b 100644 --- a/linguistic/source/thesdsp.cxx +++ b/linguistic/source/thesdsp.cxx @@ -136,7 +136,8 @@ Sequence< Reference< XMeaning > > SAL_CALL return aMeanings; // search for entry with that language - LangSvcEntries_Thes *pEntry = aSvcMap[ nLanguage ].get(); + ThesSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (!pEntry) { @@ -264,8 +265,9 @@ Sequence< OUString > // search for entry with that language and use data from that INT16 nLanguage = LocaleToLanguage( rLocale ); - ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this; - const LangSvcEntries_Thes *pEntry = pThis->aSvcMap[ nLanguage ].get(); + ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this; + const ThesSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) ); + const LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (pEntry) aRes = pEntry->aSvcImplNames; diff --git a/sfx2/inc/sfx2/mnuitem.hxx b/sfx2/inc/sfx2/mnuitem.hxx index 85381a891c4b..a173f6e1a31e 100644 --- a/sfx2/inc/sfx2/mnuitem.hxx +++ b/sfx2/inc/sfx2/mnuitem.hxx @@ -90,9 +90,9 @@ public: virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); - static SfxMenuControl* CreateControl( USHORT nId, Menu &, SfxBindings & ); - static SfxUnoMenuControl* - CreateControl( const String&, USHORT, Menu&, SfxBindings&, SfxVirtualMenu* ); + static SfxMenuControl* CreateControl( USHORT nId, Menu &, SfxBindings & ); + static SfxUnoMenuControl* CreateControl( const String&, USHORT, Menu&, SfxBindings&, SfxVirtualMenu* ); + static SfxUnoMenuControl* CreateControl( const String&, USHORT, Menu&, const String& sItemText, const String& sHelpText, SfxBindings&, SfxVirtualMenu* ); static BOOL IsSpecialControl( USHORT nId, SfxModule* ); static void RegisterMenuControl(SfxModule*, SfxMenuCtrlFactory*); @@ -104,6 +104,9 @@ class SfxUnoMenuControl : public SfxMenuControl public: SfxUnoMenuControl( const String&, USHORT nId, Menu&, SfxBindings&, SfxVirtualMenu* ); + SfxUnoMenuControl( const String&, USHORT nId, Menu&, + const String&, const String&, + SfxBindings&, SfxVirtualMenu* ); ~SfxUnoMenuControl(); void Select(); }; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 32ae33ec3c8b..302233a93ad7 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -155,6 +155,8 @@ using namespace ::com::sun::star::io; #define MAX_REDIRECT 5 +sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath ); + //========================================================== namespace { @@ -1145,6 +1147,15 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) } catch( uno::Exception ) {} + + if ( !bContentReadonly ) + { + // the file is not readonly, check the ACL + + String aPhysPath; + if ( ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aPhysPath ) ) + bContentReadonly = IsReadonlyAccordingACL( aPhysPath.GetBuffer() ); + } } // do further checks only if the file not readonly in fs diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index 1b42844491e0..66fd03175a8e 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -86,11 +86,19 @@ SLOFILES = \ $(SLO)$/DocumentMetadataAccess.obj \ $(SLO)$/Metadatable.obj \ $(SLO)$/sfxmodelfactory.obj \ + $(SLO)$/sfxacldetect.obj \ $(SLO)$/docstoragemodifylistener.obj \ $(SLO)$/querytemplate.obj # $(SLO)$/applet.obj \ +.IF "$(GUI)" == "WNT" + +#HACK TO DISABLE PCH +NOOPTFILES= \ + $(SLO)$/sfxacldetect.obj +.ENDIF + # --- Tagets ------------------------------------------------------- diff --git a/sfx2/source/doc/sfxacldetect.cxx b/sfx2/source/doc/sfxacldetect.cxx new file mode 100755 index 000000000000..94370e9a1c52 --- /dev/null +++ b/sfx2/source/doc/sfxacldetect.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: shutdowniconw32.cxx,v $ + * $Revision: 1.48 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef WNT + +// necessary to include system headers without warnings +#ifdef _MSC_VER +#pragma warning(disable:4668 4917) +#endif + +#include +#include +#include + +sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath ) +{ + sal_Bool bResult = sal_False; + + sal_uInt32 nFDSize = 0; + GetFileSecurityW( pFilePath, DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, NULL, 0, &nFDSize ); + if ( nFDSize ) + { + PSECURITY_DESCRIPTOR pFileDescr = reinterpret_cast< PSECURITY_DESCRIPTOR >( malloc( nFDSize ) ); + if ( GetFileSecurityW( pFilePath, DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, pFileDescr, nFDSize, &nFDSize ) ) + { + HANDLE hToken = NULL; + if ( OpenThreadToken( GetCurrentThread(), TOKEN_DUPLICATE|TOKEN_QUERY, TRUE, &hToken ) + || OpenProcessToken( GetCurrentProcess(), TOKEN_DUPLICATE|TOKEN_QUERY, &hToken) ) + { + HANDLE hImpersonationToken = NULL; + if ( DuplicateToken( hToken, SecurityImpersonation, &hImpersonationToken) ) + { + sal_uInt32 nDesiredAccess = ACCESS_WRITE; + GENERIC_MAPPING aGenericMapping = { ACCESS_READ, ACCESS_WRITE, 0, ACCESS_READ | ACCESS_WRITE }; + MapGenericMask( &nDesiredAccess, &aGenericMapping ); + + PRIVILEGE_SET aPrivilegeSet; + sal_uInt32 nPrivilegeSetSize = sizeof( PRIVILEGE_SET ); + + sal_uInt32 nGrantedAccess; + BOOL bAccessible = TRUE; + if ( AccessCheck( pFileDescr, + hImpersonationToken, + nDesiredAccess, + &aGenericMapping, + &aPrivilegeSet, + &nPrivilegeSetSize, + &nGrantedAccess, + &bAccessible ) ) + { + bResult = !bAccessible; + } + + CloseHandle( hImpersonationToken ); + } + + CloseHandle( hToken ); + } + } + + free( pFileDescr ); + } + + return bResult; +} + +#else // this is UNX +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + + +#include + +sal_Bool IsReadonlyAccordingACL( const sal_Unicode* ) +{ + // to be implemented + return sal_False; +} + +#endif + diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index 6619c17d3077..88247a0966e7 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -542,6 +542,13 @@ SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd, return new SfxUnoMenuControl( rCmd, nId, rMenu, rBindings, pVirt ); } +SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd, + USHORT nId, Menu& rMenu, const String& sItemText, const String& sHelpText, + SfxBindings& rBindings, SfxVirtualMenu* pVirt) +{ + return new SfxUnoMenuControl( rCmd, nId, rMenu, sItemText, sHelpText, rBindings, pVirt); +} + SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, USHORT nSlotId, Menu& rMenu, SfxBindings& rBindings, SfxVirtualMenu* pVirt ) : SfxMenuControl( nSlotId, rBindings ) @@ -554,6 +561,19 @@ SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, USHORT nSlotId, pUnoCtrl->GetNewDispatch(); } +SfxUnoMenuControl::SfxUnoMenuControl( + const String& rCmd, USHORT nSlotId, Menu& /*rMenu*/, + const String& rItemText, const String& rHelpText, + SfxBindings& rBindings, SfxVirtualMenu* pVirt) + : SfxMenuControl( nSlotId, rBindings ) +{ + Bind( pVirt, nSlotId, rItemText, rHelpText, rBindings); + UnBind(); + pUnoCtrl = new SfxUnoControllerItem( this, rBindings, rCmd ); + pUnoCtrl->acquire(); + pUnoCtrl->GetNewDispatch(); +} + SfxUnoMenuControl::~SfxUnoMenuControl() { pUnoCtrl->UnBind(); diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index e0b6f6f32bf2..326431c3ffbd 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -417,8 +417,12 @@ void SfxVirtualMenu::CreateFromSVMenu() DELETEZ( pPopup ); } + const String sItemText = pSVMenu->GetItemText(nSlotId); + const String sHelpText = pSVMenu->GetHelpText(nSlotId); + if ( pPopup ) { + SfxMenuControl *pMnuCtrl = SfxMenuControl::CreateControl(nSlotId, *pPopup, *pBindings); @@ -434,10 +438,8 @@ void SfxVirtualMenu::CreateFromSVMenu() SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count() ); - (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), - pSVMenu->GetHelpText(nSlotId), *pBindings); - pMnuCtrl->Bind( this, nSlotId, pSVMenu->GetItemText(nSlotId), - pSVMenu->GetHelpText(nSlotId), *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); + pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings); if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) { @@ -473,7 +475,7 @@ void SfxVirtualMenu::CreateFromSVMenu() { pMnuCtrl->Bind( this, nSlotId, *new SfxVirtualMenu(nSlotId, this, *pPopup, bHelpInitialized, *pBindings, bOLE, bResCtor), - pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), + sItemText, sHelpText, *pBindings ); } } @@ -510,12 +512,12 @@ void SfxVirtualMenu::CreateFromSVMenu() if ( aCmd.Len() && (( nSlotId < SID_SFX_START ) || ( nSlotId > SHRT_MAX )) ) { // try to create control via comand name - pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, *pBindings, this ); + pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, sItemText, sHelpText, *pBindings, this ); if ( pMnuCtrl ) { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count()); - (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); } } @@ -527,13 +529,13 @@ void SfxVirtualMenu::CreateFromSVMenu() { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count()); - (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); } else // take default control pMnuCtrl = (pItems+nPos); - pMnuCtrl->Bind( this, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings); + pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings); } if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index c0980017c2ed..1de0bc80ee73 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -137,6 +137,19 @@ rtl::OUString Databases::expandURL( const rtl::OUString& aURL, Reference< uno::X return aRetURL; } + +// Hold Packages to improve performance (#i106100) +// The PackageManager implementation seems to completely throw away all cached data +// as soon as the last reference to a XPackage dies. Maybe this should be changed. +struct ImplPackageSequenceHolder +{ + Sequence< Reference< deployment::XPackage > > m_aUserPackagesSeq; + Sequence< Reference< deployment::XPackage > > m_aSharedPackagesSeq; +}; + +static ImplPackageSequenceHolder* GpPackageSequenceHolder = NULL; + + Databases::Databases( sal_Bool showBasic, const rtl::OUString& instPath, const com::sun::star::uno::Sequence< rtl::OUString >& imagesZipPaths, @@ -187,6 +200,8 @@ Databases::Databases( sal_Bool showBasic, m_xSFA = Reference< ucb::XSimpleFileAccess >( m_xSMgr->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), m_xContext ), UNO_QUERY_THROW ); + + GpPackageSequenceHolder = new ImplPackageSequenceHolder(); } Databases::~Databases() @@ -235,6 +250,7 @@ Databases::~Databases() } } + delete GpPackageSequenceHolder; } static bool impl_getZipFile( @@ -1530,6 +1546,8 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextUserHelpPack thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("user") ); m_aUserPackagesSeq = xUserManager->getDeployedPackages ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + if( GpPackageSequenceHolder != NULL ) + GpPackageSequenceHolder->m_aUserPackagesSeq = m_aUserPackagesSeq; m_bUserPackagesLoaded = true; } @@ -1560,6 +1578,8 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("shared") ); m_aSharedPackagesSeq = xSharedManager->getDeployedPackages ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + if( GpPackageSequenceHolder != NULL ) + GpPackageSequenceHolder->m_aSharedPackagesSeq = m_aSharedPackagesSeq; m_bSharedPackagesLoaded = true; } From 2c993660864d3e0ac89d9a88155827eaa88ecef5 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 24 Nov 2009 14:40:24 +0000 Subject: [PATCH 113/117] CWS-TOOLING: integrate CWS localization37 2009-11-20 17:34:04 +0100 ihi r277585 : not yet the best solution 2009-11-19 14:34:34 +0100 ihi r277560 : #i103247# updated Luxembourgish autocorrect data 2009-11-16 16:58:56 +0100 ihi r277525 : added ast to no_ms_lang 2009-11-16 16:57:23 +0100 ihi r277524 : added ast 2009-11-16 16:41:22 +0100 ihi r277523 : #i106900# updated identifier ShowAnnotation -> ShowAnnotations 2009-11-16 16:39:34 +0100 ihi r277522 : small helper script 2009-11-16 15:24:34 +0100 ihi r277520 : Fixed german and removed ln ti pap ur 2009-11-11 14:27:38 +0100 releng r277457 : added ug, om, si, oc, or, ml, as to non ms langs 2009-11-11 14:23:30 +0100 releng r277456 : Fix for merging more then just one 2009-11-11 14:12:52 +0100 ihi r277455 : #i106775# Merge of OOo 3.2 l10n cws localization37 nb nn he ga uk my bg ja uz fi bn kid fr nl vi ca pt-BR ru ka oc gl cs km kn ko sh si om gu sk sl zh-CN ku or da sr de sv hi-IN pa-IN ta te pl th hu dz lv pt tr en-GB id el ar as eo es ml et eu zh-TW is ug it mr 2009-11-05 23:07:09 +0100 ihi r277375 : added om kid , removed dupe ta-IN 2009-11-03 18:09:39 +0100 ihi r277327 : removed dupe 2009-11-02 19:02:55 +0100 ihi r277303 : #i105973 obsolete sdf files removed 2009-11-02 19:02:16 +0100 ihi r277302 : #i105973 obsolete sdf files removed 2009-10-13 19:19:06 +0200 ihi r276871 : CWS-TOOLING: rebase CWS localization37 to branches/OOO320@276773 (milestone: OOO320:m1) 2009-10-01 13:19:45 +0200 ihi r276598 : key -> ky ... this one triggered a bad crash in rsc 2009-09-09 17:02:20 +0200 ihi r276004 : added some langs 2009-09-09 13:17:16 +0200 ihi r275986 : lucky local cygwin fix 2009-09-03 18:47:45 +0200 ihi r275769 : #104328# deal with l10nless src files 2009-09-03 15:58:51 +0200 ihi r275760 : added some new langs 2009-09-03 15:54:16 +0200 ihi r275759 : old localize.pl tool used as a helper 2009-09-03 15:53:48 +0200 ihi r275758 : do not merge not wellformated sdf files 2009-09-03 15:51:59 +0200 ihi r275757 : old localize.pl tool used as a helper 2009-09-03 15:50:03 +0200 ihi r275756 : some small helpers added 2009-09-01 18:22:04 +0200 ihi r275681 : update DEV300 code line with OOO310 strings 2009-09-01 13:45:43 +0200 ihi r275658 : #i104680# prevent that self defined or dupe ms ids are merged --- shell/source/tools/lngconvex/lngconvex.cxx | 31 +++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/shell/source/tools/lngconvex/lngconvex.cxx b/shell/source/tools/lngconvex/lngconvex.cxx index 7f177233d7cc..43fbd410dbe3 100644 --- a/shell/source/tools/lngconvex/lngconvex.cxx +++ b/shell/source/tools/lngconvex/lngconvex.cxx @@ -65,6 +65,7 @@ #include #include #include +#include namespace /* private */ { @@ -324,6 +325,8 @@ private: iso_lang_identifier active_iso_lang_; }; +typedef std::map< unsigned short , std::string , std::less< unsigned short > > shortmap; + //########################################### void add_group_entries( Config& aConfig, @@ -334,21 +337,35 @@ void add_group_entries( aConfig.SetGroup(GroupName); size_t key_count = aConfig.GetKeyCount(); + shortmap map; for (size_t i = 0; i < key_count; i++) { ByteString iso_lang = aConfig.GetKeyName(sal::static_int_cast(i)); ByteString key_value_utf8 = aConfig.ReadKey(sal::static_int_cast(i)); + iso_lang_identifier myiso_lang( iso_lang ); + LanguageType ltype = MsLangId::convertIsoNamesToLanguage(myiso_lang.language(), myiso_lang.country()); + if( ( ltype & 0x0200 ) == 0 && map[ ltype ].empty() ) + { + Substitutor.set_language(iso_lang_identifier(iso_lang)); - Substitutor.set_language(iso_lang_identifier(iso_lang)); + key_value_utf8.EraseLeadingAndTrailingChars('\"'); - key_value_utf8.EraseLeadingAndTrailingChars('\"'); + OUString key_value_utf16 = + rtl::OStringToOUString(key_value_utf8, RTL_TEXTENCODING_UTF8); - OUString key_value_utf16 = - rtl::OStringToOUString(key_value_utf8, RTL_TEXTENCODING_UTF8); - - Substitutor.add_substitution( - GroupName.GetBuffer(), make_winrc_unicode_string(key_value_utf16)); + Substitutor.add_substitution( + GroupName.GetBuffer(), make_winrc_unicode_string(key_value_utf16)); + map[ static_cast(ltype) ] = std::string( iso_lang.GetBuffer() ); + } + else + { + if( !map[ ltype ].empty() ) + { + printf("ERROR: Duplicated ms id %d found for the languages %s and %s !!!! This does not work in microsoft resources\nPlease remove one!\n", ltype , map[ ltype ].c_str() , iso_lang.GetBuffer()); + exit( -1 ); + } + } } } From d5c799bd36d600f4ebbce76f12333324bc1f6c09 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Fri, 27 Nov 2009 12:39:32 +0000 Subject: [PATCH 114/117] dba33a: summary migration from SVN 2009-11-06 13:10:39 +0000 msc r277387 : minor fix for automatic test 2009-11-06 13:09:33 +0000 msc r277385 : minor fix for automatic test 2009-11-06 12:30:57 +0000 fs r277383 : argh. On some virtual machines, waiting 5 seconds for the event to arrive is not enough. Increasing the timeout ... 2009-11-06 12:13:34 +0000 fs r277382 : this diagnostic code should not have slipped in 2009-11-05 13:21:06 +0000 fs r277369 : SHL2NOCHECK=TRUE (requested by hjs) 2009-11-04 14:09:46 +0000 msc r277355 : minor fix for automatic testing 2009-11-04 13:23:02 +0000 msc r277352 : minor fix for automatic testing 2009-11-04 10:53:28 +0000 msc r277341 : minor fix for automated testscript 2009-11-04 08:30:58 +0000 msc r277333 : minor fix for automatic test 2009-11-04 08:15:43 +0000 msc r277332 : minor fix for automatic test 2009-11-03 14:25:44 +0000 fs r277324 : #i10000# 2009-11-03 09:47:47 +0000 fs r277315 : found yet another help ID zombie ... moved formhelpid.hrc content to propctrlr.hrc, where it belongs 2009-11-03 08:50:24 +0000 fs r277312 : use createTempFileURL, which cares for some more specialities ... 2009-11-03 08:44:55 +0000 fs r277311 : when creating a temp file for purpose of getting a temp file URL, the delete the file immediately. On some machines/JVMs, the file exists, with write access denied, which isn't Good (TM) 2009-10-22 13:06:17 +0000 fs r277126 : removed wrong assertion 2009-10-21 08:10:35 +0000 fs r277077 : reverted the previous change, which was nonsense 2009-10-21 07:19:43 +0000 fs r277076 : export the component_foo functions, now that some of the objects are built with VISIBILITY_HIDDEN=TRUE 2009-10-21 07:08:35 +0000 fs r277075 : spare useless call 2009-10-20 21:26:31 +0000 fs r277072 : #i10000# 2009-10-20 08:06:04 +0000 fs r277039 : CWS-TOOLING: rebase CWS dba33a to trunk@277035 (milestone: DEV300:m62) 2009-10-16 09:55:25 +0000 fs r276960 : remove one of the superfluous implts_doLayout calls introduced with the previous patch 2009-10-15 13:18:52 +0000 fs r276941 : removed the basic tests. According to cn, they're not used anymore (for a long time), and according to 'du -h', they take up 6.0M on my hard disc. For too much for useless code, /me thinks. 2009-10-15 13:06:51 +0000 fs r276940 : #i10000# remove useless include (otherwise the compiler warning it provokes would need to be fixed by declaring VISIBILITY_HIDDEN=TRUE in the makefile.mk) 2009-10-15 12:52:39 +0000 fs r276939 : #i10000# 2009-10-15 12:44:26 +0000 fs r276938 : #i10000# 2009-10-15 12:00:33 +0000 fs r276936 : #i10000# 2009-10-15 10:31:37 +0000 fs r276934 : #i105259# prepare for the Hidden arg 2009-10-15 10:31:05 +0000 fs r276933 : IsMaximized -> const 2009-10-15 09:50:15 +0000 fs r276932 : during #i105259#: introduce an option to the layout manager to preserve, if possible, the size of the content window when layouting. Enable this option for embedded (SFX-based) documents opened for outplace editing. (the option is incompatible with in-place editing, anyway) This is because such embedded objects couple the (content) window size to the VisAreaSize, in that both are used interchangeably. When an embedded object is closed, it remembers the VisAreaSize, and restores it upon next open. This, however, leads to different content window sizes when the window is closed with another toolbar set than used during opening. This patch here prevents those different content window sizes. Also, now the content window size doesn't change when, explicitly or implicitly, a toolbar is shown or hidden. Instead, the content window size stays the same, and the container window size is adjusted. 2009-10-15 09:32:41 +0000 fs r276931 : during #i105259#: UNO access to more attributes of top windows 2009-10-15 09:30:28 +0000 fs r276930 : indention corrected (better readable) 2009-10-15 09:26:46 +0000 fs r276929 : during #i105259#: access to more attributes of top windows 2009-10-14 10:04:39 +0000 fs r276889 : connecting via services manager, not naming service 2009-10-12 11:31:08 +0000 fs r276831 : during #i105806# FillPropertySet: do not attempt to set *AutoStyleName if it doesn't exist 2009-10-12 11:24:44 +0000 fs r276830 : #i105806# getPropertyValue: throw an UnknownPropertyException for, well, unknown properties 2009-10-08 08:20:58 +0000 fs r276774 : implSubmit: re-throw WrappedTargetExceptions unmodified 2009-10-07 19:19:42 +0000 fs r276770 : #i105198# do not pass an CommandType if we do not have a command 2009-10-07 17:39:36 +0000 fs r276768 : export the OWeakObject::disposeWeakConnectionPoint symbol 2009-10-07 12:59:17 +0000 fs r276754 : #i87693# 2009-10-07 11:19:22 +0000 fs r276752 : #i10000# 2009-10-07 10:21:08 +0000 fs r276748 : #105482# do not require a controller, at least not in *all* circumstances (executed reports have a model, the ReportDefinition, but no Controller) 2009-10-07 10:04:08 +0000 fs r276747 : copying the changes from CWS fwk121 herein, in particular the fix for issue #i105371# 2009-10-07 09:58:30 +0000 fs r276746 : copying the changes from CWS fwk121 herein, in particular the fix for issue #i105371# 2009-10-07 09:48:14 +0000 fs r276744 : removed (now) pointless assertion 2009-10-07 06:59:19 +0000 fs r276740 : export the OWeakObject::disposeWeakConnectionPoint symbol 2009-10-07 06:44:43 +0000 fs r276739 : OComponentHelper::release & WeakAggComponentImplHelperBase::release: when our ref count drops to 0, call OWeakObject's disposeWeakConnectionPoint before (temporarily) incrementing the ref count, again. This ensures that our adapter cannot create references to the dying object anymore. (A complex test case in dbaccess (#i105505#) triggered such a situation, but in another class using an analogous release/dispose/destroy pattern, namely WeakComponentImplHelperBase) 2009-10-07 06:37:20 +0000 fs r276738 : found during some new complex test cases: call disposeWeakConnectionPoint before actually starting to destroy the object, this ensures no other threads will resurrect it while it is dying 2009-10-06 21:58:24 +0000 fs r276734 : oops, two small corrections to the previous fix (hey, complex test cases are cool) 2009-10-06 21:51:16 +0000 fs r276733 : log the name of the data source which cannot be revoked 2009-10-06 21:50:41 +0000 fs r276732 : more detailed error message when cleanup fails 2009-10-06 21:50:01 +0000 fs r276731 : reworked the ModelImpl caching. The new and improved UNO API test for css.sdb.RowSet revealed some inconsistencies, in whether the objects are cached by their URL, or by their registration name. This has been changed to caching by registration name. 2009-10-06 13:50:34 +0000 fs r276714 : print diagnostics when we cannot clean up the test case 2009-10-06 13:45:02 +0000 fs r276713 : this test failed all the time, since the core (rightfully) threw an exception. Disabled it for the moment, until issue 84253 is fixed 2009-10-06 12:52:46 +0000 fs r276711 : rewrote this test. Now we do not re-use the same .odb across different test cases, as this leads to unreliable (timing-dependent) results/failures. Instead, every test sets up a new odb file. Also, did some re-factoring, improved the cleanup code, and caught a few more errors. 2009-10-06 12:51:07 +0000 fs r276710 : DBTools taking a logger now 2009-10-06 12:50:42 +0000 fs r276709 : taking a PrintWriter for logging purpose 2009-10-06 12:50:03 +0000 fs r276708 : DBTools taking a logger now 2009-10-06 12:49:22 +0000 fs r276707 : typo 2009-10-06 12:49:03 +0000 fs r276706 : typo 2009-10-06 12:48:52 +0000 fs r276705 : wrappers around some database-related services - initial versions only, to evolve over time, and intended to finally replace the DBTools class 2009-10-06 12:48:02 +0000 fs r276704 : typo 2009-10-06 12:38:42 +0000 fs r276702 : some better diagnostics, done during getting the API tests to work more reliably 2009-10-06 10:35:51 +0000 fs r276698 : when living in, e.g., the DataSourceBrowser, we can't expect to find an XModifiable2, so don't assert its existence 2009-10-05 12:47:52 +0000 oj r276677 : #i105607# check for read moved into if scope 2009-10-05 11:37:06 +0000 fs r276676 : when saving a file fails, retrieve the error message from the InteractionRequestStringResolver - this is better than any generic message we can create 2009-10-05 10:04:23 +0000 oj r276673 : #i105607# check for read moved into if scope 2009-10-05 09:46:17 +0000 fs r276671 : #i10000# 2009-10-05 08:43:58 +0000 fs r276664 : #i105505# release: dispose the (base classes) weak connection point before disposing ourself, and in particular before temporarily incrementing our ref count, again. This way, we prevent that a separate thread re-surrects us (using the weak connection point's queryAdapted) while we're in the process of destruction 2009-10-05 08:41:49 +0000 fs r276663 : #i105505# +disposeWeakConnectionPoint (outsourced into dedicated method from ::release) 2009-10-05 08:40:26 +0000 fs r276662 : no need to derived from OSubComponent, its features are not used, directly derive from WeakComponentImplFoo instead 2009-10-05 08:39:38 +0000 fs r276661 : #i105505# diagnostics 2009-10-05 08:39:16 +0000 fs r276660 : #i105505# +testDocumentRevenants 2009-10-05 08:36:01 +0000 fs r276659 : #i105560# reverted the removal of GenericController::openHelpAgent - this is needed in module reportdesign 2009-10-04 19:53:30 +0000 fs r276657 : #105560# remove unused code thanks to cmc@openoffice.org for submitting the patch 2009-10-04 19:50:28 +0000 fs r276656 : #i105550# remove unused 'fire' method (thanks to cmc) 2009-10-03 16:13:15 +0000 fs r276655 : CWS-TOOLING: rebase CWS dba33a to trunk@276429 (milestone: DEV300:m60) 2009-10-02 19:20:48 +0000 fs r276651 : #i104117# lotta changed IDs ... 2009-10-02 10:52:24 +0000 fs r276634 : #i105505# If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized. In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl call attachResource. This ensures that the model is initialized completely, including firing the necessary events. 2009-10-02 10:51:08 +0000 fs r276633 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document 2009-10-01 11:10:13 +0000 fs r276597 : do not rely on the name 'Standard' for the one and only form in a document 2009-10-01 10:36:29 +0000 fs r276590 : #i105509# don't rely on default form component names, use indexes 2009-10-01 09:12:20 +0000 fs r276582 : #i105505# 2009-09-30 07:55:21 +0000 fs r276542 : removed some unsed methods / spared some unnecessary pixel<->logic conversion 2009-09-30 07:53:22 +0000 fs r276541 : removed unneeded methods 2009-09-30 06:35:59 +0000 fs r276538 : #i10000# 2009-09-29 13:45:02 +0000 fs r276531 : refactored the Roadmap* classes, to be able to fix above-mentioned #i105113# 2009-09-29 10:27:10 +0000 fs r276520 : #i105367# 2009-09-29 08:46:45 +0000 fs r276510 : #i104956# cleaned up the makefiles 2009-09-28 21:00:07 +0000 fs r276505 : #i104117# sourced those IDs out from extension.hrc 2009-09-28 20:59:05 +0000 fs r276504 : no need to let one FREE... 2009-09-28 20:53:36 +0000 fs r276503 : #i104117# cleaned up the mess with help IDs in module extensions. Formerly, extensions used to use help IDs which were declared in module svx, and vice versa. Also, help ID ranges were not respected. 2009-09-28 11:25:36 +0000 fs r276489 : typo 2009-09-28 11:25:10 +0000 fs r276488 : #i105235# 2009-09-24 11:53:16 +0000 fs r276423 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document) 2009-09-24 09:42:28 +0000 fs r276415 : #i105234# proper zoom handling for the nav bar 2009-09-24 09:42:19 +0000 fs r276414 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double 2009-09-16 11:11:43 +0000 fs r276195 : #i105082# consolidated the sub storage handling, by delegating more functionality into the DocumentStorageAccess class. As a result, there won't be that many unnecessary commits anymore. Also, the two different storage caches (in ModelImpl::m_aStorages and DocumentStorageAccess::m_aExposedStorages) have been consolidated. This is not really part of the fix of issue 105082, but it helped reducing the calls to the storage/package implementation. 2009-09-15 21:42:27 +0000 fs r276190 : don't calculate space for BOLD if the text is not really bold (speeds up rendering for large tree structures) 2009-09-15 20:20:23 +0000 fs r276188 : getTypeInfo: fill m_aTypeInfoRows only if really all type infos could be retrieved 2009-09-15 20:19:29 +0000 fs r276187 : do not continue loading when the controller initialization throws an error 2009-09-14 12:25:57 +0000 fs r276119 : oops, this patch was not intended for this CWS 2009-09-14 12:13:57 +0000 fs r276114 : #cr6875455# introduce a ReferenceDevice property for various control models 2009-09-14 10:33:02 +0000 fs r276106 : removed dead file 2009-09-09 08:37:31 +0000 fs r275972 : remove OSL_TRACE in VCLXButton dtor 2009-09-08 11:19:17 +0000 oj r275926 : i76534# remove mnemonic from fixed text 2009-09-07 08:39:37 +0000 fs r275874 : create CWS dba33a from cws/dba32g@275857 (CWS: dba32g) --- .../qa/connectivity/tools/DbaseDatabase.java | 3 +- .../qa/connectivity/tools/HsqlDatabase.java | 3 +- .../commontools/TDatabaseMetaDataBase.cxx | 4 +- .../drivers/mozab/bootstrap/makefile.mk | 113 +------ connectivity/source/drivers/mozab/makefile.mk | 44 +-- .../source/drivers/mozab/makefile_mozab.mk | 128 ++++++++ .../drivers/mozab/mozillasrc/makefile.mk | 101 +----- embeddedobj/source/general/docholder.cxx | 21 +- framework/inc/macros/registration.hxx | 6 +- framework/inc/properties.h | 17 +- framework/inc/services.h | 1 + framework/inc/services/layoutmanager.hxx | 38 ++- .../source/layoutmanager/layoutmanager.cxx | 302 ++++++++---------- framework/source/layoutmanager/makefile.mk | 2 + framework/source/register/makefile.mk | 2 + framework/source/xml/menuconfiguration.cxx | 4 - sfx2/source/view/sfxbasecontroller.cxx | 24 ++ svx/inc/fmhelp.hrc | 165 ++++------ svx/util/hidother.src | 7 - .../source/forms/gridcolumnproptranslator.cxx | 10 +- xmloff/source/text/txtstyli.cxx | 58 ++-- 21 files changed, 477 insertions(+), 576 deletions(-) create mode 100644 connectivity/source/drivers/mozab/makefile_mozab.mk diff --git a/connectivity/qa/connectivity/tools/DbaseDatabase.java b/connectivity/qa/connectivity/tools/DbaseDatabase.java index 9c1d6ea47411..8846c3995f56 100755 --- a/connectivity/qa/connectivity/tools/DbaseDatabase.java +++ b/connectivity/qa/connectivity/tools/DbaseDatabase.java @@ -65,7 +65,8 @@ public class DbaseDatabase extends AbstractDatabase private void createDBDocument() throws Exception { final File documentFile = File.createTempFile("dbase", ".odb"); - documentFile.deleteOnExit(); + if ( documentFile.exists() ) + documentFile.delete(); final File subPath = new File(documentFile.getParent() + File.separator + documentFile.getName().replaceAll(".odb", "") + File.separator ); subPath.mkdir(); //subPath.deleteOnExit(); diff --git a/connectivity/qa/connectivity/tools/HsqlDatabase.java b/connectivity/qa/connectivity/tools/HsqlDatabase.java index d27816cf4b7e..593a5ad95981 100644 --- a/connectivity/qa/connectivity/tools/HsqlDatabase.java +++ b/connectivity/qa/connectivity/tools/HsqlDatabase.java @@ -71,7 +71,8 @@ public class HsqlDatabase extends AbstractDatabase private void createDBDocument() throws Exception { final File documentFile = File.createTempFile("testdb", ".odb"); - documentFile.deleteOnExit(); + if ( documentFile.exists() ) + documentFile.delete(); m_databaseDocumentFile = URLHelper.getFileURLFromSystemPath(documentFile); m_databaseDocument = (XOfficeDatabaseDocument) UnoRuntime.queryInterface( diff --git a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx index b3cbb4ae67c7..4c3f3db8b754 100644 --- a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx +++ b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx @@ -145,6 +145,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( ) throw(SQ } } + ::connectivity::ODatabaseMetaDataResultSet::ORows aTypeInfoRows; while( xRet->next() ) { ::connectivity::ODatabaseMetaDataResultSet::ORow aRow; @@ -169,8 +170,9 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( ) throw(SQ else ++aIter; } - m_aTypeInfoRows.push_back(aRow); + aTypeInfoRows.push_back(aRow); } + m_aTypeInfoRows = aTypeInfoRows; } } ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo); diff --git a/connectivity/source/drivers/mozab/bootstrap/makefile.mk b/connectivity/source/drivers/mozab/bootstrap/makefile.mk index 9b4b05868cd2..00f76ddeb8fd 100644 --- a/connectivity/source/drivers/mozab/bootstrap/makefile.mk +++ b/connectivity/source/drivers/mozab/bootstrap/makefile.mk @@ -30,37 +30,35 @@ #************************************************************************* CALL_CDECL=TRUE -#mozilla specific stuff. -MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT) -MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla -#End of mozilla specific stuff. - PRJ=..$/..$/..$/.. PRJINC=..$/..$/.. PRJNAME=connectivity TARGET=mozbootstrap -USE_DEFFILE=TRUE -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - .IF "$(OS)" == "OS2" all: @echo " Not building under OS/2" .ENDIF # --- Settings ---------------------------------- -.IF "$(DBGUTIL_OJ)"!="" -ENVCFLAGS+=/FR$(SLO)$/ -.ENDIF +USE_DEFFILE=TRUE +ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE + +# --- begin of mozilla specific stuff +MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT) +MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla +# --- end of mozilla specific stuff .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/version.mk +.INCLUDE : ../makefile_mozab.mk + +INCPRE += -I../mozillasrc -#mozilla specific stuff. # --- Files ------------------------------------- SLOFILES += \ @@ -93,95 +91,6 @@ SLOFILES += \ $(SLO)$/MNSProfileDirServiceProvider.obj .ENDIF -CDEFS += -DMOZILLA_INTERNAL_API - -.IF "$(GUI)"=="UNX" -.IF "$(COMNAME)"=="sunpro5" -CFLAGS += -features=tmplife -#This flag is needed to build mozilla 1.7 code -.ENDIF # "$(COMNAME)"=="sunpro5" -.ENDIF - -MOZINC = . -I.. -I..$/mozillasrc -I$(MOZ_INC) -I$(MOZ_INC)$/nspr -I$(MOZ_INC)$/xpcom \ - -I$(MOZ_INC)$/string -I$(MOZ_INC)$/rdf -I$(MOZ_INC)$/msgbase \ - -I$(MOZ_INC)$/addrbook -I$(MOZ_INC)$/mork -I$(MOZ_INC)$/locale \ - -I$(MOZ_INC)$/pref -I$(MOZ_INC)$/mime -I$(MOZ_INC)$/chrome \ - -I$(MOZ_INC)$/necko -I$(MOZ_INC)$/intl -I$(MOZ_INC)$/profile \ - -I$(MOZ_INC)$/embed_base -I$(MOZ_INC)$/mozldap -I$(MOZ_INC)$/uconv\ - -I$(MOZ_INC)$/xpcom_obsolete -I$(MOZ_INC)$/content - -.IF "$(GUI)" == "WNT" -.IF "$(COM)" == "GCC" -INCPOST += $(MOZINC) -CDEFS += -DWINVER=0x400 -DMOZILLA_CLIENT \ - -DNS_NET_FILE -DCookieManagement -DSingleSignon -DClientWallet \ - -DTRACING -DXP_PC -DXP_WIN -DXP_WIN32 -DHW_THREADS \ - -DNS_MT_SUPPORTED -DNETLIB_THREAD \ - -DOJI -DWIN32 -D_X86_ -D_WINDOWS \ - -DMOZ_XUL -DMOZ_REFLOW_PERF -DMOZ_REFLOW_PERF_DSP \ - -DNSPR20 -DOS_HAS_DLL -DNO_JNI_STUBS \ - -DNETSCAPE -DMOZILLA_CLIENT -DJS_THREADSAFE -DNECKO -DINCLUDE_XUL -CFLAGSCXX += \ - -fno-rtti -Wall -Wconversion -Wpointer-arith \ - -Wcast-align -Woverloaded-virtual -Wsynth \ - -Wno-long-long -.ELSE -.IF "$(DBG_LEVEL)" == "0" -INCPRE += $(MOZINC) -CDEFS += -DWINVER=0x400 -DMOZILLA_CLIENT \ - -DNS_NET_FILE -DCookieManagement -DSingleSignon -DClientWallet \ - -DTRACING -DXP_PC -DXP_WIN -DXP_WIN32 -DHW_THREADS \ - -DDMSVC4 -DNS_MT_SUPPORTED -DNETLIB_THREAD \ - -DOJI -DWIN32 -D_X86_ -D_WINDOWS \ - -DMOZ_XUL -DMOZ_REFLOW_PERF -DMOZ_REFLOW_PERF_DSP \ - -DNSPR20 -DOS_HAS_DLL -DNO_JNI_STUBS \ - -DNETSCAPE -DMOZILLA_CLIENT -DJS_THREADSAFE -DNECKO -DINCLUDE_XUL \ - -UDEBUG -CFLAGS += -GR- -W3 -Gy -MD -UDEBUG -.ELSE -INCPRE += $(MOZINC) -CDEFS += -DWINVER=0x400 -DMOZILLA_CLIENT \ - -DNS_NET_FILE -DCookieManagement -DSingleSignon -DClientWallet \ - -DTRACING -DXP_PC -DXP_WIN -DXP_WIN32 -DHW_THREADS \ - -DDMSVC4 -DDEVELOPER_DEBUG -DNS_MT_SUPPORTED -DNETLIB_THREAD \ - -DOJI -DWIN32 -D_X86_ -D_WINDOWS \ - -DMOZ_XUL -DMOZ_REFLOW_PERF -DMOZ_REFLOW_PERF_DSP \ - -DDEBUG_Administrator -DNSPR20 -DOS_HAS_DLL -DNO_JNI_STUBS \ - -DNETSCAPE -DMOZILLA_CLIENT -DJS_THREADSAFE -DNECKO -DINCLUDE_XUL \ - -UDEBUG -CFLAGS += -Zi -GR- -W3 -Gy -MDd -UDEBUG -.IF "$(CCNUMVER)" >= "001399999999" -CDEFS += -D_STL_NOFORCE_MANIFEST -.ENDIF -.ENDIF -.ENDIF -.ENDIF -.IF "$(GUI)" == "UNX" -INCPOST += $(MOZINC) -CDEFS+= -DMOZILLA_CLIENT \ - -DXP_UNIX -.IF "$(OS)" == "LINUX" -CFLAGS += -fPIC -g -CDEFS+= -DOJI - -CFLAGSCXX += \ - -fno-rtti -Wconversion -Wpointer-arith \ - -Wcast-align -Woverloaded-virtual -Wsynth \ - -Wno-long-long -pthread -CDEFS += -DTRACING -.ELIF "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX" -CFLAGS += -fPIC -CFLAGSCXX += \ - -fno-rtti -Wconversion -Wpointer-arith \ - -Wcast-align -Woverloaded-virtual -Wsynth \ - -Wno-long-long -Wno-deprecated -CDEFS += -DTRACING -.ENDIF - -SHL1TARGET_NAME=$(TARGET)$(MOZAB_MAJOR) - -.ENDIF # MACOSX - # --- Targets ---------------------------------- .INCLUDE : target.mk diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk index 677e605096c4..76161dc32119 100644 --- a/connectivity/source/drivers/mozab/makefile.mk +++ b/connectivity/source/drivers/mozab/makefile.mk @@ -43,38 +43,28 @@ all: @echo " see http://www.mozilla.org/issues/show_bug.cgi?id=91209" .ENDIF -#mozilla specific stuff. +# --- begin of mozilla specific stuff MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT) MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla .IF "$(OS)"=="WNT" -.IF "$(USE_SHELL)"=="4nt" -MOZ_EMBED_LIB := $(shell @+-dir /ba:f $(MOZ_LIB)$/embed_base_s.lib 2>NUL ) -MOZ_REG_LIB := $(shell @+-dir /ba:f $(MOZ_LIB)$/mozreg_s.lib 2>NUL ) -.ELSE #"$(USE_SHELL)"=="4nt" -MOZ_EMBED_LIB := $(shell @-test -f $(MOZ_LIB)$/embed_base_s.lib && echo $(MOZ_LIB)$/embed_base_s.lib ) -MOZ_REG_LIB := $(shell @-test -f $(MOZ_LIB)$/mozreg_s.lib && echo $(MOZ_LIB)$/mozreg_s.lib ) -.ENDIF + MOZ_EMBED_LIB := $(shell @-test -f $(MOZ_LIB)$/embed_base_s.lib && echo $(MOZ_LIB)$/embed_base_s.lib ) + MOZ_REG_LIB := $(shell @-test -f $(MOZ_LIB)$/mozreg_s.lib && echo $(MOZ_LIB)$/mozreg_s.lib ) -.IF X"$(MOZ_EMBED_LIB)"=="X" -MOZ_EMBED_LIB := $(MOZ_LIB)$/baseembed_s.lib -.ENDIF -.IF X"$(MOZ_REG_LIB)" == "X" -MOZ_REG_LIB := $(MOZ_LIB)$/mozreg.lib -.ENDIF -.ENDIF + MOZ_EMBED_LIB *:= $(MOZ_LIB)$/baseembed_s.lib + MOZ_REG_LIB *:= $(MOZ_LIB)$/mozreg.lib + + .IF "$(COM)"=="GCC" + MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom -lxpcom_core + .ELSE + LIB += $(MOZ_LIB) + MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib $(MOZ_LIB)$/xpcom_core.lib + .ENDIF -.IF "$(OS)"=="WNT" -.IF "$(COM)"=="GCC" -MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom -lxpcom_core -.ELSE -LIB += $(MOZ_LIB) -MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib $(MOZ_LIB)$/xpcom_core.lib -.ENDIF .ELSE "$(OS)"=="WNT" -MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lnspr4 -lxpcom_core -lmozreg_s -lembed_base_s + MOZ_LIB_XPCOM = -L$(MOZ_LIB) -lnspr4 -lxpcom_core -lmozreg_s -lembed_base_s .ENDIF -#End of mozilla specific stuff. +# --- end of mozilla specific stuff USE_DEFFILE=TRUE ENABLE_EXCEPTIONS=TRUE @@ -87,10 +77,6 @@ COMPONENT_CONFIG_SCHEMA=$(TARGET)2.xcs # --- Settings ---------------------------------- -.IF "$(DBGUTIL_OJ)"!="" -ENVCFLAGS+=/FR$(SLO)$/ -.ENDIF - .INCLUDE : $(PRJ)$/makefile.pmk .INCLUDE : $(PRJ)$/version.mk @@ -121,7 +107,6 @@ DEF1NAME= $(SHL1TARGET) DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \ $(SLB)$/$(TARGET).lib DEFLIB1NAME=$(TARGET) -#DEF1EXPORTFILE= exports.dxp # --- Files ------------------------------------- @@ -165,6 +150,7 @@ DEPOBJFILES=$(SLO2FILES) # --- MOZAB BASE Library ----------------------------------- SHL2VERSIONMAP= $(TARGET2).map +SHL2NOCHECK=TRUE SHL2TARGET= $(TARGET2)$(DLLPOSTFIX) SHL2OBJS=$(SLO2FILES) SHL2STDLIBS=\ diff --git a/connectivity/source/drivers/mozab/makefile_mozab.mk b/connectivity/source/drivers/mozab/makefile_mozab.mk new file mode 100644 index 000000000000..28b56ec2a84a --- /dev/null +++ b/connectivity/source/drivers/mozab/makefile_mozab.mk @@ -0,0 +1,128 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +CDEFS += -DMOZILLA_INTERNAL_API + +.IF "$(GUI)"=="UNX" + .IF "$(COMNAME)"=="sunpro5" + CFLAGS += -features=tmplife + #This flag is needed to build mozilla 1.7 code + .ENDIF # "$(COMNAME)"=="sunpro5" +.ENDIF + +MOZINC = . \ + -I.. \ + -I$(MOZ_INC) \ + -I$(MOZ_INC)$/nspr \ + -I$(MOZ_INC)$/xpcom \ + -I$(MOZ_INC)$/string \ + -I$(MOZ_INC)$/rdf \ + -I$(MOZ_INC)$/msgbase \ + -I$(MOZ_INC)$/addrbook \ + -I$(MOZ_INC)$/mork \ + -I$(MOZ_INC)$/locale \ + -I$(MOZ_INC)$/pref \ + -I$(MOZ_INC)$/mime \ + -I$(MOZ_INC)$/chrome \ + -I$(MOZ_INC)$/necko \ + -I$(MOZ_INC)$/intl \ + -I$(MOZ_INC)$/profile \ + -I$(MOZ_INC)$/embed_base \ + -I$(MOZ_INC)$/mozldap \ + -I$(MOZ_INC)$/uconv \ + -I$(MOZ_INC)$/xpcom_obsolete \ + -I$(MOZ_INC)$/content + +.IF "$(GUI)" == "WNT" + CDEFS += \ + -DMOZILLA_CLIENT \ + -DXP_PC \ + -DXP_WIN \ + -DXP_WIN32 \ + -DOJI \ + -DWIN32 \ + -D_X86_ \ + -D_WINDOWS \ + -DMOZ_XUL \ + -DMOZ_REFLOW_PERF \ + -DMOZ_REFLOW_PERF_DSP + .IF "$(COM)" == "GCC" + INCPOST += $(MOZINC) + CFLAGSCXX += \ + -fno-rtti \ + -Wall \ + -Wconversion \ + -Wpointer-arith \ + -Wcast-align \ + -Woverloaded-virtual \ + -Wsynth \ + -Wno-long-long + .ELSE # .IF "$(COM)" == "GCC" + INCPRE += $(MOZINC) + .IF "$(DBG_LEVEL)" != "0" + .IF "$(CCNUMVER)" >= "001399999999" + CDEFS += -D_STL_NOFORCE_MANIFEST + .ENDIF # .IF "$(CCNUMVER)" >= "001399999999" + .ENDIF # .IF "$(DBG_LEVEL)" != "0" + .ENDIF # .IF "$(COM)" == "GCC" +.ENDIF # .IF "$(GUI)" == "WNT" + +.IF "$(GUI)" == "UNX" + INCPOST += $(MOZINC) + CDEFS+= -DMOZILLA_CLIENT \ + -DXP_UNIX + .IF "$(OS)" == "LINUX" + CFLAGS += -fPIC -g + CDEFS += -DOJI + CFLAGSCXX += \ + -fno-rtti \ + -Wconversion \ + -Wpointer-arith \ + -Wcast-align \ + -Woverloaded-virtual \ + -Wsynth \ + -Wno-long-long \ + -pthread + CDEFS += -DTRACING + .ELIF "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX" + CFLAGS += -fPIC + CFLAGSCXX += \ + -fno-rtti \ + -Wconversion \ + -Wpointer-arith \ + -Wcast-align \ + -Woverloaded-virtual \ + -Wsynth \ + -Wno-long-long \ + -Wno-deprecated + CDEFS += -DTRACING + .ENDIF # "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX" + + SHL1TARGET_NAME=$(TARGET)$(MOZAB_MAJOR) + +.ENDIF # "$(GUI)" == "UNX" + diff --git a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk index e31d4c7e412b..1e5b39e0f140 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk +++ b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk @@ -40,16 +40,12 @@ PRJINC=..$/..$/.. PRJNAME=connectivity TARGET=mozabsrc +# --- Settings ---------------------------------- + USE_DEFFILE=TRUE ENABLE_EXCEPTIONS=TRUE VISIBILITY_HIDDEN=TRUE -# --- Settings ---------------------------------- -.IF "$(DBGUTIL_OJ)"!="" -ENVCFLAGS+=/FR$(SLO)$/ -.ENDIF - - .INCLUDE : settings.mk .IF ("$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || "$(OS)" == "OS2" @@ -61,8 +57,10 @@ dummy: .INCLUDE : $(PRJ)$/version.mk +.INCLUDE : ../makefile_mozab.mk + +INCPRE += -I../bootstrap -#mozilla specific stuff. # --- Files ------------------------------------- SLOFILES = \ @@ -74,98 +72,9 @@ SLOFILES = \ $(SLO)$/MNSMozabProxy.obj \ $(SLO)$/MNSTerminateListener.obj \ $(SLO)$/MLdapAttributeMap.obj \ - -CDEFS += -DMOZILLA_INTERNAL_API - -.IF "$(GUI)"=="UNX" -.IF "$(COMNAME)"=="sunpro5" -CFLAGS += -features=tmplife -#This flag is needed to build mozilla 1.7 code -.ENDIF # "$(COMNAME)"=="sunpro5" .ENDIF -MOZINC = . -I.. -I..$/bootstrap -I$(MOZ_INC) -I$(MOZ_INC)$/nspr -I$(MOZ_INC)$/xpcom \ - -I$(MOZ_INC)$/string -I$(MOZ_INC)$/rdf -I$(MOZ_INC)$/msgbase \ - -I$(MOZ_INC)$/addrbook -I$(MOZ_INC)$/mork -I$(MOZ_INC)$/locale \ - -I$(MOZ_INC)$/pref -I$(MOZ_INC)$/mime -I$(MOZ_INC)$/chrome \ - -I$(MOZ_INC)$/necko -I$(MOZ_INC)$/intl -I$(MOZ_INC)$/profile \ - -I$(MOZ_INC)$/embed_base -I$(MOZ_INC)$/mozldap -I$(MOZ_INC)$/uconv\ - -I$(MOZ_INC)$/xpcom_obsolete -I$(MOZ_INC)$/content - -.IF "$(GUI)" == "WNT" -.IF "$(COM)"=="GCC" -INCPOST += $(MOZINC) -CDEFS += -DWINVER=0x400 -DMOZILLA_CLIENT \ - -DNS_NET_FILE -DCookieManagement -DSingleSignon -DClientWallet \ - -DTRACING -DXP_PC -DXP_WIN -DXP_WIN32 -DHW_THREADS \ - -DNS_MT_SUPPORTED -DNETLIB_THREAD \ - -DOJI -DWIN32 -D_X86_ -D_WINDOWS \ - -DMOZ_XUL -DMOZ_REFLOW_PERF -DMOZ_REFLOW_PERF_DSP \ - -DNSPR20 -DOS_HAS_DLL -DNO_JNI_STUBS \ - -DNETSCAPE -DMOZILLA_CLIENT -DJS_THREADSAFE -DNECKO -DINCLUDE_XUL -CFLAGSCXX += \ - -fno-rtti -Wall -Wconversion -Wpointer-arith \ - -Wcast-align -Woverloaded-virtual -Wsynth \ - -Wno-long-long -.ELSE -.IF "$(DBG_LEVEL)" == "0" -INCPRE += $(MOZINC) -CDEFS += -DWINVER=0x400 -DMOZILLA_CLIENT \ - -DNS_NET_FILE -DCookieManagement -DSingleSignon -DClientWallet \ - -DTRACING -DXP_PC -DXP_WIN -DXP_WIN32 -DHW_THREADS \ - -DDMSVC4 -DNS_MT_SUPPORTED -DNETLIB_THREAD \ - -DOJI -DWIN32 -D_X86_ -D_WINDOWS \ - -DMOZ_XUL -DMOZ_REFLOW_PERF -DMOZ_REFLOW_PERF_DSP \ - -DNSPR20 -DOS_HAS_DLL -DNO_JNI_STUBS \ - -DNETSCAPE -DMOZILLA_CLIENT -DJS_THREADSAFE -DNECKO -DINCLUDE_XUL \ - -UDEBUG -CFLAGS += -GR- -W3 -Gy -MD -UDEBUG -.ELSE -INCPRE += $(MOZINC) -CDEFS += -DWINVER=0x400 -DMOZILLA_CLIENT \ - -DNS_NET_FILE -DCookieManagement -DSingleSignon -DClientWallet \ - -DTRACING -DXP_PC -DXP_WIN -DXP_WIN32 -DHW_THREADS \ - -DDMSVC4 -DDEVELOPER_DEBUG -DNS_MT_SUPPORTED -DNETLIB_THREAD \ - -DOJI -DWIN32 -D_X86_ -D_WINDOWS \ - -DMOZ_XUL -DMOZ_REFLOW_PERF -DMOZ_REFLOW_PERF_DSP \ - -DDEBUG_Administrator -DNSPR20 -DOS_HAS_DLL -DNO_JNI_STUBS \ - -DNETSCAPE -DMOZILLA_CLIENT -DJS_THREADSAFE -DNECKO -DINCLUDE_XUL \ - -UDEBUG -CFLAGS += -Zi -GR- -W3 -Gy -MDd -UDEBUG -.IF "$(CCNUMVER)" >= "001399999999" -CDEFS += -D_STL_NOFORCE_MANIFEST -.ENDIF -.ENDIF -.ENDIF -.ENDIF -.IF "$(GUI)" == "UNX" -INCPOST += $(MOZINC) -CDEFS+= -DMOZILLA_CLIENT \ - -DXP_UNIX -.IF "$(OS)" == "LINUX" -CFLAGS += -fPIC -g -CDEFS+= -DOJI - -CFLAGSCXX += \ - -fno-rtti -Wconversion -Wpointer-arith \ - -Wcast-align -Woverloaded-virtual -Wsynth \ - -Wno-long-long -pthread -CDEFS += -DTRACING -.ELIF "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX" -CFLAGS += -fPIC -CFLAGSCXX += \ - -fno-rtti -Wconversion -Wpointer-arith \ - -Wcast-align -Woverloaded-virtual -Wsynth \ - -Wno-long-long -Wno-deprecated -CDEFS += -DTRACING -.ENDIF -.ENDIF - -SHL1TARGET_NAME=$(TARGET)$(MOZAB_MAJOR) - -.ENDIF # MACOSX - # --- Targets ---------------------------------- .INCLUDE : target.mk diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 93a5a28dd46d..7e9f3bc3791f 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -83,6 +83,7 @@ #include #include +#include #include "docholder.hxx" #include "commonembobj.hxx" @@ -1025,20 +1026,14 @@ sal_Bool DocumentHolder::LoadDocToFrame( sal_Bool bInPlace ) if ( xDoc.is() ) { // load new document in to the frame - uno::Reference< frame::XComponentLoader > xComponentLoader( m_xFrame, uno::UNO_QUERY ); - if( !xComponentLoader.is() ) - throw uno::RuntimeException(); + uno::Reference< frame::XComponentLoader > xComponentLoader( m_xFrame, uno::UNO_QUERY_THROW ); - uno::Sequence< beans::PropertyValue > aArgs( bInPlace ? 3 : 2 ); - aArgs[0].Name = ::rtl::OUString::createFromAscii( "Model" ); - aArgs[0].Value <<= m_xComponent; - aArgs[1].Name = ::rtl::OUString::createFromAscii( "ReadOnly" ); - aArgs[1].Value <<= m_bReadOnly; + ::comphelper::NamedValueCollection aArgs; + aArgs.put( "Model", m_xComponent ); + aArgs.put( "ReadOnly", m_bReadOnly ); + //aArgs.put( "Hidden", sal_True ); if ( bInPlace ) - { - aArgs[2].Name = ::rtl::OUString::createFromAscii( "PluginMode" ); - aArgs[2].Value <<= sal_Int16(1); - } + aArgs.put( "PluginMode", sal_Int16(1) ); ::rtl::OUString sUrl; uno::Reference< lang::XServiceInfo> xServiceInfo(xDoc,uno::UNO_QUERY); if ( xServiceInfo.is() @@ -1055,7 +1050,7 @@ sal_Bool DocumentHolder::LoadDocToFrame( sal_Bool bInPlace ) xComponentLoader->loadComponentFromURL( sUrl, rtl::OUString::createFromAscii( "_self" ), 0, - aArgs ); + aArgs.getPropertyValues() ); return sal_True; } diff --git a/framework/inc/macros/registration.hxx b/framework/inc/macros/registration.hxx index 7a48fad1f84c..d026c1b0f04c 100644 --- a/framework/inc/macros/registration.hxx +++ b/framework/inc/macros/registration.hxx @@ -139,7 +139,7 @@ ________________________________________________________________________________ // define helper to get information about service environment //***************************************************************************************************************** #define COMPONENTGETIMPLEMENTATIONENVIRONMENT \ - extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName , \ + extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName , \ uno_Environment** ) \ { \ *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; \ @@ -150,7 +150,7 @@ ________________________________________________________________________________ // define registration of service //***************************************************************************************************************** #define COMPONENTWRITEINFO( INFOS ) \ - extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/ , \ + extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/ , \ void* pRegistryKey ) \ { \ LOG_REGISTRATION_WRITEINFO( "\t[start]\n" ) \ @@ -185,7 +185,7 @@ ________________________________________________________________________________ // define method to instanciate new services //***************************************************************************************************************** #define COMPONENTGETFACTORY( IFFACTORIES ) \ - extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplementationName , \ + extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName , \ void* pServiceManager , \ void* /*pRegistryKey*/ ) \ { \ diff --git a/framework/inc/properties.h b/framework/inc/properties.h index d09fde5a5fc4..d2619cd9ee87 100644 --- a/framework/inc/properties.h +++ b/framework/inc/properties.h @@ -193,25 +193,26 @@ namespace framework{ //_______________________________________________ /** properties for "LayoutManager" class */ -#define LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER "MenuBarCloser" -#define LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS "AutomaticToolbars" -#define LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY "RefreshContextToolbarVisibility" -#define LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI "HideCurrentUI" -#define LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT "LockCount" +#define LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER "MenuBarCloser" +#define LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS "AutomaticToolbars" +#define LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY "RefreshContextToolbarVisibility" +#define LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI "HideCurrentUI" +#define LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT "LockCount" +#define LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE "PreserveContentSize" #define LAYOUTMANAGER_PROPNAME_MENUBARCLOSER ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER ) #define LAYOUTMANAGER_PROPNAME_AUTOMATICTOOLBARS ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS ) #define LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY ) #define LAYOUTMANAGER_PROPNAME_HIDECURRENTUI ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI ) #define LAYOUTMANAGER_PROPNAME_LOCKCOUNT ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT ) +#define LAYOUTMANAGER_PROPNAME_PRESERVE_CONTENT_SIZE ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE ) #define LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER 0 #define LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS 1 #define LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY 2 #define LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI 3 #define LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT 4 - -#define LAYOUTMANAGER_PROPCOUNT 5 +#define LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE 5 //_______________________________________________ /** properties for "UICommandDescription" class */ @@ -271,7 +272,7 @@ namespace framework{ #define TABWINDOWSERVICE_PROPNAME_WINDOW ::rtl::OUString::createFromAscii( TABWINDOWSERVICE_PROPNAME_ASCII_WINDOW ) #define TABWINDOWSERVICE_PROPHANDLE_WINDOW 0 -#define TABWINDOWSERVICE_PROPCOUNT 1 +#define TABWINDOWSERVICE_PROPCOUNT 1 //_______________________________________________ /** properties of tabreg service */ diff --git a/framework/inc/services.h b/framework/inc/services.h index e9f3e1bfe3ce..70f4f8fde9a2 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -127,6 +127,7 @@ namespace framework{ #define SERVICENAME_IMAGEMANAGER DECLARE_ASCII("com.sun.star.ui.ImageManager" ) #define SERVICENAME_TABWINDOWSERVICE DECLARE_ASCII("com.sun.star.ui.dialogs.TabContainerWindow" ) #define SERVICENAME_WINDOWCONTENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.WindowContentFactoryManager" ) +#define SERVICENAME_DISPLAYACCESS DECLARE_ASCII("com.sun.star.awt.DisplayAccess" ) //_________________________________________________________________________________________________________________ // used implementationnames by framework diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index 86dec1a938bf..8c412e5d6237 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -69,6 +69,7 @@ #include #include #include +#include #include #include #include @@ -78,8 +79,9 @@ // other includes //_________________________________________________________________________________________________________________ #include +#include #include -#include +#include #include #include #include @@ -89,22 +91,23 @@ class MenuBar; namespace framework { class GlobalSettings; - class LayoutManager : public css::lang::XTypeProvider , - public css::lang::XServiceInfo , - public ::com::sun::star::frame::XLayoutManager , - public css::awt::XWindowListener , - public css::frame::XFrameActionListener , - public ::com::sun::star::ui::XUIConfigurationListener , - public ::com::sun::star::frame::XInplaceLayout , - public css::awt::XDockableWindowListener , - public ::com::sun::star::frame::XMenuBarMergingAcceptor, - public css::frame::XLayoutManagerEventBroadcaster , + typedef ::cppu::WeakImplHelper9 < ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::frame::XLayoutManager + , ::com::sun::star::awt::XWindowListener + , ::com::sun::star::frame::XFrameActionListener + , ::com::sun::star::ui::XUIConfigurationListener + , ::com::sun::star::frame::XInplaceLayout + , ::com::sun::star::awt::XDockableWindowListener + , ::com::sun::star::frame::XMenuBarMergingAcceptor + , ::com::sun::star::frame::XLayoutManagerEventBroadcaster + > LayoutManager_Base; + typedef ::comphelper::OPropertyContainer LayoutManager_PBase; + class LayoutManager : public LayoutManager_Base , // base classes // Order is neccessary for right initialization! private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. public ::cppu::OBroadcastHelper , - public ::cppu::OPropertySetHelper , // => XPropertySet / XFastPropertySet / XMultiPropertySet - public ::cppu::OWeakObject // => XWeak, XInterface + public LayoutManager_PBase { public: enum { DOCKINGAREAS_COUNT = 4 }; @@ -388,6 +391,7 @@ namespace framework // layouting methods sal_Bool implts_compareRectangles( const ::com::sun::star::awt::Rectangle& rRect1, const ::com::sun::star::awt::Rectangle& rRect2 ); + sal_Bool implts_resizeContainerWindow( const ::com::sun::star::awt::Size& rContainerSize, const ::com::sun::star::awt::Point& rComponentPos ); ::Size implts_getTopBottomDockingAreaSizes(); ::Size implts_getContainerWindowOutputSize(); ::com::sun::star::awt::Rectangle implts_getDockingAreaWindowSizes(); @@ -399,7 +403,8 @@ namespace framework void implts_findNextDockingPos( ::com::sun::star::ui::DockingArea DockingArea, const ::Size& aUIElementSize, ::Point& rVirtualPos, ::Point& rPixelPos ); ::com::sun::star::awt::Rectangle implts_calcDockingAreaSizes(); void implts_setDockingAreaWindowSizes( const com::sun::star::awt::Rectangle& rBorderSpace ); - sal_Bool implts_doLayout( sal_Bool bForceRequestBorderSpace ); + sal_Bool implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_Bool bOuterResize ); + void implts_doLayout_notify( sal_Bool bOuterResize ); // internal methods to control status/progress bar ::Size implts_getStatusBarSize(); @@ -449,15 +454,15 @@ namespace framework virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); - static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; /** reference to factory, which has created this instance. */ css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + css::uno::Reference< css::container::XIndexAccess > m_xDisplayAccess; css::uno::Reference< css::frame::XFrame > m_xFrame; css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr; css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr; css::uno::WeakReference< css::frame::XModel > m_xModel; css::uno::Reference< css::awt::XWindow > m_xContainerWindow; + css::uno::Reference< css::awt::XTopWindow2 > m_xContainerTopWindow; css::uno::Reference< css::awt::XWindow > m_xDockAreaWindows[DOCKINGAREAS_COUNT]; sal_Int32 m_nLockCount; UIElementVector m_aUIElements; @@ -474,6 +479,7 @@ namespace framework bool m_bStoreWindowState; bool m_bHideCurrentUI; bool m_bGlobalSettings; + bool m_bPreserveContentSize; DockingOperation m_eDockOperation; UIElement m_aDockUIElement; css::awt::Rectangle m_aDockingArea; diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index fb10e4fae24c..491738dea73f 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -67,17 +67,13 @@ #include #include #include -#ifndef _COM_SUN_STAR_LANG_XYSTEMDEPENDENT_HPP_ #include -#endif #include #include #include #include #include -#ifndef _COM_SUN_STAR_UI_XMODULEUICONFIGURATIONMANAGER_HPP_ #include -#endif #include #include #include @@ -92,18 +88,18 @@ // other includes //_________________________________________________________________________________________________________________ #include +#include #include #include #include #include #include #include -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include -#endif #include #include #include +#include #include #include @@ -354,40 +350,8 @@ static void impl_setDockingWindowVisibility( const css::uno::Reference< css::lan //***************************************************************************************************************** // XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XINTERFACE_14 ( LayoutManager , - OWeakObject , - DIRECT_INTERFACE( css::lang::XTypeProvider ), - DIRECT_INTERFACE( css::lang::XServiceInfo ), - DIRECT_INTERFACE( ::com::sun::star::frame::XLayoutManager ), - DIRECT_INTERFACE( css::awt::XWindowListener ), - DIRECT_INTERFACE( css::frame::XFrameActionListener ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationListener ), - DIRECT_INTERFACE( ::com::sun::star::frame::XInplaceLayout ), - DIRECT_INTERFACE( css::awt::XDockableWindowListener ), - DIRECT_INTERFACE( ::com::sun::star::frame::XMenuBarMergingAcceptor ), - DIRECT_INTERFACE( css::frame::XLayoutManagerEventBroadcaster ), - DERIVED_INTERFACE( css::lang::XEventListener, css::frame::XFrameActionListener ), - DIRECT_INTERFACE( ::com::sun::star::beans::XMultiPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::beans::XFastPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::beans::XPropertySet ) - ) - -DEFINE_XTYPEPROVIDER_14 ( LayoutManager , - css::lang::XTypeProvider , - css::lang::XServiceInfo , - ::com::sun::star::frame::XLayoutManager , - css::awt::XWindowListener , - css::frame::XFrameActionListener , - css::lang::XEventListener , - ::com::sun::star::ui::XUIConfigurationListener , - ::com::sun::star::frame::XInplaceLayout , - css::awt::XDockableWindowListener , - ::com::sun::star::frame::XMenuBarMergingAcceptor , - css::frame::XLayoutManagerEventBroadcaster , - ::com::sun::star::beans::XMultiPropertySet , - ::com::sun::star::beans::XFastPropertySet , - ::com::sun::star::beans::XPropertySet - ) +IMPLEMENT_FORWARD_XTYPEPROVIDER2( LayoutManager, LayoutManager_Base, LayoutManager_PBase ) +IMPLEMENT_FORWARD_XINTERFACE2( LayoutManager, LayoutManager_Base, LayoutManager_PBase ) DEFINE_XSERVICEINFO_MULTISERVICE ( LayoutManager , ::cppu::OWeakObject , @@ -398,15 +362,14 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( LayoutManager DEFINE_INIT_SERVICE ( LayoutManager, {} ) -LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceManager ) : - ThreadHelpBase( &Application::GetSolarMutex() ) +LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceManager ) + : LayoutManager_Base ( ) + , ThreadHelpBase ( &Application::GetSolarMutex() ) , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() ) - , ::cppu::OPropertySetHelper ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) - , ::cppu::OWeakObject ( ) + , LayoutManager_PBase ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) , m_xSMGR( xServiceManager ) - , m_xURLTransformer( Reference< XURLTransformer >( xServiceManager->createInstance( - SERVICENAME_URLTRANSFORMER), - UNO_QUERY )) + , m_xURLTransformer( xServiceManager->createInstance( SERVICENAME_URLTRANSFORMER ), UNO_QUERY ) + , m_xDisplayAccess( xServiceManager->createInstance( SERVICENAME_DISPLAYACCESS ), UNO_QUERY ) , m_nLockCount( 0 ) , m_bActive( sal_False ) , m_bInplaceMenuSet( sal_False ) @@ -421,6 +384,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM , m_bStoreWindowState( sal_False ) , m_bHideCurrentUI( false ) , m_bGlobalSettings( sal_False ) + , m_bPreserveContentSize( false ) , m_eDockOperation( DOCKOP_ON_COLROW ) , m_pInplaceMenuBar( NULL ) , m_xModuleManager( Reference< XModuleManager >( @@ -462,6 +426,15 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM m_aAsyncLayoutTimer.SetTimeout( 50 ); m_aAsyncLayoutTimer.SetTimeoutHdl( LINK( this, LayoutManager, AsyncLayoutHdl ) ); + + + registerProperty( LAYOUTMANAGER_PROPNAME_AUTOMATICTOOLBARS, LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS, css::beans::PropertyAttribute::TRANSIENT, &m_bAutomaticToolbars, ::getCppuType( &m_bAutomaticToolbars ) ); + registerProperty( LAYOUTMANAGER_PROPNAME_HIDECURRENTUI, LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI, css::beans::PropertyAttribute::TRANSIENT, &m_bHideCurrentUI, ::getCppuType( &m_bHideCurrentUI ) ); + registerProperty( LAYOUTMANAGER_PROPNAME_LOCKCOUNT, LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT, css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY, &m_nLockCount, getCppuType( &m_nLockCount ) ); + registerProperty( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, css::beans::PropertyAttribute::TRANSIENT, &m_bMenuBarCloser, ::getCppuType( &m_bMenuBarCloser ) ); + const sal_Bool bRefreshVisibility = sal_False; + registerPropertyNoMember( LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY, LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, css::beans::PropertyAttribute::TRANSIENT, ::getCppuType( &bRefreshVisibility ), &bRefreshVisibility ); + registerProperty( LAYOUTMANAGER_PROPNAME_PRESERVE_CONTENT_SIZE, LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE, css::beans::PropertyAttribute::TRANSIENT, &m_bPreserveContentSize, ::getCppuType( &m_bPreserveContentSize ) ); } LayoutManager::~LayoutManager() @@ -3240,7 +3213,7 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible ) if ( bSetVisible ) { implts_createNonContextSensitiveToolBars(); - doLayout(); + implts_doLayout_notify( sal_False ); } else { @@ -3516,7 +3489,7 @@ sal_Bool LayoutManager::implts_showProgressBar() if ( !pWindow->IsVisible() ) { pWindow->Show(); - doLayout(); + implts_doLayout_notify( sal_False ); } return sal_True; } @@ -3557,7 +3530,7 @@ sal_Bool LayoutManager::implts_hideProgressBar() ( bHideStatusBar || bInternalStatusBar )) { pWindow->Hide(); - doLayout(); + implts_doLayout_notify( sal_False ); return sal_True; } @@ -3829,6 +3802,7 @@ throw ( RuntimeException ) { m_aDockingArea = css::awt::Rectangle(); m_xContainerWindow = m_xDockingAreaAcceptor->getContainerWindow(); + m_xContainerTopWindow.set( m_xContainerWindow, UNO_QUERY ); m_xContainerWindow->addWindowListener( Reference< css::awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); // we always must keep a connection to the window of our frame for resize events @@ -3913,7 +3887,7 @@ throw ( RuntimeException ) implts_createNonContextSensitiveToolBars(); } implts_sortUIElements(); - implts_doLayout( sal_True ); + implts_doLayout( sal_True, sal_False ); } } @@ -5477,26 +5451,33 @@ throw (RuntimeException) implts_notifyListeners( css::frame::LayoutManagerEvents::UNLOCK, a ); if ( bDoLayout ) - doLayout(); + implts_doLayout_notify( sal_True ); } void SAL_CALL LayoutManager::doLayout() throw (RuntimeException) { - sal_Bool bLayouted = implts_doLayout( sal_False ); + implts_doLayout_notify( sal_True ); +} +void LayoutManager::implts_doLayout_notify( sal_Bool bOuterResize ) +{ + sal_Bool bLayouted = implts_doLayout( sal_False, bOuterResize ); if ( bLayouted ) implts_notifyListeners( css::frame::LayoutManagerEvents::LAYOUT, Any() ); } -sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace ) +sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_Bool bOuterResize ) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::implts_doLayout" ); sal_Bool bNoLock( sal_False ); css::awt::Rectangle aCurrBorderSpace; Reference< css::awt::XWindow > xContainerWindow; + Reference< css::awt::XTopWindow2 > xContainerTopWindow; + Reference< css::awt::XWindow > xComponentWindow; Reference< XDockingAreaAcceptor > xDockingAreaAcceptor; + bool bPreserveContentSize( false ); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); @@ -5507,8 +5488,11 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace ) bNoLock = ( m_nLockCount == 0 ); xContainerWindow = m_xContainerWindow; + xContainerTopWindow = m_xContainerTopWindow; + xComponentWindow = m_xFrame->getComponentWindow(); xDockingAreaAcceptor = m_xDockingAreaAcceptor; aCurrBorderSpace = m_aDockingArea; + bPreserveContentSize = m_bPreserveContentSize; aReadLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ @@ -5516,7 +5500,8 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace ) if ( bNoLock && xDockingAreaAcceptor.is() && - xContainerWindow.is() ) + xContainerWindow.is() && + xComponentWindow.is() ) { bLayouted = sal_True; @@ -5532,11 +5517,44 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace ) if ( !bEqual || bForceRequestBorderSpace || bMustDoLayout ) { - bGotRequestedBorderSpace = xDockingAreaAcceptor->requestDockingAreaSpace( aBorderSpace ); + // we always resize the content window (instead of the complete container window) if we're not set up + // to (attempt to) preserve the content window's size + if ( bOuterResize && !bPreserveContentSize ) + bOuterResize = sal_False; + + // maximized windows can resized their content window only, not their container window + if ( bOuterResize && xContainerTopWindow.is() && xContainerTopWindow->getIsMaximized() ) + bOuterResize = sal_False; + + // if the component window does not have a size (yet), then we can't use it to calc the container + // window size + css::awt::Rectangle aComponentRect = xComponentWindow->getPosSize(); + if ( bOuterResize && ( aComponentRect.Width == 0 ) && ( aComponentRect.Height == 0 ) ) + bOuterResize = sal_False; + + bGotRequestedBorderSpace = sal_False; + if ( bOuterResize ) + { + Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY ); + awt::DeviceInfo aContainerInfo = xDevice->getInfo(); + + awt::Size aRequestedSize( aComponentRect.Width + aContainerInfo.LeftInset + aContainerInfo.RightInset + aBorderSpace.X + aBorderSpace.Width, + aComponentRect.Height + aContainerInfo.TopInset + aContainerInfo.BottomInset + aBorderSpace.Y + aBorderSpace.Height ); + awt::Point aComponentPos( aBorderSpace.X, aBorderSpace.Y ); + + bGotRequestedBorderSpace = implts_resizeContainerWindow( aRequestedSize, aComponentPos ); + } + + // if we did not do an container window resize, or it failed, then use the DockingAcceptor as usual + if ( !bGotRequestedBorderSpace ) + { + bGotRequestedBorderSpace = xDockingAreaAcceptor->requestDockingAreaSpace( aBorderSpace ); + if ( bGotRequestedBorderSpace ) + xDockingAreaAcceptor->setDockingAreaSpace( aBorderSpace ); + } + if ( bGotRequestedBorderSpace ) { - xDockingAreaAcceptor->setDockingAreaSpace( aBorderSpace ); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ aWriteGuard.lock(); m_aDockingArea = aBorderSpace; @@ -5603,6 +5621,52 @@ sal_Bool LayoutManager::implts_compareRectangles( const css::awt::Rectangle& rRe ( rRect1.Height == rRect2.Height )); } +sal_Bool LayoutManager::implts_resizeContainerWindow( const awt::Size& rContainerSize, + const awt::Point& rComponentPos ) +{ + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + ReadGuard aReadLock( m_aLock ); + Reference< awt::XWindow > xContainerWindow = m_xContainerWindow; + Reference< awt::XTopWindow2 > xContainerTopWindow = m_xContainerTopWindow; + Reference< awt::XWindow > xComponentWindow = m_xFrame->getComponentWindow(); + Reference< container::XIndexAccess > xDisplayAccess = m_xDisplayAccess; + aReadLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + + // calculate the maximum size we have for the container window + awt::Rectangle aWorkArea; + try + { + sal_Int32 nDisplay = xContainerTopWindow->getDisplay(); + Reference< beans::XPropertySet > xDisplayInfo( xDisplayAccess->getByIndex( nDisplay ), UNO_QUERY_THROW ); + OSL_VERIFY( xDisplayInfo->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WorkArea" ) ) ) >>= aWorkArea ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( ( aWorkArea.Width > 0 ) && ( aWorkArea.Height > 0 ) ) + { + if ( ( rContainerSize.Width > aWorkArea.Width ) + || ( rContainerSize.Height > aWorkArea.Height ) + ) + return sal_False; + // Strictly, this is not correct. If we have a multi-screen display (css.awt.DisplayAccess.MultiDisplay == true), + // the the "effective work area" would be much larger than the work area of a single display, since we could in theory + // position the container window across multiple screens. + // However, this should suffice as a heuristics here ... (nobody really wants to check whethere the different screens are + // stacked horizontally or vertically, whether their work areas can really be combined, or are separated by non-work-areas, + // and the like ... right?) + } + + // resize our container window + xContainerWindow->setPosSize( 0, 0, rContainerSize.Width, rContainerSize.Height, css::awt::PosSize::SIZE ); + // position the component window + xComponentWindow->setPosSize( rComponentPos.X, rComponentPos.Y, 0, 0, css::awt::PosSize::POS ); + return sal_True; +} + void SAL_CALL LayoutManager::setVisible( sal_Bool bVisible ) throw (::com::sun::star::uno::RuntimeException) { @@ -7028,7 +7092,7 @@ IMPL_LINK( LayoutManager, AsyncLayoutHdl, Timer *, EMPTYARG ) aReadLock.unlock(); implts_setDockingAreaWindowSizes( aDockingArea ); - implts_doLayout( sal_True ); + implts_doLayout( sal_True, sal_False ); return 0; } @@ -7079,7 +7143,8 @@ throw ( RuntimeException ) /* SAFE AREA ----------------------------------------------------------------------------------------------- */ implts_reset( sal_True ); - implts_doLayout( sal_True ); + implts_doLayout( sal_True, sal_False ); + implts_doLayout( sal_True, sal_True ); } else if (( aEvent.Action == FrameAction_FRAME_UI_ACTIVATED ) || ( aEvent.Action == FrameAction_FRAME_UI_DEACTIVATING )) @@ -7106,7 +7171,6 @@ throw ( RuntimeException ) // SAFE AREA ----------------------------------------------------------------------------------------------- implts_reset( sal_False ); - } } @@ -7148,6 +7212,7 @@ throw( RuntimeException ) } m_xInplaceMenuBar.clear(); m_xContainerWindow.clear(); + m_xContainerTopWindow.clear(); implts_destroyDockingAreaWindows(); if ( m_xModuleCfgMgr.is() ) @@ -7198,6 +7263,7 @@ throw( RuntimeException ) } m_xInplaceMenuBar.clear(); m_xContainerWindow.clear(); + m_xContainerTopWindow.clear(); } else if ( rEvent.Source == Reference< XInterface >( m_xDocCfgMgr, UNO_QUERY )) { @@ -7412,65 +7478,21 @@ sal_Bool SAL_CALL LayoutManager::convertFastPropertyValue( Any& aConverted sal_Int32 nHandle , const Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ) { - // Initialize state with FALSE !!! - // (Handle can be invalid) - sal_Bool bReturn = sal_False; - - switch( nHandle ) - { - case LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER : - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_bMenuBarCloser), - aValue, - aOldValue, - aConvertedValue); - break; - case LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_bAutomaticToolbars), - aValue, - aOldValue, - aConvertedValue); - break; - case LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(sal_False), - aValue, - aOldValue, - aConvertedValue); - break; - case LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_bHideCurrentUI), - aValue, - aOldValue, - aConvertedValue); - break; - } - - // Return state of operation. - return bReturn ; + return LayoutManager_PBase::convertFastPropertyValue( aConvertedValue, aOldValue, nHandle, aValue ); } void SAL_CALL LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ) { + if ( nHandle != LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY ) + LayoutManager_PBase::setFastPropertyValue_NoBroadcast( nHandle, aValue ); + switch( nHandle ) { case LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER: - { - sal_Bool bCloserState = sal_False; - aValue >>= bCloserState; - implts_setMenuBarCloser( bCloserState ); + implts_updateMenuBarClose(); break; - } - case LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS: - { - sal_Bool bValue = sal_Bool(); - if ( aValue >>= bValue ) - m_bAutomaticToolbars = bValue; - break; - } + case LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY: { sal_Bool bValue = sal_Bool(); @@ -7478,40 +7500,17 @@ void SAL_CALL LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32 implts_refreshContextToolbarsVisibility(); break; } + case LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI: - { - sal_Bool bValue = sal_Bool(); - if ( aValue >>= bValue ) - { - m_bHideCurrentUI = bValue; - implts_setCurrentUIVisibility( !bValue ); - } + implts_setCurrentUIVisibility( !m_bHideCurrentUI ); break; - } } } void SAL_CALL LayoutManager::getFastPropertyValue( com::sun::star::uno::Any& aValue , sal_Int32 nHandle ) const { - switch( nHandle ) - { - case LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER: - aValue <<= m_bMenuBarCloser; - break; - case LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS: - aValue <<= m_bAutomaticToolbars; - break; - case LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY: - aValue <<= sal_False; - break; - case LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI: - aValue <<= m_bHideCurrentUI; - break; - case LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT: - aValue <<= m_nLockCount; - break; - } + LayoutManager_PBase::getFastPropertyValue( aValue, nHandle ); } ::cppu::IPropertyArrayHelper& SAL_CALL LayoutManager::getInfoHelper() @@ -7530,9 +7529,9 @@ void SAL_CALL LayoutManager::getFastPropertyValue( com::sun::star::uno::Any& aVa if( pInfoHelper == NULL ) { // Define static member to give structure of properties to baseclass "OPropertySetHelper". - // "impl_getStaticPropertyDescriptor" is a non exported and static funtion, who will define a static propertytable. - // "sal_True" say: Table is sorted by name. - static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), sal_True ); + uno::Sequence< beans::Property > aProperties; + describeProperties( aProperties ); + static ::cppu::OPropertyArrayHelper aInfoHelper( aProperties, sal_True ); pInfoHelper = &aInfoHelper; } } @@ -7564,28 +7563,5 @@ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CA return (*pInfo); } -const com::sun::star::uno::Sequence< com::sun::star::beans::Property > LayoutManager::impl_getStaticPropertyDescriptor() -{ - // Create a new static property array to initialize sequence! - // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! - // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! - // It's necessary for methods of OPropertySetHelper. - // ATTENTION: - // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - - static const com::sun::star::beans::Property pProperties[] = - { - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_AUTOMATICTOOLBARS, LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_HIDECURRENTUI, LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_LOCKCOUNT, LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT, ::getCppuType((const sal_Int32*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT|com::sun::star::beans::PropertyAttribute::READONLY ), - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY, LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ) - }; - // Use it to initialize sequence! - static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, LAYOUTMANAGER_PROPCOUNT ); - // Return static "PropertyDescriptor" - return lPropertyDescriptor; -} - } // namespace framework diff --git a/framework/source/layoutmanager/makefile.mk b/framework/source/layoutmanager/makefile.mk index b9b6bcf248ff..3af616971ad7 100644 --- a/framework/source/layoutmanager/makefile.mk +++ b/framework/source/layoutmanager/makefile.mk @@ -39,6 +39,8 @@ ENABLE_EXCEPTIONS= TRUE .INCLUDE : settings.mk +VISIBILITY_HIDDEN = TRUE + # --- Generate ----------------------------------------------------- SLOFILES= \ diff --git a/framework/source/register/makefile.mk b/framework/source/register/makefile.mk index 1e15c55bd23a..7d7f00e94512 100644 --- a/framework/source/register/makefile.mk +++ b/framework/source/register/makefile.mk @@ -40,6 +40,8 @@ LIBTARGET= NO .INCLUDE : settings.mk +VISIBILITY_HIDDEN = TRUE + # --- Generate ----------------------------------------------------- SLOFILES= \ diff --git a/framework/source/xml/menuconfiguration.cxx b/framework/source/xml/menuconfiguration.cxx index 7b0520219ef6..dcaf354891f6 100644 --- a/framework/source/xml/menuconfiguration.cxx +++ b/framework/source/xml/menuconfiguration.cxx @@ -44,10 +44,6 @@ #include #include -#ifndef _FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ -#include -#endif - #ifndef _FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_ #include #endif diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 54ccd29a7dd7..2951ac3ef4a3 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -81,6 +81,7 @@ #include #include +#include #include #include #include @@ -706,6 +707,29 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ; pActFrame->Enable( TRUE ); pActFrame->GetDispatcher()->Lock( FALSE ); + + if ( ( m_pData->m_pViewShell->GetObjectShell() != NULL ) + && ( m_pData->m_pViewShell->GetObjectShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) + ) + { + SfxViewFrame* pViewFrm = m_pData->m_pViewShell->GetViewFrame(); + if ( !pViewFrm->GetFrame()->IsInPlace() ) + { + // for outplace embedded objects, we want the layout manager to keep the content window + // size constant, if possible + try + { + uno::Reference< beans::XPropertySet > xFrameProps( m_pData->m_xFrame, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xLayouterProps( + xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ), uno::UNO_QUERY_THROW ); + xLayouterProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreserveContentSize" ) ), uno::makeAny( sal_True ) ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } } } } diff --git a/svx/inc/fmhelp.hrc b/svx/inc/fmhelp.hrc index c7f172cbe5db..b5089d663c72 100644 --- a/svx/inc/fmhelp.hrc +++ b/svx/inc/fmhelp.hrc @@ -33,106 +33,75 @@ // include ----------------------------------------------------------- #include -// in solar.hrc -//#define HID_FORMS_START (HID_LIB_START+4000) -//#define HID_FORMS_END (HID_LIB_START+4999) - // Help-Ids -------------------------------------------------------------- -// insgesamt 200 -#define HID_DLG_DBINFO (HID_FORMS_START + 0) -#define HID_DLG_DBMSG (HID_FORMS_START + 1) - -#define HID_FM_OTHER_START (HID_FORMS_START + 300) -#define HID_FORM_NAVIGATOR (HID_FM_OTHER_START + 0) -#define HID_FORM_NAVIGATOR_WIN (HID_FM_OTHER_START + 1) -#define HID_FIELD_SEL (HID_FM_OTHER_START + 2) -#define HID_FIELD_SEL_WIN (HID_FM_OTHER_START + 3) -#define HID_FILTER_NAVIGATOR (HID_FM_OTHER_START + 4) -#define HID_FILTER_NAVIGATOR_WIN (HID_FM_OTHER_START + 5) - -#define HID_FORM_DLG_START (HID_FORMS_START + 400) -// FREE -// FREE -// FREE -#define HID_FM_PROPDLG_WINDOW (HID_FORM_DLG_START + 3) -#define HID_FM_PROPDLG_CONTAINER (HID_FORM_DLG_START + 4) -#define HID_FM_PROPDLG_TABCTR (HID_FORM_DLG_START + 5) -#define HID_FM_PROPDLG_TAB_GENERAL (HID_FORM_DLG_START + 6) -#define HID_FM_PROPDLG_TAB_DATA (HID_FORM_DLG_START + 7) -#define HID_FM_PROPDLG_TAB_EVT (HID_FORM_DLG_START + 8) -#define HID_FM_DLG_SEARCH (HID_FORM_DLG_START + 9) - -#define HID_SEARCH_TEXT (HID_FORM_DLG_START + 10) -#define HID_SEARCH_ALLFIELDS (HID_FORM_DLG_START + 11) -#define HID_SEARCH_SINGLEFIELD (HID_FORM_DLG_START + 12) -#define HID_SEARCH_FIELDSELECTION (HID_FORM_DLG_START + 13) -#define HID_SEARCH_POSITION (HID_FORM_DLG_START + 14) -#define HID_SEARCH_FORMATTER (HID_FORM_DLG_START + 15) -#define HID_SEARCH_CASE (HID_FORM_DLG_START + 16) -#define HID_SEARCH_BACKWARD (HID_FORM_DLG_START + 17) -#define HID_SEARCH_STARTOVER (HID_FORM_DLG_START + 18) -#define HID_SEARCH_WILDCARD (HID_FORM_DLG_START + 19) -#define HID_SEARCH_REGULAR (HID_FORM_DLG_START + 20) -#define HID_SEARCH_APPROX (HID_FORM_DLG_START + 21) -#define HID_SEARCH_APPROXSETTINGS (HID_FORM_DLG_START + 22) -#define HID_SEARCH_BTN_SEARCH (HID_FORM_DLG_START + 23) -#define HID_SEARCH_BTN_CLOSE (HID_FORM_DLG_START + 24) - -#define HID_TABORDER_CONTROLS (HID_FORM_DLG_START + 25) - -#define HID_CONTROLS_DATE_N_TIME (HID_FORM_DLG_START + 26) -#define HID_FM_DLG_PARAM (HID_FORM_DLG_START + 27) - -#define HID_GRID_TRAVEL_FIRST (HID_FORM_DLG_START + 28) -#define HID_GRID_TRAVEL_PREV (HID_FORM_DLG_START + 29) -#define HID_GRID_TRAVEL_NEXT (HID_FORM_DLG_START + 30) -#define HID_GRID_TRAVEL_LAST (HID_FORM_DLG_START + 31) -#define HID_GRID_TRAVEL_NEW (HID_FORM_DLG_START + 32) -#define HID_GRID_TRAVEL_ABSOLUTE (HID_FORM_DLG_START + 33) -#define HID_GRID_NUMBEROFRECORDS (HID_FORM_DLG_START + 34) - -#define UID_SEARCH_RECORDSTATUS (HID_FORM_DLG_START + 35) - -#define UID_FORMPROPBROWSER_FRAME (HID_FORM_DLG_START + 37) -#define UID_ABSOLUTE_RECORD_WINDOW (HID_FORM_DLG_START + 38) - -#define HID_DATA_NAVIGATOR_WIN (HID_FM_OTHER_START + 39) -#define HID_XFORMS_ADDDATAITEM_DLG (HID_FM_OTHER_START + 40) -#define HID_XFORMS_ADDCONDITION_DLG (HID_FM_OTHER_START + 41) -#define HID_XFORMS_NAMESPACEITEM_DLG (HID_FM_OTHER_START + 42) -#define HID_XFORMS_NAMESPACEITEM_LIST (HID_FM_OTHER_START + 43) -#define HID_XFORMS_MANAGENAMESPACE_DLG (HID_FM_OTHER_START + 44) - -#define HID_TP_XFORMS_INSTANCE (HID_FM_OTHER_START + 45) -#define HID_TP_XFORMS_SUBMISSION (HID_FM_OTHER_START + 46) -#define HID_TP_XFORMS_BINDING (HID_FM_OTHER_START + 47) - -#define HID_MN_XFORMS_MODELS_ADD (HID_FM_OTHER_START + 48) -#define HID_MN_XFORMS_MODELS_EDIT (HID_FM_OTHER_START + 49) -#define HID_MN_XFORMS_MODELS_REMOVE (HID_FM_OTHER_START + 50) -#define HID_MN_XFORMS_INSTANCES_ADD (HID_FM_OTHER_START + 51) -#define HID_MN_XFORMS_INSTANCES_EDIT (HID_FM_OTHER_START + 52) -#define HID_MN_XFORMS_INSTANCES_REMOVE (HID_FM_OTHER_START + 53) -#define HID_MN_XFORMS_SHOW_DETAILS (HID_FM_OTHER_START + 54) -#define HID_XFORMS_TOOLBOX (HID_FM_OTHER_START + 55) -#define HID_XFORMS_TOOLBOX_ITEM_ADD (HID_FM_OTHER_START + 56) -#define HID_XFORMS_TOOLBOX_ITEM_ADD_ELEMENT (HID_FM_OTHER_START + 57) -#define HID_XFORMS_TOOLBOX_ITEM_ADD_ATTRIBUTE (HID_FM_OTHER_START + 58) -#define HID_XFORMS_TOOLBOX_ITEM_EDIT (HID_FM_OTHER_START + 59) -#define HID_XFORMS_TOOLBOX_ITEM_REMOVE (HID_FM_OTHER_START + 60) -#define HID_XFORMS_ITEMS_LIST (HID_FM_OTHER_START + 61) -#define HID_XFORMS_MODELS_LIST (HID_FM_OTHER_START + 62) -#define HID_XFORMS_MODELS_MENUBTN (HID_FM_OTHER_START + 63) -#define HID_XFORMS_INSTANCES_MENUBTN (HID_FM_OTHER_START + 64) -#define HID_XFORMS_ADDSUBMISSION_DLG (HID_FM_OTHER_START + 65) -#define HID_XFORMS_ADDMODEL_DLG (HID_FM_OTHER_START + 66) -#define HID_XFORMS_ADDINSTANCE_DLG (HID_FM_OTHER_START + 67) -#define HID_XFORMS_MID_INSERT_CONTROL (HID_FM_OTHER_START + 68) -#define HID_XFORMS_TAB_CONTROL (HID_FM_OTHER_START + 69) - -// if you add a new define here, please adjust the overflow check -// at the end of the file!! +#define HID_DLG_DBMSG ( HID_FORMS_START + 1) +#define HID_FORM_NAVIGATOR ( HID_FORMS_START + 2) +#define HID_FORM_NAVIGATOR_WIN ( HID_FORMS_START + 3) +#define HID_FIELD_SEL ( HID_FORMS_START + 4) +#define HID_FIELD_SEL_WIN ( HID_FORMS_START + 5) +#define HID_FILTER_NAVIGATOR ( HID_FORMS_START + 6) +#define HID_FILTER_NAVIGATOR_WIN ( HID_FORMS_START + 7) +#define HID_FM_DLG_SEARCH ( HID_FORMS_START + 8) +#define HID_SEARCH_TEXT ( HID_FORMS_START + 9) +#define HID_SEARCH_ALLFIELDS ( HID_FORMS_START + 10) +#define HID_SEARCH_SINGLEFIELD ( HID_FORMS_START + 11) +#define HID_SEARCH_FIELDSELECTION ( HID_FORMS_START + 12) +#define HID_SEARCH_POSITION ( HID_FORMS_START + 13) +#define HID_SEARCH_FORMATTER ( HID_FORMS_START + 14) +#define HID_SEARCH_CASE ( HID_FORMS_START + 15) +#define HID_SEARCH_BACKWARD ( HID_FORMS_START + 16) +#define HID_SEARCH_STARTOVER ( HID_FORMS_START + 17) +#define HID_SEARCH_WILDCARD ( HID_FORMS_START + 18) +#define HID_SEARCH_REGULAR ( HID_FORMS_START + 19) +#define HID_SEARCH_APPROX ( HID_FORMS_START + 20) +#define HID_SEARCH_APPROXSETTINGS ( HID_FORMS_START + 21) +#define HID_SEARCH_BTN_SEARCH ( HID_FORMS_START + 22) +#define HID_SEARCH_BTN_CLOSE ( HID_FORMS_START + 23) +#define HID_CONTROLS_DATE_N_TIME ( HID_FORMS_START + 24) +#define HID_GRID_TRAVEL_FIRST ( HID_FORMS_START + 25) +#define HID_GRID_TRAVEL_PREV ( HID_FORMS_START + 26) +#define HID_GRID_TRAVEL_NEXT ( HID_FORMS_START + 27) +#define HID_GRID_TRAVEL_LAST ( HID_FORMS_START + 28) +#define HID_GRID_TRAVEL_NEW ( HID_FORMS_START + 29) +#define HID_GRID_TRAVEL_ABSOLUTE ( HID_FORMS_START + 30) +#define HID_GRID_NUMBEROFRECORDS ( HID_FORMS_START + 31) +#define UID_SEARCH_RECORDSTATUS ( HID_FORMS_START + 32) +#define UID_FORMPROPBROWSER_FRAME ( HID_FORMS_START + 33) +#define UID_ABSOLUTE_RECORD_WINDOW ( HID_FORMS_START + 34) +#define HID_DATA_NAVIGATOR_WIN ( HID_FORMS_START + 35) +#define HID_XFORMS_ADDDATAITEM_DLG ( HID_FORMS_START + 36) +#define HID_XFORMS_ADDCONDITION_DLG ( HID_FORMS_START + 37) +#define HID_XFORMS_NAMESPACEITEM_DLG ( HID_FORMS_START + 38) +#define HID_XFORMS_NAMESPACEITEM_LIST ( HID_FORMS_START + 39) +#define HID_XFORMS_MANAGENAMESPACE_DLG ( HID_FORMS_START + 40) +#define HID_TP_XFORMS_INSTANCE ( HID_FORMS_START + 41) +#define HID_TP_XFORMS_SUBMISSION ( HID_FORMS_START + 42) +#define HID_TP_XFORMS_BINDING ( HID_FORMS_START + 43) +#define HID_MN_XFORMS_MODELS_ADD ( HID_FORMS_START + 44) +#define HID_MN_XFORMS_MODELS_EDIT ( HID_FORMS_START + 45) +#define HID_MN_XFORMS_MODELS_REMOVE ( HID_FORMS_START + 46) +#define HID_MN_XFORMS_INSTANCES_ADD ( HID_FORMS_START + 47) +#define HID_MN_XFORMS_INSTANCES_EDIT ( HID_FORMS_START + 48) +#define HID_MN_XFORMS_INSTANCES_REMOVE ( HID_FORMS_START + 49) +#define HID_MN_XFORMS_SHOW_DETAILS ( HID_FORMS_START + 50) +#define HID_XFORMS_TOOLBOX ( HID_FORMS_START + 51) +#define HID_XFORMS_TOOLBOX_ITEM_ADD ( HID_FORMS_START + 52) +#define HID_XFORMS_TOOLBOX_ITEM_ADD_ELEMENT ( HID_FORMS_START + 53) +#define HID_XFORMS_TOOLBOX_ITEM_ADD_ATTRIBUTE ( HID_FORMS_START + 54) +#define HID_XFORMS_TOOLBOX_ITEM_EDIT ( HID_FORMS_START + 55) +#define HID_XFORMS_TOOLBOX_ITEM_REMOVE ( HID_FORMS_START + 56) +#define HID_XFORMS_ITEMS_LIST ( HID_FORMS_START + 57) +#define HID_XFORMS_MODELS_LIST ( HID_FORMS_START + 58) +#define HID_XFORMS_MODELS_MENUBTN ( HID_FORMS_START + 59) +#define HID_XFORMS_INSTANCES_MENUBTN ( HID_FORMS_START + 60) +#define HID_XFORMS_ADDSUBMISSION_DLG ( HID_FORMS_START + 61) +#define HID_XFORMS_ADDMODEL_DLG ( HID_FORMS_START + 62) +#define HID_XFORMS_ADDINSTANCE_DLG ( HID_FORMS_START + 63) +#define HID_XFORMS_MID_INSERT_CONTROL ( HID_FORMS_START + 64) +#define HID_XFORMS_TAB_CONTROL ( HID_FORMS_START + 65) + // if you add a new define here, please adjust the overflow check + // at the end of the file!! // ----------------------------------------------------------------------- diff --git a/svx/util/hidother.src b/svx/util/hidother.src index 6ef00e2640a2..9f1a665b4061 100644 --- a/svx/util/hidother.src +++ b/svx/util/hidother.src @@ -71,11 +71,6 @@ hidspecial HID_FIELD_SEL_WIN { HelpID =HID_FIELD_SEL_WIN hidspecial HID_FILTER_NAVIGATOR { HelpID =HID_FILTER_NAVIGATOR ;}; hidspecial HID_FILTER_NAVIGATOR_WIN { HelpID =HID_FILTER_NAVIGATOR_WIN ;}; -hidspecial HID_FM_PROPDLG_TABCTR { HelpID =HID_FM_PROPDLG_TABCTR ;}; -hidspecial HID_FM_PROPDLG_TAB_GENERAL { HelpID =HID_FM_PROPDLG_TAB_GENERAL;}; -hidspecial HID_FM_PROPDLG_TAB_DATA { HelpID =HID_FM_PROPDLG_TAB_DATA ;}; -hidspecial HID_FM_PROPDLG_TAB_EVT { HelpID =HID_FM_PROPDLG_TAB_EVT ;}; - hidspecial HID_VALUESET_SINGLENUM { HelpID = HID_VALUESET_SINGLENUM ;}; hidspecial HID_VALUESET_BULLET { HelpID = HID_VALUESET_BULLET ;}; hidspecial HID_VALUESET_NUM { HelpID = HID_VALUESET_NUM ;}; @@ -88,8 +83,6 @@ hidspecial HID_TPPAGE_FULLSIZE { HelpId = HID_TPPAGE_FULLSIZE hidspecial HID_OPTINET2_CTL_COOKIES { HelpId = HID_OPTINET2_CTL_COOKIES ;}; hidspecial HID_OPTPATH_CTL_PATH { HelpId = HID_OPTPATH_CTL_PATH ;}; -hidspecial HID_TABORDER_CONTROLS { HelpId = HID_TABORDER_CONTROLS ;}; - hidspecial HID_POPUP_LINEEND { HelpId = HID_POPUP_LINEEND ;}; hidspecial HID_POPUP_LINEEND_CTRL { HelpId = HID_POPUP_LINEEND_CTRL ;}; diff --git a/xmloff/source/forms/gridcolumnproptranslator.cxx b/xmloff/source/forms/gridcolumnproptranslator.cxx index 766c2dd2483f..7e2476e6f054 100644 --- a/xmloff/source/forms/gridcolumnproptranslator.cxx +++ b/xmloff/source/forms/gridcolumnproptranslator.cxx @@ -235,9 +235,15 @@ namespace xmloff } //-------------------------------------------------------------------- - void SAL_CALL OGridColumnPropertyTranslator::setPropertyValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) + void SAL_CALL OGridColumnPropertyTranslator::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { - Sequence< ::rtl::OUString > aNames( &aPropertyName, 1 ); + // we implement this by delegating it to setPropertyValues, which is to ignore unknown properties. On the other hand, our + // contract requires us to throw a UnknownPropertyException for unknown properties, so check this first. + + if ( !getPropertySetInfo()->hasPropertyByName( _rPropertyName ) ) + throw UnknownPropertyException( _rPropertyName, *this ); + + Sequence< ::rtl::OUString > aNames( &_rPropertyName, 1 ); Sequence< Any > aValues( &aValue, 1 ); setPropertyValues( aNames, aValues ); } diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index c41d54bb00ed..2d3d1620afe1 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -30,34 +30,29 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#include -#include + +#include "XMLTextPropertySetContext.hxx" +#include "xmlnmspe.hxx" +#include "xmloff/XMLEventsImportContext.hxx" +#include "xmloff/attrlist.hxx" +#include "xmloff/families.hxx" +#include "xmloff/txtprmap.hxx" +#include "xmloff/txtstyli.hxx" +#include "xmloff/xmlimp.hxx" +#include "xmloff/xmltkmap.hxx" +#include "xmloff/xmltoken.hxx" +#include "xmloff/xmluconv.hxx" + +#include #include +#include +#include #include #include -#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP -#include -#endif -#include -#include "xmlnmspe.hxx" -#include -#ifndef _XMLOFF_FAMILIES_HXX -#include -#endif -#include "XMLTextPropertySetContext.hxx" -#include -#include -#include +#include -#ifndef _XMLOFF_TXTPRMAP_HXX -#include -#endif -#ifndef _XMLOFF_TXTSTYLI_HXX -#include -#endif -#include -#include #include +#include // STL includes #include @@ -464,6 +459,9 @@ void XMLTextStyleContext::FillPropertySet( { -1, -1 } }; + // get property set info + Reference< XPropertySetInfo > xInfo( rPropSet->getPropertySetInfo(), UNO_SET_THROW ); + bool bAutomatic = false; if( ((SvXMLStylesContext *)GetStyles())->IsAutomaticStyle() && ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) ) @@ -476,11 +474,15 @@ void XMLTextStyleContext::FillPropertySet( OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAutoStyleName") ); try { - rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) ); + if ( xInfo->hasPropertyByName( sAutoProp ) ) + rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) ); + else + bAutomatic = false; } catch( const RuntimeException& ) { throw; } catch( const Exception& ) { + DBG_UNHANDLED_EXCEPTION(); bAutomatic = false; } } @@ -499,9 +501,6 @@ void XMLTextStyleContext::FillPropertySet( bHasCombinedCharactersLetter = bVal; } - // get property set info - Reference< XPropertySetInfo > xInfo; - // keep-together: the application default is different from // the file format default. Hence, if we always set this // value; if we didn't find one, we'll set to false, the file @@ -534,9 +533,6 @@ void XMLTextStyleContext::FillPropertySet( // check for StarBats and StarMath fonts - if (!xInfo.is()) - xInfo.set(rPropSet->getPropertySetInfo()); - // iterate over aContextIDs entries 3..6 for ( sal_Int32 i = 3; i < 7; i++ ) { @@ -572,8 +568,6 @@ void XMLTextStyleContext::FillPropertySet( // set property OUString rPropertyName( rPropMapper->GetEntryAPIName(nMapperIndex) ); - if( !xInfo.is() ) - xInfo = rPropSet->getPropertySetInfo(); if ( xInfo->hasPropertyByName( rPropertyName ) ) { rPropSet->setPropertyValue( rPropertyName, aAny ); From ef1ec7001a06a6ba0fdbed702bcd7a6fec58eaf9 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Mon, 30 Nov 2009 14:20:54 +0100 Subject: [PATCH 115/117] #i10000# remove duplicated declaration --- sfx2/inc/sfx2/filedlghelper.hxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index 91be281e9617..e6dc185ef919 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -240,9 +240,6 @@ public: /** Provides the selected files with full path information */ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const; - /** Provides the selected files with full path information */ - ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const; - void AddFilter( const String& rFilterName, const String& rExtension ); void SetCurrentFilter( const String& rFilter ); From 17df85c0d6fa91721b9582f4d265789d8dd3aa38 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Tue, 1 Dec 2009 08:03:58 +0000 Subject: [PATCH 116/117] CWS-TOOLING: integrate CWS hb32showstoppers2 2009-11-05 14:28:58 +0100 hbrinkm r277370 : CWS-TOOLING: rebase CWS hb32showstoppers2 to branches/OOO320@277262 (milestone: OOO320:m3) 2009-11-04 16:04:47 +0100 hbrinkm r277357 : #i102434# write background color/shadow like WW8 does 2009-11-03 12:22:27 +0100 os r277319 : #i106515# call to LeaveDrawCreate() moved from SwWrtShell::UnSelectFrame() to SwPostItMgr::AssureStdModeAtShell() 2009-10-30 14:58:39 +0100 hbrinkm r277272 : #i103374# set default style on table row ends 2009-10-30 13:19:38 +0100 hbrinkm r277265 : #i106057# applied here because otherwise saving DOCs crashes 2009-10-28 13:50:44 +0100 hbrinkm r277240 : applied patch for OOO320_m2 #i105052# debugging code #i102420# rewritten debug output for SwNodes. #i105052# debugging code sw/source/filter/ww8/wrtww8.cxx: MSWordExportBase::WriteText: Keep track of nodes already exported and assert when a node is exported for the second time. sw/source/filter/ww8/WW8TableInfo.cxx: WW8TableNodeInfo::setNext: Announce from where to where the next pointer points. #i105052# save pointer to next SwNode in WW8TableNodeInfo merged DEV300_m60 #i105653# applied patch #i105941# crash on initialization fixed merged changes from hb32showstoppers 2009-10-27 16:39:40 +0100 mst r277223 : #i106349#: SwBaseShell::ExecUndo(): do not access members after dying --- svx/source/dialog/hyperdlg.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/svx/source/dialog/hyperdlg.cxx b/svx/source/dialog/hyperdlg.cxx index d17a24a37e22..adc1317cdece 100644 --- a/svx/source/dialog/hyperdlg.cxx +++ b/svx/source/dialog/hyperdlg.cxx @@ -78,9 +78,11 @@ SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( Window* _pParent, USHORT nId, pWindow = mpDlg->GetWindow(); ((MyStruct*)pImp)->bVisible = FALSE; - if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 ) + Window* pTopWindow = 0; + if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 && + (0 != (pTopWindow = SFX_APP()->GetTopWindow()))) { - Size aParentSize( SFX_APP()->GetTopWindow()->GetSizePixel() ); + Size aParentSize( pTopWindow->GetSizePixel() ); Size aDlgSize ( GetSizePixel () ); if( aParentSize.Width() < pInfo->aPos.X() ) From dd7703d3d5da474f2ccdb6b193d875141ea21a7c Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Tue, 1 Dec 2009 09:53:35 +0000 Subject: [PATCH 117/117] 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 | 75 +++++----- connectivity/inc/connectivity/FValue.hxx | 12 ++ connectivity/source/commontools/FValue.cxx | 154 +++++++++++++++++---- desktop/source/app/app.cxx | 7 + 4 files changed, 183 insertions(+), 65 deletions(-) diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 7776b57829c9..b0c8f4b3c36c 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; + OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" ); + if ( !pBasic ) + return NULL; - SbxObject* basicChosen = pBasic; + // 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; - if ( basicChosen == 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 ) - { - basicChosen = pParentParent; - } - else if( pParent ) - { - basicChosen = pParent; - } - - - Any aModel; - SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT ); - - 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 + if ( !pThisComponent ) { OSL_TRACE("Failed to get ThisComponent"); + // the application Basic, at the latest, should have this variable + return NULL; } + + Any aThisComponent( sbxToUnoValue( pThisComponent ) ); + Reference< frame::XModel > xModel( aThisComponent, UNO_QUERY ); + if ( !xModel.is() ) + { + // 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; + +#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 + return xModel; } diff --git a/connectivity/inc/connectivity/FValue.hxx b/connectivity/inc/connectivity/FValue.hxx index 4196e8d843d9..22a169f4025d 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 cd09efa227fe..f7943fc4cf45 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 efc689b54ff8..ede5fdf7511a 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;