diff options
82 files changed, 1800 insertions, 1244 deletions
diff --git a/dbaccess/prj/build.lst b/dbaccess/prj/build.lst index f89f7fef47e9..973e95620b3f 100644 --- a/dbaccess/prj/build.lst +++ b/dbaccess/prj/build.lst @@ -1,4 +1,4 @@ -ba dbaccess : BOOST:boost connectivity svx stoc uui QADEVOOO:qadevOOo NULL +ba dbaccess : BOOST:boost connectivity svx stoc uui QADEVOOO:qadevOOo xmlscript NULL ba dbaccess usr1 - all ba_mkout NULL ba dbaccess\inc nmake - all ba_inc NULL ba dbaccess\source\ui\inc nmake - all ba_uiinc ba_inc NULL diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java index 145ef40515ae..09f7871dbbbb 100644 --- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java +++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java @@ -338,7 +338,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. for ( int i=0; i<unsupportedMethods.length; ++i) { - verifyExpectedException( _document, unsupportedMethods[i].unoInterfaceClass, + assureException( _document, unsupportedMethods[i].unoInterfaceClass, unsupportedMethods[i].methodName, new Object[]{}, _isInitialized ? null : NotInitializedException.class ); } } @@ -428,9 +428,9 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_checkDocumentInitState( databaseDoc, true ); // and while we are here ... initilizing the same document again should not be possible - verifyExpectedException( databaseDoc, XLoadable.class, "initNew", new Object[0], + assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], DoubleInitializationException.class ); - verifyExpectedException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, + assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, DoubleInitializationException.class ); // .................................................................... @@ -443,9 +443,9 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_checkDocumentInitState( databaseDoc, true ); // same as above - initializing the document a second time must fail - verifyExpectedException( databaseDoc, XLoadable.class, "initNew", new Object[0], + assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], DoubleInitializationException.class ); - verifyExpectedException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, + assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, DoubleInitializationException.class ); } diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java index 7fdc2c3d886b..fddf055b011e 100644 --- a/dbaccess/qa/complex/dbaccess/TestCase.java +++ b/dbaccess/qa/complex/dbaccess/TestCase.java @@ -36,8 +36,8 @@ import com.sun.star.uno.XComponentContext; import helper.FileTools; import java.io.File; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URI; import java.net.URISyntaxException; @@ -108,42 +108,10 @@ public abstract class TestCase extends complexlib.ComplexTestCase } // -------------------------------------------------------------------------------------------------------- - protected void verifyExpectedException( Object _object, Class _unoInterfaceClass, String _methodName, Object[] _methodArgs, + protected void assureException( Object _object, Class _unoInterfaceClass, String _methodName, Object[] _methodArgs, Class _expectedExceptionClass ) { - verifyExpectedException( UnoRuntime.queryInterface( _unoInterfaceClass, _object ), _methodName, + assureException( UnoRuntime.queryInterface( _unoInterfaceClass, _object ), _methodName, _methodArgs, _expectedExceptionClass ); } - - // -------------------------------------------------------------------------------------------------------- - protected void verifyExpectedException( Object _object, String _methodName, Object[] _methodArgs, - Class _expectedExceptionClass ) - { - Class objectClass = _object.getClass(); - Class[] methodArgsClasses = new Class[ _methodArgs.length ]; - for ( int i=0; i<_methodArgs.length; ++i ) - methodArgsClasses[i] = _methodArgs[i].getClass(); - - boolean noExceptionAllowed = _expectedExceptionClass == null; - - boolean caughtExpected = noExceptionAllowed ? true : false; - try - { - Method method = objectClass.getMethod( _methodName, methodArgsClasses ); - method.invoke(_object, _methodArgs ); - } - catch ( InvocationTargetException e ) - { - caughtExpected = noExceptionAllowed - ? false - : ( e.getTargetException().getClass().equals( _expectedExceptionClass ) ); - } - catch( Exception e ) - { - caughtExpected = false; - } - assure( "did not catch the expected exception (" + - ( noExceptionAllowed ? "none" : _expectedExceptionClass.getName() ) + - ") while calling " + _object.getClass().getName() + "." + _methodName, caughtExpected ); - } } diff --git a/dbaccess/qa/complex/dbaccess/makefile.mk b/dbaccess/qa/complex/dbaccess/makefile.mk index fa820f3dbeb3..0d86e53337d9 100755 --- a/dbaccess/qa/complex/dbaccess/makefile.mk +++ b/dbaccess/qa/complex/dbaccess/makefile.mk @@ -59,7 +59,7 @@ JARCLASSDIRS = $(PACKAGE) JARTARGET = $(TARGET).jar JARCOMPRESS = TRUE -RUNNER_ARGS = -cp $(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar org.openoffice.Runner -TestBase java_complex +RUNNER_ARGS = -cp "$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar" org.openoffice.Runner -TestBase java_complex # --- Targets ------------------------------------------------------ diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 290c88031349..302bae23c984 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -275,7 +275,6 @@ ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory ,m_bCanUpdateInsertedRows(sal_True) ,m_bOwnConnection(sal_False) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::ORowSet" ); m_nResultSetType = ResultSetType::SCROLL_SENSITIVE; m_nResultSetConcurrency = ResultSetConcurrency::UPDATABLE; m_pMySelf = this; @@ -341,7 +340,6 @@ ORowSet::~ORowSet() // ----------------------------------------------------------------------------- void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getPropertyDefaultByHandle" ); switch( _nHandle ) { case PROPERTY_ID_COMMAND_TYPE: @@ -377,6 +375,18 @@ void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) c case PROPERTY_ID_ESCAPE_PROCESSING: _rDefault <<= sal_True; break; + case PROPERTY_ID_MAXROWS: + _rDefault <<= sal_Int32( 0 ); + break; + case PROPERTY_ID_FILTER: + case PROPERTY_ID_HAVING_CLAUSE: + case PROPERTY_ID_GROUP_BY: + case PROPERTY_ID_ORDER: + case PROPERTY_ID_UPDATE_CATALOGNAME: + case PROPERTY_ID_UPDATE_SCHEMANAME: + case PROPERTY_ID_UPDATE_TABLENAME: + _rDefault <<= ::rtl::OUString(); + break; } } // ------------------------------------------------------------------------- @@ -384,7 +394,6 @@ void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) c void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setFastPropertyValue_NoBroadcast" ); switch(nHandle) { case PROPERTY_ID_ISMODIFIED: @@ -474,7 +483,6 @@ void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const // ------------------------------------------------------------------------- void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getFastPropertyValue" ); if(m_pCache) { switch(nHandle) @@ -517,7 +525,6 @@ void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const // com::sun::star::XTypeProvider Sequence< Type > SAL_CALL ORowSet::getTypes() throw (RuntimeException) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getTypes" ); OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ), ::getCppuType( (const Reference< XFastPropertySet > *)0 ), ::getCppuType( (const Reference< XMultiPropertySet > *)0 ), @@ -527,7 +534,6 @@ Sequence< Type > SAL_CALL ORowSet::getTypes() throw (RuntimeException) // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL ORowSet::getImplementationId() throw (RuntimeException) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getImplementationId" ); static OImplementationId * pId = 0; if (! pId) { @@ -545,7 +551,6 @@ Sequence< sal_Int8 > SAL_CALL ORowSet::getImplementationId() throw (RuntimeExcep // com::sun::star::XInterface Any SAL_CALL ORowSet::queryInterface( const Type & rType ) throw (RuntimeException) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::queryInterface" ); return ORowSet_BASE1::queryInterface( rType); } // ------------------------------------------------------------------------- @@ -563,7 +568,6 @@ void SAL_CALL ORowSet::release() throw() // com::sun::star::XUnoTunnel sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getSomething" ); if (rId.getLength() == 16 && 0 == rtl_compareMemory(getImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) return reinterpret_cast<sal_Int64>(this); @@ -573,7 +577,6 @@ sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) thro // com::sun::star::XAggregation Any SAL_CALL ORowSet::queryAggregation( const Type& rType ) throw(RuntimeException) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::queryAggregation" ); Any aRet(ORowSetBase::queryInterface(rType)); if (!aRet.hasValue()) aRet = ORowSet_BASE1::queryAggregation(rType); @@ -582,26 +585,22 @@ Any SAL_CALL ORowSet::queryAggregation( const Type& rType ) throw(RuntimeExcepti //------------------------------------------------------------------------------ rtl::OUString ORowSet::getImplementationName_static( ) throw(RuntimeException) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getImplementationName_static" ); return rtl::OUString::createFromAscii("com.sun.star.comp.dba.ORowSet"); } // ------------------------------------------------------------------------- // ::com::sun::star::XServiceInfo ::rtl::OUString SAL_CALL ORowSet::getImplementationName( ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getImplementationName" ); return getImplementationName_static(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::supportsService" ); return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > ORowSet::getSupportedServiceNames_static( ) throw (RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getSupportedServiceNames_static" ); Sequence< rtl::OUString > aSNS( 5 ); aSNS[0] = SERVICE_SDBC_RESULTSET; aSNS[1] = SERVICE_SDBC_ROWSET; @@ -613,13 +612,11 @@ Sequence< ::rtl::OUString > ORowSet::getSupportedServiceNames_static( ) throw ( // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL ORowSet::getSupportedServiceNames( ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getSupportedServiceNames" ); return getSupportedServiceNames_static(); } //------------------------------------------------------------------------------ Reference< XInterface > ORowSet::Create(const Reference< XComponentContext >& _rxContext) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::Create" ); ::comphelper::ComponentContext aContext( _rxContext ); return ORowSet_CreateInstance( aContext.getLegacyServiceFactory() ); } @@ -627,7 +624,6 @@ Reference< XInterface > ORowSet::Create(const Reference< XComponentContext >& _r // OComponentHelper void SAL_CALL ORowSet::disposing() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::disposing" ); OPropertyStateContainer::disposing(); MutexGuard aGuard(m_aMutex); @@ -658,7 +654,6 @@ void SAL_CALL ORowSet::disposing() // ------------------------------------------------------------------------- void ORowSet::freeResources( bool _bComplete ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::freeResources" ); MutexGuard aGuard(m_aMutex); // free all clones @@ -712,7 +707,6 @@ void ORowSet::freeResources( bool _bComplete ) // ------------------------------------------------------------------------- void ORowSet::setActiveConnection( Reference< XConnection >& _rxNewConn, sal_Bool _bFireEvent ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setActiveConnection" ); if (_rxNewConn.get() == m_xActiveConnection.get()) // nothing to do return; @@ -760,7 +754,6 @@ void ORowSet::setActiveConnection( Reference< XConnection >& _rxNewConn, sal_Boo // ::com::sun::star::XEventListener void SAL_CALL ORowSet::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::disposing" ); // close rowset because the connection is going to be deleted (someone told me :-) Reference<XConnection> xCon(Source.Source,UNO_QUERY); if(m_xActiveConnection == xCon) @@ -778,7 +771,6 @@ void SAL_CALL ORowSet::disposing( const ::com::sun::star::lang::EventObject& Sou // XCloseable void SAL_CALL ORowSet::close( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::close" ); { MutexGuard aGuard( m_aMutex ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -790,7 +782,6 @@ void SAL_CALL ORowSet::close( ) throw(SQLException, RuntimeException) // comphelper::OPropertyArrayUsageHelper ::cppu::IPropertyArrayHelper* ORowSet::createArrayHelper( ) const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::createArrayHelper" ); Sequence< Property > aProps; describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); @@ -799,14 +790,12 @@ void SAL_CALL ORowSet::close( ) throw(SQLException, RuntimeException) // cppu::OPropertySetHelper ::cppu::IPropertyArrayHelper& SAL_CALL ORowSet::getInfoHelper() { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getInfoHelper" ); typedef ::comphelper::OPropertyArrayUsageHelper<ORowSet> ORowSet_PROP; return *ORowSet_PROP::getArrayHelper(); } // ----------------------------------------------------------------------------- void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateValue" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -824,85 +813,71 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) // XRowUpdate void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateNull" ); updateValue(columnIndex,ORowSetValue()); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateBoolean" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateByte" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateShort" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateInt" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateLong" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateFloat" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateDouble" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateString" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateBytes" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateDate" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateTime" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateTimestamp" ); updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateBinaryStream" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -933,7 +908,6 @@ void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Referenc // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateCharacterStream" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -950,7 +924,6 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateObject" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -999,7 +972,6 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateNumericObject" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -1018,7 +990,6 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, // XResultSetUpdate void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::insertRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); // insertRow is not allowd when // standing not on the insert row nor @@ -1068,17 +1039,15 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getRow" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); // check if we are inserting a row - return (m_pCache && ( m_pCache->m_bNew || m_bModified )) ? 0 : impl_getRow(); + return (m_pCache && ( m_pCache->m_bNew || m_bModified )) ? 0 : ORowSetBase::getRow(); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::updateRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); // not allowed when standing on insert row ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1116,7 +1085,6 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::deleteRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1134,7 +1102,7 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) if ( ( m_pCache->m_nPrivileges & Privilege::DELETE ) != Privilege::DELETE ) throwSQLException( "DELETE privilege not available.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); // TODO: resource - if ( impl_rowDeleted() ) + if ( rowDeleted() ) throwSQLException( "Current row already deleted.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); // TODO: resource @@ -1173,7 +1141,6 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQLException, RuntimeException ) ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::implCancelRowUpdates" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -1211,14 +1178,12 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL // ------------------------------------------------------------------------- void SAL_CALL ORowSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::cancelRowUpdates" ); implCancelRowUpdates( sal_True ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::addRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::addRowSetListener" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -1228,7 +1193,6 @@ void SAL_CALL ORowSet::addRowSetListener( const Reference< XRowSetListener >& li // ------------------------------------------------------------------------- void SAL_CALL ORowSet::removeRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::removeRowSetListener" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -1238,7 +1202,6 @@ void SAL_CALL ORowSet::removeRowSetListener( const Reference< XRowSetListener >& // ----------------------------------------------------------------------------- void ORowSet::notifyAllListeners(::osl::ResettableMutexGuard& _rGuard) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListeners" ); EventObject aEvt(*m_pMySelf); _rGuard.clear(); m_aRowsetListeners.notifyEach( &XRowSetListener::rowSetChanged, aEvt ); @@ -1247,7 +1210,6 @@ void ORowSet::notifyAllListeners(::osl::ResettableMutexGuard& _rGuard) // ------------------------------------------------------------------------- void ORowSet::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListenersCursorMoved" ); EventObject aEvt(*m_pMySelf); _rGuard.clear(); m_aRowsetListeners.notifyEach( &XRowSetListener::cursorMoved, aEvt ); @@ -1256,7 +1218,6 @@ void ORowSet::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard // ------------------------------------------------------------------------- void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard, const EventObject& aEvt) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListenersRowChanged" ); _rGuard.clear(); m_aRowsetListeners.notifyEach( &XRowSetListener::rowChanged, aEvt ); _rGuard.reset(); @@ -1264,7 +1225,6 @@ void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard, // ------------------------------------------------------------------------- sal_Bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListenersCursorBeforeMove" ); EventObject aEvt(*m_pMySelf); NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveCursorMove); return bCheck; @@ -1272,7 +1232,6 @@ sal_Bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard // ------------------------------------------------------------------------- void ORowSet::notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const RowChangeEvent &aEvt) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyAllListenersRowBeforeChange" ); NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveRowChange); if ( !bCheck ) m_aErrors.raiseTypedException( sdb::ErrorCondition::ROW_SET_OPERATION_VETOED, *this, ::cppu::UnoType< RowSetVetoException >::get() ); @@ -1280,7 +1239,6 @@ void ORowSet::notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rG // ------------------------------------------------------------------------- void ORowSet::fireRowcount() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::fireRowcount" ); sal_Int32 nCurrentRowCount( impl_getRowCount() ); sal_Bool bCurrentRowCountFinal( m_pCache->m_bRowCountFinal ); @@ -1305,7 +1263,6 @@ void ORowSet::fireRowcount() // ------------------------------------------------------------------------- void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::moveToInsertRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1363,7 +1320,6 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::moveToCurrentRow" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1401,111 +1357,96 @@ void SAL_CALL ORowSet::moveToCurrentRow( ) throw(SQLException, RuntimeException // XRow sal_Bool SAL_CALL ORowSet::wasNull( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::wasNull" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - return ( m_pCache && isInsertRow() ) ? ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex].isNull() : impl_wasNull(); + return ( m_pCache && isInsertRow() ) ? ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex].isNull() : ORowSetBase::wasNull(); } // ----------------------------------------------------------------------------- const ORowSetValue& ORowSet::getInsertValue(sal_Int32 columnIndex) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getInsertValue" ); checkCache(); if ( m_pCache && isInsertRow() ) return ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex]; - return impl_getValue(columnIndex); + return getValue(columnIndex); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ORowSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getString" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getBoolean" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL ORowSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getByte" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL ORowSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getShort" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getInt" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL ORowSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getLong" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL ORowSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getFloat" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL ORowSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getDouble" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL ORowSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getBytes" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL ORowSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getDate" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Time SAL_CALL ORowSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getTime" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL ORowSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getTimestamp" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getBinaryStream" ); ::osl::MutexGuard aGuard( *m_pMutex ); if ( m_pCache && isInsertRow() ) { @@ -1518,7 +1459,6 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getBinaryStrea // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getCharacterStream" ); ::osl::MutexGuard aGuard( *m_pMutex ); if(m_pCache && isInsertRow() ) { @@ -1531,38 +1471,32 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getCharacterSt // ------------------------------------------------------------------------- Any SAL_CALL ORowSet::getObject( sal_Int32 columnIndex, const Reference< XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getObject" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex).makeAny(); } // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL ORowSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getRef" ); return Reference< XRef >(); } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getBlob" ); return Reference< XBlob >(); } // ------------------------------------------------------------------------- Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getClob" ); return Reference< XClob >(); } // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL ORowSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getArray" ); return Reference< XArray >(); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandler >& _rxHandler ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::executeWithCompletion" ); if (!_rxHandler.is()) execute(); @@ -1588,7 +1522,14 @@ void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandl m_bRebuildConnOnExecute = sal_False; Reference< XSingleSelectQueryComposer > xComposer = getCurrentSettingsComposer( this, m_aContext.getLegacyServiceFactory() ); - ::dbtools::askForParameters( xComposer, this, m_xActiveConnection, _rxHandler ); + Reference<XParametersSupplier> xParameters(xComposer, UNO_QUERY); + + Reference<XIndexAccess> xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() : Reference<XIndexAccess>(); + const sal_Int32 nParamCount = xParamsAsIndicies.is() ? xParamsAsIndicies->getCount() : 0; + if ( m_aParametersSet.size() < (size_t)nParamCount ) + m_aParametersSet.resize( nParamCount ,false); + + ::dbtools::askForParameters( xComposer, this, m_xActiveConnection, _rxHandler,m_aParametersSet ); } // ensure that only the allowed exceptions leave this block catch(SQLException&) @@ -1613,7 +1554,6 @@ void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandl // ------------------------------------------------------------------------- Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( ) throw (RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getParameters" ); ::osl::MutexGuard aGuard( *m_pMutex ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -1641,7 +1581,6 @@ Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( ) throw (RuntimeExce // ------------------------------------------------------------------------- void ORowSet::approveExecution() throw (RowSetVetoException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::approveExecution" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); EventObject aEvt(*this); @@ -1672,7 +1611,6 @@ void ORowSet::approveExecution() throw (RowSetVetoException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL ORowSet::execute( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::execute" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); // tell everybody that we will change the result set @@ -1698,7 +1636,6 @@ void SAL_CALL ORowSet::execute( ) throw(SQLException, RuntimeException) //------------------------------------------------------------------------------ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxStatement, sal_Int32 _nDesiredResultSetType, sal_Int32 _nDesiredResultSetConcurrency ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setStatementResultSetType" ); OSL_ENSURE( _rxStatement.is(), "ORowSet::setStatementResultSetType: invalid statement - this will crash!" ); sal_Int32 nResultSetType( _nDesiredResultSetType ); @@ -1749,7 +1686,6 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta // ----------------------------------------------------------------------------- Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_prepareAndExecute_throw" ); ::rtl::OUString sCommandToExecute; sal_Bool bUseEscapeProcessing = impl_initComposer_throw( sCommandToExecute ); @@ -1814,7 +1750,6 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() // ----------------------------------------------------------------------------- void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertySet >& _rxTemplateColumn, const Reference< XPropertySet >& _rxRowSetColumn ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_initializeColumnSettings_nothrow" ); OSL_ENSURE( _rxTemplateColumn.is() && _rxRowSetColumn.is(), "ORowSet::impl_initializeColumnSettings_nothrow: this will crash!" ); @@ -2018,7 +1953,6 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi else { // create the rowset columns - const Reference< XDatabaseMetaData > xDatabaseMetaData( m_xActiveConnection->getMetaData() ); Reference< XResultSetMetaData > xMeta( getMetaData(), UNO_QUERY_THROW ); sal_Int32 nCount = xMeta->getColumnCount(); m_aDataColumns.reserve(nCount+1); @@ -2073,7 +2007,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi this, this, i, - xDatabaseMetaData, + m_xActiveConnection->getMetaData(), aDescription, m_aCurrentRow); aColumns->get().push_back(pColumn); @@ -2112,7 +2046,6 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi // XRowSetApproveBroadcaster void SAL_CALL ORowSet::addRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::addRowSetApproveListener" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2122,7 +2055,6 @@ void SAL_CALL ORowSet::addRowSetApproveListener( const Reference< XRowSetApprove // ------------------------------------------------------------------------- void SAL_CALL ORowSet::removeRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::removeRowSetApproveListener" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2134,7 +2066,6 @@ void SAL_CALL ORowSet::removeRowSetApproveListener( const Reference< XRowSetAppr // XResultSetAccess Reference< XResultSet > SAL_CALL ORowSet::createResultSet( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::createResultSet" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); if(m_xStatement.is()) @@ -2151,7 +2082,6 @@ Reference< XResultSet > SAL_CALL ORowSet::createResultSet( ) throw(SQLException // ::com::sun::star::util::XCancellable void SAL_CALL ORowSet::cancel( ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::cancel" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); } // ------------------------------------------------------------------------- @@ -2159,7 +2089,6 @@ void SAL_CALL ORowSet::cancel( ) throw(RuntimeException) // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL ORowSet::deleteRows( const Sequence< Any >& rows ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::deleteRows" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); if(!m_pCache || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) @@ -2213,7 +2142,6 @@ Sequence< sal_Int32 > SAL_CALL ORowSet::deleteRows( const Sequence< Any >& rows // ----------------------------------------------------------------------------- void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyRowSetAndClonesRowDelete" ); // notify ourself onDeleteRow( _rBookmark ); // notify the clones @@ -2231,7 +2159,6 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark ) //------------------------------------------------------------------------------ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 _nPos ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::notifyRowSetAndClonesRowDeleted" ); // notify ourself onDeletedRow( _rBookmark, _nPos ); // notify the clones @@ -2249,7 +2176,6 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 //------------------------------------------------------------------------------ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionHandler >& _rxHandler) throw( SQLException, RuntimeException ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::calcConnection" ); MutexGuard aGuard(m_aMutex); if (!m_xActiveConnection.is()) { @@ -2294,7 +2220,6 @@ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionH //------------------------------------------------------------------------------ Reference< XNameAccess > ORowSet::impl_getTables_throw() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_getTables_throw" ); Reference< XNameAccess > xTables; Reference< XTablesSupplier > xTablesAccess( m_xActiveConnection, UNO_QUERY ); @@ -2335,7 +2260,6 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() //------------------------------------------------------------------------------ void ORowSet::impl_resetTables_nothrow() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_resetTables_nothrow" ); if ( !m_pTables ) return; @@ -2354,7 +2278,6 @@ void ORowSet::impl_resetTables_nothrow() //------------------------------------------------------------------------------ sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecute ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_initComposer_throw" ); sal_Bool bUseEscapeProcessing = impl_buildActiveCommand_throw( ); _out_rCommandToExecute = m_aActiveCommand; if ( !bUseEscapeProcessing ) @@ -2405,7 +2328,6 @@ sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecu //------------------------------------------------------------------------------ sal_Bool ORowSet::impl_buildActiveCommand_throw() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_buildActiveCommand_throw" ); // create the sql command // from a table name or get the command out of a query (not a view) // the last use the command as it is @@ -2516,7 +2438,6 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw() //------------------------------------------------------------------------------ void ORowSet::impl_initParametersContainer_nothrow() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_initParametersContainer_nothrow" ); OSL_PRECOND( !m_pParameters.is(), "ORowSet::impl_initParametersContainer_nothrow: already initialized the parameters!" ); m_pParameters = new param::ParameterWrapperContainer( m_xComposer.get() ); @@ -2531,7 +2452,6 @@ void ORowSet::impl_initParametersContainer_nothrow() //------------------------------------------------------------------------------ void ORowSet::impl_disposeParametersContainer_nothrow() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::impl_disposeParametersContainer_nothrow" ); if ( !m_pParameters.is() ) return; @@ -2550,11 +2470,18 @@ void ORowSet::impl_disposeParametersContainer_nothrow() // ----------------------------------------------------------------------------- ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::getParameterStorage" ); ::connectivity::checkDisposed( ORowSet_BASE1::rBHelper.bDisposed ); if ( parameterIndex < 1 ) throwInvalidIndexException( *this ); + if ( m_aParametersSet.size() < (size_t)parameterIndex ) + m_aParametersSet.resize( parameterIndex ,false); + m_aParametersSet[parameterIndex - 1] = true; + + if ( m_aParametersSet.size() < (size_t)parameterIndex ) + m_aParametersSet.resize( parameterIndex ,false); + m_aParametersSet[parameterIndex - 1] = true; + if ( m_pParameters.is() ) { if ( m_bCommandFacetsDirty ) @@ -2577,7 +2504,6 @@ ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex) // XParameters void SAL_CALL ORowSet::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setNull" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); getParameterStorage( parameterIndex ).setNull(); @@ -2585,13 +2511,11 @@ void SAL_CALL ORowSet::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setObjectNull" ); setNull( parameterIndex, sqlType ); } // ----------------------------------------------------------------------------- void ORowSet::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setParameter" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); getParameterStorage( parameterIndex ) = x; @@ -2600,79 +2524,66 @@ void ORowSet::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x) // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setBoolean" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setByte" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setShort" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setInt" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setLong" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setFloat" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setDouble" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setString" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setBytes" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setDate" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setTime" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setTimestamp" ); setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setBinaryStream" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) ); @@ -2691,7 +2602,6 @@ void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Referenc // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setCharacterStream" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) ); try @@ -2714,7 +2624,6 @@ void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Refer // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setObject" ); if ( !::dbtools::implSetObject( this, parameterIndex, x ) ) { // there is no other setXXX call which can handle the value in x throw SQLException(); @@ -2723,7 +2632,6 @@ void SAL_CALL ORowSet::setObject( sal_Int32 parameterIndex, const Any& x ) throw // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setObjectWithInfo" ); ::osl::MutexGuard aGuard( m_aColumnsMutex ); ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) ); setObject( parameterIndex, x ); @@ -2732,31 +2640,26 @@ void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setRef" ); ::dbtools::throwFeatureNotImplementedException( "XParameters::setRef", *this ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setBlob" ); ::dbtools::throwFeatureNotImplementedException( "XParameters::setBlob", *this ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setClob" ); ::dbtools::throwFeatureNotImplementedException( "XParameters::setClob", *this ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::setArray" ); ::dbtools::throwFeatureNotImplementedException( "XParameters::setArray", *this ); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::clearParameters( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::clearParameters" ); ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2764,11 +2667,11 @@ void SAL_CALL ORowSet::clearParameters( ) throw(SQLException, RuntimeException) size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues.get().size() ); for ( size_t i=1; i<=nParamCount; ++i ) getParameterStorage( (sal_Int32)i ).setNull(); + m_aParametersSet.clear(); } // ------------------------------------------------------------------------- void ORowSet::firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rOldValue) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::firePropertyChange" ); OSL_ENSURE(_nPos < (sal_Int32)m_aDataColumns.size(),"nPos is invalid!"); m_aDataColumns[_nPos]->fireValueChange(_rOldValue); } @@ -2776,7 +2679,6 @@ void ORowSet::firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetVa // ----------------------------------------------------------------------------- void ORowSet::doCancelModification( ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::doCancelModification" ); //OSL_ENSURE( isModification(), "ORowSet::doCancelModification: invalid call (no cache!)!" ); if ( isModification() ) m_pCache->cancelRowModification(); @@ -2786,28 +2688,24 @@ void ORowSet::doCancelModification( ) // ----------------------------------------------------------------------------- sal_Bool ORowSet::isModification( ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::isModification" ); return isNew(); } // ----------------------------------------------------------------------------- sal_Bool ORowSet::isModified( ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::isModified" ); return m_bModified; } // ----------------------------------------------------------------------------- sal_Bool ORowSet::isNew( ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::isNew" ); return m_bNew; } // ----------------------------------------------------------------------------- void ORowSet::checkUpdateIterator() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::checkUpdateIterator" ); if(!m_bModified && !m_bNew) { m_pCache->setUpdateIterator(m_aCurrentRow); @@ -2820,12 +2718,11 @@ void ORowSet::checkUpdateIterator() // ----------------------------------------------------------------------------- void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::checkUpdateConditions" ); checkCache(); if ( columnIndex <= 0 ) throwSQLException( "Invalid column index", SQL_INVALID_DESCRIPTOR_INDEX, *this ); // TODO: resource - if ( impl_rowDeleted() ) + if ( rowDeleted() ) throwSQLException( "Current row is deleted", SQL_INVALID_CURSOR_POSITION, *this ); // TODO: resource if ( m_aCurrentRow.isNull() ) @@ -2841,7 +2738,6 @@ void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) // ----------------------------------------------------------------------------- void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSet::refreshRow" ); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -2893,45 +2789,47 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo // Locale aLocale; // pConfigMgr->GetDirectConfigProperty(ConfigManager::LOCALE) >>= aLocale; Locale aLocale = SvtSysLocale().GetLocaleData().getLocale(); - const Reference<XDatabaseMetaData> xMetaData( rParent.m_xActiveConnection->getMetaData() ); - const Reference< XResultSetMetaData > xRowMetaData( rParent.getMetaData() ); - - Sequence< ::rtl::OUString> aSeq = rParent.m_pColumns->getElementNames(); - const ::rtl::OUString* pIter = aSeq.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aSeq.getLength(); - aColumns->get().reserve(aSeq.getLength()+1); - for(sal_Int32 i=1;pIter != pEnd ;++pIter,++i) - { - Reference<XPropertySet> xColumn; - rParent.m_pColumns->getByName(*pIter) >>= xColumn; - if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION)) - aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION)); - - ORowSetColumn* pColumn = new ORowSetColumn( xRowMetaData, - this, - i, - xMetaData, - aDescription, - m_aCurrentRow); - aColumns->get().push_back(pColumn); - pColumn->setName(*pIter); - aNames.push_back(*pIter); - m_aDataColumns.push_back(pColumn); - - pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,xColumn->getPropertyValue(PROPERTY_ALIGN)); - sal_Int32 nFormatKey = comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT)); - if(!nFormatKey && xColumn.is() && m_xNumberFormatTypes.is()) - nFormatKey = ::dbtools::getDefaultNumberFormat(xColumn,m_xNumberFormatTypes,aLocale); - pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey)); - pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,xColumn->getPropertyValue(PROPERTY_RELATIVEPOSITION)); - pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,xColumn->getPropertyValue(PROPERTY_WIDTH)); - pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN,xColumn->getPropertyValue(PROPERTY_HIDDEN)); - pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLMODEL,xColumn->getPropertyValue(PROPERTY_CONTROLMODEL)); - pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HELPTEXT,xColumn->getPropertyValue(PROPERTY_HELPTEXT)); - pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLDEFAULT,xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT)); - - } - m_pColumns = new ORowSetDataColumns(xMetaData.is() && xMetaData->supportsMixedCaseQuotedIdentifiers(), + + if ( rParent.m_pColumns ) + { + Sequence< ::rtl::OUString> aSeq = rParent.m_pColumns->getElementNames(); + const ::rtl::OUString* pIter = aSeq.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aSeq.getLength(); + aColumns->get().reserve(aSeq.getLength()+1); + for(sal_Int32 i=1;pIter != pEnd ;++pIter,++i) + { + Reference<XPropertySet> xColumn; + rParent.m_pColumns->getByName(*pIter) >>= xColumn; + if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION)) + aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION)); + + ORowSetColumn* pColumn = new ORowSetColumn( rParent.getMetaData(), + this, + i, + rParent.m_xActiveConnection->getMetaData(), + aDescription, + m_aCurrentRow); + aColumns->get().push_back(pColumn); + pColumn->setName(*pIter); + aNames.push_back(*pIter); + m_aDataColumns.push_back(pColumn); + + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,xColumn->getPropertyValue(PROPERTY_ALIGN)); + sal_Int32 nFormatKey = comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT)); + if(!nFormatKey && xColumn.is() && m_xNumberFormatTypes.is()) + nFormatKey = ::dbtools::getDefaultNumberFormat(xColumn,m_xNumberFormatTypes,aLocale); + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey)); + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,xColumn->getPropertyValue(PROPERTY_RELATIVEPOSITION)); + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,xColumn->getPropertyValue(PROPERTY_WIDTH)); + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN,xColumn->getPropertyValue(PROPERTY_HIDDEN)); + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLMODEL,xColumn->getPropertyValue(PROPERTY_CONTROLMODEL)); + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HELPTEXT,xColumn->getPropertyValue(PROPERTY_HELPTEXT)); + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLDEFAULT,xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT)); + + } // for(sal_Int32 i=1;pIter != pEnd ;++pIter,++i) + } + Reference<XDatabaseMetaData> xMeta = rParent.m_xActiveConnection->getMetaData(); + m_pColumns = new ORowSetDataColumns(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(), aColumns,*this,m_aMutex,aNames); sal_Int32 nRT = PropertyAttribute::READONLY | PropertyAttribute::TRANSIENT; diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx index 843f970bcae5..b36608f1c495 100644 --- a/dbaccess/source/core/api/RowSet.hxx +++ b/dbaccess/source/core/api/RowSet.hxx @@ -131,6 +131,7 @@ namespace dbaccess (since we have not been executed, yet) */ ORowSetValueVector m_aPrematureParamValues; + ::std::bit_vector m_aParametersSet; ::cppu::OInterfaceContainerHelper m_aRowsetListeners; ::cppu::OInterfaceContainerHelper m_aApproveListeners; diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index 59737c5fc5d3..7067cf50fce9 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -66,6 +66,9 @@ #ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> #endif +#ifndef TOOLS_DIAGNOSE_EX_H +#include <tools/diagnose_ex.h> +#endif using namespace dbaccess; using namespace dbtools; @@ -164,6 +167,7 @@ void OTableContainer::removeMasterContainerListener() // XServiceInfo //------------------------------------------------------------------------------ IMPLEMENT_SERVICE_INFO2(OTableContainer, "com.sun.star.sdb.dbaccess.OTableContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES) + // ----------------------------------------------------------------------------- namespace { diff --git a/dbaccess/source/core/inc/DatabaseDataProvider.hxx b/dbaccess/source/core/inc/DatabaseDataProvider.hxx index 68d67808e921..2e3d43443b88 100644 --- a/dbaccess/source/core/inc/DatabaseDataProvider.hxx +++ b/dbaccess/source/core/inc/DatabaseDataProvider.hxx @@ -202,10 +202,11 @@ private: virtual void SAL_CALL disposing(); void impl_fillRowSet_throw(); - void impl_executeRowSet_nothrow(::osl::ResettableMutexGuard& _rClearForNotifies); + void impl_executeRowSet_throw(::osl::ResettableMutexGuard& _rClearForNotifies); bool impl_fillParameters_nothrow( ::osl::ResettableMutexGuard& _rClearForNotifies); - void impl_fillInternalDataProvider_throw(); + void impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories); void impl_invalidateParameter_nothrow(); + ::com::sun::star::uno::Any impl_getNumberFormatKey_nothrow(const ::rtl::OUString & _sRangeRepresentation) const; template <typename T> void set( const ::rtl::OUString& _sProperty ,const T& _Value @@ -214,14 +215,18 @@ private: BoundListeners l; { ::osl::MutexGuard aGuard(m_aMutex); - prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l); - _member = _Value; + if ( _member != _Value ) + { + prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l); + _member = _Value; + } } l.notify(); } ::dbtools::ParameterManager m_aParameterManager; ::dbtools::FilterManager m_aFilterManager; + ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any> m_aNumberFormats; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xActiveConnection; diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index 33c437f970b9..cd16eb68a5ee 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -43,6 +43,8 @@ #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/XChartDataArray.hpp> @@ -57,12 +59,6 @@ using ::com::sun::star::sdbc::SQLException; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::RuntimeException; // ----------------------------------------------------------------------------- -::rtl::OUString lcl_getLabel() -{ - static const ::rtl::OUString s_sLabel(RTL_CONSTASCII_USTRINGPARAM("label ")); - return s_sLabel; -} -// ----------------------------------------------------------------------------- DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContext > const & context) : TDatabaseDataProvider(m_aMutex), ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >( @@ -74,7 +70,7 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex m_CommandType(sdb::CommandType::COMMAND), // #i94114 m_RowLimit(0), m_EscapeProcessing(sal_True), - m_ApplyFilter(sal_False) + m_ApplyFilter(sal_True) { m_xInternal.set( m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.chart.InternalDataProvider")),m_xContext ), uno::UNO_QUERY ); m_xRangeConversion.set(m_xInternal,uno::UNO_QUERY); @@ -171,48 +167,87 @@ void SAL_CALL DatabaseDataProvider::initialize(const uno::Sequence< uno::Any > & // ----------------------------------------------------------------------------- // chart2::data::XDataProvider: -::sal_Bool SAL_CALL DatabaseDataProvider::createDataSourcePossible(const uno::Sequence< beans::PropertyValue > & /*aArguments*/) throw (uno::RuntimeException) +::sal_Bool SAL_CALL DatabaseDataProvider::createDataSourcePossible(const uno::Sequence< beans::PropertyValue > & _aArguments) throw (uno::RuntimeException) { - ::osl::ResettableMutexGuard aClearForNotifies(m_aMutex); - bool bRet = false; - if ( m_Command.getLength() != 0 && m_xActiveConnection.is() ) + //::osl::ResettableMutexGuard aClearForNotifies(m_aMutex); + const beans::PropertyValue* pArgIter = _aArguments.getConstArray(); + const beans::PropertyValue* pArgEnd = pArgIter + _aArguments.getLength(); + for(;pArgIter != pArgEnd;++pArgIter) { - try + if ( pArgIter->Name.equalsAscii("DataRowSource") ) { - impl_fillRowSet_throw(); - impl_executeRowSet_nothrow(aClearForNotifies); - impl_fillInternalDataProvider_throw(); - bRet = true; - } - catch(const uno::Exception& /*e*/) + ::com::sun::star::chart::ChartDataRowSource eRowSource = ::com::sun::star::chart::ChartDataRowSource_COLUMNS; + pArgIter->Value >>= eRowSource; + if ( eRowSource != ::com::sun::star::chart::ChartDataRowSource_COLUMNS ) + return sal_False; + } // if ( pArgIter->Name.equalsAscii("DataRowSource") ) + else if ( pArgIter->Name.equalsAscii("CellRangeRepresentation") ) { + ::rtl::OUString sRange; + pArgIter->Value >>= sRange; + if ( !sRange.equalsAscii("all") ) + return sal_False; } - } - if ( !bRet ) // no command set or an error occured, use Internal data handler - { - uno::Reference< lang::XInitialization> xIni(m_xInternal,uno::UNO_QUERY); - if ( xIni.is() ) + else if ( pArgIter->Name.equalsAscii("FirstCellAsLabel") ) { - uno::Sequence< uno::Any > aArgs(1); - beans::NamedValue aParam(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDefaultData")),uno::makeAny(sal_True)); - aArgs[0] <<= aParam; - xIni->initialize(aArgs); + sal_Bool bFirstCellAsLabel = sal_True; + pArgIter->Value >>= bFirstCellAsLabel; + if ( !bFirstCellAsLabel ) + return sal_False; } } - - return bRet; + return sal_True; } // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::createDataSource(const uno::Sequence< beans::PropertyValue > & _aArguments) throw (uno::RuntimeException, lang::IllegalArgumentException) { - osl::MutexGuard g(m_aMutex); - createDataSourcePossible(_aArguments); + osl::ResettableMutexGuard aClearForNotifies(m_aMutex); + if ( createDataSourcePossible(_aArguments) ) + { + sal_Bool bHasCategories = sal_True; + const beans::PropertyValue* pArgIter = _aArguments.getConstArray(); + const beans::PropertyValue* pArgEnd = pArgIter + _aArguments.getLength(); + for(;pArgIter != pArgEnd;++pArgIter) + { + if ( pArgIter->Name.equalsAscii("HasCategories") ) + { + pArgIter->Value >>= bHasCategories; + break; + } + } + bool bRet = false; + if ( m_Command.getLength() != 0 && m_xActiveConnection.is() ) + { + try + { + impl_fillRowSet_throw(); + impl_executeRowSet_throw(aClearForNotifies); + impl_fillInternalDataProvider_throw(bHasCategories); + bRet = true; + } + catch(const uno::Exception& /*e*/) + { + } + } + if ( !bRet ) // no command set or an error occured, use Internal data handler + { + uno::Reference< lang::XInitialization> xIni(m_xInternal,uno::UNO_QUERY); + if ( xIni.is() ) + { + uno::Sequence< uno::Any > aArgs(1); + beans::NamedValue aParam(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDefaultData")),uno::makeAny(sal_True)); + aArgs[0] <<= aParam; + xIni->initialize(aArgs); + } + } + + } return m_xInternal->createDataSource(_aArguments); } // ----------------------------------------------------------------------------- -uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArguments(const uno::Reference< chart2::data::XDataSource > & /*xDataSource*/) throw (uno::RuntimeException) +uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArguments(const uno::Reference< chart2::data::XDataSource > & _xDataSource) throw (uno::RuntimeException) { uno::Sequence< beans::PropertyValue > aArguments( 4 ); aArguments[0] = beans::PropertyValue( @@ -224,8 +259,30 @@ uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArgum // internal data always contains labels and categories aArguments[2] = beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FirstCellAsLabel")), -1, uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE ); + sal_Bool bHasCategories = sal_False; + if( _xDataSource.is()) + { + uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSequences(_xDataSource->getDataSequences()); + const sal_Int32 nCount( aSequences.getLength()); + for( sal_Int32 nIdx=0; nIdx<nCount; ++nIdx ) + { + if( aSequences[nIdx].is() ) + { + uno::Reference< beans::XPropertySet > xSeqProp( aSequences[nIdx]->getValues(), uno::UNO_QUERY ); + ::rtl::OUString aRole; + if( xSeqProp.is() && + (xSeqProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Role"))) >>= aRole) && + aRole.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("categories")) ) + { + bHasCategories = sal_True; + break; + } + } + } + } + aArguments[3] = beans::PropertyValue( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasCategories")), -1, uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasCategories")), -1, uno::makeAny( bHasCategories ), beans::PropertyState_DIRECT_VALUE ); return aArguments; } // ----------------------------------------------------------------------------- @@ -235,11 +292,25 @@ uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArgum return sal_True; } // ----------------------------------------------------------------------------- - +uno::Any DatabaseDataProvider::impl_getNumberFormatKey_nothrow(const ::rtl::OUString & _sRangeRepresentation) const +{ + ::std::map< ::rtl::OUString,com::sun::star::uno::Any>::const_iterator aFind = m_aNumberFormats.find(_sRangeRepresentation); + if ( aFind != m_aNumberFormats.end() ) + return aFind->second; + return uno::makeAny(sal_Int32(0)); +} +// ----------------------------------------------------------------------------- uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::createDataSequenceByRangeRepresentation(const ::rtl::OUString & _sRangeRepresentation) throw (uno::RuntimeException, lang::IllegalArgumentException) { osl::MutexGuard g(m_aMutex); - return m_xInternal->createDataSequenceByRangeRepresentation(_sRangeRepresentation); + uno::Reference< chart2::data::XDataSequence > xData = m_xInternal->createDataSequenceByRangeRepresentation(_sRangeRepresentation);; + uno::Reference<beans::XPropertySet> xProp(xData,uno::UNO_QUERY); + const static ::rtl::OUString s_sNumberFormatKey(RTL_CONSTASCII_USTRINGPARAM("NumberFormatKey")); + if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(s_sNumberFormatKey) ) + { + xProp->setPropertyValue(s_sNumberFormatKey,impl_getNumberFormatKey_nothrow(_sRangeRepresentation)); + } + return xData; } // ----------------------------------------------------------------------------- @@ -499,19 +570,13 @@ void SAL_CALL DatabaseDataProvider::setDataSourceName(const ::rtl::OUString& the set(PROPERTY_DATASOURCENAME,the_value,m_DataSourceName); } // ----------------------------------------------------------------------------- -void DatabaseDataProvider::impl_executeRowSet_nothrow(::osl::ResettableMutexGuard& _rClearForNotifies) +void DatabaseDataProvider::impl_executeRowSet_throw(::osl::ResettableMutexGuard& _rClearForNotifies) { - try - { - if ( impl_fillParameters_nothrow(_rClearForNotifies) ) - m_xRowSet->execute(); - } - catch(const uno::Exception&) - { - } + if ( impl_fillParameters_nothrow(_rClearForNotifies) ) + m_xRowSet->execute(); } // ----------------------------------------------------------------------------- -void DatabaseDataProvider::impl_fillInternalDataProvider_throw() +void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories) { // clear the data before fill the new one uno::Reference< chart::XChartDataArray> xChartData(m_xInternal,uno::UNO_QUERY); @@ -522,31 +587,57 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw() m_xInternal->deleteSequence(0); } - uno::Sequence< ::rtl::OUString > aColumns = ::dbtools::getFieldNamesByCommandDescriptor(getActiveConnection() - ,getCommandType() - ,m_Command); - + uno::Sequence< ::rtl::OUString > aColumns; + uno::Reference< sdbcx::XColumnsSupplier> xColSup(m_xRowSet,uno::UNO_QUERY_THROW); + uno::Reference< container::XNameAccess > xColumns = xColSup->getColumns(); + if ( xColumns.is() ) + aColumns = xColumns->getElementNames(); // fill the data uno::Reference< sdbc::XResultSet> xRes(m_xRowSet,uno::UNO_QUERY_THROW); uno::Reference< sdbc::XRow> xRow(m_xRowSet,uno::UNO_QUERY_THROW); + uno::Reference< sdbc::XResultSetMetaData> xResultSetMetaData = uno::Reference< sdbc::XResultSetMetaDataSupplier>(m_xRowSet,uno::UNO_QUERY)->getMetaData(); + ::std::vector<sal_Int32> aColumnTypes; uno::Sequence< uno::Any > aLabelArgs(1); const sal_Int32 nCount = aColumns.getLength(); + if ( nCount ) + aColumnTypes.push_back(xResultSetMetaData->getColumnType(1)); for (sal_Int32 i = 1; i < nCount; ++i) { - aLabelArgs[0] <<= aColumns[i]; // i == 0 is the category - const ::rtl::OUString sLabelRange = lcl_getLabel() + ::rtl::OUString::valueOf(i - 1); - m_xInternal->setDataByRangeRepresentation(sLabelRange,aLabelArgs); + aColumnTypes.push_back(xResultSetMetaData->getColumnType(i+1)); + } // for (sal_Int32 i = 1; i < nCount; ++i) + + const ::rtl::OUString* pIter = aColumns.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aColumns.getLength(); + for(sal_Int32 k = 0;pIter != pEnd;++pIter,++k) + { + uno::Reference< beans::XPropertySet> xColumn(xColumns->getByName(*pIter),uno::UNO_QUERY); + if ( xColumn.is() ) + { + m_aNumberFormats.insert( ::std::map< ::rtl::OUString,uno::Any>::value_type(::rtl::OUString::valueOf(k),xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT))); + } } - ::std::vector< ::std::vector< uno::Any > > aDataValues(nCount); + ::std::vector< ::rtl::OUString > aRowLabels; + ::std::vector< ::std::vector< double > > aDataValues; sal_Int32 nRowCount = 0; + ::connectivity::ORowSetValue aValue; while( xRes->next() && (!m_RowLimit || nRowCount < m_RowLimit) ) { ++nRowCount; - for (sal_Int32 j = 1; j <= nCount; ++j) - aDataValues[j-1].push_back(uno::makeAny(xRow->getString(j))); + + aValue.fill(1,aColumnTypes[0],xRow); + aRowLabels.push_back(aValue.getString()); + ::std::vector< double > aRow; + for (sal_Int32 j = _bHasCategories ? 2 : 1,i = 0; j <= nCount; ++j,++i) + { + aValue.fill(j,aColumnTypes[j-1],xRow); + aRow.push_back(aValue.getDouble()); + } // for (sal_Int32 j = 2,i = 0; j <= nCount; ++j,++i) + aDataValues.push_back(aRow); } // while( xRes->next() && (!m_RowLimit || nRowCount < m_RowLimit) ) + + // insert default data when no rows exist if ( !nRowCount ) { nRowCount = 3; @@ -555,30 +646,33 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw() 2.40, 8.80, 9.65, 3.10, 1.50, 3.70, 4.30, 9.02, 6.20 }; - for (sal_Int32 j = 1,k = 0; j <= nCount; ++j,++k) + for(sal_Int32 h = 0,k = 0; h < nRowCount; ++h,++k ) { - sal_Int32 nSize = sizeof(fDefaultData)/sizeof(fDefaultData[0]); - if ( k >= nSize ) - k = 0; - aDataValues[j-1].push_back(uno::makeAny(fDefaultData[k])); - } - } - ::std::vector< ::std::vector< uno::Any > >::iterator aDataValuesIter = aDataValues.begin(); - const ::std::vector< ::std::vector< uno::Any > >::iterator aDataValuesEnd = aDataValues.end(); - bool bFirst = true; - for (sal_Int32 nPos = 0;nRowCount && aDataValuesIter != aDataValuesEnd ; ++aDataValuesIter,++nPos) - { - if ( !aDataValuesIter->empty() ) - { - if ( bFirst ) + aRowLabels.push_back(::rtl::OUString::valueOf(h+1)); + ::std::vector< double > aRow; + const sal_Int32 nSize = sizeof(fDefaultData)/sizeof(fDefaultData[0]); + for (sal_Int32 j = 0; j < (nCount-1); ++j,++k) { - m_xInternal->setDataByRangeRepresentation(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("categories")),uno::Sequence< uno::Any >(&(*aDataValuesIter->begin()),aDataValuesIter->size())); - bFirst = false; - } - else - m_xInternal->setDataByRangeRepresentation(::rtl::OUString::valueOf(nPos-1),uno::Sequence< uno::Any >(&(*aDataValuesIter->begin()),aDataValuesIter->size())); + if ( k >= nSize ) + k = 0; + aRow.push_back(fDefaultData[k]); + } // for (sal_Int32 j = 0,k = 0; j < (nCount-1); ++j,++k) + aDataValues.push_back(aRow); } - } // for (sal_Int32 nPos = 0;nRowCount && aDataValuesIter != aDataValuesEnd ; ++aDataValuesIter,++nPos) + } // if ( !nRowCount ) + + uno::Reference< chart::XChartDataArray> xData(m_xInternal,uno::UNO_QUERY); + xData->setRowDescriptions(uno::Sequence< ::rtl::OUString >(&(*aRowLabels.begin()),aRowLabels.size())); + xData->setColumnDescriptions(uno::Sequence< ::rtl::OUString >(aColumns.getArray()+ (_bHasCategories ? 1 : 0),aColumns.getLength() - (_bHasCategories ? 1 : 0) )); + uno::Sequence< uno::Sequence< double > > aData(aDataValues.size()); + uno::Sequence< double >* pDataIter = aData.getArray(); + uno::Sequence< double >* pDataEnd = pDataIter + aData.getLength(); + for(sal_Int32 i= 0;pDataIter != pDataEnd; ++pDataIter,++i ) + { + if ( !aDataValues[i].empty() ) + *pDataIter = uno::Sequence< double >(&(*(aDataValues[i]).begin()),(aDataValues[i]).size()); + } + xData->setData(aData); } // ----------------------------------------------------------------------------- void DatabaseDataProvider::impl_fillRowSet_throw() @@ -743,7 +837,7 @@ void SAL_CALL DatabaseDataProvider::clearParameters() throw( SQLException, Runti void SAL_CALL DatabaseDataProvider::execute() throw( SQLException, RuntimeException ) { uno::Sequence< beans::PropertyValue > aEmpty; - createDataSourcePossible(aEmpty); + createDataSource(aEmpty); } //------------------------------------------------------------------------------ void SAL_CALL DatabaseDataProvider::addRowSetListener(const uno::Reference<sdbc::XRowSetListener>& _rListener) throw( RuntimeException ) @@ -886,4 +980,3 @@ void DatabaseDataProvider::impl_invalidateParameter_nothrow() } // ----------------------------------------------------------------------------- } // namespace dbaccess - diff --git a/dbaccess/source/ext/macromigration/makefile.mk b/dbaccess/source/ext/macromigration/makefile.mk index 880a62afc173..32be89263968 100644 --- a/dbaccess/source/ext/macromigration/makefile.mk +++ b/dbaccess/source/ext/macromigration/makefile.mk @@ -79,7 +79,8 @@ SHL1STDLIBS= \ $(SVLLIB) \ $(VCLLIB) \ $(SVXLIB) \ - $(UCBHELPERLIB) + $(UCBHELPERLIB) \ + $(XMLSCRIPTLIB) SHL1LIBS= $(SLB)$/$(TARGET).lib SHL1IMPLIB= i$(TARGET) diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index acb3cfcfca22..c1d1c41eca39 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -68,6 +68,8 @@ #include <com/sun/star/script/XEventAttacherManager.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> #include <com/sun/star/io/WrongFormatException.hpp> +#include <com/sun/star/script/XScriptEventsSupplier.hpp> +#include <com/sun/star/io/XInputStreamProvider.hpp> /** === end UNO includes === **/ #include <comphelper/documentinfo.hxx> @@ -82,6 +84,7 @@ #include <rtl/ustrbuf.hxx> #include <rtl/ref.hxx> #include <unotools/sharedunocomponent.hxx> +#include <xmlscript/xmldlg_imexp.hxx> #include <vector> #include <set> @@ -143,6 +146,9 @@ namespace dbmm using ::com::sun::star::script::ScriptEventDescriptor; using ::com::sun::star::script::XLibraryContainerPassword; using ::com::sun::star::io::WrongFormatException; + using ::com::sun::star::script::XScriptEventsSupplier; + using ::com::sun::star::io::XInputStreamProvider; + using ::com::sun::star::io::XInputStream; /** === end UNO using === **/ namespace ElementModes = ::com::sun::star::embed::ElementModes; @@ -925,6 +931,23 @@ namespace dbmm const PhaseID _nPhaseID ) const; + /** adjusts the events for the given dialog/element, taking into account the new names + of the moved libraries + */ + void impl_adjustDialogElementEvents_throw( + const Reference< XInterface >& _rxElement + ) const; + + /** adjusts the events in the given dialog, and its controls, taking into account the new names + of the moved libraries + */ + bool impl_adjustDialogEvents_nothrow( + Any& _inout_rDialogLibraryElement, + const ::rtl::OUString& _rDocName, + const ::rtl::OUString& _rDialogLibName, + const ::rtl::OUString& _rDialogName + ) const; + /** adjust the document-events which refer to macros/scripts in the document, taking into account the new names of the moved libraries */ @@ -1158,6 +1181,8 @@ namespace dbmm bSuccess = bSuccess && impl_migrateContainerLibraries_nothrow( aSubDocument, eBasic, aProgressMixer, PHASE_BASIC ) && impl_migrateContainerLibraries_nothrow( aSubDocument, eDialog, aProgressMixer, PHASE_DIALOGS ); + // order matters: First Basic scripts, then dialogs. So we can adjust references from the latter + // to the former // adjust the events in the document // (note that errors are ignored here - failure to convert a script reference @@ -1547,6 +1572,14 @@ namespace dbmm Any aElement = xSourceLib->getByName( *pSourceElementName ); OSL_ENSURE( aElement.hasValue(), "MigrationEngine_Impl::impl_migrateContainerLibraries_nothrow: invalid (empty) lib element!" ); + + // if this is a dialog, adjust the references to scripts + if ( _eScriptType == eDialog ) + { + impl_adjustDialogEvents_nothrow( aElement, lcl_getSubDocumentDescription( _rDocument ), + *pSourceLibName, *pSourceElementName ); + } + xTargetLib->insertByName( *pSourceElementName, aElement ); } @@ -1773,6 +1806,71 @@ namespace dbmm } //-------------------------------------------------------------------- + void MigrationEngine_Impl::impl_adjustDialogElementEvents_throw( const Reference< XInterface >& _rxElement ) const + { + Reference< XScriptEventsSupplier > xEventsSupplier( _rxElement, UNO_QUERY_THROW ); + Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW ); + Sequence< ::rtl::OUString > aEventNames( xEvents->getElementNames() ); + + const ::rtl::OUString* eventName = aEventNames.getArray(); + const ::rtl::OUString* eventNamesEnd = eventName + aEventNames.getLength(); + + ScriptEventDescriptor aScriptEvent; + for ( ; eventName != eventNamesEnd; ++eventName ) + { + OSL_VERIFY( xEvents->getByName( *eventName ) >>= aScriptEvent ); + + if ( !impl_adjustScriptLibrary_nothrow( aScriptEvent ) ) + continue; + + xEvents->replaceByName( *eventName, makeAny( aScriptEvent ) ); + } + } + + //-------------------------------------------------------------------- + bool MigrationEngine_Impl::impl_adjustDialogEvents_nothrow( Any& _inout_rDialogLibraryElement, + const ::rtl::OUString& _rDocName, const ::rtl::OUString& _rDialogLibName, const ::rtl::OUString& _rDialogName ) const + { + try + { + // load a dialog model from the stream describing it + Reference< XInputStreamProvider > xISP( _inout_rDialogLibraryElement, UNO_QUERY_THROW ); + Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW ); + + Reference< XNameContainer > xDialogModel( m_aContext.createComponent( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY_THROW ); + ::xmlscript::importDialogModel( xInput, xDialogModel, m_aContext.getUNOContext() ); + + // adjust the events of the dialog + impl_adjustDialogElementEvents_throw( xDialogModel ); + + // adjust the events of the controls + Sequence< ::rtl::OUString > aControlNames( xDialogModel->getElementNames() ); + const ::rtl::OUString* controlName = aControlNames.getConstArray(); + const ::rtl::OUString* controlNamesEnd = controlName + aControlNames.getLength(); + for ( ; controlName != controlNamesEnd; ++controlName ) + { + impl_adjustDialogElementEvents_throw( Reference< XInterface >( xDialogModel->getByName( *controlName ), UNO_QUERY ) ); + } + + // export dialog model + xISP = ::xmlscript::exportDialogModel( xDialogModel, m_aContext.getUNOContext() ); + _inout_rDialogLibraryElement <<= xISP; + } + catch( const Exception& ) + { + m_rLogger.logRecoverable( MigrationError( + ERR_ADJUSTING_DIALOG_EVENTS_FAILED, + _rDocName, + _rDialogLibName, + _rDialogName, + ::cppu::getCaughtException() + ) ); + return false; + } + return true; + } + + //-------------------------------------------------------------------- void MigrationEngine_Impl::impl_adjustFormComponentEvents_throw( const Reference< XIndexAccess >& _rxComponentContainer ) const { FormComponentIterator aCompIter( _rxComponentContainer ); diff --git a/dbaccess/source/ext/macromigration/migrationerror.hxx b/dbaccess/source/ext/macromigration/migrationerror.hxx index 84b972f0e9bf..fa7e058a5622 100644 --- a/dbaccess/source/ext/macromigration/migrationerror.hxx +++ b/dbaccess/source/ext/macromigration/migrationerror.hxx @@ -59,6 +59,7 @@ namespace dbmm ERR_SCRIPT_TRANSLATION_FAILURE, ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT, ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED, + ERR_ADJUSTING_DIALOG_EVENTS_FAILED, ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED, ERR_BIND_SCRIPT_STORAGE_FAILED, ERR_REMOVE_SCRIPTS_STORAGE_FAILED, @@ -136,6 +137,18 @@ namespace dbmm const MigrationErrorType _eType, const ::rtl::OUString& _rDetail1, const ::rtl::OUString& _rDetail2, + const ::rtl::OUString& _rDetail3, + const ::com::sun::star::uno::Any& _rCaughtException ) + :eType( _eType ) + ,aCaughtException( _rCaughtException ) + { + impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 ); + } + + MigrationError( + const MigrationErrorType _eType, + const ::rtl::OUString& _rDetail1, + const ::rtl::OUString& _rDetail2, const ::rtl::OUString& _rDetail3 ) :eType( _eType ) { diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx index 1b22367857aa..0d3cb09427b8 100644 --- a/dbaccess/source/ext/macromigration/migrationlog.cxx +++ b/dbaccess/source/ext/macromigration/migrationlog.cxx @@ -329,6 +329,13 @@ namespace dbmm aAsciiParameterNames.push_back( "#doc#" ); break; + case ERR_ADJUSTING_DIALOG_EVENTS_FAILED: + pAsciiErrorDescription = "adjusting events for dialog #lib#.#dlg# in document '#doc#' failed"; + aAsciiParameterNames.push_back( "#doc#" ); + aAsciiParameterNames.push_back( "#lib#" ); + aAsciiParameterNames.push_back( "#dlg#" ); + break; + case ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED: pAsciiErrorDescription = "adjusting form component events for '#doc#' failed"; aAsciiParameterNames.push_back( "#doc#" ); diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 2570822ca6e2..0b1be1189bd4 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -619,7 +619,7 @@ void OApplicationController::onDocumentOpened( const ::rtl::OUString& _rName, co try { - m_pSubComponentManager->onSubComponentOpened( _rName, _nType, _eMode, _xDocument ); + m_pSubComponentManager->onSubComponentOpened( _rName, _nType, _eMode, _rxDefinition.is() ? _rxDefinition : _xDocument ); if ( _rxDefinition.is() ) { diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index 59a552ffc7cf..8ef4f77f20c7 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -36,6 +36,8 @@ #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/awt/XTopWindow.hpp> +#include <com/sun/star/embed/XComponentSupplier.hpp> +#include <com/sun/star/ucb/XCommandProcessor.hpp> #include <com/sun/star/document/XDocumentEventBroadcaster.hpp> /** === end UNO includes === **/ @@ -73,6 +75,9 @@ namespace dbaui using ::com::sun::star::container::XEnumeration; using ::com::sun::star::util::XCloseable; using ::com::sun::star::awt::XTopWindow; + using ::com::sun::star::embed::XComponentSupplier; + using ::com::sun::star::ucb::XCommandProcessor; + using ::com::sun::star::ucb::Command; using ::com::sun::star::document::XDocumentEventBroadcaster; /** === end UNO using === **/ @@ -84,11 +89,13 @@ namespace dbaui struct SubComponentDescriptor { /// the frame which the component resides in. Must not be <NULL/> - Reference< XFrame > xFrame; + Reference< XFrame > xFrame; /// the controller of the sub component. Must not be <NULL/> - Reference< XController > xController; + Reference< XController > xController; /// the model of the sub component. Might be <NULL/> - Reference< XModel > xModel; + Reference< XModel > xModel; + /// the document definition which holds the component, if any + Reference< XCommandProcessor > xComponentCommandProcessor; SubComponentDescriptor() :xFrame() @@ -99,28 +106,53 @@ namespace dbaui SubComponentDescriptor( const Reference< XComponent >& _rxComponent ) { - xModel.set( _rxComponent, UNO_QUERY ); + if ( !impl_constructFrom( _rxComponent ) ) + { + Reference< XComponentSupplier > xCompSupp( _rxComponent, UNO_QUERY_THROW ); + Reference< XComponent > xComponent( xCompSupp->getComponent(), UNO_QUERY_THROW ); + if ( !impl_constructFrom( xComponent ) ) + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal component type." ) ), NULL ); + xComponentCommandProcessor.set( _rxComponent, UNO_QUERY_THROW ); + } + } + + inline bool is() const { return xFrame.is(); } + private: + bool impl_constructFrom( const Reference< XComponent >& _rxComponent ) + { + // is it a model? + xModel.set( _rxComponent, UNO_QUERY ); if ( xModel.is() ) + { xController.set( xModel->getCurrentController(), UNO_SET_THROW ); - else - xController.set( _rxComponent, UNO_QUERY ); - - if ( xController.is() ) xFrame.set( xController->getFrame(), UNO_SET_THROW ); + } else - xFrame.set( _rxComponent, UNO_QUERY_THROW ); + { + // is it a controller? + xController.set( _rxComponent, UNO_QUERY ); + if ( xController.is() ) + { + xFrame.set( xController->getFrame(), UNO_SET_THROW ); + } + else + { + // is it a frame? + xFrame.set( _rxComponent, UNO_QUERY ); + if ( !xFrame.is() ) + return false; - // if the given component was a frame, then ensure we have a controller - if ( xFrame.is() && !xController.is() ) - xController.set( xFrame->getController(), UNO_SET_THROW ); + // ensure we have a controller + xController.set( xFrame->getController(), UNO_SET_THROW ); + } - // if the component was a frame or a controller, then check wether there is a model (not required) - if ( !xModel.is() ) + // check wether there is a model (not required) xModel.set( xController->getModel() ); - } + } - inline bool is() const { return xFrame.is(); } + return true; + } }; struct SelectSubComponent : public ::std::unary_function< SubComponentDescriptor, Reference< XComponent > > @@ -260,8 +292,32 @@ namespace dbaui } //---------------------------------------------------------------- + bool lcl_closeComponent( const Reference< XCommandProcessor >& _rxCommandProcessor ) + { + bool bSuccess = false; + try + { + Reference< XCommandProcessor > xCommandProcessor( _rxCommandProcessor, UNO_SET_THROW ); + sal_Int32 nCommandIdentifier = xCommandProcessor->createCommandIdentifier(); + + Command aCommand; + aCommand.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "close" ) ); + xCommandProcessor->execute( aCommand, nCommandIdentifier, NULL ); + bSuccess = true; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return bSuccess; + } + + //---------------------------------------------------------------- bool lcl_closeComponent( const SubComponentDescriptor& _rComponent ) { + if ( _rComponent.xComponentCommandProcessor.is() ) + return lcl_closeComponent( _rComponent.xComponentCommandProcessor ); + Reference< XController > xController( _rComponent.xController ); OSL_ENSURE( xController.is(), "lcl_closeComponent: invalid controller!" ); diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index fad75416bb3c..a9c757a3cf70 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -37,111 +37,44 @@ #define ITEMID_LINEBREAK SID_ATTR_ALIGN_LINEBREAK #define ITEMID_MARGIN SID_ATTR_ALIGN_MARGIN -#ifndef DBAUI_FIELDDESCRIPTIONCONTROL_HXX #include "FieldDescControl.hxx" -#endif -#ifndef DBAUI_FIELDCONTROLS_HXX #include "FieldControls.hxx" -#endif -#ifndef _ZFORLIST_HXX //autogen -#define _ZFORLIST_DECLARE_TABLE // ohne das bekomme ich einen Compiler-Fehler in <svtools/zforlist.hxx> -#include <svtools/zforlist.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef DBAUI_TABLEDESIGNHELPBAR_HXX +#include <tools/diagnose_ex.h> #include "TableDesignHelpBar.hxx" -#endif -#ifndef _SV_SCRBAR_HXX #include <vcl/scrbar.hxx> -#endif -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif -#ifndef _SVX_NUMFMTSH_HXX -#include <svx/numfmtsh.hxx> -#endif -#ifndef _DBU_CONTROL_HRC_ -#include "dbu_control.hrc" -#endif -#ifndef _DBU_TBL_HRC_ -#include "dbu_tbl.hrc" -#endif - -#ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> -#endif -#ifndef _SV_FIXED_HXX #include <vcl/fixed.hxx> -#endif -#ifndef _SV_MSGBOX_HXX #include <vcl/msgbox.hxx> -#endif -#ifndef _VECTOR_ #include <vector> -#endif -#ifndef DBAUI_FIELDDESCRIPTIONS_HXX #include "FieldDescriptions.hxx" -#endif -#ifndef _SFXITEMPOOL_HXX -#include <svtools/itempool.hxx> -#endif -#ifndef DBAUI_SBATTRDLG_HXX #include "dlgattr.hxx" -#endif -#ifndef _SVX_SVXIDS_HRC +#include <svx/numfmtsh.hxx> #include <svx/svxids.hrc> -#endif -#ifndef _SVX_ALGITEM_HXX #include <svx/algitem.hxx> -#endif -#ifndef _SFXRNGITEM_HXX +#include <svtools/itempool.hxx> +#define _ZFORLIST_DECLARE_TABLE // ohne das bekomme ich einen Compiler-Fehler in <svtools/zforlist.hxx> +#include <svtools/zforlist.hxx> #include <svtools/rngitem.hxx> -#endif -#ifndef _SFXINTITEM_HXX #include <svtools/intitem.hxx> -#endif -#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <svtools/numuno.hxx> +#include <svtools/transfer.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_ #include <com/sun/star/util/NumberFormat.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATPREVIEWER_HPP_ #include <com/sun/star/util/XNumberFormatPreviewer.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ #include <com/sun/star/util/XNumberFormatTypes.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef DBAUI_ENUMTYPES_HXX #include "QEnumTypes.hxx" -#endif -#ifndef _DBA_DBACCESS_HELPID_HRC_ #include "dbaccess_helpid.hrc" -#endif -#ifndef _NUMUNO_HXX -#include <svtools/numuno.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _COMPHELPER_NUMBERS_HXX_ +#include <connectivity/dbconversion.hxx> #include <comphelper/numbers.hxx> -#endif -#ifndef DBAUI_TOOLS_HXX #include "UITools.hxx" -#endif #include <memory> -#ifndef _DBHELPER_DBCONVERSION_HXX_ -#include <connectivity/dbconversion.hxx> -#endif -#ifndef _TRANSFER_HXX -#include <svtools/transfer.hxx> -#endif +#include "dbu_control.hrc" +#include "dbu_tbl.hrc" + using namespace dbaui; using namespace dbtools; @@ -156,7 +89,6 @@ using namespace ::com::sun::star::util; // fuer die Controls auf der OFieldDescGenPage #define CONTROL_SPACING_X 18 // 6 #define CONTROL_SPACING_Y 4 -#define CONTROL_HEIGHT 10 #define CONTROL_WIDTH_1 160 // 100 #define CONTROL_WIDTH_2 100 // 60 #define CONTROL_WIDTH_3 250 @@ -185,6 +117,20 @@ namespace return nValue; } // ----------------------------------------------------------------------------- + template< typename T1, typename T2> void lcl_HideAndDeleteControl(short& _nPos,T1** _pControl,T2** _pControlText) + { + if ( *_pControl ) + { + --_nPos; + (*_pControl)->Hide(); + (*_pControlText)->Hide(); + delete *_pControl; + delete *_pControlText; + (*_pControl) = NULL; + (*_pControlText) = NULL; + } + } + } //================================================================== @@ -241,22 +187,7 @@ OFieldDescControl::OFieldDescControl( Window* pParent, const ResId& rResId, OTab { DBG_CTOR(OFieldDescControl,NULL); - m_pVertScroll = new ScrollBar(this, WB_VSCROLL | WB_REPEAT | WB_DRAG); - m_pHorzScroll = new ScrollBar(this, WB_HSCROLL | WB_REPEAT | WB_DRAG); - m_pVertScroll->SetScrollHdl(LINK(this, OFieldDescControl, OnScroll)); - m_pHorzScroll->SetScrollHdl(LINK(this, OFieldDescControl, OnScroll)); - m_pVertScroll->Show(); - m_pHorzScroll->Show(); - - m_pVertScroll->EnableClipSiblings(); - m_pHorzScroll->EnableClipSiblings(); - - m_pVertScroll->SetLineSize(1); - m_pVertScroll->SetPageSize(1); - m_pHorzScroll->SetLineSize(1); - m_pHorzScroll->SetPageSize(1); - - m_nOldVThumb = m_nOldHThumb = 0; + Contruct(); } //------------------------------------------------------------------------------ OFieldDescControl::OFieldDescControl( Window* pParent, OTableDesignHelpBar* pHelpBar ) @@ -305,7 +236,11 @@ OFieldDescControl::OFieldDescControl( Window* pParent, OTableDesignHelpBar* pHel ,pActFieldDescr(NULL) { DBG_CTOR(OFieldDescControl,NULL); - + Contruct(); +} +// ----------------------------------------------------------------------------- +void OFieldDescControl::Contruct() +{ m_pVertScroll = new ScrollBar(this, WB_VSCROLL | WB_REPEAT | WB_DRAG); m_pHorzScroll = new ScrollBar(this, WB_HSCROLL | WB_REPEAT | WB_DRAG); m_pVertScroll->SetScrollHdl(LINK(this, OFieldDescControl, OnScroll)); @@ -322,7 +257,6 @@ OFieldDescControl::OFieldDescControl( Window* pParent, OTableDesignHelpBar* pHel m_pHorzScroll->SetPageSize(1); m_nOldVThumb = m_nOldHThumb = 0; - } //------------------------------------------------------------------------------ @@ -451,7 +385,7 @@ void OFieldDescControl::CheckScrollBars() sal_uInt16 nActive = CountActiveAggregates(); // welches ist das letzte, was ganz drauf passt ? sal_uInt16 nLastVisible; - const sal_Int32 nControlHeight = LogicToPixel(Size(0, CONTROL_HEIGHT),MAP_APPFONT).Height(); + const sal_Int32 nControlHeight = GetMaxControlHeight(); const sal_Int32 nControl_Spacing_y = LogicToPixel(Size(0, CONTROL_SPACING_Y),MAP_APPFONT).Height(); if (bNeedHScrollBar) nLastVisible = static_cast<sal_uInt16>((szOverallSize.Height() - nControl_Spacing_y - nHScrollHeight) / (nControl_Spacing_y + nControlHeight)); @@ -536,7 +470,7 @@ void OFieldDescControl::ScrollAllAggregates() if (m_nOldVThumb != m_pVertScroll->GetThumbPos()) { - const sal_Int32 nControlHeight = LogicToPixel(Size(0, CONTROL_HEIGHT),MAP_APPFONT).Height(); + const sal_Int32 nControlHeight = GetMaxControlHeight(); const sal_Int32 nControl_Spacing_y = LogicToPixel(Size(0, CONTROL_SPACING_Y),MAP_APPFONT).Height(); nDeltaY = (m_nOldVThumb - m_pVertScroll->GetThumbPos()) * (nControl_Spacing_y + nControlHeight); m_nOldVThumb = m_pVertScroll->GetThumbPos(); @@ -573,7 +507,23 @@ sal_uInt16 OFieldDescControl::CountActiveAggregates() const ++nVisibleAggregates; return nVisibleAggregates; } +//------------------------------------------------------------------------------ +sal_Int32 OFieldDescControl::GetMaxControlHeight() const +{ + Size aHeight; + Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; + for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + { + if ( ppAggregates[i] ) + { + const Size aTemp( ppAggregates[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) ); + if ( aTemp.Height() > aHeight.Height() ) + aHeight.Height() = aTemp.Height(); + } // if ( ppAggregates[i] ) + } + return aHeight.Height(); +} //------------------------------------------------------------------------------ void OFieldDescControl::SetReadOnly( sal_Bool bReadOnly ) { @@ -909,7 +859,8 @@ void OFieldDescControl::ArrangeAggregates() // die Z-Order so, dass die Controls auch wirklich in derselben Reihenfolge durchwandert werden koennen, in der sie // hier angeordnet wurden - adAggregates[i].pctrlInputControl->SetZOrder(pZOrderPredecessor, pZOrderPredecessor ? WINDOW_ZORDER_BEHIND : WINDOW_ZORDER_FIRST); + adAggregates[i].pctrlTextControl->SetZOrder(pZOrderPredecessor, pZOrderPredecessor ? WINDOW_ZORDER_BEHIND : WINDOW_ZORDER_FIRST); + adAggregates[i].pctrlInputControl->SetZOrder(adAggregates[i].pctrlTextControl, WINDOW_ZORDER_BEHIND ); pZOrderPredecessor = adAggregates[i].pctrlInputControl; if (adAggregates[i].pctrlInputControl == pFormatSample) @@ -947,36 +898,18 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) if( pDefault ) return; m_nPos++; - pDefaultText =new FixedText( this ); - pDefaultText->SetText( ModuleRes(STR_DEFAULT_VALUE) ); + pDefaultText = CreateText(STR_DEFAULT_VALUE); pDefault = new OPropEditCtrl( this, STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT, WB_BORDER ); - pDefault->SetHelpId(HID_TAB_ENT_DEFAULT); - // SetPosSize( (Control**)&pDefaultText, m_nPos, 0 ); - // SetPosSize( (Control**)&pDefault, m_nPos, 3 ); - - pDefault->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pDefault->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - pDefaultText->EnableClipSiblings(); - pDefault->EnableClipSiblings(); + InitializeControl(pDefault,HID_TAB_ENT_DEFAULT,false); break; case tpAutoIncrementValue: if( m_pAutoIncrementValue || !isAutoIncrementValueEnabled() ) return; m_nPos++; - m_pAutoIncrementValueText =new FixedText( this ); - m_pAutoIncrementValueText->SetText( ModuleRes(STR_AUTOINCREMENT_VALUE) ); + m_pAutoIncrementValueText = CreateText(STR_AUTOINCREMENT_VALUE); m_pAutoIncrementValue = new OPropEditCtrl( this, STR_HELP_AUTOINCREMENT_VALUE, FIELD_PRPOERTY_AUTOINCREMENT, WB_BORDER ); - m_pAutoIncrementValue->SetHelpId(HID_TAB_AUTOINCREMENTVALUE); - // SetPosSize( (Control**)&m_pAutoIncrementValueText, m_nPos, 0 ); - // SetPosSize( (Control**)&m_pAutoIncrementValue, m_nPos, 3 ); - - m_pAutoIncrementValue->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - m_pAutoIncrementValue->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - m_pAutoIncrementValueText->EnableClipSiblings(); - m_pAutoIncrementValue->EnableClipSiblings(); m_pAutoIncrementValue->SetText( getAutoIncrementValue() ); + InitializeControl(m_pAutoIncrementValue,HID_TAB_AUTOINCREMENTVALUE,false); break; case tpRequired: @@ -988,21 +921,14 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) if(xMetaData.is() && xMetaData->supportsNonNullableColumns()) { m_nPos++; - pRequiredText =new FixedText( this ); - pRequiredText->SetText( ModuleRes(STR_FIELD_REQUIRED) ); + pRequiredText = CreateText(STR_FIELD_REQUIRED); pRequired = new OPropListBoxCtrl( this, STR_HELP_FIELD_REQUIRED, FIELD_PROPERTY_REQUIRED, WB_DROPDOWN); - pRequired->SetHelpId(HID_TAB_ENT_REQUIRED); pRequired->InsertEntry( aYes ); pRequired->InsertEntry( aNo ); pRequired->SelectEntryPos(1); - pRequired->SetSelectHdl(LINK(this,OFieldDescControl,ChangeHdl)); - - pRequired->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pRequired->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - pRequiredText->EnableClipSiblings(); - pRequired->EnableClipSiblings(); + InitializeControl(pRequired,HID_TAB_ENT_REQUIRED,true); } } break; @@ -1011,53 +937,28 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) if( pAutoIncrement ) return; m_nPos++; - pAutoIncrementText =new FixedText( this ); - pAutoIncrementText->SetText( ModuleRes(STR_FIELD_AUTOINCREMENT) ); + pAutoIncrementText = CreateText(STR_FIELD_AUTOINCREMENT); pAutoIncrement = new OPropListBoxCtrl( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_AUTOINC, WB_DROPDOWN ); - pAutoIncrement->SetHelpId(HID_TAB_ENT_AUTOINCREMENT); - pAutoIncrement->InsertEntry( aYes ); pAutoIncrement->InsertEntry( aNo ); pAutoIncrement->SelectEntryPos(0); - pAutoIncrement->SetSelectHdl(LINK(this,OFieldDescControl,ChangeHdl)); - - pAutoIncrement->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pAutoIncrement->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - pAutoIncrementText->EnableClipSiblings(); - pAutoIncrement->EnableClipSiblings(); + InitializeControl(pAutoIncrement,HID_TAB_ENT_AUTOINCREMENT,true); } break; case tpTextLen: if( pTextLen ) return; m_nPos++; - pTextLenText =new FixedText( this ); - pTextLenText->SetText( ModuleRes(STR_TEXT_LENGTH) ); - - pTextLen = new OPropNumericEditCtrl( this, STR_HELP_TEXT_LENGTH, FIELD_PROPERTY_TEXTLEN, WB_BORDER ); - pTextLen->SetDecimalDigits(0); - pTextLen->SetMin(0); - pTextLen->SetMax(0x7FFFFFFF); // soll draussen geaendert werden, wenn noetig - pTextLen->SetStrictFormat(TRUE); - - pTextLen->SetHelpId(HID_TAB_ENT_TEXT_LEN); - - pTextLen->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pTextLen->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - pTextLenText->EnableClipSiblings(); - pTextLen->EnableClipSiblings(); + pTextLenText = CreateText(STR_TEXT_LENGTH); + pTextLen = CreateNumericControl(STR_HELP_TEXT_LENGTH, FIELD_PROPERTY_TEXTLEN,HID_TAB_ENT_TEXT_LEN); break; case tpType: if( m_pType) return; m_nPos++; - m_pTypeText =new FixedText( this ); - m_pTypeText->SetText( ModuleRes(STR_TAB_FIELD_DATATYPE) ); + m_pTypeText = CreateText(STR_TAB_FIELD_DATATYPE); m_pType = new OPropListBoxCtrl( this, STR_HELP_AUTOINCREMENT, FIELD_PRPOERTY_TYPE, WB_DROPDOWN ); - m_pType->SetHelpId(HID_TAB_ENT_TYPE); m_pType->SetDropDownLineCount(20); { const OTypeInfoMap* pTypeInfo = getTypeInfo(); @@ -1066,50 +967,48 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) m_pType->InsertEntry( aIter->second->aUIName ); } m_pType->SelectEntryPos(0); - m_pType->SetSelectHdl(LINK(this,OFieldDescControl,ChangeHdl)); - - m_pType->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - m_pType->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - m_pTypeText->EnableClipSiblings(); - m_pType->EnableClipSiblings(); + InitializeControl(m_pType,HID_TAB_ENT_TYPE,true); break; case tpColumnName: if( m_pColumnName ) return; m_nPos++; { - Reference< XDatabaseMetaData> xMetaData = getMetaData(); - sal_uInt32 nMax = xMetaData.is() ? xMetaData->getMaxColumnNameLength() : EDIT_NOLIMIT; - m_pColumnNameText =new FixedText( this ); - m_pColumnNameText->SetText( ModuleRes(STR_TAB_FIELD_NAME) ); - ::rtl::OUString aTmpString( xMetaData.is() ? xMetaData->getExtraNameCharacters() : ::rtl::OUString() ); + sal_uInt32 nMax = EDIT_NOLIMIT; + ::rtl::OUString aTmpString; + try + { + Reference< XDatabaseMetaData> xMetaData = getMetaData(); + if ( xMetaData.is() ) + { + nMax = xMetaData->getMaxColumnNameLength(); + aTmpString = xMetaData->getExtraNameCharacters(); + } + } + catch(Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } + m_pColumnNameText = CreateText(STR_TAB_FIELD_NAME); m_pColumnName = new OPropColumnEditCtrl( this, aTmpString, STR_HELP_DEFAULT_VALUE, FIELD_PRPOERTY_COLUMNNAME, WB_BORDER ); - m_pColumnName->SetHelpId(HID_TAB_ENT_COLUMNNAME); m_pColumnName->SetMaxTextLen(xub_StrLen( nMax ? nMax : EDIT_NOLIMIT)); m_pColumnName->setCheck( isSQL92CheckEnabled(getConnection()) ); } - m_pColumnName->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - m_pColumnName->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - m_pColumnNameText->EnableClipSiblings(); - m_pColumnName->EnableClipSiblings(); + InitializeControl(m_pColumnName,HID_TAB_ENT_COLUMNNAME,false); break; case tpNumType: if( pNumType ) return; m_nPos++; - pNumTypeText =new FixedText( this ); - pNumTypeText->SetText( ModuleRes(STR_NUMERIC_TYPE) ); + pNumTypeText = CreateText(STR_NUMERIC_TYPE); pNumType = new OPropListBoxCtrl( this, STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE, WB_DROPDOWN ); pNumType->SetDropDownLineCount(5); - pNumType->SetHelpId(HID_TAB_ENT_NUMTYP); pNumType->InsertEntry( String::CreateFromAscii("Byte") ); pNumType->InsertEntry( String::CreateFromAscii("SmallInt") ); @@ -1117,84 +1016,41 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) pNumType->InsertEntry( String::CreateFromAscii("Single") ); pNumType->InsertEntry( String::CreateFromAscii("Double") ); pNumType->SelectEntryPos(2); - pNumType->SetSelectHdl(LINK(this,OFieldDescControl,ChangeHdl)); - - pNumType->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pNumType->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - pNumTypeText->EnableClipSiblings(); - pNumType->EnableClipSiblings(); + InitializeControl(pNumType,HID_TAB_ENT_NUMTYP,true); break; case tpLength: if( pLength ) return; m_nPos++; - pLengthText =new FixedText( this ); - pLengthText->SetText( ModuleRes(STR_LENGTH) ); - - pLength = new OPropNumericEditCtrl( this, STR_HELP_LENGTH, FIELD_PROPERTY_LENGTH, WB_BORDER ); - pLength->SetDecimalDigits(0); - pLength->SetMin(0); - pLength->SetMax(0x7FFFFFFF); // soll draussen geaendert werden, wenn noetig - pLength->SetStrictFormat(TRUE); - - pLength->SetHelpId(HID_TAB_ENT_LEN); - - pLength->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pLength->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - pLengthText->EnableClipSiblings(); - pLength->EnableClipSiblings(); + pLengthText = CreateText(STR_LENGTH); + pLength = CreateNumericControl(STR_HELP_LENGTH, FIELD_PROPERTY_LENGTH,HID_TAB_ENT_LEN); break; case tpScale: if( pScale ) return; m_nPos++; - pScaleText =new FixedText( this ); - pScaleText->SetText( ModuleRes(STR_SCALE) ); - pScale = new OPropNumericEditCtrl( this, STR_HELP_SCALE, FIELD_PROPERTY_SCALE, WB_BORDER ); - pScale->SetDecimalDigits(0); - pScale->SetMin(0); - pScale->SetMax(0x7FFFFFFF); // soll draussen geaendert werden, wenn noetig - pScale->SetStrictFormat(TRUE); - - pScale->SetHelpId(HID_TAB_ENT_SCALE); - - pScale->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pScale->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - pScaleText->EnableClipSiblings(); - pScale->EnableClipSiblings(); + pScaleText = CreateText(STR_SCALE); + pScale = CreateNumericControl(STR_HELP_SCALE, FIELD_PROPERTY_SCALE,HID_TAB_ENT_SCALE); break; case tpFormat: if (!pFormat) { m_nPos++; - pFormatText =new FixedText( this ); - pFormatText->SetText( ModuleRes(STR_FORMAT) ); + pFormatText = CreateText(STR_FORMAT); pFormatSample = new OPropEditCtrl( this, STR_HELP_FORMAT_CODE, -1, WB_BORDER ); - pFormatSample->SetHelpId(HID_TAB_ENT_FORMAT_SAMPLE); pFormatSample->SetReadOnly(sal_True); pFormatSample->Enable(sal_False); + InitializeControl(pFormatSample,HID_TAB_ENT_FORMAT_SAMPLE,false); pFormat = new PushButton( this, ModuleRes(PB_FORMAT) ); - pFormat->SetHelpId(HID_TAB_ENT_FORMAT); - const sal_Int32 nControlHeight = LogicToPixel(Size(0, CONTROL_HEIGHT),MAP_APPFONT).Height(); + const sal_Int32 nControlHeight = GetMaxControlHeight(); pFormat->SetSizePixel(Size(nControlHeight, nControlHeight)); pFormat->SetClickHdl( LINK( this, OFieldDescControl, FormatClickHdl ) ); - - pFormatSample->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pFormatSample->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - pFormat->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pFormat->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - pFormatText->EnableClipSiblings(); - pFormatSample->EnableClipSiblings(); - pFormat->EnableClipSiblings(); + InitializeControl(pFormat,HID_TAB_ENT_FORMAT,false); } UpdateFormatSample(pActFieldDescr); @@ -1204,25 +1060,49 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) return; m_nPos++; - pBoolDefaultText =new FixedText(this); - pBoolDefaultText->SetText(ModuleRes(STR_DEFAULT_VALUE)); + pBoolDefaultText = CreateText(STR_DEFAULT_VALUE); pBoolDefault = new OPropListBoxCtrl( this, STR_HELP_BOOL_DEFAULT, FIELD_PROPERTY_BOOL_DEFAULT, WB_DROPDOWN ); pBoolDefault->SetDropDownLineCount(3); pBoolDefault->InsertEntry(String(ModuleRes(STR_VALUE_NONE))); pBoolDefault->InsertEntry(aYes); pBoolDefault->InsertEntry(aNo); - pBoolDefault->SetHelpId(HID_TAB_ENT_BOOL_DEFAULT); - pBoolDefault->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); - pBoolDefault->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); - - pBoolDefaultText->EnableClipSiblings(); - pBoolDefault->EnableClipSiblings(); + InitializeControl(pBoolDefault,HID_TAB_ENT_BOOL_DEFAULT,false); break; - } } +// ----------------------------------------------------------------------------- +void OFieldDescControl::InitializeControl(Control* _pControl,ULONG _nHelpId,bool _bAddChangeHandler) +{ + _pControl->SetHelpId(_nHelpId); + if ( _bAddChangeHandler ) + ((OPropListBoxCtrl*)_pControl)->SetSelectHdl(LINK(this,OFieldDescControl,ChangeHdl)); + _pControl->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot)); + _pControl->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost)); + _pControl->EnableClipSiblings(); +} +// ----------------------------------------------------------------------------- +FixedText* OFieldDescControl::CreateText(USHORT _nTextRes) +{ + FixedText* pFixedText = new FixedText( this ); + pFixedText->SetText( ModuleRes(_nTextRes) ); + pFixedText->EnableClipSiblings(); + return pFixedText; +} +// ----------------------------------------------------------------------------- +OPropNumericEditCtrl* OFieldDescControl::CreateNumericControl(USHORT _nHelpStr,short _nProperty,ULONG _nHelpId) +{ + OPropNumericEditCtrl* pControl = new OPropNumericEditCtrl( this, _nHelpStr, _nProperty, WB_BORDER ); + pControl->SetDecimalDigits(0); + pControl->SetMin(0); + pControl->SetMax(0x7FFFFFFF); // soll draussen geaendert werden, wenn noetig + pControl->SetStrictFormat(TRUE); + + InitializeControl(pControl,_nHelpId,false); + + return pControl; +} //------------------------------------------------------------------------------ void OFieldDescControl::DeactivateAggregate( EControlType eType ) { @@ -1233,150 +1113,58 @@ void OFieldDescControl::DeactivateAggregate( EControlType eType ) switch( eType ) { case tpDefault: - if( !pDefault ) - return; - m_nPos--; - pDefault->Hide(); - pDefaultText->Hide(); - delete pDefault; - delete pDefaultText; - pDefault = NULL; - pDefaultText =NULL; + lcl_HideAndDeleteControl(m_nPos,&pDefault,&pDefaultText); break; case tpAutoIncrementValue: - if( !m_pAutoIncrementValue ) - return; - m_nPos--; - m_pAutoIncrementValue->Hide(); - m_pAutoIncrementValueText->Hide(); - delete m_pAutoIncrementValue; - delete m_pAutoIncrementValueText; - m_pAutoIncrementValue = NULL; - m_pAutoIncrementValueText =NULL; + lcl_HideAndDeleteControl(m_nPos,&m_pAutoIncrementValue,&m_pAutoIncrementValueText); break; case tpColumnName: - if( !m_pColumnName ) - return; - m_nPos--; - m_pColumnName->Hide(); - m_pColumnNameText->Hide(); - delete m_pColumnName; - delete m_pColumnNameText; - m_pColumnName = NULL; - m_pColumnNameText =NULL; + lcl_HideAndDeleteControl(m_nPos,&m_pColumnName,&m_pColumnNameText); break; case tpType: - if( !m_pType ) - return; - m_nPos--; - m_pType->Hide(); - m_pTypeText->Hide(); - delete m_pType; - delete m_pTypeText; - m_pType = NULL; - m_pTypeText =NULL; + lcl_HideAndDeleteControl(m_nPos,&m_pType,&m_pTypeText); break; case tpAutoIncrement: - if( !pAutoIncrement ) - return; - m_nPos--; - pAutoIncrement->Hide(); - pAutoIncrementText->Hide(); - delete pAutoIncrement; - delete pAutoIncrementText; - pAutoIncrement = NULL; - pAutoIncrementText =NULL; + lcl_HideAndDeleteControl(m_nPos,&pAutoIncrement,&pAutoIncrementText); break; case tpRequired: - if( !pRequired ) - return; - m_nPos--; - pRequired->Hide(); - pRequiredText->Hide(); - delete pRequired; - delete pRequiredText; - pRequired = NULL; - pRequiredText =NULL; + lcl_HideAndDeleteControl(m_nPos,&pRequired,&pRequiredText); break; case tpTextLen: - if( !pTextLen ) - return; - m_nPos--; - pTextLen->Hide(); - pTextLenText->Hide(); - delete pTextLen; - delete pTextLenText; - pTextLen = NULL; - pTextLenText =NULL; + lcl_HideAndDeleteControl(m_nPos,&pTextLen,&pTextLenText); break; case tpNumType: - if( !pNumType ) - return; - m_nPos--; - pNumType->Hide(); - pNumTypeText->Hide(); - delete pNumType; - delete pNumTypeText; - pNumType = NULL; - pNumTypeText =NULL; + lcl_HideAndDeleteControl(m_nPos,&pNumType,&pNumTypeText); break; case tpLength: - if( !pLength ) - return; - m_nPos--; - pLength->Hide(); - pLengthText->Hide(); - delete pLength; - delete pLengthText; - pLength = NULL; - pLengthText =NULL; + lcl_HideAndDeleteControl(m_nPos,&pLength,&pLengthText); break; case tpScale: - if( !pScale ) - return; - m_nPos--; - pScale->Hide(); - pScaleText->Hide(); - delete pScale; - delete pScaleText; - pScale = NULL; - pScaleText =NULL; + lcl_HideAndDeleteControl(m_nPos,&pScale,&pScaleText); break; case tpFormat: - if( !pFormat ) - return; - pFormatText->Hide(); - pFormatSample->Hide(); - pFormat->Hide(); - delete pFormatText; - delete pFormatSample; - delete pFormat; - pFormatText =NULL; - pFormatSample = NULL; - pFormat = NULL; + // TODO: we have to check if we have to increment m_nPos again + lcl_HideAndDeleteControl(m_nPos,&pFormat,&pFormatText); + if ( pFormatSample ) + { + pFormatSample->Hide(); + delete pFormatSample; + pFormatSample = NULL; + } break; case tpBoolDefault: - if (!pBoolDefault) - return; - m_nPos--; - pBoolDefault->Hide(); - pBoolDefaultText->Hide(); - delete pBoolDefault; - delete pBoolDefaultText; - pBoolDefault = NULL; - pBoolDefaultText =NULL; + lcl_HideAndDeleteControl(m_nPos,&pBoolDefault,&pBoolDefaultText); break; - } } @@ -1387,48 +1175,28 @@ void OFieldDescControl::SetPosSize( Control** ppControl, long nRow, sal_uInt16 n ////////////////////////////////////////////////////////////////////// // Groesse ermitteln - const sal_Int32 nControlHeight = LogicToPixel(Size(0, CONTROL_HEIGHT),MAP_APPFONT).Height(); - Size aSize; - switch( nCol ) + const sal_Int32 nControlHeight = GetMaxControlHeight(); + Size aSize(0,nControlHeight); + if ( isRightAligned() && nCol ) + aSize.Width() = LogicToPixel(Size(m_nWidth, 0),MAP_APPFONT).Width(); + else { - case 0: - aSize.Width() = CONTROL_WIDTH_1; - aSize.Height() = nControlHeight; - break; - case 1: - if ( isRightAligned() ) - aSize.Width() = LogicToPixel(Size(m_nWidth, 0),MAP_APPFONT).Width(); - else - aSize.Width() = CONTROL_WIDTH_2; - aSize.Height() = nControlHeight; - break; - case 2: - if ( isRightAligned() ) - aSize.Width() = LogicToPixel(Size(m_nWidth, 0),MAP_APPFONT).Width(); - else + switch( nCol ) + { + case 0: + default: + aSize.Width() = CONTROL_WIDTH_1; + break; + case 1: aSize.Width() = CONTROL_WIDTH_2; - aSize.Height() = long(1.5*nControlHeight); - break; - case 3: - if ( isRightAligned() ) - aSize.Width() = LogicToPixel(Size(m_nWidth, 0),MAP_APPFONT).Width(); - else + break; + case 3: aSize.Width() = CONTROL_WIDTH_3; - aSize.Height() = nControlHeight; - break; - case 4: - if ( isRightAligned() ) - aSize.Width() = LogicToPixel(Size(m_nWidth, 0),MAP_APPFONT).Width(); - else + break; + case 4: aSize.Width() = CONTROL_WIDTH_4; - aSize.Height() = nControlHeight; - break; - default: - if ( isRightAligned() ) - aSize.Width() = LogicToPixel(Size(m_nWidth, 0),MAP_APPFONT).Width(); - else - aSize.Width() = CONTROL_WIDTH_1; - aSize.Height() = nControlHeight; + break; + } // switch( nCol ) } @@ -1442,7 +1210,6 @@ void OFieldDescControl::SetPosSize( Control** ppControl, long nRow, sal_uInt16 n aPosition.Y() = 1; break; case 1: - case 2: case 3: case 4: if ( isRightAligned() ) @@ -1965,12 +1732,8 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr ) //------------------------------------------------------------------------------ void OFieldDescControl::UpdateFormatSample(OFieldDescription* pFieldDescr) { - if(!pFieldDescr) - return; - if(!pFormatSample) - return; - - pFormatSample->SetText(getControlDefault(pFieldDescr,sal_False)); + if ( pFieldDescr && pFormatSample ) + pFormatSample->SetText(getControlDefault(pFieldDescr,sal_False)); } //------------------------------------------------------------------------------ @@ -2169,8 +1932,3 @@ String OFieldDescControl::getControlDefault( const OFieldDescription* _pFieldDes return sDefault; } // ----------------------------------------------------------------------------- - - - - - diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx index c65285cf414a..5b089f764337 100644 --- a/dbaccess/source/ui/control/opendoccontrols.cxx +++ b/dbaccess/source/ui/control/opendoccontrols.cxx @@ -300,14 +300,10 @@ namespace dbaui aURL.SetPass( sPassword ); if ( !sTitle.Len() ) - sTitle = aURL.getName(); + sTitle = aURL.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_UNAMBIGUOUS ); String sDecodedURL = aURL.GetMainURL( INetURLObject::NO_DECODE ); -// sTitle.AppendAscii( " (" ); -// sTitle += String( ::svt::OFileNotation( sDecodedURL ).get( ::svt::OFileNotation::N_SYSTEM ) ); -// sTitle.AppendAscii( ")" ); - USHORT nPos = InsertEntry( sTitle ); m_aURLs.insert( MapIndexToStringPair::value_type( nPos, StringPair( sDecodedURL, sFilter ) ) ); } diff --git a/dbaccess/source/ui/dlg/UserAdmin.hxx b/dbaccess/source/ui/dlg/UserAdmin.hxx index 57c7a59a140c..b4eae1591b3d 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.hxx +++ b/dbaccess/source/ui/dlg/UserAdmin.hxx @@ -79,7 +79,6 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUsers; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xORB; ::com::sun::star::uno::Sequence< ::rtl::OUString> m_aUserNames; String m_UserName; @@ -93,8 +92,6 @@ protected: OUserAdmin( Window* pParent, const SfxItemSet& _rCoreAttrs); public: - void setServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB) { m_xORB = _xORB; } - static SfxTabPage* Create( Window* pParent, const SfxItemSet& _rAttrSet ); ~OUserAdmin(); diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 80b8b389c45a..6df5537544a4 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -316,7 +316,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent if (pCollectionItem) m_pCollection = pCollectionItem->getCollection(); - DBG_ASSERT(m_pCollection, "OGeneralPage::OGeneralPage : really need a DSN type collection !"); + DBG_ASSERT(m_pCollection, "ODbTypeWizDialogSetup::ODbTypeWizDialogSetup : really need a DSN type collection !"); FreeResource(); diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx index bd5a4c1e6392..cc8f01dd4daf 100644 --- a/dbaccess/source/ui/dlg/sqlmessage.cxx +++ b/dbaccess/source/ui/dlg/sqlmessage.cxx @@ -258,6 +258,14 @@ namespace ExceptionDisplayInfo( SQLExceptionInfo::TYPE _eType ) : eType( _eType ), bSubEntry( false ) { } }; + static bool lcl_hasDetails( const ExceptionDisplayInfo& _displayInfo ) + { + return ( _displayInfo.sErrorCode.Len() ) + || ( _displayInfo.sSQLState.Len() + && !_displayInfo.sSQLState.EqualsAscii( "S1000" ) + ); + } + typedef ::std::vector< ExceptionDisplayInfo > ExceptionDisplayChain; //------------------------------------------------------------------------------ @@ -303,11 +311,19 @@ namespace ExceptionDisplayInfo aDisplayInfo( aCurrentElement.getType() ); - aDisplayInfo.sMessage = pCurrentError->Message; + aDisplayInfo.sMessage = pCurrentError->Message.trim(); aDisplayInfo.sSQLState = pCurrentError->SQLState; if ( pCurrentError->ErrorCode ) aDisplayInfo.sErrorCode = String::CreateFromInt32( pCurrentError->ErrorCode ); + if ( !aDisplayInfo.sMessage.Len() + && !lcl_hasDetails( aDisplayInfo ) + ) + { + OSL_ENSURE( false, "lcl_buildExceptionChain: useles exception: no state, no error code, no message!" ); + continue; + } + aDisplayInfo.pImageProvider = _rFactory.getImageProvider( aCurrentElement.getType() ); aDisplayInfo.pLabelProvider = _rFactory.getLabelProvider( aCurrentElement.getType(), false ); @@ -685,7 +701,25 @@ void OSQLMessageBox::impl_createStandardButtons( WinBits _nStyle ) void OSQLMessageBox::impl_addDetailsButton() { size_t nFirstPageVisible = m_aMessage.IsVisible() ? 2 : 1; + bool bMoreDetailsAvailable = m_pImpl->aDisplayInfo.size() > nFirstPageVisible; + if ( !bMoreDetailsAvailable ) + { + // even if the text fits into what we can display, we might need to details button + // if there is more non-trivial information in the errors than the mere messages + for ( ExceptionDisplayChain::const_iterator error = m_pImpl->aDisplayInfo.begin(); + error != m_pImpl->aDisplayInfo.end(); + ++error + ) + { + if ( lcl_hasDetails( *error ) ) + { + bMoreDetailsAvailable = true; + break; + } + } + } + if ( bMoreDetailsAvailable ) { AddButton( BUTTON_MORE, BUTTONID_MORE, 0 ); diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx index ca0e411a09cd..c77942cd71c0 100644 --- a/dbaccess/source/ui/inc/FieldDescControl.hxx +++ b/dbaccess/source/ui/inc/FieldDescControl.hxx @@ -160,6 +160,10 @@ namespace dbaui void ScrollAllAggregates(); sal_Bool isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const; + void Contruct(); + OPropNumericEditCtrl* CreateNumericControl(USHORT _nHelpStr,short _nProperty,ULONG _nHelpId); + FixedText* CreateText(USHORT _nTextRes); + void InitializeControl(Control* _pControl,ULONG _nHelpId,bool _bAddChangeHandler); protected: inline void setRightAligned() { m_bRightAligned = true; } @@ -169,7 +173,8 @@ namespace dbaui inline OFieldDescription* getCurrentFieldDescData() { return pActFieldDescr; } inline void setCurrentFieldDescData( OFieldDescription* _pDesc ) { pActFieldDescr = _pDesc; } - USHORT CountActiveAggregates() const; + sal_uInt16 CountActiveAggregates() const; + sal_Int32 GetMaxControlHeight() const; virtual void ActivateAggregate( EControlType eType ); virtual void DeactivateAggregate( EControlType eType ); diff --git a/dbaccess/source/ui/inc/FieldDescriptions.hxx b/dbaccess/source/ui/inc/FieldDescriptions.hxx index 7b54d2617bc3..ee473b032853 100644 --- a/dbaccess/source/ui/inc/FieldDescriptions.hxx +++ b/dbaccess/source/ui/inc/FieldDescriptions.hxx @@ -123,6 +123,7 @@ namespace dbaui sal_Int32 GetFormatKey() const; SvxCellHorJustify GetHorJustify() const; TOTypeInfoSP getTypeInfo() const; + TOTypeInfoSP getSpecialTypeInfo() const; sal_Bool IsAutoIncrement() const; sal_Bool IsPrimaryKey() const; sal_Bool IsCurrency() const; diff --git a/dbaccess/source/ui/inc/dbu_rel.hrc b/dbaccess/source/ui/inc/dbu_rel.hrc index 1e0e2f3423da..c8d224cbdcad 100644 --- a/dbaccess/source/ui/inc/dbu_rel.hrc +++ b/dbaccess/source/ui/inc/dbu_rel.hrc @@ -41,9 +41,10 @@ #define STR_QUERY_REL_DELETE_WINDOW RID_STR_REL_START + 3 #define STR_QUERY_REL_EDIT RID_STR_REL_START + 4 #define STR_QUERY_REL_CREATE RID_STR_REL_START + 5 +#define STR_QUERY_REL_COULD_NOT_CREATE RID_STR_REL_START + 6 // please adjust checking before insert new strings -#if STR_QUERY_REL_DELETE_WINDOW > RID_STR_REL_END +#if STR_QUERY_REL_COULD_NOT_CREATE > RID_STR_REL_END #error Resource-Id Ueberlauf in #file, #line #endif diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index dc71f6588828..880bb91b3727 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -234,7 +234,7 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection, sal_Int32 nType = aValue; ++nPos; - if( nType == DataType::VARCHAR) + if( nType == DataType::VARCHAR ) { m_pTypeInfo = TOTypeInfoSP(new OTypeInfo()); @@ -291,7 +291,9 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection, break; } } - } + } // if(xSet.is()) + if ( !m_pTypeInfo ) + m_pTypeInfo = TOTypeInfoSP(new OTypeInfo()); SetColumnTypes(pList,_pInfoMap); } //--------------------------------------------------------------------------- @@ -432,10 +434,11 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl if ( m_pFormatter && m_sNumToken.Len() ) { LanguageType eNumLang; - sal_uInt32 nNumberFormat2; - fOutNumber = SfxHTMLParser::GetTableDataOptionsValNum(nNumberFormat2,eNumLang,m_sTextToken,m_sNumToken,*m_pFormatter); + sal_uInt32 nFormatKey; + fOutNumber = SfxHTMLParser::GetTableDataOptionsValNum(nFormatKey,eNumLang,m_sTextToken,m_sNumToken,*m_pFormatter); //double fOutNumber2 = SfxHTMLParser::GetTableDataOptionsValNum(nNumberFormat2,eNumLang,m_sValToken,m_sNumToken,*m_pFormatter); - nNumberFormat = static_cast<sal_Int16>(nNumberFormat2); + Reference<XPropertySet> xProp = xFormats->getByKey(nFormatKey); + xProp->getPropertyValue(PROPERTY_TYPE) >>= nNumberFormat; } else { @@ -559,16 +562,15 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo DBG_CHKTHIS(ODatabaseExport,NULL); if(_pList && _pInfoMap) { + OSL_ENSURE(m_vNumberFormat.size() == m_vColumnSize.size() && m_vColumnSize.size() == _pList->size(),"Illegal columns in list"); Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier(); Reference< XNumberFormats > xFormats = xSupplier->getNumberFormats(); TColumnVector::const_iterator aIter = _pList->begin(); TColumnVector::const_iterator aEnd = _pList->end(); - for(sal_Int32 i= 0;aIter != aEnd;++aIter,++i) + for(sal_Int32 i= 0;aIter != aEnd && (i) < static_cast<sal_Int32>(m_vNumberFormat.size()) && (i) < static_cast<sal_Int32>(m_vColumnSize.size()) ;++aIter,++i) { sal_Int32 nDataType; sal_Int32 nLength(0),nScale(0); - OSL_ENSURE((i) < static_cast<sal_Int32>(m_vNumberFormat.size()),"m_vFormatKey: Illegal index for vector"); - OSL_ENSURE((i) < static_cast<sal_Int32>(m_vColumnSize.size()),"m_vColumnSize: Illegal index for vector"); sal_Int16 nType = m_vNumberFormat[i]; switch ( nType ) diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index e38da91c606c..809f9c407e51 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -590,11 +590,11 @@ TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo, // -> drop the precision and the scale restriction, accept any type with the property // type id (nType) - OSL_ENSURE(sal_False, - ( ::rtl::OString("getTypeInfoFromType: did not find a matching type") - += ::rtl::OString(" (expected type name: ") - += ::rtl::OString(_sTypeName.getStr(), _sTypeName.getLength(), gsl_getSystemTextEncoding()) - += ::rtl::OString(")! Defaulting to the first matching type.")).getStr()); + //OSL_ENSURE(sal_False, + // ( ::rtl::OString("getTypeInfoFromType: did not find a matching type") + // += ::rtl::OString(" (expected type name: ") + // += ::rtl::OString(_sTypeName.getStr(), _sTypeName.getLength(), gsl_getSystemTextEncoding()) + // += ::rtl::OString(")! Defaulting to the first matching type.")).getStr()); for(aIter = aPair.first; aIter != aPair.second; ++aIter) { // search the best matching type (now comparing the local names) @@ -700,6 +700,7 @@ void fillTypeInfo( const Reference< ::com::sun::star::sdbc::XConnection>& _rxCo nCount = 18; aTypes.reserve(nCount+1); aTypes.push_back(-1); + aNullable.push_back(sal_False); for (sal_Int32 j = 1; j <= nCount ; ++j) { aTypes.push_back(xResultSetMetaData->getColumnType(j)); diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx index 2b4cd971ffa1..a6788ac1926f 100644 --- a/dbaccess/source/ui/misc/WCPage.cxx +++ b/dbaccess/source/ui/misc/WCPage.cxx @@ -216,6 +216,7 @@ sal_Bool OCopyTable::LeavePage() // first check if the table already exists in the database if( m_pParent->getOperation() != CopyTableOperation::AppendData ) { + m_pParent->clearDestColumns(); DynamicTableOrQueryNameCheck aNameCheck( m_pParent->m_xDestConnection, CommandType::TABLE ); SQLExceptionInfo aErrorInfo; if ( !aNameCheck.isNameValid( m_edTableName.GetText(), aErrorInfo ) ) @@ -342,7 +343,7 @@ sal_Bool OCopyTable::checkAppendData() { bNotConvert = sal_True; m_pParent->m_vColumnPos[i] = ODatabaseExport::TPositions::value_type(nPos,nPos); - TOTypeInfoSP pTypeInfo = m_pParent->convertType((*aDestIter)->second->getTypeInfo(),bNotConvert); + TOTypeInfoSP pTypeInfo = m_pParent->convertType((*aDestIter)->second->getSpecialTypeInfo(),bNotConvert); if ( !bNotConvert ) { m_pParent->showColumnTypeNotSupported((*aDestIter)->first); diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx index 0f3f036102d5..9b4ad13d8dc7 100644 --- a/dbaccess/source/ui/misc/WColumnSelect.cxx +++ b/dbaccess/source/ui/misc/WColumnSelect.cxx @@ -336,7 +336,7 @@ void OWizColumnSelect::createNewColumn( ListBox* _pListbox, OFieldDescription* pNewField = new OFieldDescription(*_pSrcField); pNewField->SetName(sConvertedName); sal_Bool bNotConvert = sal_True; - pNewField->SetType(m_pParent->convertType(_pSrcField->getTypeInfo(),bNotConvert)); + pNewField->SetType(m_pParent->convertType(_pSrcField->getSpecialTypeInfo(),bNotConvert)); if ( !m_pParent->supportsPrimaryKey() ) pNewField->SetPrimaryKey(sal_False); diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 0cd8ae2dbeb4..ca9aeacf73e4 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -860,7 +860,7 @@ sal_Bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos) { OFieldDescription* pField = new OFieldDescription(*(*aSrcIter)->second); pField->SetName(convertColumnName(TExportColumnFindFunctor(&m_vDestColumns),(*aSrcIter)->first,sExtraChars,nMaxNameLen)); - TOTypeInfoSP pType = convertType((*aSrcIter)->second->getTypeInfo(),bRet); + TOTypeInfoSP pType = convertType((*aSrcIter)->second->getSpecialTypeInfo(),bRet); pField->SetType(pType); if ( !bPKeyAllowed ) pField->SetPrimaryKey(sal_False); diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx index 93feb3aa49b1..5325f0388cfc 100644 --- a/dbaccess/source/ui/misc/WNameMatch.cxx +++ b/dbaccess/source/ui/misc/WNameMatch.cxx @@ -206,7 +206,7 @@ sal_Bool OWizNameMatching::LeavePage() m_pParent->m_vColumnPos[nPos].first = ++nParamPos; m_pParent->m_vColumnPos[nPos].second = ::std::distance(pDestColumns->begin(),aDestIter) + 1; sal_Bool bNotConvert = sal_True; - TOTypeInfoSP pTypeInfo = m_pParent->convertType((*aDestIter)->second->getTypeInfo(),bNotConvert); + TOTypeInfoSP pTypeInfo = m_pParent->convertType((*aDestIter)->second->getSpecialTypeInfo(),bNotConvert); sal_Int32 nType = ::com::sun::star::sdbc::DataType::VARCHAR; if ( pTypeInfo.get() ) nType = pTypeInfo->nType; diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 2ae24b6f6423..440be631a3ae 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -740,6 +740,7 @@ sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDes // second test if the name can be set as select columns in a pseudo statement // we have to look which entries we should quote + const ::rtl::OUString sFieldAlias = _pEntry->GetFieldAlias(); size_t nPass = 4; ::connectivity::OSQLParser& rParser( rController.getParser() ); OSQLParseNode* pParseNode = NULL; @@ -759,6 +760,11 @@ sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDes sSql += ::dbtools::quoteName( xMetaData->getIdentifierQuoteString(), _sFieldName ); else sSql += _sFieldName; + if ( sFieldAlias.getLength() ) + { // always quote the alias name there canbe no function in it + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); + sSql += ::dbtools::quoteName( xMetaData->getIdentifierQuoteString(), sFieldAlias ); + } sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM x")); pParseNode = rParser.parseTree( sErrorMsg, sSql, bInternational ); diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx index 6e81b8b15088..f052003c2c58 100644 --- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx +++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx @@ -30,42 +30,22 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBAUI_RTABLECONNECTIONDATA_HXX #include "RTableConnectionData.hxx" -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ #include <com/sun/star/sdbc/KeyRule.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ #include <com/sun/star/sdbcx/KeyType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XKeysSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_ #include <com/sun/star/sdbcx/XAppend.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_ #include <com/sun/star/sdbcx/XDrop.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ #include <com/sun/star/container/XIndexAccess.hpp> -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef DBAUI_TOOLS_HXX +#include "dbu_rel.hrc" #include "UITools.hxx" -#endif +#include "moduledbu.hxx" +#include <connectivity/dbexception.hxx> + using namespace dbaui; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -382,6 +362,7 @@ BOOL ORelationTableConnectionData::Update() // get the name of foreign key // search for columns m_aConnName = ::rtl::OUString(); xKey = NULL; + bool bDropRelation = false; for(sal_Int32 i=0;i<xKeys->getCount();++i) { xKeys->getByIndex(i) >>= xKey; @@ -426,6 +407,7 @@ BOOL ORelationTableConnectionData::Update() { xKey->getPropertyValue(PROPERTY_NAME) >>= sName; m_aConnName = sName; + bDropRelation = aNames.getLength() == 0; // the key contains no column, so it isn't valid and we have to drop it //here we already know our column structure so we don't have to recreate the table connection data xColSup.clear(); break; @@ -437,15 +419,20 @@ BOOL ORelationTableConnectionData::Update() } } xKey = NULL; + } // for(sal_Int32 i=0;i<xKeys->getCount();++i) + if ( bDropRelation ) + { + DropRelation(); + String sError(ModuleRes(STR_QUERY_REL_COULD_NOT_CREATE)); + ::dbtools::throwGenericSQLException(sError,NULL); } // OSL_ENSURE(xKey.is(),"No key found have insertion!"); + // The fields the relation marks may not be the same as our LineDatas mark after the relation has been updated if ( xColSup.is() ) { - // The fields the relation marks may not be the same as our LineDatas mark after the relation has been updated OConnectionLineDataVec().swap(m_vConnLineData); - Reference<XNameAccess> xColumns = xColSup->getColumns(); Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); const ::rtl::OUString* pIter = aNames.getConstArray(); @@ -470,7 +457,7 @@ BOOL ORelationTableConnectionData::Update() m_vConnLineData.push_back(pNewData); } } - } + } // if ( xColSup.is() ) // NOTE : the caller is resposible for updating any other objects referencing the old LineDatas (for instance a ConnLine) //////////////////////////////////////////////////////////// diff --git a/dbaccess/source/ui/relationdesign/relation.src b/dbaccess/source/ui/relationdesign/relation.src index e3fe71452fc8..391205223886 100644 --- a/dbaccess/source/ui/relationdesign/relation.src +++ b/dbaccess/source/ui/relationdesign/relation.src @@ -70,15 +70,15 @@ QueryBox RELATION_DESIGN_SAVEMODIFIED Message [ en-US ] = "The relation design has been changed.\nDo you want to save the changes?" ; }; -/* - The menubar resource has become obsolete - you can now find the menubar definition at: <project>/uiconfig/dbrelation/menubar/menubar.xml -*/ - String STR_QUERY_REL_DELETE_WINDOW { Text [ en-US ] = "When you delete this table all corresponding relations will be deleted as well. Continue?"; }; +String STR_QUERY_REL_COULD_NOT_CREATE +{ + Text [ en-US ] = "The datbase could not create the relation. May be foreign keys for this kind of table aren't supported.\nPlease check your documentation of the database."; +}; diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx index a7ddd801fc51..4ece37f2fa51 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx +++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx @@ -578,6 +578,15 @@ TOTypeInfoSP OFieldDescription::getTypeInfo() const return m_pType; } // ----------------------------------------------------------------------------- +TOTypeInfoSP OFieldDescription::getSpecialTypeInfo() const +{ + TOTypeInfoSP pSpecialType( new OTypeInfo() ); + *pSpecialType = *m_pType; + pSpecialType->nPrecision = GetPrecision(); + pSpecialType->nMaximumScale = static_cast<sal_Int16>(GetScale()); + return pSpecialType; +} +// ----------------------------------------------------------------------------- sal_Bool OFieldDescription::IsAutoIncrement() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT) ) diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 29a8ca4951b3..353ff0ea11d5 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -349,6 +349,16 @@ void OTableEditorCtrl::InitCellController() pTypeCell->SetHelpId(HID_TABDESIGN_TYPECELL); pDescrCell->SetHelpId(HID_TABDESIGN_COMMENTCELL); + Size aHeight; + const Control* pControls[] = { pTypeCell,pDescrCell,pNameCell}; + for(sal_Size i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i) + { + const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) ); + if ( aTemp.Height() > aHeight.Height() ) + aHeight.Height() = aTemp.Height(); + } // for(int i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i + SetDataRowHeight(aHeight.Height()); + ClearModified(); } diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index d81cf5f9a5cf..f54c5104c955 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -1482,6 +1482,7 @@ void OTableController::alterColumns() // ----------------------------------------------------------------------------- void OTableController::dropPrimaryKey() { + SQLExceptionInfo aInfo; try { Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY); @@ -1506,11 +1507,24 @@ void OTableController::dropPrimaryKey() } } } + catch(const SQLContext& e) + { + aInfo = SQLExceptionInfo(e); + } + catch(const SQLWarning& e) + { + aInfo = SQLExceptionInfo(e); + } + catch(const SQLException& e) + { + aInfo = SQLExceptionInfo(e); + } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } + showError(aInfo); } // ----------------------------------------------------------------------------- void OTableController::assignTable() diff --git a/dbaccess/source/ui/tabledesign/table.src b/dbaccess/source/ui/tabledesign/table.src index c242fcecd3b1..af911ec85c07 100644 --- a/dbaccess/source/ui/tabledesign/table.src +++ b/dbaccess/source/ui/tabledesign/table.src @@ -96,7 +96,7 @@ String STR_TAB_FIELD_COLUMN_NAME }; String STR_TAB_FIELD_DATATYPE { - Text [ en-US ] = "Field type" ; + Text [ en-US ] = "Field ~type" ; }; String STR_TAB_FIELD_COLUMN_DATATYPE { diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx index 2223cf443051..ec9a5c4f5248 100644 --- a/reportdesign/inc/ReportDefinition.hxx +++ b/reportdesign/inc/ReportDefinition.hxx @@ -33,7 +33,7 @@ #include "dllapi.h" #include <com/sun/star/report/XReportDefinition.hpp> -#include <cppuhelper/compbase11.hxx> +#include <cppuhelper/compbase12.hxx> #include <cppuhelper/basemutex.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -41,13 +41,15 @@ #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> #include <com/sun/star/frame/XUntitledNumbers.hpp> +#include <com/sun/star/frame/XModule.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> #include <cppuhelper/propertysetmixin.hxx> #include <comphelper/uno3.hxx> #include <comphelper/embeddedobjectcontainer.hxx> #include <svx/unomod.hxx> -#include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#include <com/sun/star/frame/XModule.hpp> + #include "ReportHelperDefines.hxx" #include <boost/shared_ptr.hpp> @@ -63,7 +65,7 @@ namespace comphelper namespace reportdesign { class OReportComponentProperties; - typedef ::cppu::WeakComponentImplHelper11< com::sun::star::report::XReportDefinition + typedef ::cppu::WeakComponentImplHelper12< com::sun::star::report::XReportDefinition ,com::sun::star::document::XEventBroadcaster ,com::sun::star::lang::XServiceInfo ,com::sun::star::frame::XModule @@ -73,6 +75,7 @@ namespace reportdesign ,::com::sun::star::frame::XTitleChangeBroadcaster ,::com::sun::star::frame::XUntitledNumbers ,::com::sun::star::document::XDocumentPropertiesSupplier + ,::com::sun::star::datatransfer::XTransferable ,SvxUnoDrawMSFactory> ReportDefinitionBase; typedef ::cppu::PropertySetMixin<com::sun::star::report::XReportDefinition> ReportDefinitionPropertySet; @@ -145,6 +148,17 @@ namespace reportdesign ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > impl_getTitleHelper_throw(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUntitledNumbers > impl_getUntitledHelper_throw(); + + /** loads the report definition from the given storage + @precond + our mutex is locked + @throws + */ + void impl_loadFromStorage_nolck_throw( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments + ); + protected: virtual ~OReportDefinition(); @@ -359,6 +373,11 @@ namespace reportdesign // XDocumentPropertiesSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > SAL_CALL getDocumentProperties( ) throw (::com::sun::star::uno::RuntimeException); + // XTransferable + virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw (::com::sun::star::uno::RuntimeException); + // comphelper::IEmbeddedHelper virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const; virtual ::comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const; @@ -366,19 +385,6 @@ namespace reportdesign virtual bool isEnableSetModified() const; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const; - - private: - /** loads the report definition from the given storage - - @precond - our mutex is locked - @throws - */ - void impl_loadFromStorage_nolck_throw( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments - ); - }; // ============================================================================= } // namespace reportdesign diff --git a/reportdesign/inc/ReportHelperDefines.hxx b/reportdesign/inc/ReportHelperDefines.hxx index 939c98115b9f..6be7ae969300 100644 --- a/reportdesign/inc/ReportHelperDefines.hxx +++ b/reportdesign/inc/ReportHelperDefines.hxx @@ -143,8 +143,8 @@ virtual void SAL_CALL setCharRotation( ::sal_Int16 _charrotation ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual ::sal_Int16 SAL_CALL getCharScaleWidth() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual void SAL_CALL setCharScaleWidth( ::sal_Int16 _charscalewidth ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ - virtual ::sal_Int16 SAL_CALL getParaVertAlignment() throw (::com::sun::star::uno::RuntimeException);\ - virtual void SAL_CALL setParaVertAlignment( ::sal_Int16 _paravertalignment ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);\ + virtual ::com::sun::star::style::VerticalAlignment SAL_CALL getVerticalAlign() throw (::com::sun::star::beans::UnknownPropertyException,::com::sun::star::uno::RuntimeException);\ + virtual void SAL_CALL setVerticalAlign( ::com::sun::star::style::VerticalAlignment _paravertalignment ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual ::rtl::OUString SAL_CALL getHyperLinkURL() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual void SAL_CALL setHyperLinkURL( const ::rtl::OUString& _hyperlinkurl ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ virtual ::rtl::OUString SAL_CALL getHyperLinkTarget() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);\ diff --git a/reportdesign/inc/RptDef.hxx b/reportdesign/inc/RptDef.hxx index 9b30bef5ade3..31aaa2062305 100644 --- a/reportdesign/inc/RptDef.hxx +++ b/reportdesign/inc/RptDef.hxx @@ -37,6 +37,7 @@ #include <comphelper/stl_types.hxx> #include <comphelper/uno3.hxx> #include <svx/fmglob.hxx> +#include <boost/shared_ptr.hpp> FORWARD_DECLARE_INTERFACE(report,XReportComponent) @@ -81,13 +82,22 @@ namespace ControlModification static const ::sal_Int32 HEIGHT_GREATEST = (sal_Int32)10; } +class AnyConverter : public ::std::binary_function< ::rtl::OUString,::com::sun::star::uno::Any,::com::sun::star::uno::Any > +{ +public: + virtual ~AnyConverter(){} + virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& /*_sPropertyName*/,const ::com::sun::star::uno::Any& lhs) const + { + return lhs; + } +}; /** returns teh object type depending on the service name @param _xComponent the report component */ REPORTDESIGN_DLLPUBLIC sal_uInt16 getObjectType(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent); - -DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString , TPropertyNamePair); -/** returns teh property name map for the givern property id +typedef ::std::pair< ::rtl::OUString, ::boost::shared_ptr<AnyConverter> > TPropertyConverter; +DECLARE_STL_USTRINGACCESS_MAP(TPropertyConverter , TPropertyNamePair); +/** returns the property name map for the givern property id @param _nObjectId the object id */ REPORTDESIGN_DLLPUBLIC const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId); diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx index 87778659ea23..8415fd128e1d 100644 --- a/reportdesign/inc/RptObject.hxx +++ b/reportdesign/inc/RptObject.hxx @@ -125,6 +125,7 @@ public: void EndListening(sal_Bool bRemoveListener = sal_True); // PropertyChangeListener virtual void _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); + virtual void initializeOle() {} sal_Bool supportsService( const ::rtl::OUString& _sServiceName ) const; @@ -193,6 +194,7 @@ class REPORTDESIGN_DLLPUBLIC OOle2Obj: public SdrOle2Obj , public OObjectBase friend class DlgEdFactory; UINT16 m_nType; + bool m_bOnlyOnce; void impl_createDataProvider_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel); public: static OOle2Obj* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent,UINT16 _nType ) @@ -227,6 +229,7 @@ public: virtual UINT32 GetObjInventor() const; // Clone() soll eine komplette Kopie des Objektes erzeugen. virtual SdrObject* Clone() const; + virtual void initializeOle(); void initializeChart( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel); }; diff --git a/reportdesign/inc/RptResId.hrc b/reportdesign/inc/RptResId.hrc index c87ae1a9c216..c9cc382ca253 100644 --- a/reportdesign/inc/RptResId.hrc +++ b/reportdesign/inc/RptResId.hrc @@ -229,11 +229,12 @@ #define RID_STR_AREA (RID_STRING_START + 153) #define RID_STR_INSERT (RID_STRING_START + 154) #define RID_STR_UNDO_SHRINK (RID_STRING_START + 155) - #define RID_STR_F_COUNTER (RID_STRING_START + 156) #define RID_STR_F_ACCUMULATION (RID_STRING_START + 157) #define RID_STR_F_MINIMUM (RID_STRING_START + 158) #define RID_STR_F_MAXIMUM (RID_STRING_START + 159) +#define RID_STR_VERTICALALIGN (RID_STRING_START + 160) +#define RID_STR_PARAADJUST (RID_STRING_START + 161) // #define RID_STR_ (RID_STRING_START + 130) @@ -287,6 +288,8 @@ #define RID_STR_REPORTPRINTOPTION_CONST (RID_UNTYPED_START + 4) #define RID_STR_SECTIONPAGEBREAK_CONST (RID_UNTYPED_START + 5) #define RID_STR_TYPE_CONST (RID_UNTYPED_START + 6) +#define RID_STR_VERTICAL_ALIGN_CONST (RID_UNTYPED_START + 7) +#define RID_STR_PARAADJUST_CONST (RID_UNTYPED_START + 8) // toolbox lists --------------------------------------------------------------------- diff --git a/reportdesign/inc/helpids.hrc b/reportdesign/inc/helpids.hrc index 6026634499a1..b60f66823623 100644 --- a/reportdesign/inc/helpids.hrc +++ b/reportdesign/inc/helpids.hrc @@ -81,11 +81,11 @@ // free #define HID_RPT_PROP_PRINTREPEATEDVALUES (HID_RPT_START + 44) #define HID_RPT_PROP_CONDITIONALPRINTEXPRESSION (HID_RPT_START + 45) -// free +#define HID_RPT_PROP_VERTICALALIGN (HID_RPT_START + 46) #define HID_RPT_PROP_STARTNEWCOLUMN (HID_RPT_START + 47) #define HID_RPT_PROP_STARTNEWPAGE (HID_RPT_START + 48) #define HID_RPT_PROP_RESETPAGENUMBER (HID_RPT_START + 49) -// free +#define HID_RPT_PROP_PARAADJUST (HID_RPT_START + 50) #define HID_RPT_PROP_MINHEIGHTNEWPAGE (HID_RPT_START + 51) #define HID_RPT_PROP_PRINTWHENGROUPCHANGE (HID_RPT_START + 52) #define HID_RPT_PROP_CHARTTYPE (HID_RPT_START + 53) diff --git a/reportdesign/source/core/api/ReportComponent.cxx b/reportdesign/source/core/api/ReportComponent.cxx index 8b9b498fe72d..c90407c156de 100644 --- a/reportdesign/source/core/api/ReportComponent.cxx +++ b/reportdesign/source/core/api/ReportComponent.cxx @@ -41,7 +41,7 @@ #include "ReportControlModel.hxx" #include <com/sun/star/reflection/XProxyFactory.hpp> #include <com/sun/star/text/ParagraphVertAlign.hpp> -// #include <svx/unoshape.hxx> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <svx/unolingu.hxx> #include <svtools/syslocale.hxx> #include <svtools/lingucfg.hxx> @@ -73,14 +73,14 @@ void lcl_getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont,Langu rCTLFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_PRESENTATION, _eCTL, DEFAULTFONT_FLAGS_ONLYONE ) ; } OFormatProperties::OFormatProperties() - :nAlign(0) + :nAlign(style::ParagraphAdjust_LEFT) ,nFontEmphasisMark(0) ,nFontRelief(0) ,nTextColor(0) ,nTextLineColor(0) ,nCharUnderlineColor(0xFFFFFFFF) ,nBackgroundColor(COL_TRANSPARENT) - ,aVerticalAlignment(text::ParagraphVertAlign::TOP) + ,aVerticalAlignment( style::VerticalAlignment_TOP ) ,nCharEscapement(0) ,nCharCaseMap(0) ,nCharKerning(0) @@ -114,7 +114,6 @@ OFormatProperties::OFormatProperties() } aFontDescriptor.Weight = awt::FontWeight::NORMAL; aFontDescriptor.CharacterWidth = awt::FontWidth::NORMAL; - // aCharLocale = SvtSysLocale().GetLocaleData().getLocale(); } // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index c85e754eb63c..d6b22a007409 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -39,26 +39,35 @@ #include <com/sun/star/style/GraphicLocation.hpp> #include <com/sun/star/xml/AttributeData.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <comphelper/namecontainer.hxx> #include <comphelper/broadcasthelper.hxx> +#include <comphelper/documentconstants.hxx> +#include <comphelper/genericpropertyset.hxx> +#include <comphelper/mediadescriptor.hxx> +#include <comphelper/mimeconfighelper.hxx> +#include <comphelper/namecontainer.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/numberedcollection.hxx> +#include <comphelper/propertystatecontainer.hxx> +#include <comphelper/proparrhlp.hxx> +#include <comphelper/property.hxx> +#include <comphelper/propertysetinfo.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/seqstream.hxx> #include <comphelper/storagehelper.hxx> +#include <comphelper/uno3.hxx> #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp> #include <vcl/svapp.hxx> +#include <vcl/virdev.hxx> #include <vos/mutex.hxx> -#include <comphelper/uno3.hxx> -#include <comphelper/propertystatecontainer.hxx> -#include <comphelper/namedvaluecollection.hxx> -#include <comphelper/proparrhlp.hxx> #include <com/sun/star/beans/XMultiPropertyStates.hpp> #include <com/sun/star/document/EventObject.hpp> #include <com/sun/star/document/XEventListener.hpp> #include <com/sun/star/style/XStyle.hpp> -#include <comphelper/documentconstants.hxx> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/EmbedMapUnits.hpp> #include <com/sun/star/embed/EntryInitModes.hpp> +#include <com/sun/star/embed/Aspects.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/io/XSeekable.hpp> @@ -71,6 +80,8 @@ #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/task/ErrorCodeIOException.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/FrameSearchFlag.hpp> #include "corestrings.hrc" #include "Groups.hxx" #include "RptDef.hxx" @@ -81,14 +92,10 @@ #include "Tools.hxx" #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <unotools/streamwrap.hxx> #include <connectivity/CommonTools.hxx> -#include <comphelper/numberedcollection.hxx> +#include <connectivity/dbconversion.hxx> #include <framework/titlehelper.hxx> -#include <comphelper/property.hxx> -#include <comphelper/propertysetinfo.hxx> -#include <comphelper/genericpropertyset.hxx> -#include <comphelper/mediadescriptor.hxx> -#include <comphelper/namecontainer.hxx> #include <connectivity/dbtools.hxx> #include <com/sun/star/task/XStatusIndicator.hpp> #include "Functions.hxx" @@ -104,6 +111,8 @@ #include "Shape.hxx" #include "ReportHelperImpl.hxx" #include <svtools/itempool.hxx> +#include <svtools/moduleoptions.hxx> +#include <osl/thread.hxx> #include <svx/paperinf.hxx> #include <svx/svdlayer.hxx> @@ -494,6 +503,75 @@ uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const uno::Seque aRet[i] = getPropertyDefault(*pIter); return aRet; } +namespace +{ + class FactoryLoader : public ::osl::Thread + { + ::rtl::OUString m_sMimeType; + uno::Reference< uno::XComponentContext > m_xContext; + public: + FactoryLoader(const ::rtl::OUString& _sMimeType,uno::Reference< uno::XComponentContext > const & _xContext) + :m_sMimeType(_sMimeType) + ,m_xContext(_xContext) + {} + + protected: + virtual ~FactoryLoader(){} + + /// Working method which should be overridden. + virtual void SAL_CALL run(); + virtual void SAL_CALL onTerminated(); + }; + + void SAL_CALL FactoryLoader::run() + { + try + { + uno::Reference<frame::XComponentLoader> xFrameLoad( m_xContext->getServiceManager()->createInstanceWithContext( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) + ,m_xContext) + ,uno::UNO_QUERY); + ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); + sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; + uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag); + xFrameLoad.set( xFrame,uno::UNO_QUERY); + + if ( xFrameLoad.is() ) + { + uno::Sequence < beans::PropertyValue > aArgs( 3); + sal_Int32 nLen = 0; + aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); + aArgs[nLen++].Value <<= sal_False; + + aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); + aArgs[nLen++].Value <<= sal_True; + + aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden")); + aArgs[nLen++].Value <<= sal_True; + + uno::Reference< lang::XMultiServiceFactory > xFac(m_xContext->getServiceManager(),uno::UNO_QUERY); + ::comphelper::MimeConfigurationHelper aHelper(xFac); + SvtModuleOptions aModuleOptions; + uno::Reference< frame::XModel > xModel(xFrameLoad->loadComponentFromURL( + aModuleOptions.GetFactoryEmptyDocumentURL( aModuleOptions.ClassifyFactoryByServiceName( aHelper.GetDocServiceNameFromMediaType(m_sMimeType) )), + ::rtl::OUString(), // empty frame name + 0, + aArgs + ),uno::UNO_QUERY); + ::comphelper::disposeComponent(xModel); + } + } + catch(uno::Exception& ex) + { + (void)ex; + OSL_ASSERT(0); + } + } + void SAL_CALL FactoryLoader::onTerminated() + { + delete this; + } +} // ----------------------------------------------------------------------------- struct OReportDefinitionImpl { @@ -555,6 +633,9 @@ struct OReportDefinitionImpl ,m_aDocEventListeners(_aMutex) ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT) ,m_sIdentifier(SERVICE_REPORTDEFINITION) + // default visual area is 8 x 7 cm + ,m_aVisualAreaSize( 8000, 7000 ) + ,m_nAspect(embed::Aspects::MSOLE_CONTENT) ,m_nGroupKeepTogether(0) ,m_nPageHeaderOption(0) ,m_nPageFooterOption(0) @@ -672,6 +753,22 @@ void OReportDefinition::init() { try { + static bool s_bFirstTime = sal_True; + if ( s_bFirstTime ) + { + s_bFirstTime = false; + const uno::Sequence< ::rtl::OUString > aMimeTypes = getAvailableMimeTypes(); + const ::rtl::OUString* pIter = aMimeTypes.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aMimeTypes.getLength(); + for ( ; pIter != pEnd; ++pIter ) + { + FactoryLoader* pCreatorThread = new FactoryLoader(*pIter,m_aProps->m_xContext); + pCreatorThread->createSuspended(); + pCreatorThread->setPriority(osl_Thread_PriorityBelowNormal); + pCreatorThread->resume(); + } // for ( ; pIter != pEnd; ++pIter ) + } + m_pImpl->m_pReportModel.reset(new OReportModel(this)); m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges(); m_pImpl->m_pReportModel->SetScaleUnit( MAP_100TH_MM ); @@ -1491,6 +1588,24 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS bErr = sal_True; sErrFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml")); } + } // if ( !bErr ) + + uno::Any aImage; + uno::Reference< embed::XVisualObject > xCurrentController(getCurrentController(),uno::UNO_QUERY); + if ( xCurrentController.is() ) + { + xCurrentController->setVisualAreaSize(m_pImpl->m_nAspect,m_pImpl->m_aVisualAreaSize); + aImage = xCurrentController->getPreferredVisualRepresentation( m_pImpl->m_nAspect ).Data; + } + if ( aImage.hasValue() ) + { + ::rtl::OUString sObject1(RTL_CONSTASCII_USTRINGPARAM("report")); + ::rtl::OUString sPng(RTL_CONSTASCII_USTRINGPARAM("image/png")); + + uno::Sequence<sal_Int8> aSeq; + aImage >>= aSeq; + uno::Reference<io::XInputStream> xStream = new ::comphelper::SequenceInputStream( aSeq ); + m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream,sObject1,sPng); } if ( !bErr ) @@ -1788,23 +1903,44 @@ void SAL_CALL OReportDefinition::setVisualAreaSize( ::sal_Int64 _nAspect, const { ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_aVisualAreaSize = _aSize; + //if( nAspect == embed::Aspects::MSOLE_CONTENT ) + { + bool bChanged = + (m_pImpl->m_aVisualAreaSize.Width != _aSize.Width || + m_pImpl->m_aVisualAreaSize.Height != _aSize.Height); + m_pImpl->m_aVisualAreaSize = _aSize; + if( bChanged ) + setModified( sal_True ); + } m_pImpl->m_nAspect = _nAspect; } // ----------------------------------------------------------------------------- -awt::Size SAL_CALL OReportDefinition::getVisualAreaSize( ::sal_Int64 /*nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +awt::Size SAL_CALL OReportDefinition::getVisualAreaSize( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); return m_pImpl->m_aVisualAreaSize; } // ----------------------------------------------------------------------------- -embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64 /*nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - embed::VisualRepresentation aVisualRepresentation; - return aVisualRepresentation; + embed::VisualRepresentation aResult; + ::rtl::OUString sImageName(RTL_CONSTASCII_USTRINGPARAM("report")); + ::rtl::OUString sMimeType; + uno::Reference<io::XInputStream> xStream = m_pImpl->m_pObjectContainer->GetGraphicStream(sImageName,&sMimeType); + if ( xStream.is() ) + { + uno::Sequence<sal_Int8> aSeq; + xStream->readBytes(aSeq,xStream->available()); + xStream->closeInput(); + aResult.Data <<= aSeq; + aResult.Flavor.MimeType = sMimeType; + aResult.Flavor.DataType = ::getCppuType( &aSeq ); + } + + return aResult; } // ----------------------------------------------------------------------------- ::sal_Int32 SAL_CALL OReportDefinition::getMapUnit( ::sal_Int64 /*nAspect*/ ) throw (uno::Exception, uno::RuntimeException) @@ -1829,6 +1965,9 @@ void SAL_CALL OReportDefinition::setModified( ::sal_Bool _bModified ) throw (bea if ( m_pImpl->m_bModified != _bModified ) { m_pImpl->m_bModified = _bModified; + if ( m_pImpl->m_pReportModel->IsChanged() != _bModified ) + m_pImpl->m_pReportModel->SetChanged(_bModified); + lang::EventObject aEvent(*this); aGuard.clear(); m_pImpl->m_aModifyListeners.notifyEach(&util::XModifyListener::modified,aEvent); @@ -2205,6 +2344,9 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( co { uno::Reference<chart2::data::XDatabaseDataProvider> xDataProvider(chart2::data::DatabaseDataProvider::createWithConnection( m_aProps->m_xContext, m_pImpl->m_xActiveConnection )); xDataProvider->setRowLimit(10); + uno::Reference< container::XChild > xChild(xDataProvider,uno::UNO_QUERY); + if ( xChild.is() ) + xChild->setParent(*this); return uno::Reference< uno::XInterface >(xDataProvider,uno::UNO_QUERY); } else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap")) == 0 ) @@ -2318,36 +2460,28 @@ class OStylesHelper : public ::cppu::BaseMutex, public TStylesBASE OStylesHelper(const OStylesHelper&); void operator =(const OStylesHelper&); protected: - // TODO: VirtualFunctionFinder: This is virtual function! - // virtual ~OStylesHelper(){} public: OStylesHelper(const uno::Type _aType = ::getCppuType(static_cast< uno::Reference< container::XElementAccess >* >(NULL))); // XNameContainer - // TODO: VirtualFunctionFinder: This is virtual function! - // virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException); - // TODO: VirtualFunctionFinder: This is virtual function! - // virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException); // XNameReplace - // TODO: VirtualFunctionFinder: This is virtual function! - // virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException); // container::XElementAccess - uno::Type SAL_CALL getElementType( ) throw(uno::RuntimeException); - sal_Bool SAL_CALL hasElements( ) throw(uno::RuntimeException); + virtual uno::Type SAL_CALL getElementType( ) throw(uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) throw(uno::RuntimeException); // container::XIndexAccess - sal_Int32 SAL_CALL getCount( ) throw(uno::RuntimeException); - uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCount( ) throw(uno::RuntimeException); + virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException); - // container::XNameAccess - uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); - uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(uno::RuntimeException); - sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(uno::RuntimeException); + // container::XNameAccess + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(uno::RuntimeException); }; OStylesHelper::OStylesHelper(const uno::Type _aType) @@ -2411,8 +2545,6 @@ sal_Bool SAL_CALL OStylesHelper::hasByName( const ::rtl::OUString& aName ) throw ::osl::MutexGuard aGuard(m_aMutex); return m_aElements.find(aName) != m_aElements.end(); } -// TODO: VirtualFunctionFinder: This is virtual function! -// // ----------------------------------------------------------------------------- // XNameContainer void SAL_CALL OStylesHelper::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException) @@ -2425,8 +2557,6 @@ void SAL_CALL OStylesHelper::insertByName( const ::rtl::OUString& aName, const u throw lang::IllegalArgumentException(); m_aElementsPos.push_back(m_aElements.insert(TStyleElements::value_type(aName,aElement)).first); - // TODO: VirtualFunctionFinder: This is virtual function! - // } // ----------------------------------------------------------------------------- void SAL_CALL OStylesHelper::removeByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException) @@ -2438,8 +2568,6 @@ void SAL_CALL OStylesHelper::removeByName( const ::rtl::OUString& aName ) throw( m_aElementsPos.erase(::std::find(m_aElementsPos.begin(),m_aElementsPos.end(),aFind)); m_aElements.erase(aFind); } -// TODO: VirtualFunctionFinder: This is virtual function! -// // ----------------------------------------------------------------------------- // XNameReplace void SAL_CALL OStylesHelper::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException) @@ -2723,6 +2851,47 @@ uno::Reference< uno::XComponentContext > OReportDefinition::getContext() const { return m_aProps->m_xContext; } +// ----------------------------------------------------------------------------- +uno::Any SAL_CALL OReportDefinition::getTransferData( const datatransfer::DataFlavor& aFlavor ) throw (datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException) +{ + uno::Any aResult; + if( isDataFlavorSupported( aFlavor ) ) + { + try + { + aResult <<= getPreferredVisualRepresentation(0).Data; + } + catch( uno::Exception & ex ) + { + DBG_UNHANDLED_EXCEPTION(); + (void)ex; + } + } + else + { + throw datatransfer::UnsupportedFlavorException(aFlavor.MimeType, static_cast< ::cppu::OWeakObject* >( this )); + } + + return aResult; +} +// ----------------------------------------------------------------------------- +uno::Sequence< datatransfer::DataFlavor > SAL_CALL OReportDefinition::getTransferDataFlavors( ) throw (uno::RuntimeException) +{ + uno::Sequence< datatransfer::DataFlavor > aRet(1); + + aRet[0] = datatransfer::DataFlavor( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PNG")), + ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) ); + + return aRet; +} +// ----------------------------------------------------------------------------- +::sal_Bool SAL_CALL OReportDefinition::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor ) throw (uno::RuntimeException) +{ + return aFlavor.MimeType.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png"))); +} +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // ============================================================================= }// namespace reportdesign // ============================================================================= diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx index e17bd9d2f11a..03c5307e8f25 100644 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ b/reportdesign/source/core/api/ReportEngineJFree.cxx @@ -33,9 +33,11 @@ #include <comphelper/documentconstants.hxx> #include <comphelper/storagehelper.hxx> #include <connectivity/dbtools.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/mimeconfighelper.hxx> +#include <comphelper/property.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/NamedValue.hpp> -#include <comphelper/sequence.hxx> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> @@ -46,16 +48,18 @@ #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/task/XJob.hpp> -#ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC -#include "corestrings.hrc" -#endif + #include <tools/debug.hxx> +#include <tools/urlobj.hxx> #include <svtools/useroptions.hxx> #include <unotools/tempfile.hxx> #include <unotools/sharedunocomponent.hxx> -#include <comphelper/mimeconfighelper.hxx> + #include "Tools.hxx" -#include <comphelper/property.hxx> +#include "corestrings.hrc" +#include "core_resource.hrc" +#include "core_resource.hxx" + #include <connectivity/CommonTools.hxx> #include <rtl/ustrbuf.hxx> #include <sfx2/docfilt.hxx> @@ -72,6 +76,7 @@ OReportEngineJFree::OReportEngineJFree( const uno::Reference< uno::XComponentCon :ReportEngineBase(m_aMutex) ,ReportEnginePropertySet(context,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >()) ,m_xContext(context) +,m_nMaxRows(0) { DBG_CTOR( rpt_OReportEngineJFree,NULL); } @@ -197,18 +202,29 @@ void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task } m_xReport->storeToStorage(xTemp,aEmpty); // store to temp file because it may contain information which aren't in the database yet. - uno::Sequence< beans::NamedValue > aConvertedProperties(7); + uno::Sequence< beans::NamedValue > aConvertedProperties(8); sal_Int32 nPos = 0; aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStorage")); aConvertedProperties[nPos++].Value <<= xTemp; aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStorage")); - + ::rtl::OUString sFileURL; String sName = m_xReport->getCaption(); if ( !sName.Len() ) sName = m_xReport->getName(); - ::utl::TempFile aFile(sName,sal_False,&sExt); - uno::Reference< embed::XStorage > xOut = OStorageHelper::GetStorageFromURL(aFile.GetURL(),embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,uno::Reference< lang::XMultiServiceFactory >(m_xContext->getServiceManager(),uno::UNO_QUERY)); + { + ::utl::TempFile aTestFile(sName,sal_False,&sExt); + if ( !aTestFile.IsValid() ) + { + sName = RPT_RESSTRING(RID_STR_REPORT,m_xContext->getServiceManager()); + ::utl::TempFile aFile(sName,sal_False,&sExt); + sFileURL = aFile.GetURL(); + } + else + sFileURL = aTestFile.GetURL(); + } + + uno::Reference< embed::XStorage > xOut = OStorageHelper::GetStorageFromURL(sFileURL,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,uno::Reference< lang::XMultiServiceFactory >(m_xContext->getServiceManager(),uno::UNO_QUERY)); utl::DisposableComponent aOut(xOut); xStorageProp.set(xOut,uno::UNO_QUERY); if ( xStorageProp.is() ) @@ -224,6 +240,9 @@ void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task aConvertedProperties[nPos].Name = PROPERTY_ACTIVECONNECTION; aConvertedProperties[nPos++].Value <<= m_xActiveConnection; + aConvertedProperties[nPos].Name = PROPERTY_MAXROWS; + aConvertedProperties[nPos++].Value <<= m_nMaxRows; + // some meta data SvtUserOptions aUserOpts; ::rtl::OUStringBuffer sAuthor(aUserOpts.GetFirstName()); @@ -246,7 +265,7 @@ void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task if ( xStorageProp.is() ) { //xStorageProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"))) >>= sOutputName; - sOutputName = aFile.GetURL(); + sOutputName = sFileURL; } } @@ -293,7 +312,7 @@ uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentAlive ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ,m_xContext) ,uno::UNO_QUERY); - ::rtl::OUString sTarget = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")); + ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag); xFrameLoad.set( xFrame,uno::UNO_QUERY); @@ -316,7 +335,7 @@ uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentAlive } uno::Reference< lang::XMultiServiceFactory > xFac(m_xContext->getServiceManager(),uno::UNO_QUERY); - ::comphelper::MimeConfigurationHelper aHelper(xFac); + /*::comphelper::MimeConfigurationHelper aHelper(xFac);*/ xModel.set( xFrameLoad->loadComponentFromURL( sOutputName, ::rtl::OUString(), // empty frame name @@ -394,6 +413,17 @@ void SAL_CALL OReportEngineJFree::setActiveConnection( const uno::Reference< sdb throw lang::IllegalArgumentException(); set(PROPERTY_ACTIVECONNECTION,_activeconnection,m_xActiveConnection); } +// ----------------------------------------------------------------------------- +::sal_Int32 SAL_CALL OReportEngineJFree::getMaxRows() throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + return m_nMaxRows; +} +// ----------------------------------------------------------------------------- +void SAL_CALL OReportEngineJFree::setMaxRows( ::sal_Int32 _MaxRows ) throw (uno::RuntimeException) +{ + set(PROPERTY_MAXROWS,_MaxRows,m_nMaxRows); +} // ============================================================================= } // namespace reportdesign // ============================================================================= diff --git a/reportdesign/source/core/inc/ReportControlModel.hxx b/reportdesign/source/core/inc/ReportControlModel.hxx index 2e0bd0bff730..a11dd61e8ed6 100644 --- a/reportdesign/source/core/inc/ReportControlModel.hxx +++ b/reportdesign/source/core/inc/ReportControlModel.hxx @@ -74,7 +74,7 @@ namespace reportdesign ::rtl::OUString sHyperLinkName; ::rtl::OUString sVisitedCharStyleName; ::rtl::OUString sUnvisitedCharStyleName; - short aVerticalAlignment; + com::sun::star::style::VerticalAlignment aVerticalAlignment; ::sal_Int16 nCharEscapement; ::sal_Int16 nCharCaseMap; ::sal_Int16 nCharKerning; diff --git a/reportdesign/source/core/inc/ReportEngineJFree.hxx b/reportdesign/source/core/inc/ReportEngineJFree.hxx index c65a1ee7b7ae..9e95c0c2c593 100644 --- a/reportdesign/source/core/inc/ReportEngineJFree.hxx +++ b/reportdesign/source/core/inc/ReportEngineJFree.hxx @@ -57,6 +57,7 @@ namespace reportdesign ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReport; ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator> m_StatusIndicator; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xActiveConnection; + ::sal_Int32 m_nMaxRows; private: OReportEngineJFree(const OReportEngineJFree&); OReportEngineJFree& operator=(const OReportEngineJFree&); @@ -116,6 +117,8 @@ namespace reportdesign virtual void SAL_CALL setActiveConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _activeconnection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL getStatusIndicator() throw (::com::sun::star::uno::RuntimeException) ; virtual void SAL_CALL setStatusIndicator( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& _statusindicator ) throw (::com::sun::star::uno::RuntimeException) ; + virtual ::sal_Int32 SAL_CALL getMaxRows() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMaxRows( ::sal_Int32 _MaxRows ) throw (::com::sun::star::uno::RuntimeException); // Methods virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL createDocumentModel( ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ; virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL createDocumentAlive( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _frame ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ; diff --git a/reportdesign/source/core/inc/ReportHelperImpl.hxx b/reportdesign/source/core/inc/ReportHelperImpl.hxx index 14e9bc02b801..ebf8c566133d 100644 --- a/reportdesign/source/core/inc/ReportHelperImpl.hxx +++ b/reportdesign/source/core/inc/ReportHelperImpl.hxx @@ -234,13 +234,13 @@ void SAL_CALL clazz::setCharScaleWidth(::sal_Int16 the_value) throw (uno::Runtim float newValue = the_value; \ set(PROPERTY_CHARSCALEWIDTH,newValue,varName.aFontDescriptor.CharacterWidth); \ } \ -::sal_Int16 SAL_CALL clazz::getParaAdjust() throw (beans::UnknownPropertyException,uno::RuntimeException) \ +sal_Int16 SAL_CALL clazz::getParaAdjust() throw (beans::UnknownPropertyException,uno::RuntimeException) \ { \ ::osl::MutexGuard aGuard(m_aMutex); \ return varName.nAlign; \ } \ \ -void SAL_CALL clazz::setParaAdjust( ::sal_Int16 _align ) throw (beans::UnknownPropertyException,uno::RuntimeException) \ +void SAL_CALL clazz::setParaAdjust( sal_Int16 _align ) throw (beans::UnknownPropertyException,uno::RuntimeException) \ { \ set(PROPERTY_PARAADJUST,_align,varName.nAlign); \ } \ @@ -320,16 +320,14 @@ void SAL_CALL clazz::setCharUnderlineColor( ::sal_Int32 _textlinecolor ) throw ( set(PROPERTY_CHARUNDERLINECOLOR,_textlinecolor,varName.nTextLineColor); \ } \ \ -short SAL_CALL clazz::getParaVertAlignment() throw (uno::RuntimeException) \ +style::VerticalAlignment SAL_CALL clazz::getVerticalAlign() throw (beans::UnknownPropertyException,uno::RuntimeException) \ { \ ::osl::MutexGuard aGuard(m_aMutex); \ return varName.aVerticalAlignment; \ } \ \ -void SAL_CALL clazz::setParaVertAlignment( short _verticalalign ) throw (lang::IllegalArgumentException,uno::RuntimeException) \ +void SAL_CALL clazz::setVerticalAlign( style::VerticalAlignment _verticalalign ) throw (lang::IllegalArgumentException,beans::UnknownPropertyException,uno::RuntimeException) \ { \ - if ( _verticalalign < text::ParagraphVertAlign::AUTOMATIC || _verticalalign > text::ParagraphVertAlign::BOTTOM ) \ - throw lang::IllegalArgumentException(); \ set(PROPERTY_VERTICALALIGN,_verticalalign,varName.aVerticalAlignment); \ } \ \ @@ -801,11 +799,11 @@ void SAL_CALL clazz::setCharLocaleComplex( const ::com::sun::star::lang::Locale& #define NO_REPORTCONTROLFORMAT_IMPL(clazz) \ -::sal_Int16 SAL_CALL clazz::getParaAdjust() throw (uno::RuntimeException, beans::UnknownPropertyException)\ +sal_Int16 SAL_CALL clazz::getParaAdjust() throw (uno::RuntimeException, beans::UnknownPropertyException)\ {\ throw beans::UnknownPropertyException();\ }\ -void SAL_CALL clazz::setParaAdjust(::sal_Int16 /*the_value*/) throw (uno::RuntimeException, beans::UnknownPropertyException)\ +void SAL_CALL clazz::setParaAdjust(sal_Int16 /*the_value*/) throw (uno::RuntimeException, beans::UnknownPropertyException)\ {\ throw beans::UnknownPropertyException();\ }\ @@ -1030,16 +1028,14 @@ void SAL_CALL clazz::setCharUnderlineColor( ::sal_Int32 /*_textlinecolor*/ ) thr throw beans::UnknownPropertyException();\ }\ \ -short SAL_CALL clazz::getParaVertAlignment() throw (uno::RuntimeException)\ +style::VerticalAlignment SAL_CALL clazz::getVerticalAlign() throw (beans::UnknownPropertyException,uno::RuntimeException)\ {\ ::osl::MutexGuard aGuard(m_aMutex);\ return m_aProps.aFormatProperties.aVerticalAlignment;\ }\ \ -void SAL_CALL clazz::setParaVertAlignment( short _verticalalign ) throw (lang::IllegalArgumentException,uno::RuntimeException)\ +void SAL_CALL clazz::setVerticalAlign( style::VerticalAlignment _verticalalign ) throw (lang::IllegalArgumentException,beans::UnknownPropertyException,uno::RuntimeException)\ {\ - if ( _verticalalign < text::ParagraphVertAlign::AUTOMATIC || _verticalalign > text::ParagraphVertAlign::BOTTOM )\ - throw lang::IllegalArgumentException();\ set(PROPERTY_VERTICALALIGN,_verticalalign,m_aProps.aFormatProperties.aVerticalAlignment);\ }\ \ diff --git a/reportdesign/source/core/inc/Tools.hxx b/reportdesign/source/core/inc/Tools.hxx index f549582019b2..232408c308fb 100644 --- a/reportdesign/source/core/inc/Tools.hxx +++ b/reportdesign/source/core/inc/Tools.hxx @@ -103,9 +103,12 @@ namespace reportdesign if ( _pShape->m_aProps.aComponent.m_xShape.is() ) { ::com::sun::star::awt::Size aOldSize = _pShape->m_aProps.aComponent.m_xShape->getSize(); - _pShape->m_aProps.aComponent.m_nWidth = aOldSize.Width; - _pShape->m_aProps.aComponent.m_nHeight = aOldSize.Height; - _pShape->m_aProps.aComponent.m_xShape->setSize(aSize); + if ( aOldSize.Height != aSize.Height || aOldSize.Width != aSize.Width ) + { + _pShape->m_aProps.aComponent.m_nWidth = aOldSize.Width; + _pShape->m_aProps.aComponent.m_nHeight = aOldSize.Height; + _pShape->m_aProps.aComponent.m_xShape->setSize(aSize); + } } _pShape->set(PROPERTY_WIDTH,aSize.Width,_pShape->m_aProps.aComponent.m_nWidth); _pShape->set(PROPERTY_HEIGHT,aSize.Height,_pShape->m_aProps.aComponent.m_nHeight); @@ -136,9 +139,12 @@ namespace reportdesign if ( _pShape->m_aProps.aComponent.m_xShape.is() ) { aOldPos = _pShape->m_aProps.aComponent.m_xShape->getPosition(); - _pShape->m_aProps.aComponent.m_nPosX = aOldPos.X; - _pShape->m_aProps.aComponent.m_nPosY = aOldPos.Y; - _pShape->m_aProps.aComponent.m_xShape->setPosition(aPosition); + if ( aOldPos.X != aPosition.X || aOldPos.Y != aPosition.Y ) + { + _pShape->m_aProps.aComponent.m_nPosX = aOldPos.X; + _pShape->m_aProps.aComponent.m_nPosY = aOldPos.Y; + _pShape->m_aProps.aComponent.m_xShape->setPosition(aPosition); + } } _pShape->set(PROPERTY_POSITIONX,aPosition.X,aOldPos.X); _pShape->set(PROPERTY_POSITIONY,aPosition.Y,aOldPos.Y); diff --git a/reportdesign/source/core/sdr/PropertyForward.cxx b/reportdesign/source/core/sdr/PropertyForward.cxx index f5ec06d1e683..7f71d101e91b 100644 --- a/reportdesign/source/core/sdr/PropertyForward.cxx +++ b/reportdesign/source/core/sdr/PropertyForward.cxx @@ -33,6 +33,7 @@ #include <comphelper/property.hxx> #include <com/sun/star/sdbcx/XAppend.hpp> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include "corestrings.hrc" //........................................................................ @@ -71,12 +72,12 @@ OPropertyMediator::OPropertyMediator(const Reference< XPropertySet>& _xSource TPropertyNamePair::iterator aEnd = m_aNameMap.end(); for (; aIter != aEnd; ++aIter) { - Any aValue = _xDest->getPropertyValue(aIter->second); Property aProp = m_xSourceInfo->getPropertyByName(aIter->first); if (0 == (aProp.Attributes & PropertyAttribute::READONLY)) { + Any aValue = _xDest->getPropertyValue(aIter->second.first); if ( 0 != (aProp.Attributes & PropertyAttribute::MAYBEVOID) || aValue.hasValue() ) - _xSource->setPropertyValue(aIter->first,aValue); + _xSource->setPropertyValue(aIter->first,aIter->second.second->operator()(aIter->second.first,aValue)); } } } @@ -86,13 +87,14 @@ OPropertyMediator::OPropertyMediator(const Reference< XPropertySet>& _xSource TPropertyNamePair::iterator aIter = m_aNameMap.begin(); TPropertyNamePair::iterator aEnd = m_aNameMap.end(); for (; aIter != aEnd; ++aIter) - _xDest->setPropertyValue(aIter->second,_xSource->getPropertyValue(aIter->first)); + _xDest->setPropertyValue(aIter->second.first,aIter->second.second->operator()(aIter->second.first,_xSource->getPropertyValue(aIter->first))); } startListening(); } - catch(Exception&) + catch(Exception& e) { - OSL_ENSURE(sal_False, "OPropertyMediator::OPropertyMediator: caught an exception!"); + DBG_UNHANDLED_EXCEPTION(); + (void)e; } } // if ( m_xDest.is() && m_xSource.is() ) osl_decrementInterlockedCount(&m_refCount); @@ -125,7 +127,7 @@ void SAL_CALL OPropertyMediator::propertyChange( const PropertyChangeEvent& evt TPropertyNamePair::iterator aFind = m_aNameMap.find(evt.PropertyName); ::rtl::OUString sPropName; if ( aFind != m_aNameMap.end() ) - sPropName = aFind->second; + sPropName = aFind->second.first; else { aFind = ::std::find_if( @@ -133,14 +135,14 @@ void SAL_CALL OPropertyMediator::propertyChange( const PropertyChangeEvent& evt m_aNameMap.end(), ::std::compose1( ::std::bind2nd(::std::equal_to< ::rtl::OUString >(), evt.PropertyName), - ::std::select2nd<TPropertyNamePair::value_type>() + ::std::compose1(::std::select1st<TPropertyConverter>(),::std::select2nd<TPropertyNamePair::value_type>()) ) ); if ( aFind != m_aNameMap.end() ) sPropName = aFind->first; } if ( sPropName.getLength() && xPropInfo->hasPropertyByName(sPropName) ) - xProp->setPropertyValue(sPropName,evt.NewValue); + xProp->setPropertyValue(sPropName,aFind->second.second->operator()(sPropName,evt.NewValue)); else if ( evt.PropertyName == PROPERTY_CHARFONTNAME || evt.PropertyName == PROPERTY_CHARFONTSTYLENAME || evt.PropertyName == PROPERTY_CHARSTRIKEOUT diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index b5974a226341..3036872518b6 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/awt/XUnoControlContainer.hpp> #include <com/sun/star/awt/XVclContainerPeer.hpp> #include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/TextAlign.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/script/XScriptEventsSupplier.hpp> @@ -67,6 +68,8 @@ #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/style/VerticalAlignment.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/report/XFormattedField.hpp> #include <comphelper/genericpropertyset.hxx> #include <comphelper/processfactory.hxx> @@ -74,6 +77,7 @@ #include <tools/diagnose_ex.h> #include "PropertyForward.hxx" #include <connectivity/dbtools.hxx> +#include <connectivity/dbconversion.hxx> #include "UndoActions.hxx" #include "UndoEnv.hxx" #include <algorithm> @@ -179,6 +183,63 @@ SdrObject* OObjectBase::createObject(const uno::Reference< report::XReportCompon return pNewObj; } // ----------------------------------------------------------------------------- +namespace +{ + class ParaAdjust : public AnyConverter + { + public: + virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& _sPropertyName,const ::com::sun::star::uno::Any& lhs) const + { + uno::Any aRet; + if ( _sPropertyName.equalsAscii(PROPERTY_PARAADJUST) ) + { + sal_Int16 nTextAlign = 0; + lhs >>= nTextAlign; + switch(nTextAlign) + { + case awt::TextAlign::LEFT: + nTextAlign = style::ParagraphAdjust_LEFT; + break; + case awt::TextAlign::CENTER: + nTextAlign = style::ParagraphAdjust_CENTER; + break; + case awt::TextAlign::RIGHT: + nTextAlign = style::ParagraphAdjust_RIGHT; + break; + default: + OSL_ENSURE(0,"Illegal text alignment value!"); + break; + } // switch(nTextAlign) + aRet <<= (style::ParagraphAdjust)nTextAlign; + } + else + { + sal_Int16 nTextAlign = 0; + sal_Int16 eParagraphAdjust = 0; + lhs >>= eParagraphAdjust; + switch(eParagraphAdjust) + { + case style::ParagraphAdjust_LEFT: + case style::ParagraphAdjust_BLOCK: + nTextAlign = awt::TextAlign::LEFT; + break; + case style::ParagraphAdjust_CENTER: + nTextAlign = awt::TextAlign::CENTER; + break; + case style::ParagraphAdjust_RIGHT: + nTextAlign = awt::TextAlign::RIGHT; + break; + default: + OSL_ENSURE(0,"Illegal text alignment value!"); + break; + } // switch(eParagraphAdjust) + aRet <<= nTextAlign; + } + return aRet; + } + }; +} +// ----------------------------------------------------------------------------- const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) { switch(_nObjectId) @@ -188,30 +249,54 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) static TPropertyNamePair s_aNameMap; if ( s_aNameMap.empty() ) { - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,PROPERTY_BACKGROUNDCOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,PROPERTY_BORDER)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,PROPERTY_BORDERCOLOR)); + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter))); //s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,PROPERTY_ALIGN)); } return s_aNameMap; } case OBJ_DLG_FIXEDTEXT: + { + static TPropertyNamePair s_aNameMap; + if ( s_aNameMap.empty() ) + { + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter))); + + ::boost::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust))); + } + return s_aNameMap; + } case OBJ_DLG_FORMATTEDFIELD: { static TPropertyNamePair s_aNameMap; if ( s_aNameMap.empty() ) { - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,PROPERTY_TEXTCOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,PROPERTY_BACKGROUNDCOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,PROPERTY_TEXTLINECOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,PROPERTY_FONTRELIEF)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,PROPERTY_FONTHEIGHT)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,PROPERTY_FONTSTRIKEOUT)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,PROPERTY_FONTEMPHASISMARK)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,PROPERTY_BORDER)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,PROPERTY_BORDERCOLOR)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,PROPERTY_ALIGN)); + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter))); + //s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aNoConverter))); + ::boost::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust()); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust))); } return s_aNameMap; } @@ -221,8 +306,9 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) static TPropertyNamePair s_aNameMap; if ( s_aNameMap.empty() ) { - s_aNameMap.insert(TPropertyNamePair::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")),PROPERTY_CONTROLBACKGROUND)); - s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,PROPERTY_ALIGN)); + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); + s_aNameMap.insert(TPropertyNamePair::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")),TPropertyConverter(PROPERTY_CONTROLBACKGROUND,aNoConverter))); + s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aNoConverter))); } return s_aNameMap; } @@ -424,8 +510,7 @@ OCustomShape::OCustomShape(const uno::Reference< report::XReportComponent>& _xCo ,OObjectBase(_xComponent) { DBG_CTOR( rpt_OCustomShape, NULL); - // start listening - mxUnoShape = uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY); + impl_setUnoShape( uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY) ); m_bIsListening = sal_True; } //---------------------------------------------------------------------------- @@ -441,7 +526,6 @@ OCustomShape::OCustomShape(const ::rtl::OUString& _sComponentName) OCustomShape::~OCustomShape() { DBG_DTOR( rpt_OCustomShape, NULL); - //mxUnoShape = uno::WeakReference< uno::XInterface >(); } // ----------------------------------------------------------------------------- UINT16 OCustomShape::GetObjIdentifier() const @@ -588,7 +672,10 @@ OUnoObject::OUnoObject(const uno::Reference< report::XReportComponent>& _xCompon ,m_nObjectType(_nObjectType) { DBG_CTOR( rpt_OUnoObject, NULL); - mxUnoShape = uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY); + impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) ); + + if ( rModelName.getLength() ) + impl_initializeModel_nothrow(); if ( rModelName.getLength() ) impl_initializeModel_nothrow(); @@ -597,7 +684,6 @@ OUnoObject::OUnoObject(const uno::Reference< report::XReportComponent>& _xCompon OUnoObject::~OUnoObject() { DBG_DTOR( rpt_OUnoObject, NULL); - //mxUnoShape = uno::WeakReference< uno::XInterface >(); } // ----------------------------------------------------------------------------- void OUnoObject::impl_initializeModel_nothrow() @@ -926,22 +1012,19 @@ OOle2Obj::OOle2Obj(const uno::Reference< report::XReportComponent>& _xComponent, :SdrOle2Obj() ,OObjectBase(_xComponent) ,m_nType(_nType) + ,m_bOnlyOnce(true) { DBG_CTOR( rpt_OOle2Obj, NULL); - // start listening - mxUnoShape = uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY); + impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) ); m_bIsListening = sal_True; - //uno::Reference< embed::XEmbeddedObject > xEmbed(_xComponent,uno::UNO_QUERY); - //OSL_ENSURE(xEmbed.is(),"This is no embedded object!"); - - //SetObjRef(xEmbed); } //---------------------------------------------------------------------------- OOle2Obj::OOle2Obj(const ::rtl::OUString& _sComponentName,UINT16 _nType) :SdrOle2Obj() ,OObjectBase(_sComponentName) ,m_nType(_nType) + ,m_bOnlyOnce(true) { DBG_CTOR( rpt_OOle2Obj, NULL); m_bIsListening = sal_True; @@ -1123,17 +1206,42 @@ SdrObject* OOle2Obj::Clone() const // ----------------------------------------------------------------------------- void OOle2Obj::impl_createDataProvider_nothrow(const uno::Reference< frame::XModel>& _xModel) { - uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); - uno::Reference< chart2::data::XDataReceiver > xReceiver; - uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); - if( xCompSupp.is()) - xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); - OSL_ASSERT( xReceiver.is()); - if( xReceiver.is() ) + try + { + uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); + uno::Reference< chart2::data::XDataReceiver > xReceiver; + uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); + if( xCompSupp.is()) + xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); + OSL_ASSERT( xReceiver.is()); + if( xReceiver.is() ) + { + uno::Reference< lang::XMultiServiceFactory> xFac(_xModel,uno::UNO_QUERY); + uno::Reference< chart2::data::XDatabaseDataProvider > xDataProvider( xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"))),uno::UNO_QUERY); + xReceiver->attachDataProvider( xDataProvider.get() ); + } // if( xReceiver.is() ) + } + catch(uno::Exception) { - uno::Reference< lang::XMultiServiceFactory> xFac(_xModel,uno::UNO_QUERY); - uno::Reference< chart2::data::XDatabaseDataProvider > xDataProvider( xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"))),uno::UNO_QUERY); - xReceiver->attachDataProvider( xDataProvider.get() ); + } +} +// ----------------------------------------------------------------------------- +void OOle2Obj::initializeOle() +{ + if ( m_bOnlyOnce ) + { + m_bOnlyOnce = false; + uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); + OReportModel* pRptModel = static_cast<OReportModel*>(GetModel()); + pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj)); + + uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); + if( xCompSupp.is() ) + { + uno::Reference< beans::XPropertySet > xChartProps( xCompSupp->getComponent(), uno::UNO_QUERY ); + if ( xChartProps.is() ) + xChartProps->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate")),uno::makeAny(util::DateTime(0,0,0,0,1,1,1900))); + } } } // ----------------------------------------------------------------------------- @@ -1155,8 +1263,8 @@ void OOle2Obj::initializeChart( const uno::Reference< frame::XModel>& _xModel) if ( !lcl_getDataProvider(xObj).is() ) impl_createDataProvider_nothrow(_xModel); - uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( _xModel, uno::UNO_QUERY ); - xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier ); + OReportModel* pRptModel = static_cast<OReportModel*>(GetModel()); + pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj)); uno::Sequence< beans::PropertyValue > aArgs( 4 ); aArgs[0] = beans::PropertyValue( diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx index 1db6b8e95c98..4d302a491a06 100644 --- a/reportdesign/source/core/sdr/RptPage.cxx +++ b/reportdesign/source/core/sdr/RptPage.cxx @@ -187,6 +187,7 @@ void OReportPage::removeTempObject(SdrObject *_pToRemoveObj) { SdrObject* pObject = RemoveObject(i); (void)pObject; + break; // delete pObject; } } @@ -195,6 +196,7 @@ void OReportPage::removeTempObject(SdrObject *_pToRemoveObj) void OReportPage::resetSpecialMode() { + const sal_Bool bChanged = rModel.IsChanged(); ::std::vector<SdrObject*>::iterator aIter = m_aTemporaryObjectList.begin(); ::std::vector<SdrObject*>::iterator aEnd = m_aTemporaryObjectList.end(); @@ -202,6 +204,8 @@ void OReportPage::resetSpecialMode() { removeTempObject(*aIter); } + m_aTemporaryObjectList.clear(); + rModel.SetChanged(bChanged); m_bSpecialInsertMode = false; } diff --git a/reportdesign/source/core/sdr/UndoActions.cxx b/reportdesign/source/core/sdr/UndoActions.cxx index 4fd0fbad8dd7..7c2bb2bd98e5 100644 --- a/reportdesign/source/core/sdr/UndoActions.cxx +++ b/reportdesign/source/core/sdr/UndoActions.cxx @@ -446,9 +446,6 @@ Reference< XPropertySet> OUndoPropertyReportSectionAction::getObject() { return m_pMemberFunction(&m_aReportHelper).get(); } - - - //============================================================================ } // rptui //============================================================================ diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index add9ea18b7a8..63a76c047195 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -323,7 +323,7 @@ ORptExport::ORptExport(const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt1 UniReference < XMLPropertySetMapper > xPropMapper(new XMLTextPropertySetMapper( TEXT_PROP_MAP_PARA )); m_xParaPropMapper = new OSpecialHanldeXMLExportPropertyMapper( xPropMapper); - //m_xParaPropMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); + // m_xParaPropMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); ::rtl::OUString sFamily( GetXMLToken(XML_PARAGRAPH) ); ::rtl::OUString aPrefix( String( 'P' ) ); @@ -948,6 +948,10 @@ void ORptExport::exportContainer(const Reference< XSection>& _xSection) AddAttribute(XML_NAMESPACE_FORM, XML_IMAGE_DATA,sTargetLocation); } bExportData = sal_True; + ::rtl::OUStringBuffer sValue;
+ const SvXMLEnumMapEntry* aXML_ImageScaleEnumMap = OXMLHelper::GetImageScaleOptions();
+ if ( SvXMLUnitConverter::convertEnum( sValue, xImage->getScaleMode(),aXML_ImageScaleEnumMap ) )
+ AddAttribute(XML_NAMESPACE_REPORT, XML_SCALE, sValue.makeStringAndClear() ); } else if ( xReportDefinition.is() ) { @@ -1268,37 +1272,37 @@ void ORptExport::exportAutoStyle(XPropertySet* _xProp,const Reference<XFormatted } else { - sal_Int32 nTextAlignIndex = m_xCellStylesExportPropertySetMapper->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST ); - if ( nTextAlignIndex != -1 ) - { - ::std::vector< XMLPropertyState >::iterator aIter = aPropertyStates.begin(); - ::std::vector< XMLPropertyState >::iterator aEnd = aPropertyStates.end(); - for (; aIter != aEnd; ++aIter) - { - if ( aIter->mnIndex == nTextAlignIndex ) - { - sal_Int16 nTextAlign = 0; - aIter->maValue >>= nTextAlign; - switch(nTextAlign) - { - case awt::TextAlign::LEFT: - nTextAlign = style::ParagraphAdjust_LEFT; - break; - case awt::TextAlign::CENTER: - nTextAlign = style::ParagraphAdjust_CENTER; - break; - case awt::TextAlign::RIGHT: - nTextAlign = style::ParagraphAdjust_RIGHT; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - aIter->maValue <<= nTextAlign; - break; - } - } - } + //sal_Int32 nTextAlignIndex = m_xCellStylesExportPropertySetMapper->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST ); + //if ( nTextAlignIndex != -1 ) + //{ + // ::std::vector< XMLPropertyState >::iterator aIter = aPropertyStates.begin(); + // ::std::vector< XMLPropertyState >::iterator aEnd = aPropertyStates.end(); + // for (; aIter != aEnd; ++aIter) + // { + // if ( aIter->mnIndex == nTextAlignIndex ) + // { + // sal_Int16 nTextAlign = 0; + // aIter->maValue >>= nTextAlign; + // switch(nTextAlign) + // { + // case awt::TextAlign::LEFT: + // nTextAlign = style::ParagraphAdjust_LEFT; + // break; + // case awt::TextAlign::CENTER: + // nTextAlign = style::ParagraphAdjust_CENTER; + // break; + // case awt::TextAlign::RIGHT: + // nTextAlign = style::ParagraphAdjust_RIGHT; + // break; + // default: + // OSL_ENSURE(0,"Illegal text alignment value!"); + // break; + // } + // aIter->maValue <<= nTextAlign; + // break; + // } + // } + //} const Reference<XFormattedField> xFormattedField(_xProp,uno::UNO_QUERY); if ( (_xParentFormattedField.is() || xFormattedField.is()) && !aPropertyStates.empty() ) { diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx index f4a394263234..73df0a049241 100644 --- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx @@ -88,9 +88,11 @@ void lcl_correctCellAddress(const ::rtl::OUString & _sName, const uno::Reference ExportDocumentHandler::ExportDocumentHandler(uno::Reference< uno::XComponentContext > const & context) : m_xContext(context) ,m_nCurrentCellIndex(0) + ,m_nColumnCount(0) ,m_bTableRowsStarted(false) ,m_bFirstRowExported(false) ,m_bExportChar(false) + ,m_bCountColumnHeader(false) { } // ----------------------------------------------------------------------------- @@ -189,6 +191,17 @@ void SAL_CALL ExportDocumentHandler::startElement(const ::rtl::OUString & _sName pList->AddAttribute(lcl_createAttribute(XML_NP_OFFICE,XML_MIMETYPE),MIMETYPE_OASIS_OPENDOCUMENT_CHART); m_xDelegatee->startElement(lcl_createAttribute(XML_NP_OFFICE,XML_REPORT),xNewAttribs); + + const ::rtl::OUString sTableCalc = lcl_createAttribute(XML_NP_TABLE,XML_CALCULATION_SETTINGS); + m_xDelegatee->startElement(sTableCalc,NULL); + pList = new SvXMLAttributeList(); + uno::Reference< xml::sax::XAttributeList > xNullAttr = pList; + pList->AddAttribute(lcl_createAttribute(XML_NP_TABLE,XML_DATE_VALUE),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1900-01-01"))); + + const ::rtl::OUString sNullDate = lcl_createAttribute(XML_NP_TABLE,XML_NULL_DATE); + m_xDelegatee->startElement(sNullDate,xNullAttr); + m_xDelegatee->endElement(sNullDate); + m_xDelegatee->endElement(sTableCalc); bExport = false; } else if ( _sName.equalsAscii("table:table") ) @@ -196,6 +209,14 @@ void SAL_CALL ExportDocumentHandler::startElement(const ::rtl::OUString & _sName m_xDelegatee->startElement(lcl_createAttribute(XML_NP_RPT,XML_DETAIL),NULL); lcl_exportPrettyPrinting(m_xDelegatee); } + else if ( _sName.equalsAscii("table:table-header-rows") ) + { + m_bCountColumnHeader = true; + } + else if ( m_bCountColumnHeader && _sName.equalsAscii("table:table-cell") ) + { + ++m_nColumnCount; + } else if ( _sName.equalsAscii("table:table-rows") ) { m_xDelegatee->startElement(_sName,xAttribs); @@ -249,6 +270,10 @@ void SAL_CALL ExportDocumentHandler::endElement(const ::rtl::OUString & _sName) lcl_exportPrettyPrinting(m_xDelegatee); sNewName = lcl_createAttribute(XML_NP_RPT,XML_DETAIL); } + else if ( _sName.equalsAscii("table:table-header-rows") ) + { + m_bCountColumnHeader = false; + } else if ( _sName.equalsAscii("table:table-rows") ) m_bTableRowsStarted = false; else if ( m_bTableRowsStarted && m_bFirstRowExported && (_sName.equalsAscii("table:table-row") || _sName.equalsAscii("table:table-cell")) ) @@ -360,8 +385,26 @@ void ExportDocumentHandler::exportTableRows() uno::Reference< xml::sax::XAttributeList > xCellAtt = pCellAtt; pCellAtt->AddAttribute(sValueType,s_sString); + bool bRemoveString = true; ::rtl::OUString sFormula; const sal_Int32 nCount = m_aColumns.getLength(); + if ( m_nColumnCount > nCount ) + { + const sal_Int32 nEmptyCellCount = m_nColumnCount - nCount; + for(sal_Int32 i = 0; i < nEmptyCellCount ; ++i) + { + m_xDelegatee->startElement(sCell,xCellAtt); + if ( bRemoveString ) + { + bRemoveString = false; + pCellAtt->RemoveAttribute(sValueType); + pCellAtt->AddAttribute(sValueType,s_sFloat); + } // if ( i == 0 ) + m_xDelegatee->startElement(sP,NULL); + m_xDelegatee->endElement(sP); + m_xDelegatee->endElement(sCell); + } + } for(sal_Int32 i = 0; i < nCount ; ++i) { sFormula = s_sFieldPrefix; @@ -372,8 +415,9 @@ void ExportDocumentHandler::exportTableRows() pList->AddAttribute(sFormulaAttrib,sFormula); m_xDelegatee->startElement(sCell,xCellAtt); - if ( i == 0 ) + if ( bRemoveString ) { + bRemoveString = false; pCellAtt->RemoveAttribute(sValueType); pCellAtt->AddAttribute(sValueType,s_sFloat); } diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.hxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.hxx index 33cad946997a..3da9f99ca9d1 100644 --- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.hxx +++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.hxx @@ -96,9 +96,11 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDatabaseDataProvider > m_xDatabaseDataProvider; ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aColumns; sal_Int32 m_nCurrentCellIndex; + sal_Int32 m_nColumnCount; bool m_bTableRowsStarted; bool m_bFirstRowExported; bool m_bExportChar; + bool m_bCountColumnHeader; }; // ----------------------------------------------------------------------------- } // namespace rptxml diff --git a/reportdesign/source/filter/xml/xmlHelper.cxx b/reportdesign/source/filter/xml/xmlHelper.cxx index 1b81d87a1119..d0e75499ace0 100644 --- a/reportdesign/source/filter/xml/xmlHelper.cxx +++ b/reportdesign/source/filter/xml/xmlHelper.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/awt/TextAlign.hpp> #include <com/sun/star/awt/ImagePosition.hpp> +#include <com/sun/star/awt/ImageScaleMode.hpp> #include <xmloff/prstylei.hxx> #include "xmlstrings.hrc" #include "xmlEnums.hxx" @@ -59,7 +60,7 @@ #include <com/sun/star/report/XReportControlFormat.hpp> #include <com/sun/star/form/ListSourceType.hpp> #include <com/sun/star/sdb/CommandType.hpp> -#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/style/VerticalAlignment.hpp> #include <xmloff/EnumPropertyHdl.hxx> #define XML_RPT_ALGINMENT (XML_DB_TYPES_START+1) @@ -85,21 +86,22 @@ OPropertyHandlerFactory::~OPropertyHandlerFactory() const XMLPropertyHandler* OPropertyHandlerFactory::GetPropertyHandler(sal_Int32 _nType) const { const XMLPropertyHandler* pHandler = NULL; + sal_Int32 nType = _nType; + nType &= MID_FLAG_MASK; - switch(_nType) + switch(nType) { case XML_RPT_ALGINMENT: { static SvXMLEnumMapEntry __READONLY_DATA pXML_VerticalAlign_Enum[] = { - { XML_TOP, drawing::TextVerticalAdjust_TOP }, - { XML_MIDDLE, drawing::TextVerticalAdjust_CENTER }, - { XML_BOTTOM, drawing::TextVerticalAdjust_BOTTOM }, - { XML_JUSTIFY, drawing::TextVerticalAdjust_BLOCK }, + { XML_TOP, style::VerticalAlignment_TOP }, + { XML_MIDDLE, style::VerticalAlignment_MIDDLE }, + { XML_BOTTOM, style::VerticalAlignment_BOTTOM }, { XML_TOKEN_INVALID, 0 } }; - pHandler = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::drawing::TextVerticalAdjust*)0) ); + pHandler = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::style::VerticalAlignment*)0) ); } break; case (XML_SD_TYPES_START+34): @@ -110,6 +112,8 @@ const XMLPropertyHandler* OPropertyHandlerFactory::GetPropertyHandler(sal_Int32 if ( !pHandler ) pHandler = OControlPropertyHandlerFactory::GetPropertyHandler(_nType); + else + PutHdlCache(nType, pHandler); return pHandler; } // ----------------------------------------------------------------------------- @@ -134,13 +138,13 @@ UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap(bool _ MAP_CONST_C( PROPERTY_CONTROLBACKGROUND, FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), + MAP_CONST_C( PROPERTY_VERTICALALIGN, STYLE, VERTICAL_ALIGN, XML_RPT_ALGINMENT, 0 ), MAP_CONST_C( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), MAP_CONST_P( PROPERTY_CONTROLBACKGROUND, FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_P( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), - GMAP( PROPERTY_SCALEMODE,STYLE,REPEAT, (XML_SD_TYPES_START+34)|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_C_ASCII( "BorderLeft", FO, BORDER_LEFT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderRight", FO, BORDER_RIGHT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderTop", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ), @@ -159,7 +163,8 @@ UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap(bool _ FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_C( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), - GMAP( PROPERTY_SCALEMODE,STYLE,REPEAT, (XML_SD_TYPES_START+34)|MID_FLAG_MULTI_PROPERTY, 0 ), + MAP_CONST_C( PROPERTY_VERTICALALIGN, + STYLE, VERTICAL_ALIGN, XML_RPT_ALGINMENT, 0 ), MAP_CONST_C_ASCII( "BorderLeft", FO, BORDER_LEFT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderRight", FO, BORDER_RIGHT, XML_TYPE_BORDER, 0 ), MAP_CONST_C_ASCII( "BorderTop", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ), @@ -231,26 +236,6 @@ const SvXMLEnumMapEntry* OXMLHelper::GetForceNewPageOptions() return s_aXML_EnumMap; } // ----------------------------------------------------------------------------- -//// ----------------------------------------------------------------------------- -//const SvXMLEnumMapEntry* OXMLHelper::GetGroupOnOptions() -//{ -// static SvXMLEnumMapEntry s_aXML_EnumMap[] = -// { -// // { XML_DEFAULT ,report::GroupOn::DEFAULT }, // default -// { XML_PREFIX_CHARACTERS ,report::GroupOn::PREFIX_CHARACTERS }, -// { XML_YEAR ,report::GroupOn::YEAR }, -// { XML_QUARTAL , report::GroupOn::QUARTAL }, -// { XML_MONTH , report::GroupOn::MONTH }, -// { XML_WEEK , report::GroupOn::WEEK }, -// { XML_DAY , report::GroupOn::DAY }, -// { XML_HOUR , report::GroupOn::HOUR }, -// { XML_MINUTE , report::GroupOn::MINUTE }, -// { XML_INTERVAL , report::GroupOn::INTERVAL }, -// { XML_TOKEN_INVALID, 0 } -// }; -// return s_aXML_EnumMap; -//} -// ----------------------------------------------------------------------------- const SvXMLEnumMapEntry* OXMLHelper::GetKeepTogetherOptions() { static SvXMLEnumMapEntry s_aXML_EnumMap[] = @@ -352,33 +337,10 @@ void OXMLHelper::copyStyleElements(const bool _bOld,const ::rtl::OUString& _sSty xProp->getPropertyValue(PROPERTY_FONTTYPE) >>= aFont.Type; uno::Reference<report::XReportControlFormat> xReportControlModel(_xProp,uno::UNO_QUERY); if ( xReportControlModel.is() && aFont.Name.getLength() ) - try - { - xReportControlModel->setFontDescriptor(aFont); - } - catch(beans::UnknownPropertyException){} - - if ( xReportControlModel.is() ) { try { - sal_Int16 nTextAlign = xReportControlModel->getParaAdjust(); - switch(nTextAlign) - { - case style::ParagraphAdjust_LEFT: - nTextAlign = awt::TextAlign::LEFT; - break; - case style::ParagraphAdjust_CENTER: - nTextAlign = awt::TextAlign::CENTER; - break; - case style::ParagraphAdjust_RIGHT: - nTextAlign = awt::TextAlign::RIGHT; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - xReportControlModel->setParaAdjust(nTextAlign); + xReportControlModel->setFontDescriptor(aFont); } catch(beans::UnknownPropertyException){} } @@ -442,5 +404,18 @@ SvXMLTokenMap* OXMLHelper::GetSubDocumentElemTokenMap() return new SvXMLTokenMap( aElemTokenMap ); } // ----------------------------------------------------------------------------- +const SvXMLEnumMapEntry* OXMLHelper::GetImageScaleOptions()
+{
+ static SvXMLEnumMapEntry s_aXML_EnumMap[] =
+ {
+ // { XML_NONE, awt::ImageScaleMode::None }, // default
+ { XML_ISOTROPIC, awt::ImageScaleMode::Isotropic },
+ { XML_ANISOTROPIC, awt::ImageScaleMode::Anisotropic },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return s_aXML_EnumMap;
+}
+// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- } // rptxml // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/filter/xml/xmlHelper.hxx b/reportdesign/source/filter/xml/xmlHelper.hxx index cfb0df81a213..909ae9defeda 100644 --- a/reportdesign/source/filter/xml/xmlHelper.hxx +++ b/reportdesign/source/filter/xml/xmlHelper.hxx @@ -39,8 +39,7 @@ #include <memory> -#define CTF_RPT_NUMBERFORMAT (XML_DB_CTF_START + 1) -#define CTF_RPT_PARAVERTALIGNMENT (XML_DB_CTF_START + 2) +#define CTF_RPT_NUMBERFORMAT (XML_DB_CTF_START + 1) #define XML_STYLE_FAMILY_REPORT_ID 700 #define XML_STYLE_FAMILY_REPORT_NAME "report-element" @@ -76,6 +75,7 @@ namespace rptxml static const SvXMLEnumMapEntry* GetForceNewPageOptions(); static const SvXMLEnumMapEntry* GetKeepTogetherOptions(); static const SvXMLEnumMapEntry* GetCommandTypeOptions(); + static const SvXMLEnumMapEntry* GetImageScaleOptions(); static const XMLPropertyMapEntry* GetTableStyleProps(); static const XMLPropertyMapEntry* GetColumnStyleProps(); diff --git a/reportdesign/source/filter/xml/xmlImage.cxx b/reportdesign/source/filter/xml/xmlImage.cxx index 33c0b58646b2..b1341a35c365 100644 --- a/reportdesign/source/filter/xml/xmlImage.cxx +++ b/reportdesign/source/filter/xml/xmlImage.cxx @@ -33,10 +33,12 @@ #include <xmloff/xmltoken.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/nmspmap.hxx> +#include <xmloff/xmluconv.hxx> #include "xmlEnums.hxx" #include "xmlComponent.hxx" #include "xmlReportElement.hxx" #include "xmlControlProperty.hxx" +#include "xmlHelper.hxx" #include <tools/debug.hxx> #include <svtools/pathoptions.hxx> @@ -90,7 +92,19 @@ OXMLImage::OXMLImage( ORptFilter& rImport, _xComponent->setPreserveIRI(s_sTRUE == sValue); break; case XML_TOK_SCALE: - _xComponent->setScaleMode(s_sTRUE == sValue ? awt::ImageScaleMode::Anisotropic : awt::ImageScaleMode::None ); + {
+ sal_uInt16 nRet = awt::ImageScaleMode::None;
+ if ( s_sTRUE == sValue )
+ {
+ nRet = awt::ImageScaleMode::Anisotropic;
+ }
+ else
+ {
+ const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetImageScaleOptions();
+ SvXMLUnitConverter::convertEnum( nRet, sValue, aXML_EnumMap );
+ }
+ _xComponent->setScaleMode( nRet );
+ } break; case XML_TOK_DATA_FORMULA: _xComponent->setDataField(ORptFilter::convertFormula(sValue)); diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx index 32944bc81998..ea1095258261 100644 --- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx @@ -58,7 +58,8 @@ using namespace ::xmloff::token; ::rtl::OUString lcl_createAttribute(const xmloff::token::XMLTokenEnum& _eNamespace,const xmloff::token::XMLTokenEnum& _eAttribute); ImportDocumentHandler::ImportDocumentHandler(uno::Reference< uno::XComponentContext > const & context) : - m_xContext(context) + m_xContext(context) + ,m_bOnlyOnce(true) { } // ----------------------------------------------------------------------------- @@ -167,7 +168,6 @@ void SAL_CALL ImportDocumentHandler::startElement(const ::rtl::OUString & _sName break; } } - m_xDatabaseDataProvider->execute(); } catch(uno::Exception&) { @@ -224,10 +224,52 @@ void SAL_CALL ImportDocumentHandler::startElement(const ::rtl::OUString & _sName bExport = false; else if ( _sName.equalsAscii("chart:plot-area")) { + sal_Bool bHasCategories = sal_True; + const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0; + ::std::auto_ptr<SvXMLTokenMap> pMasterElemTokenMap( OXMLHelper::GetSubDocumentElemTokenMap()); + for(sal_Int16 i = 0; i < nLength; ++i) + { + ::rtl::OUString sLocalName; + const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i ); + const sal_Int32 nColonPos = sAttrName.indexOf( sal_Unicode(':') ); + if( -1L == nColonPos ) + sLocalName = sAttrName; + else + sLocalName = sAttrName.copy( nColonPos + 1L ); + if ( sLocalName.equalsAscii("data-source-has-labels") ) + { + const rtl::OUString sValue = _xAttrList->getValueByIndex( i ); + bHasCategories = sValue.equalsAscii("both"); + break; + } + } // for(sal_Int16 i = 0; i < nLength; ++i) + beans::PropertyValue* pArgIter = m_aArguments.getArray(); + beans::PropertyValue* pArgEnd = pArgIter + m_aArguments.getLength(); + for(;pArgIter != pArgEnd;++pArgIter) + { + if ( pArgIter->Name.equalsAscii("HasCategories") ) + { + pArgIter->Value <<= bHasCategories; + break; + } + } // for(;pArgIter != pArgEnd;++pArgIter) + + if ( m_bOnlyOnce ) + { + try + { + m_xDatabaseDataProvider->createDataSource(m_aArguments); + m_bOnlyOnce = false; + } + catch(uno::Exception) + {} + } // if ( m_bOnlyOnce ) + SvXMLAttributeList* pList = new SvXMLAttributeList(); xNewAttribs = pList; pList->AppendAttributeList(_xAttrList); pList->AddAttribute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("table:cell-range-address")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("local-table.$A$1:.$Z$65536"))); + } if ( bExport ) @@ -239,7 +281,9 @@ void SAL_CALL ImportDocumentHandler::endElement(const ::rtl::OUString & _sName) bool bExport = true; ::rtl::OUString sNewName = _sName; if ( _sName.equalsAscii("office:report") ) + { sNewName = lcl_createAttribute(XML_NP_OFFICE,XML_CHART); + } else if ( _sName.equalsAscii("rpt:master-detail-fields") ) { if ( !m_aMasterFields.empty() ) @@ -302,7 +346,9 @@ void SAL_CALL ImportDocumentHandler::initialize( const uno::Sequence< uno::Any > uno::Reference< chart2::data::XDataReceiver > xReceiver(m_xModel,uno::UNO_QUERY_THROW); xReceiver->attachDataProvider(m_xDatabaseDataProvider.get()); - } + } // if ( !m_xDatabaseDataProvider.is() ) + + m_aArguments = m_xDatabaseDataProvider->detectArguments(NULL); uno::Reference< reflection::XProxyFactory > xProxyFactory( m_xContext->getServiceManager()->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.ProxyFactory")),m_xContext), diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx index 8a8b126828fa..068fac8cb5f9 100644 --- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx +++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx @@ -90,6 +90,7 @@ private: ::osl::Mutex m_aMutex; ::std::vector< ::rtl::OUString> m_aMasterFields; ::std::vector< ::rtl::OUString> m_aDetailFields; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aArguments; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xDelegatee; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxy; @@ -99,6 +100,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDatabaseDataProvider > m_xDatabaseDataProvider; ::std::auto_ptr<SvXMLTokenMap> m_pReportElemTokenMap; + bool m_bOnlyOnce; }; // ----------------------------------------------------------------------------- } // namespace rptxml diff --git a/reportdesign/source/filter/xml/xmlPropertyHandler.cxx b/reportdesign/source/filter/xml/xmlPropertyHandler.cxx index a11965caf4be..33f04d81af30 100644 --- a/reportdesign/source/filter/xml/xmlPropertyHandler.cxx +++ b/reportdesign/source/filter/xml/xmlPropertyHandler.cxx @@ -48,12 +48,10 @@ DBG_NAME( rpt_OXMLRptPropHdlFactory ) OXMLRptPropHdlFactory::OXMLRptPropHdlFactory() { DBG_CTOR( rpt_OXMLRptPropHdlFactory,NULL); - } // ----------------------------------------------------------------------------- OXMLRptPropHdlFactory::~OXMLRptPropHdlFactory() { - DBG_DTOR( rpt_OXMLRptPropHdlFactory,NULL); } // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index 80c2c2d885f6..51307c956c65 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -566,8 +566,8 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) { MAP_LEN( "OldFormat" ), 1, &::getCppuType((const sal_Bool*)0), beans::PropertyAttribute::BOUND, 0 }, { MAP_LEN( "StreamName"), 0, &::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, { MAP_LEN("PrivateData"), 0, &::getCppuType( (uno::Reference<XInterface> *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "BaseURI"), 0,&::getCppuType( (::rtl::OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "StreamRelPath"), 0,&::getCppuType( (::rtl::OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "BaseURI"), 0, &::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "StreamRelPath"), 0, &::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, { NULL, 0, 0, NULL, 0, 0 } }; ::comphelper::MediaDescriptor aDescriptor(rDescriptor); diff --git a/reportdesign/source/inc/stringconstants.hrc b/reportdesign/source/inc/stringconstants.hrc index c9f4c520c863..69482ef4b869 100644 --- a/reportdesign/source/inc/stringconstants.hrc +++ b/reportdesign/source/inc/stringconstants.hrc @@ -160,6 +160,7 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_FONTFAMILY); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTHEIGHT); DECLARE_CONSTASCII_USTRING(PROPERTY_CHARFONTHEIGHT); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTKERNING); +DECLARE_CONSTASCII_USTRING(PROPERTY_FONT); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTNAME); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTORIENTATION); DECLARE_CONSTASCII_USTRING(PROPERTY_FONTPITCH); @@ -281,6 +282,7 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_CHARKERNING ); DECLARE_CONSTASCII_USTRING(PROPERTY_ORDER ); DECLARE_CONSTASCII_USTRING(PROPERTY_APPLYFILTER ); +DECLARE_CONSTASCII_USTRING(PROPERTY_MAXROWS ); //============================================================ //= service names diff --git a/reportdesign/source/inc/uistrings.hrc b/reportdesign/source/inc/uistrings.hrc index 07d5f492ba89..356088a19b5f 100644 --- a/reportdesign/source/inc/uistrings.hrc +++ b/reportdesign/source/inc/uistrings.hrc @@ -73,7 +73,6 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_FILLGRADIENTNAME ); DECLARE_CONSTASCII_USTRING(PROPERTY_FILLHATCHNAME ); DECLARE_CONSTASCII_USTRING(PROPERTY_FILLBITMAPNAME ); DECLARE_CONSTASCII_USTRING(PROPERTY_FILLSTYLE ); - DECLARE_CONSTASCII_USTRING(DBTEXTBOXBOUNDCONTENT ); } diff --git a/reportdesign/source/shared/stringconstants.cxx b/reportdesign/source/shared/stringconstants.cxx index f0486bf9c92c..e4123f21e3e8 100644 --- a/reportdesign/source/shared/stringconstants.cxx +++ b/reportdesign/source/shared/stringconstants.cxx @@ -113,7 +113,7 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTDESCRIPTORCOMPLEX , "FontDescriptorCom IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLTEXTEMPHASISMARK , "ControlTextEmphasis"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARRELIEF , "CharRelief"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARCOLOR , "CharColor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VERTICALALIGN , "ParaVertAlignment"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VERTICALALIGN , "VerticalAlign"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_IMAGEPOSITION , "ImagePosition"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_IMAGEURL , "ImageURL"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARUNDERLINECOLOR , "CharUnderlineColor"); @@ -154,6 +154,7 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTFAMILY, "CharFontFamily"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHARFONTHEIGHT, "CharHeight"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTHEIGHT, "FontHeight"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTKERNING, "FontKerning"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT, "FontDescriptor"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTNAME, "FontName"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTORIENTATION, "CharRotation"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTPITCH, "CharFontPitch"); @@ -273,5 +274,6 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HYPERLINKNAME , "HyperLinkName"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VISITEDCHARSTYLENAME, "VisitedCharStyleName"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_UNVISITEDCHARSTYLENAME, "UnvisitedCharStyleName"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ORDER, "Order"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_APPLYFILTER, "ApplyFilter"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ORDER, "Order"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_APPLYFILTER, "ApplyFilter"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MAXROWS, "MaxRows"); diff --git a/reportdesign/source/shared/uistrings.cxx b/reportdesign/source/shared/uistrings.cxx index ceee0aea34f0..21d80cb19ad4 100644 --- a/reportdesign/source/shared/uistrings.cxx +++ b/reportdesign/source/shared/uistrings.cxx @@ -70,4 +70,3 @@ namespace rptui IMPLEMENT_CONSTASCII_USTRING(DBTEXTBOXBOUNDCONTENT , "TextBoxBoundContent"); } - diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx index afc53270754a..034ff5f9c7b5 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -401,7 +401,6 @@ void OAddFieldWindow::Resize() // Help text Point aFTPos( aRelated.Width(), aFLPos.Y() + aFLSize.Height() + aRelated.Height() ); m_aHelpText.SetPosSizePixel( aFTPos, aHelpTextSize ); - } // ----------------------------------------------------------------------------- uno::Reference< sdbc::XConnection> OAddFieldWindow::getConnection() const diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx index 43e17fcff67e..d84da255e9e3 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -49,7 +49,8 @@ #include <com/sun/star/report/XReportEngine.hpp> #include <com/sun/star/report/XSection.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> -#include <cppuhelper/implbase4.hxx> +#include <com/sun/star/embed/XVisualObject.hpp> +#include <cppuhelper/implbase5.hxx> #include <svtools/transfer.hxx> #include <svtools/lstner.hxx> #include <svx/svdedtv.hxx> @@ -81,10 +82,11 @@ namespace rptui class OSectionWindow; typedef ::dbaui::OSingleDocumentController OReportController_BASE; - typedef ::cppu::ImplHelper4 < ::com::sun::star::container::XContainerListener + typedef ::cppu::ImplHelper5 < ::com::sun::star::container::XContainerListener , ::com::sun::star::beans::XPropertyChangeListener , ::com::sun::star::view::XSelectionSupplier , ::com::sun::star::util::XModeSelector + , ::com::sun::star::embed::XVisualObject > OReportController_Listener; class OReportController : public OReportController_BASE @@ -114,6 +116,7 @@ namespace rptui ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > m_xRowSetMediator; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; // a number formatter working with the report's NumberFormatsSupplier + ::com::sun::star::awt::Size m_aVisualAreaSize; ::boost::shared_ptr<rptui::OReportModel> m_aReportModel; @@ -123,6 +126,7 @@ namespace rptui sal_Int32 m_nSplitPos; /// the position of the splitter sal_Int32 m_nPageNum; /// the page number from the restoreView call sal_Int32 m_nSelectionCount; + ::sal_Int64 m_nAspect; sal_Int16 m_nZoomValue; SvxZoomType m_eZoomType; sal_Bool m_bShowRuler; @@ -133,6 +137,7 @@ namespace rptui sal_Bool m_bHelplinesMove; bool m_bChartEnabled; bool m_bChartEnabledAsked; + bool m_bInGeneratePreview; /** creates a formatted field in the given section with the given formula as data field * @@ -409,6 +414,12 @@ namespace rptui virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes( ) throw (::com::sun::star::uno::RuntimeException) ; virtual ::sal_Bool SAL_CALL supportsMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::uno::RuntimeException) ; + // XVisualObject + virtual void SAL_CALL setVisualAreaSize( ::sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMapUnit( ::sal_Int64 nAspect ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + /** returns the current position of the splitter * diff --git a/reportdesign/source/ui/inc/ReportControllerObserver.hxx b/reportdesign/source/ui/inc/ReportControllerObserver.hxx index 7d11bf0d0fa8..87468d61e303 100644 --- a/reportdesign/source/ui/inc/ReportControllerObserver.hxx +++ b/reportdesign/source/ui/inc/ReportControllerObserver.hxx @@ -73,8 +73,7 @@ namespace rptui void switchListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, sal_Bool _bStartListening); - /* virtual */ ~OXReportControllerObserver(); // UNO Object must have private destructor! - + virtual ~OXReportControllerObserver(); // UNO Object must have private destructor! public: OXReportControllerObserver(const OReportController& _rController); diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx index a3f20f9523df..e07dce364c59 100644 --- a/reportdesign/source/ui/inc/metadata.hxx +++ b/reportdesign/source/ui/inc/metadata.hxx @@ -137,10 +137,10 @@ namespace rptui #define PROPERTY_ID_DEEPTRAVERSING 25 #define PROPERTY_ID_PREEVALUATED 26 - #define PROPERTY_ID_BACKCOLOR 29 - #define PROPERTY_ID_CONTROLBACKGROUND 30 #define PROPERTY_ID_BACKTRANSPARENT 27 #define PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT 28 + #define PROPERTY_ID_BACKCOLOR 29 + #define PROPERTY_ID_CONTROLBACKGROUND 30 #define PROPERTY_ID_FORMULALIST 31 #define PROPERTY_ID_SCOPE 32 @@ -152,6 +152,11 @@ namespace rptui #define PROPERTY_ID_AREA 38 #define PROPERTY_ID_MIMETYPE 39 + #define PROPERTY_ID_FONT 40 + #define PROPERTY_ID_PARAADJUST 41 + #define PROPERTY_ID_VERTICALALIGN 42 + + //............................................................................ } // namespace rptui //............................................................................ diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx index 66a922daeed9..3a9ebf033e03 100644 --- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx +++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx @@ -163,9 +163,10 @@ void SAL_CALL DataProviderHandler::inspect(const uno::Reference< uno::XInterface m_xReportComponent.set( xNameCont->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReportComponent" ) ) ), uno::UNO_QUERY ); if ( m_xDataProvider.is() ) { + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); TPropertyNamePair aPropertyMediation; - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_MASTERFIELDS, PROPERTY_MASTERFIELDS ) ); - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_DETAILFIELDS, PROPERTY_DETAILFIELDS ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_MASTERFIELDS, TPropertyConverter(PROPERTY_MASTERFIELDS,aNoConverter) ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_DETAILFIELDS, TPropertyConverter(PROPERTY_DETAILFIELDS,aNoConverter) ) ); m_xMasterDetails = new OPropertyMediator( m_xDataProvider.get(), m_xReportComponent.get(), aPropertyMediation,sal_True ); } @@ -488,7 +489,8 @@ void SAL_CALL DataProviderHandler::actuatingPropertyChanged(const ::rtl::OUStrin xReceiver->setArguments( aArgs ); if ( !bModified ) xReport->setModified(sal_False); - } + } // if ( NewValue != OldValue ) + m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit); } // if ( ActuatingPropertyName == PROPERTY_COMMAND ) else if ( ActuatingPropertyName == PROPERTY_TITLE ) { diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 95b7cdc3fcea..c2d9f067ff75 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -61,10 +61,11 @@ #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/inspection/XNumericControl.hpp> -#include <com/sun/star/util/MeasureUnit.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <vcl/msgbox.hxx> #include <vcl/waitobj.hxx> @@ -651,7 +652,7 @@ void SAL_CALL GeometryHandler::setPropertyValue(const ::rtl::OUString & Property } } break; - case PROPERTY_ID_CHARFONTNAME: + case PROPERTY_ID_FONT: { const uno::Reference< report::XReportControlFormat > xReportControlFormat( m_xReportComponent,uno::UNO_QUERY_THROW ); uno::Sequence< beans::NamedValue > aFontSettings; @@ -825,7 +826,7 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const case PROPERTY_ID_CONTROLBACKGROUND: aOut.Control = _xControlFactory->createPropertyControl( inspection::PropertyControlType::ColorListBox, sal_False ); break; - case PROPERTY_ID_CHARFONTNAME: + case PROPERTY_ID_FONT: aOut.PrimaryButtonId = UID_RPT_RPT_PROP_DLG_FONT_TYPE; aOut.Control = _xControlFactory->createPropertyControl( inspection::PropertyControlType::TextField, sal_True ); aOut.HasPrimaryButton = sal_True; @@ -835,6 +836,12 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const aOut.Control = _xControlFactory->createPropertyControl( inspection::PropertyControlType::TextField, sal_True ); aOut.HasPrimaryButton = sal_True; break; + case PROPERTY_ID_VERTICALALIGN: + implCreateListLikeControl(_xControlFactory,aOut,RID_STR_VERTICAL_ALIGN_CONST,sal_False,sal_True); + break; + case PROPERTY_ID_PARAADJUST: + implCreateListLikeControl(_xControlFactory,aOut,RID_STR_PARAADJUST_CONST,sal_False,sal_True); + break; default: { aOut = m_xFormComponentHandler->describePropertyLine(PropertyName, _xControlFactory); @@ -1051,8 +1058,9 @@ uno::Any SAL_CALL GeometryHandler::convertToPropertyValue(const ::rtl::OUString aPropertyValue <<= nPosX; } break; - case PROPERTY_ID_CHARFONTNAME: - return m_xFormComponentHandler->convertToPropertyValue(PROPERTY_FONTNAME, _rControlValue); + case PROPERTY_ID_FONT: + aPropertyValue = m_xFormComponentHandler->convertToPropertyValue(PROPERTY_FONT, _rControlValue); + break; case PROPERTY_ID_SCOPE: case PROPERTY_ID_FORMULALIST: case PROPERTY_ID_AREA: @@ -1072,6 +1080,28 @@ uno::Any SAL_CALL GeometryHandler::convertToPropertyValue(const ::rtl::OUString case PROPERTY_ID_MIMETYPE: aPropertyValue = _rControlValue; break; + case PROPERTY_ID_VERTICALALIGN: + { + ::rtl::OUString sValue; + _rControlValue >>= sValue; + ::std::vector< ::rtl::OUString > aList; + tools::StringListResource aRes(ModuleRes(RID_STR_VERTICAL_ALIGN_CONST),aList); + ::std::vector< ::rtl::OUString >::iterator aFind = ::std::find(aList.begin(),aList.end(),sValue); + if ( aFind != aList.end() ) + aPropertyValue <<= static_cast<style::VerticalAlignment>(aFind - aList.begin()); + } + break; + case PROPERTY_ID_PARAADJUST: + { + ::rtl::OUString sValue; + _rControlValue >>= sValue; + ::std::vector< ::rtl::OUString > aList; + tools::StringListResource aRes(ModuleRes(RID_STR_PARAADJUST_CONST),aList); + ::std::vector< ::rtl::OUString >::iterator aFind = ::std::find(aList.begin(),aList.end(),sValue); + if ( aFind != aList.end() ) + aPropertyValue <<= static_cast<sal_Int16>(aFind - aList.begin()); + } + break; default: return m_xFormComponentHandler->convertToPropertyValue(PropertyName, _rControlValue); } @@ -1158,8 +1188,8 @@ uno::Any SAL_CALL GeometryHandler::convertToControlValue(const ::rtl::OUString & lcl_convertFormulaTo(aPropertyValue,aControlValue); } break; - case PROPERTY_ID_CHARFONTNAME: - aControlValue = m_xFormComponentHandler->convertToControlValue(PROPERTY_FONTNAME, aPropertyValue, _rControlValueType); + case PROPERTY_ID_FONT: + aControlValue = m_xFormComponentHandler->convertToControlValue(PROPERTY_FONT, aPropertyValue, _rControlValueType); break; case PROPERTY_ID_POSITIONX: { @@ -1189,6 +1219,26 @@ uno::Any SAL_CALL GeometryHandler::convertToControlValue(const ::rtl::OUString & aControlValue <<= aList[m_nDataFieldType]; } break; + case PROPERTY_ID_VERTICALALIGN: + { + style::VerticalAlignment nParagraphVertAlign = style::VerticalAlignment_TOP; + aPropertyValue >>= nParagraphVertAlign; + ::std::vector< ::rtl::OUString > aList; + tools::StringListResource aRes(ModuleRes(RID_STR_VERTICAL_ALIGN_CONST),aList); + if ( static_cast<sal_Int16>(nParagraphVertAlign) < static_cast<sal_Int16>(aList.size()) ) + aControlValue <<= aList[nParagraphVertAlign]; + } + break; + case PROPERTY_ID_PARAADJUST: + { + sal_Int16 nParagraphAdjust = style::ParagraphAdjust_LEFT; + aPropertyValue >>= nParagraphAdjust; + ::std::vector< ::rtl::OUString > aList; + tools::StringListResource aRes(ModuleRes(RID_STR_PARAADJUST_CONST),aList); + if ( nParagraphAdjust < static_cast<sal_Int16>(aList.size()) ) + aControlValue <<= aList[nParagraphAdjust]; + } + break; case PROPERTY_ID_BACKCOLOR: case PROPERTY_ID_CONTROLBACKGROUND: { @@ -1249,13 +1299,15 @@ uno::Sequence< beans::Property > SAL_CALL GeometryHandler::getSupportedPropertie ,PROPERTY_INITIALFORMULA ,PROPERTY_PRESERVEIRI ,PROPERTY_DATAFIELD - ,PROPERTY_CHARFONTNAME + ,PROPERTY_FONT ,PROPERTY_BACKCOLOR ,PROPERTY_BACKTRANSPARENT ,PROPERTY_CONTROLBACKGROUND ,PROPERTY_CONTROLBACKGROUNDTRANSPARENT ,PROPERTY_LABEL ,PROPERTY_MIMETYPE + ,PROPERTY_VERTICALALIGN + ,PROPERTY_PARAADJUST }; const uno::Reference < beans::XPropertySetInfo > xInfo = m_xReportComponent->getPropertySetInfo(); const uno::Sequence< beans::Property> aSeq = xInfo->getProperties(); @@ -1346,7 +1398,7 @@ inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePr } return eResult; } - else if ( PropertyName.equalsAscii(PROPERTY_CHARFONTNAME) ) + else if ( PropertyName.equalsAscii(PROPERTY_FONT) ) { ::osl::ClearableMutexGuard aGuard( m_aMutex ); diff --git a/reportdesign/source/ui/inspection/inspection.src b/reportdesign/source/ui/inspection/inspection.src index c13eb2a141c9..42d62ba94b37 100644 --- a/reportdesign/source/ui/inspection/inspection.src +++ b/reportdesign/source/ui/inspection/inspection.src @@ -336,6 +336,48 @@ String RID_STR_MIMETYPE { Text [ en-US ] = "Report Output Format" ; }; +String RID_STR_VERTICALALIGN +{ + Text [ en-US ] = "Vert. Alignment" ; +}; +Resource RID_STR_VERTICAL_ALIGN_CONST +{ + String 1 + { + Text [ en-US ] = "Top"; + }; + String 2 + { + Text [ en-US ] = "Middle"; + }; + String 3 + { + Text [ en-US ] = "Bottom"; + }; +}; +String RID_STR_PARAADJUST +{ + Text [ en-US ] = "Horz. Alignment" ; +}; +Resource RID_STR_PARAADJUST_CONST +{ + String 1 + { + Text [ en-US ] = "Left"; + }; + String 2 + { + Text [ en-US ] = "Right"; + }; + String 3 + { + Text [ en-US ] = "Block"; + }; + String 4 + { + Text [ en-US ] = "Center"; + }; +}; String RID_STR_F_COUNTER { Text [ en-US ] = "Counter" ; @@ -352,3 +394,4 @@ String RID_STR_F_MAXIMUM { Text [ en-US ] = "Maximum" ; }; + diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index 8c4e9a8aac00..82a19c2e1b1a 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -131,7 +131,6 @@ namespace rptui // this ensures that we have our resource file loaded sal_uInt16 nPos = 1; - static OPropertyInfoImpl aPropertyInfos[] = { /* @@ -156,7 +155,7 @@ namespace rptui ,DEF_INFO_1( POSITIONY, POSITIONY, RPT_POSITIONY, COMPOSEABLE ) ,DEF_INFO_1( WIDTH, WIDTH, RPT_WIDTH, COMPOSEABLE ) ,DEF_INFO_1( HEIGHT, HEIGHT, RPT_HEIGHT, COMPOSEABLE ) - ,DEF_INFO_1( CHARFONTNAME, FONT, RPT_FONT, COMPOSEABLE ) + ,DEF_INFO_1( FONT, FONT, RPT_FONT, COMPOSEABLE ) ,DEF_INFO_1( PREEVALUATED, PREEVALUATED, PREEVALUATED, COMPOSEABLE ) ,DEF_INFO_1( DEEPTRAVERSING, DEEPTRAVERSING, DEEPTRAVERSING, COMPOSEABLE ) ,DEF_INFO_1( FORMULA, FORMULA, FORMULA, COMPOSEABLE ) @@ -177,6 +176,8 @@ namespace rptui ,DEF_INFO_2( DETAILFIELDS, DETAILFIELDS, DETAILFIELDS, COMPOSEABLE,DATA_PROPERTY) ,DEF_INFO_1( AREA, AREA, AREA, COMPOSEABLE ) ,DEF_INFO_2( MIMETYPE, MIMETYPE, MIMETYPE, COMPOSEABLE,DATA_PROPERTY ) + ,DEF_INFO_1( PARAADJUST, PARAADJUST, PARAADJUST, COMPOSEABLE ) + ,DEF_INFO_1( VERTICALALIGN, VERTICALALIGN, VERTICALALIGN, COMPOSEABLE ) }; s_pPropertyInfos = aPropertyInfos; @@ -298,13 +299,15 @@ namespace rptui ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HideInactiveSelection")), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SubmitAction")), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputRequired")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VerticalAlign")), + PROPERTY_ALIGN, PROPERTY_EMPTY_IS_NULL, PROPERTY_FILTERPROPOSAL ,PROPERTY_POSITIONX ,PROPERTY_POSITIONY ,PROPERTY_WIDTH ,PROPERTY_HEIGHT - ,PROPERTY_FONTNAME + ,PROPERTY_FONT ,PROPERTY_LABEL ,PROPERTY_LINECOLOR ,PROPERTY_BORDER @@ -317,6 +320,7 @@ namespace rptui ,PROPERTY_SCOPE ,PROPERTY_TYPE ,PROPERTY_DATASOURCENAME + ,PROPERTY_VERTICALALIGN }; beans::Property* pPropsIter = aProps.getArray(); diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index faa4a22c8fc0..7bbdb87cc48d 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -99,7 +99,7 @@ #include <com/sun/star/report/XGroups.hpp> #include <com/sun/star/awt/TextAlign.hpp> -#include <com/sun/star/text/ParagraphVertAlign.hpp> +#include <com/sun/star/style/VerticalAlignment.hpp> #include <com/sun/star/report/XShape.hpp> #include <com/sun/star/report/Function.hpp> #include <com/sun/star/sdb/XParametersSupplier.hpp> @@ -166,101 +166,6 @@ namespace rptui using namespace ::com::sun::star; using namespace formula; // ----------------------------------------------------------------------------- -SvxCellHorJustify lcl_MapHorizontalAlignment(const sal_Int16 _nAlign) -{ - SvxCellHorJustify eRet = SVX_HOR_JUSTIFY_STANDARD; - switch(_nAlign) - { - case awt::TextAlign::LEFT: - eRet = SVX_HOR_JUSTIFY_LEFT; - break; - case awt::TextAlign::CENTER: - eRet = SVX_HOR_JUSTIFY_CENTER; - break; - case awt::TextAlign::RIGHT: - eRet = SVX_HOR_JUSTIFY_RIGHT; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - return eRet; -} -// ----------------------------------------------------------------------------- -sal_Int16 lcl_MapHorizontalAlignment(const SvxCellHorJustify _eAlign) -{ - sal_Int16 nRet = awt::TextAlign::LEFT; - switch(_eAlign) - { - case SVX_HOR_JUSTIFY_LEFT: - nRet = awt::TextAlign::LEFT; - break; - case SVX_HOR_JUSTIFY_CENTER: - nRet = awt::TextAlign::CENTER; - break; - case SVX_HOR_JUSTIFY_RIGHT: - nRet = awt::TextAlign::RIGHT; - break; - case SVX_HOR_JUSTIFY_BLOCK: - case SVX_HOR_JUSTIFY_REPEAT: - nRet = awt::TextAlign::CENTER; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - return nRet; -} -// ----------------------------------------------------------------------------- -SvxCellVerJustify lcl_MapVerticalAlignment(const sal_Int16 _nAlign) -{ - SvxCellVerJustify eRet = SVX_VER_JUSTIFY_STANDARD; - switch(_nAlign) - { - case text::ParagraphVertAlign::AUTOMATIC: - case text::ParagraphVertAlign::BASELINE: - eRet = SVX_VER_JUSTIFY_STANDARD; - break; - case text::ParagraphVertAlign::TOP: - eRet = SVX_VER_JUSTIFY_TOP; - break; - case text::ParagraphVertAlign::CENTER: - eRet = SVX_VER_JUSTIFY_CENTER; - break; - case text::ParagraphVertAlign::BOTTOM: - eRet = SVX_VER_JUSTIFY_BOTTOM; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - return eRet; -} -// ----------------------------------------------------------------------------- -sal_Int16 lcl_MapVerticalAlignment(const SvxCellVerJustify _eAlign) -{ - sal_Int16 nRet = text::ParagraphVertAlign::TOP; - switch(_eAlign) - { - case SVX_VER_JUSTIFY_STANDARD: - nRet = text::ParagraphVertAlign::AUTOMATIC; - break; - case SVX_VER_JUSTIFY_TOP: - nRet = text::ParagraphVertAlign::TOP; - break; - case SVX_VER_JUSTIFY_CENTER: - nRet = text::ParagraphVertAlign::CENTER; - break; - case SVX_VER_JUSTIFY_BOTTOM: - nRet = text::ParagraphVertAlign::BOTTOM; - break; - default: - OSL_ENSURE(0,"Illegal text alignment value!"); - break; - } - return nRet; -} -// ----------------------------------------------------------------------------- void adjustSectionName(const uno::Reference< report::XGroup >& _xGroup,sal_Int32 _nPos) { OSL_ENSURE(_xGroup.is(),"Group is NULL -> GPF"); @@ -355,8 +260,9 @@ namespace case COMPLEX: aLocale = _rxReportControlFormat->getCharLocaleComplex(); break; - } - _rItemSet.Put(SvxLanguageItem(MsLangId::convertLocaleToLanguage(aLocale),_nLanguage)); + } // switch(_nWhich) + + _rItemSet.Put(SvxLanguageItem(MsLangId::convertLocaleToLanguageWithFallback(aLocale),_nLanguage)); _rItemSet.Put(SvxPostureItem(aFont.GetItalic(),_nPosture)); _rItemSet.Put(SvxWeightItem(aFont.GetWeight(),_nWeight)); @@ -425,6 +331,8 @@ namespace if ( !_rxReportControlFormat.is() ) throw lang::NullPointerException(); + uno::Reference< beans::XPropertySet > xSet(_rxReportControlFormat,uno::UNO_QUERY_THROW); + // fill it const Font aFont( lcl_setFont(_rxReportControlFormat, _rItemSet,WESTERN,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_LANGUAGE,ITEMID_POSTURE,ITEMID_WEIGHT ) ); @@ -450,9 +358,13 @@ namespace _rItemSet.Put(SvxCharRotateItem(_rxReportControlFormat->getCharRotation(),sal_False,ITEMID_CHARROTATE)); _rItemSet.Put(SvxCharScaleWidthItem(_rxReportControlFormat->getCharScaleWidth(),ITEMID_CHARSCALE_W)); - _rItemSet.Put(SvxHorJustifyItem(lcl_MapHorizontalAlignment(_rxReportControlFormat->getParaAdjust()),ITEMID_HORJUSTIFY)); + SvxHorJustifyItem aHorJustifyItem(ITEMID_HORJUSTIFY); + aHorJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_PARAADJUST),MID_HORJUST_ADJUST); + _rItemSet.Put(aHorJustifyItem); //_rItemSet.Put(SfxInt32Item(ITEMID_DEGREES,_rxReportControlFormat->getCharRotation())); - _rItemSet.Put(SvxVerJustifyItem(lcl_MapVerticalAlignment(_rxReportControlFormat->getParaVertAlignment()),ITEMID_VERJUSTIFY)); + SvxVerJustifyItem aVerJustifyItem(ITEMID_VERJUSTIFY); + aVerJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_VERTICALALIGN),0); + _rItemSet.Put(aVerJustifyItem); //_rItemSet.Put(SfxInt32Item(ITEMID_IDENT,_rxReportControlFormat->getCharRotation())); uno::Reference< report::XShape> xShape(_rxReportControlFormat,uno::UNO_QUERY); @@ -569,12 +481,16 @@ namespace if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_HORJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxHorJustifyItem)) { const SvxHorJustifyItem* pJustifyItem = static_cast<const SvxHorJustifyItem*>(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_PARAADJUST, uno::makeAny( lcl_MapHorizontalAlignment( static_cast< SvxCellHorJustify >( pJustifyItem->GetEnumValue() ) ) ) ); + uno::Any aValue; + pJustifyItem->QueryValue(aValue,MID_HORJUST_ADJUST); + lcl_pushBack( _out_rProperties, PROPERTY_PARAADJUST, aValue ); } if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_VERJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxVerJustifyItem)) { const SvxVerJustifyItem* pJustifyItem = static_cast<const SvxVerJustifyItem*>(pItem); - lcl_pushBack( _out_rProperties, PROPERTY_VERTICALALIGN, uno::makeAny( lcl_MapVerticalAlignment( static_cast< SvxCellVerJustify >( pJustifyItem->GetEnumValue() ) ) ) ); + uno::Any aValue; + pJustifyItem->QueryValue(aValue,0); + lcl_pushBack( _out_rProperties, PROPERTY_VERTICALALIGN, aValue ); } if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARRELIEF,sal_True,&pItem) && pItem->ISA(SvxCharReliefItem)) { @@ -724,7 +640,8 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE }, { SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE }, { SID_ATTR_CHAR_HIDDEN, SFX_ITEM_POOLABLE }, - { SID_ATTR_BRUSH_CHAR, SFX_ITEM_POOLABLE }, + //{ SID_ATTR_BRUSH_CHAR, SFX_ITEM_POOLABLE }, + { SID_ATTR_BRUSH, SFX_ITEM_POOLABLE }, { SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEM_POOLABLE }, { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEM_POOLABLE }, @@ -798,19 +715,17 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep 0 }; - bool bSuccess = false; - SfxItemPool* pPool = new SfxItemPool(String::CreateFromAscii("ReportCharProperties"), ITEMID_FONT,ITEMID_WEIGHT_COMPLEX, aItemInfos, pDefaults); + SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ReportCharProperties"), ITEMID_FONT,ITEMID_WEIGHT_COMPLEX, aItemInfos, pDefaults) ); // not needed for font height pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why pPool->FreezeIdRanges(); // the same - + bool bSuccess = false; try { - - SfxItemSet aDescriptor( *pPool, pRanges ); - lcl_CharPropertiesToItems( _rxReportControlFormat, aDescriptor ); + ::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( *pPool, pRanges ) ); + lcl_CharPropertiesToItems( _rxReportControlFormat, *pDescriptor ); { // want the dialog to be destroyed before our set - ORptPageDialog aDlg(pParent, &aDescriptor, RID_PAGEDIALOG_CHAR); + ORptPageDialog aDlg(pParent, pDescriptor.get(),RID_PAGEDIALOG_CHAR); uno::Reference< report::XShape > xShape( _rxReportControlFormat, uno::UNO_QUERY ); if ( xShape.is() ) aDlg.RemoveTabPage( RID_PAGE_BACKGROUND ); @@ -829,7 +744,6 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep } SfxItemPool::Free(pPool); - for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) delete pDefaults[i]; @@ -856,16 +770,16 @@ bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::R try { SfxItemPool& rItemPool = pModel->GetItemPool(); - SfxItemSet aDescriptor( rItemPool, rItemPool.GetFirstWhich(),rItemPool.GetLastWhich() ); + ::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( rItemPool, rItemPool.GetFirstWhich(),rItemPool.GetLastWhich() ) ); - lcl_fillShapeToItems(_xShape, aDescriptor); + lcl_fillShapeToItems(_xShape,*pDescriptor); { // want the dialog to be destroyed before our set SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ::std::auto_ptr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog( pParent, &aDescriptor, pModel.get(), RID_SVXDLG_AREA )); + ::std::auto_ptr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog( pParent,pDescriptor.get(),pModel.get(),RID_SVXDLG_AREA )); // #i74099# by default, the dialog deletes the current color table if a different one is loaded // (see SwDrawShell::ExecDrawDlg) - const SvxColorTableItem* pColorItem = static_cast<const SvxColorTableItem*>( aDescriptor.GetItem(SID_COLOR_TABLE) ); + const SvxColorTableItem* pColorItem = static_cast<const SvxColorTableItem*>( pDescriptor->GetItem(SID_COLOR_TABLE) ); if (pColorItem && pColorItem->GetColorTable() == XColorTable::GetStdColorTable()) pDialog->DontDeleteColorTable(); bSuccess = ( RET_OK == pDialog->Execute() ); @@ -874,6 +788,7 @@ bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::R lcl_fillItemsToShape(_xShape,*pDialog->GetOutputItemSet()); } } + } catch(uno::Exception&) { @@ -917,7 +832,7 @@ void applyCharacterSettings( const uno::Reference< report::XReportControlFormat lcl_applyFontAttribute( aSettings, PROPERTY_CHARCONTOURED, _rxReportControlFormat, &report::XReportControlFormat::setCharContoured ); lcl_applyFontAttribute( aSettings, PROPERTY_CHARUNDERLINECOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharUnderlineColor ); lcl_applyFontAttribute( aSettings, PROPERTY_PARAADJUST, _rxReportControlFormat, &report::XReportControlFormat::setParaAdjust ); - lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN, _rxReportControlFormat, &report::XReportControlFormat::setParaVertAlignment ); + lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN, _rxReportControlFormat, &report::XReportControlFormat::setVerticalAlign ); lcl_applyFontAttribute( aSettings, PROPERTY_CHARRELIEF, _rxReportControlFormat, &report::XReportControlFormat::setCharRelief ); lcl_applyFontAttribute( aSettings, PROPERTY_CHARHIDDEN, _rxReportControlFormat, &report::XReportControlFormat::setCharHidden ); lcl_applyFontAttribute( aSettings, PROPERTY_CHARAUTOKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharAutoKerning ); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 89939759abbd..777af6dd83fa 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -62,6 +62,7 @@ #include "reportformula.hxx" #include <comphelper/documentconstants.hxx> +#include <comphelper/mediadescriptor.hxx> #include <comphelper/property.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/types.hxx> @@ -71,11 +72,13 @@ #include <com/sun/star/style/GraphicLocation.hpp> #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/style/PageStyleLayout.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/report/XImageControl.hpp> @@ -89,6 +92,7 @@ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/EmbedMapUnits.hpp> #include <comphelper/streamsection.hxx> #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontUnderline.hpp> @@ -160,6 +164,8 @@ #include <ReportControllerObserver.hxx> +#define MAX_ROWS_FOR_PREVIEW 50 + using namespace ::com::sun::star; using namespace uno; using namespace io; @@ -306,6 +312,7 @@ OReportController::OReportController(Reference< XComponentContext > const & xCon ,m_bHelplinesMove(sal_True) ,m_bChartEnabled(false) ,m_bChartEnabledAsked(false) +,m_bInGeneratePreview(false) { // new Observer m_pReportControllerObserver = new OXReportControllerObserver(*this); @@ -850,6 +857,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const case SID_ATTR_PARA_ADJUST_LEFT: case SID_ATTR_PARA_ADJUST_CENTER: case SID_ATTR_PARA_ADJUST_RIGHT: + case SID_ATTR_PARA_ADJUST_BLOCK: impl_fillState_nothrow(PROPERTY_PARAADJUST,aReturn); if ( aReturn.bEnabled ) { @@ -858,15 +866,19 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const { switch(nParaAdjust) { - case awt::TextAlign::LEFT: + case style::ParagraphAdjust_LEFT: aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_LEFT; break; - case awt::TextAlign::CENTER: - aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_CENTER; - break; - case awt::TextAlign::RIGHT: + case style::ParagraphAdjust_RIGHT: aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_RIGHT; break; + case style::ParagraphAdjust_BLOCK: + case style::ParagraphAdjust_STRETCH: + aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_BLOCK; + break; + case style::ParagraphAdjust_CENTER: + aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_CENTER; + break; } } // if ( aReturn.aValue >>= nParaAdjust ) aReturn.aValue.clear(); @@ -1505,25 +1517,30 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > case SID_ATTR_PARA_ADJUST_LEFT: case SID_ATTR_PARA_ADJUST_CENTER: case SID_ATTR_PARA_ADJUST_RIGHT: + case SID_ATTR_PARA_ADJUST_BLOCK: { - sal_Int16 nValue = awt::TextAlign::LEFT; + sal_Int16 eParagraphAdjust = style::ParagraphAdjust_LEFT; switch(_nId) { case SID_ATTR_PARA_ADJUST_LEFT: - nValue = awt::TextAlign::LEFT; + eParagraphAdjust = style::ParagraphAdjust_LEFT; break; case SID_ATTR_PARA_ADJUST_CENTER: - nValue = awt::TextAlign::CENTER; + eParagraphAdjust = style::ParagraphAdjust_CENTER; break; case SID_ATTR_PARA_ADJUST_RIGHT: - nValue = awt::TextAlign::RIGHT; + eParagraphAdjust = style::ParagraphAdjust_RIGHT; + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + eParagraphAdjust = style::ParagraphAdjust_BLOCK; break; } // switch(_nId) - impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT,PROPERTY_PARAADJUST,uno::makeAny(nValue),aArgs); + impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT,PROPERTY_PARAADJUST,uno::makeAny(eParagraphAdjust),aArgs); InvalidateFeature(SID_ATTR_PARA_ADJUST_LEFT); InvalidateFeature(SID_ATTR_PARA_ADJUST_CENTER); InvalidateFeature(SID_ATTR_PARA_ADJUST_RIGHT); + InvalidateFeature(SID_ATTR_PARA_ADJUST_BLOCK); } break; case SID_CHAR_DLG: @@ -1686,7 +1703,11 @@ void OReportController::impl_initialize( ) m_xFormatter.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY); m_xFormatter->attachNumberFormatsSupplier(Reference< XNumberFormatsSupplier>(m_xReportDefinition,uno::UNO_QUERY)); - if ( !m_xReportDefinition->getCommand().getLength() && getConnection().is()) + ::comphelper::MediaDescriptor aDescriptor( m_xReportDefinition->getArgs() ); + ::rtl::OUString sHierarchicalDocumentName; + sHierarchicalDocumentName = aDescriptor.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName")),sHierarchicalDocumentName); + + if ( !sHierarchicalDocumentName.getLength() && getConnection().is() ) { uno::Reference<sdbcx::XTablesSupplier> xTablesSup(getConnection(),uno::UNO_QUERY_THROW); uno::Reference<container::XNameAccess> xTables = xTablesSup->getTables(); @@ -1866,6 +1887,8 @@ void OReportController::describeSupportedFeatures() implDescribeSupportedFeature( ".uno:LeftPara", SID_ATTR_PARA_ADJUST_LEFT, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:CenterPara", SID_ATTR_PARA_ADJUST_CENTER, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:RightPara", SID_ATTR_PARA_ADJUST_RIGHT, CommandGroup::FORMAT ); + implDescribeSupportedFeature( ".uno:JustifyPara", SID_ATTR_PARA_ADJUST_BLOCK, CommandGroup::FORMAT ); + implDescribeSupportedFeature( ".uno:FontHeight", SID_ATTR_CHAR_FONTHEIGHT, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:CharFontName", SID_ATTR_CHAR_FONT, CommandGroup::FORMAT ); @@ -2418,26 +2441,24 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ SID_ATTR_METRIC,SID_ATTR_METRIC, 0 }; - - SfxItemPool* pPool = new SfxItemPool(String::CreateFromAscii("ReportPageProperties"), RPTUI_ID_LRSPACE,RPTUI_ID_METRIC, aItemInfos, pDefaults); + SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ReportPageProperties"), RPTUI_ID_LRSPACE,RPTUI_ID_METRIC, aItemInfos, pDefaults) ); pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why pPool->FreezeIdRanges(); // the same try { - SfxItemSet aDescriptor(*pPool, pRanges); - + ::std::auto_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges)); // fill it if ( _xSection.is() ) - aDescriptor.Put(SvxBrushItem(::Color(_xSection->getBackColor()),ITEMID_BRUSH)); + pDescriptor->Put(SvxBrushItem(::Color(_xSection->getBackColor()),ITEMID_BRUSH)); else { - aDescriptor.Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE)))); - aDescriptor.Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN) + pDescriptor->Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE)))); + pDescriptor->Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN) ,getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN),0,0,RPTUI_ID_LRSPACE)); - aDescriptor.Put(SvxULSpaceItem(static_cast<USHORT>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN)) + pDescriptor->Put(SvxULSpaceItem(static_cast<USHORT>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN)) ,static_cast<USHORT>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BOTTOMMARGIN)),RPTUI_ID_ULSPACE)); - aDescriptor.Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<UINT16>(eUserMetric))); + pDescriptor->Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<UINT16>(eUserMetric))); uno::Reference< style::XStyle> xPageStyle(getUsedStyle(m_xReportDefinition)); if ( xPageStyle.is() ) @@ -2448,13 +2469,13 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ aPageItem.PutValue(xProp->getPropertyValue(PROPERTY_PAGESTYLELAYOUT),MID_PAGE_LAYOUT); aPageItem.SetLandscape(getStyleProperty<sal_Bool>(m_xReportDefinition,PROPERTY_ISLANDSCAPE)); aPageItem.SetNumType((SvxNumType)getStyleProperty<sal_Int16>(m_xReportDefinition,PROPERTY_NUMBERINGTYPE)); - aDescriptor.Put(aPageItem); - aDescriptor.Put(SvxBrushItem(::Color(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH)); + pDescriptor->Put(aPageItem); + pDescriptor->Put(SvxBrushItem(::Color(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH)); } } { // want the dialog to be destroyed before our set - ORptPageDialog aDlg(getView(), &aDescriptor, _xSection.is() ? RID_PAGEDIALOG_BACKGROUND : RID_PAGEDIALOG_PAGE); + ORptPageDialog aDlg(getView(), pDescriptor.get(),_xSection.is() ? RID_PAGEDIALOG_BACKGROUND : RID_PAGEDIALOG_PAGE); if (RET_OK == aDlg.Execute()) { // ------------ @@ -2516,11 +2537,11 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ { DBG_UNHANDLED_EXCEPTION(); } - SfxItemPool::Free(pPool); for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) delete pDefaults[i]; + } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OReportController::attachModel(const uno::Reference< frame::XModel > & xModel) throw( uno::RuntimeException ) @@ -2895,6 +2916,7 @@ uno::Reference<frame::XModel> OReportController::executeReport() } else { + m_bInGeneratePreview = true; try { WaitObject aWait(getView()); // cursor @@ -2943,7 +2965,8 @@ uno::Reference<frame::XModel> OReportController::executeReport() { const String suSQLContext = String( ModuleRes( RID_STR_COULD_NOT_CREATE_REPORT ) ); aInfo.prepend(suSQLContext); - } + } // if (aInfo.isValid()) + m_bInGeneratePreview = false; } if (aInfo.isValid()) @@ -2975,11 +2998,12 @@ uno::Reference< sdbc::XRowSet > OReportController::getRowSet() xRowSetProp->setPropertyValue( PROPERTY_ACTIVECONNECTION, uno::makeAny( getConnection() ) ); xRowSetProp->setPropertyValue( PROPERTY_APPLYFILTER, uno::makeAny( sal_True ) ); + ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter()); TPropertyNamePair aPropertyMediation; - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMAND, PROPERTY_COMMAND ) ); - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMANDTYPE, PROPERTY_COMMANDTYPE ) ); - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_ESCAPEPROCESSING, PROPERTY_ESCAPEPROCESSING ) ); - aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_FILTER, PROPERTY_FILTER ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMAND, TPropertyConverter(PROPERTY_COMMAND,aNoConverter) ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMANDTYPE, TPropertyConverter(PROPERTY_COMMANDTYPE,aNoConverter) ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_ESCAPEPROCESSING, TPropertyConverter(PROPERTY_ESCAPEPROCESSING,aNoConverter) ) ); + aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_FILTER, TPropertyConverter(PROPERTY_FILTER,aNoConverter) ) ); m_xRowSetMediator = new OPropertyMediator( m_xReportDefinition.get(), xRowSetProp, aPropertyMediation ); m_xRowSet = xRowSet; @@ -4221,21 +4245,18 @@ void OReportController::openZoomDialog() SID_ATTR_ZOOM,SID_ATTR_ZOOM, 0 }; - - SfxItemPool* pPool = new SfxItemPool(String::CreateFromAscii("ZoomProperties"), SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, pDefaults); + SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ZoomProperties"), SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, pDefaults) ); pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why pPool->FreezeIdRanges(); // the same - try { - SfxItemSet aDescriptor(*pPool, pRanges); - + ::std::auto_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges)); // fill it SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM ); aZoomItem.SetValueSet(SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_WHOLEPAGE|SVX_ZOOM_ENABLE_PAGEWIDTH); - aDescriptor.Put(aZoomItem); + pDescriptor->Put(aZoomItem); - ::std::auto_ptr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(NULL, aDescriptor, RID_SVXDLG_ZOOM) ); + ::std::auto_ptr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(NULL, *pDescriptor.get(), RID_SVXDLG_ZOOM) ); pDlg->SetLimits( 20, 400 ); bool bCancel = ( RET_CANCEL == pDlg->Execute() ); @@ -4254,7 +4275,6 @@ void OReportController::openZoomDialog() { DBG_UNHANDLED_EXCEPTION(); } - SfxItemPool::Free(pPool); for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) @@ -4262,3 +4282,70 @@ void OReportController::openZoomDialog() } // if(pFact) } // ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// XVisualObject +void SAL_CALL OReportController::setVisualAreaSize( ::sal_Int64 _nAspect, const awt::Size& _aSize ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( getMutex() ); + //if( nAspect == embed::Aspects::MSOLE_CONTENT ) + { + bool bChanged = + (m_aVisualAreaSize.Width != _aSize.Width || + m_aVisualAreaSize.Height != _aSize.Height); + m_aVisualAreaSize = _aSize; + if( bChanged ) + setModified( sal_True ); + } + m_nAspect = _nAspect; +} +// ----------------------------------------------------------------------------- +awt::Size SAL_CALL OReportController::getVisualAreaSize( ::sal_Int64 /*nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( getMutex() ); + return m_aVisualAreaSize; +} +// ----------------------------------------------------------------------------- +embed::VisualRepresentation SAL_CALL OReportController::getPreferredVisualRepresentation( ::sal_Int64 _nAspect ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( getMutex() ); + embed::VisualRepresentation aResult; + if ( !m_bInGeneratePreview ) + { + m_bInGeneratePreview = true; + try + { + if ( !m_xReportEngine.is() ) + m_xReportEngine.set(getORB()->createInstance(SERVICE_REPORTENGINE),uno::UNO_QUERY_THROW); + const sal_Int32 nOldMaxRows = m_xReportEngine->getMaxRows(); + m_xReportEngine->setMaxRows(MAX_ROWS_FOR_PREVIEW); + m_xReportEngine->setReportDefinition(m_xReportDefinition); + m_xReportEngine->setActiveConnection(getConnection()); + try + { + Reference<embed::XVisualObject> xTransfer(m_xReportEngine->createDocumentModel(),UNO_QUERY); + if ( xTransfer.is() ) + { + xTransfer->setVisualAreaSize(m_nAspect,m_aVisualAreaSize); + aResult = xTransfer->getPreferredVisualRepresentation( _nAspect ); + } // if ( xTransfer.is() ) + } + catch( uno::Exception & ex ) + { + (void)ex; + } + m_xReportEngine->setMaxRows(nOldMaxRows); + } + catch( uno::Exception & ex ) + { + (void)ex; + } + m_bInGeneratePreview = false; + } + return aResult; +} +// ----------------------------------------------------------------------------- +::sal_Int32 SAL_CALL OReportController::getMapUnit( ::sal_Int64 /*nAspect*/ ) throw (uno::Exception, uno::RuntimeException) +{ + return embed::EmbedMapUnits::ONE_100TH_MM; +} diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 42ceaaea5eba..aebf42bfaa00 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -1104,7 +1104,9 @@ void OViewsWindow::BegDragObj_createInvisibleObjectAtPosition(const Rectangle& _ // pNewObj->Move(Size(_aRect.Left(), _aRect.Top())); pNewObj->Move(Size(0, aNewPos.Y())); + BOOL bChanged = rView.GetModel()->IsChanged(); rReportSection.getPage()->InsertObject(pNewObj); + rView.GetModel()->SetChanged(bChanged); m_aBegDragTempList.push_back(pNewObj); Rectangle aRect = pNewObj->GetLogicRect(); @@ -1120,16 +1122,7 @@ void OViewsWindow::BegDragObj_createInvisibleObjectAtPosition(const Rectangle& _ // ----------------------------------------------------------------------------- bool OViewsWindow::isObjectInMyTempList(SdrObject *_pObj) { - ::std::vector<SdrObject*>::iterator aIter = m_aBegDragTempList.begin(); - ::std::vector<SdrObject*>::iterator aEnd = m_aBegDragTempList.end(); - for (; aIter != aEnd; ++aIter) - { - if (*aIter == _pObj) - { - return true; - } - } - return false; + return ::std::find(m_aBegDragTempList.begin(),m_aBegDragTempList.end(),_pObj) != m_aBegDragTempList.end(); } // ----------------------------------------------------------------------------- @@ -1552,7 +1545,6 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection,bo const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height(); aRealMousePos.Y() -= nSectionHeight; } - #if 0 #if OSL_DEBUG_LEVEL > 0 // TEST TEST TEST TEST diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 3b8dd3616ee5..111cc936ace3 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -446,6 +446,7 @@ void PropBrw::implSetNewObject( const uno::Sequence< Reference<uno::XInterface> // ----------------------------------------------------------------------------- uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(OObjectBase* _pObj) { + _pObj->initializeOle(); return CreateComponentPair(_pObj->getAwtComponent(),_pObj->getReportComponent()); } //---------------------------------------------------------------------------- diff --git a/reportdesign/uiconfig/dbreport/menubar/menubar.xml b/reportdesign/uiconfig/dbreport/menubar/menubar.xml index a8c8d2e0d871..8fa04f47ba7f 100644 --- a/reportdesign/uiconfig/dbreport/menubar/menubar.xml +++ b/reportdesign/uiconfig/dbreport/menubar/menubar.xml @@ -37,7 +37,6 @@ <menu:menuitem menu:id=".uno:SelectAllLabels"/> <menu:menuitem menu:id=".uno:SelectAllEdits"/> <menu:menuitem menu:id=".uno:SelectReport"/> - <menu:menuitem menu:id=".uno:SelectObject"/> </menu:menupopup> </menu:menu> <menu:menuseparator/> @@ -47,6 +46,74 @@ <menu:menuitem menu:id=".uno:ReportHeaderFooter"/> <menu:menuitem menu:id=".uno:ColumnHeaderFooter"/> <menu:menuseparator/> + + <menu:menu menu:id=".uno:EditShapeMenu"> + <menu:menupopup> + <!-- + <menu:menu menu:id=".uno:ArrangeMenu"> + <menu:menupopup> +--> + <menu:menuitem menu:id=".uno:BringToFront"/> + <menu:menuitem menu:id=".uno:ObjectBackOne"/> + <menu:menuitem menu:id=".uno:ObjectForwardOne"/> + <menu:menuitem menu:id=".uno:SendToBack"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:SetObjectToForeground"/> + <menu:menuitem menu:id=".uno:SetObjectToBackground"/> + <!-- + </menu:menupopup> + </menu:menu> +--> + </menu:menupopup> + </menu:menu> + + <menu:menu menu:id=".uno:EditControlMenu"> + <menu:menupopup> + <menu:menu menu:id=".uno:ObjectAlign" > + <menu:menupopup> + <menu:menuitem menu:id=".uno:ObjectAlignLeft"/> + <menu:menuitem menu:id=".uno:AlignCenter"/> + <menu:menuitem menu:id=".uno:ObjectAlignRight"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:AlignUp"/> + <menu:menuitem menu:id=".uno:AlignMiddle"/> + <menu:menuitem menu:id=".uno:AlignDown"/> + </menu:menupopup> + </menu:menu> + + <menu:menu menu:id=".uno:ObjectResize" > + <menu:menupopup> + <menu:menuitem menu:id=".uno:SmallestWidth"/> + <menu:menuitem menu:id=".uno:GreatestWidth"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:SmallestHeight"/> + <menu:menuitem menu:id=".uno:GreatestHeight"/> + </menu:menupopup> + </menu:menu> + + <menu:menu menu:id=".uno:SectionAlignmentMenu" > + <menu:menupopup> + <menu:menuitem menu:id=".uno:SectionAlignLeft"/> + <menu:menuitem menu:id=".uno:SectionAlignRight"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:SectionAlignTop"/> + <menu:menuitem menu:id=".uno:SectionAlignBottom"/> + </menu:menupopup> + </menu:menu> + + </menu:menupopup> + </menu:menu> + + <menu:menu menu:id=".uno:SectionShrinkMenu" > + <menu:menupopup> + <menu:menuitem menu:id=".uno:SectionShrink"/> + <menu:menuitem menu:id=".uno:SectionShrinkTop"/> + <menu:menuitem menu:id=".uno:SectionShrinkBottom"/> + </menu:menupopup> + </menu:menu> + + + <menu:menuseparator/> <menu:menuitem menu:id=".uno:ExecuteReport"/> </menu:menupopup> </menu:menu> @@ -85,6 +152,10 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:ReportControlMenu" > <menu:menupopup> + <menu:menuitem menu:id=".uno:SelectObject"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:ControlProperties"/> + <menu:menuseparator/> <menu:menuitem menu:id=".uno:Label" /> <menu:menuitem menu:id=".uno:Edit" /> <menu:menuitem menu:id=".uno:ImageControl" /> @@ -304,23 +375,6 @@ <menu:menuitem menu:id=".uno:GreatestHeight"/> </menu:menupopup> </menu:menu> - <menu:menu menu:id=".uno:SectionAlignmentMenu" > - <menu:menupopup> - <menu:menuitem menu:id=".uno:SectionAlignLeft"/> - <menu:menuitem menu:id=".uno:SectionAlignRight"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:SectionAlignTop"/> - <menu:menuitem menu:id=".uno:SectionAlignBottom"/> - </menu:menupopup> - </menu:menu> - <menu:menuseparator/> - <menu:menu menu:id=".uno:SectionShrinkMenu" > - <menu:menupopup> - <menu:menuitem menu:id=".uno:SectionShrink"/> - <menu:menuitem menu:id=".uno:SectionShrinkTop"/> - <menu:menuitem menu:id=".uno:SectionShrinkBottom"/> - </menu:menupopup> - </menu:menu> <menu:menuseparator/> <menu:menuitem menu:id=".uno:Distribution"/> </menu:menupopup> diff --git a/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml b/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml index c4fe386324a7..2fc8494938d4 100644 --- a/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml +++ b/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml @@ -14,6 +14,7 @@ <toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:style="radio" /> <toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:style="radio" /> <toolbar:toolbaritem xlink:href=".uno:RightPara" toolbar:style="radio" /> + <toolbar:toolbaritem xlink:href=".uno:JustifyPara" toolbar:helpid="helpid:10031" toolbar:text="" toolbar:style="radio" /> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:FontColor" toolbar:style="dropdown" /> <toolbar:toolbaritem xlink:href=".uno:BackgroundColor" toolbar:style="dropdown" /> diff --git a/reportdesign/util/hidother.src b/reportdesign/util/hidother.src index f0b1e8d5aa72..15cc051a5193 100644 --- a/reportdesign/util/hidother.src +++ b/reportdesign/util/hidother.src @@ -165,8 +165,10 @@ hidspecial HID_RPT_PROP_AREA { HelpId = HID_RPT_PROP_AREA; }; hidspecial UID_RPT_RPT_PROP_DLG_AREA { HelpId = UID_RPT_RPT_PROP_DLG_AREA; }; hidspecial UID_RPT_PROP_FORMULA { HelpId = UID_RPT_PROP_FORMULA; }; -hidspecial HID_RPT_GROUPSORT_MOVE_UP { HelpId = HID_RPT_GROUPSORT_MOVE_UP; }; -hidspecial HID_RPT_GROUPSORT_MOVE_DOWN { HelpId = HID_RPT_GROUPSORT_MOVE_DOWN; }; -hidspecial HID_RPT_GROUPSORT_DELETE { HelpId = HID_RPT_GROUPSORT_DELETE; }; -hidspecial HID_RPT_PROP_MIMETYPE { HelpId = HID_RPT_PROP_MIMETYPE; }; +hidspecial HID_RPT_GROUPSORT_MOVE_UP { HelpId = HID_RPT_GROUPSORT_MOVE_UP; }; +hidspecial HID_RPT_GROUPSORT_MOVE_DOWN { HelpId = HID_RPT_GROUPSORT_MOVE_DOWN; }; +hidspecial HID_RPT_GROUPSORT_DELETE { HelpId = HID_RPT_GROUPSORT_DELETE; }; +hidspecial HID_RPT_PROP_MIMETYPE { HelpId = HID_RPT_PROP_MIMETYPE; }; +hidspecial HID_RPT_PROP_VERTICALALIGN { HelpId = HID_RPT_PROP_VERTICALALIGN; }; +hidspecial HID_RPT_PROP_PARAADJUST { HelpId = HID_RPT_PROP_PARAADJUST; }; |