diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-12-09 07:25:38 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-12-09 07:25:38 +0000 |
commit | 568af9ac86c8eee3531ff9cb718aeba240f274be (patch) | |
tree | 710059fbd5080acac11680bc02bf27761346e17b /dbaccess | |
parent | b4e6996966166bf80447fc9eda619b283e8c86ef (diff) |
CWS-TOOLING: integrate CWS dba31d
2008-12-08 16:22:07 +0100 rt r265005 : Remove DOS lineends
2008-12-05 13:56:24 +0100 fs r264906 : #i10000# removed unreachable statement
2008-11-20 11:41:26 +0100 fs r264037 : merged in the fix for #i95865# (it was wrongly committed to CWS dba32a, should have been here)
2008-11-20 11:34:24 +0100 fs r264036 : line ends
2008-11-14 08:44:50 +0100 lla r263665 : #i10000# comparsion between int and uint fixed
2008-11-13 13:31:12 +0100 lla r263641 : #i10000# build problem fixed
2008-11-13 11:20:01 +0100 lla r263625 : #i96130# hard code name of extension
2008-11-12 11:13:41 +0100 fs r263582 : #i96096# when opening a SRB-report fails due to the missing SRB extension, log this as warning only, and proceed with the migration
2008-11-12 11:11:35 +0100 fs r263581 : #i96096# ContentType handling. Now all contents deliver proper results in XContent::getContentType
2008-11-12 11:10:11 +0100 fs r263580 : #i96096# new ctors taking UNO_QUERY_THROW
2008-11-11 10:10:13 +0100 lla r263546 : CWS-TOOLING: rebase CWS dba31d to trunk@263288 (milestone: DEV300:m35)
2008-11-06 15:55:39 +0100 oj r263393 : #i93452# get field from model fallbackis the name
2008-11-06 15:31:47 +0100 oj r263392 : #i93465# remeber location of floating windows
2008-11-06 13:36:24 +0100 oj r263381 : #i93450# check typemap for null
2008-11-06 13:28:49 +0100 oj r263379 : #i93020# empty column list boxes when new relation should be created
2008-11-06 12:33:53 +0100 oj r263377 : #i93012# set border to default : flat
2008-11-06 12:26:54 +0100 oj r263375 : #i74927# do some less calls for odbc
2008-11-06 09:34:01 +0100 oj r263362 : #i93383# grabFocus in suspend to get allmodified cells
2008-11-03 21:01:39 +0100 oj r263308 : #i86739# check if slash can be valid for tables
2008-11-03 14:40:21 +0100 oj r263287 : #i86739# check if slash can be valid for tables
2008-11-03 14:32:17 +0100 oj r263286 : #i95227# column width
2008-11-03 14:27:26 +0100 oj r263285 : link fwe
2008-11-03 14:24:54 +0100 oj r263284 : #i95235# changed to hold no ref only weak
2008-10-31 11:21:48 +0100 oj r262859 : #i93459# set images add menu entry
2008-10-31 09:06:37 +0100 oj r262851 : #i88629# correct fileopen filter for database odb files
2008-10-30 15:01:04 +0100 oj r262828 : #i95229# set filter at the composer
2008-10-29 15:57:41 +0100 oj r262817 : #i95235# changed to hold no ref only weak
2008-10-29 15:57:19 +0100 oj r262816 : #i95235# changed to hold no ref only weak
2008-10-29 15:57:03 +0100 oj r262815 : #i95235# changed to hold no ref only weak
2008-10-29 15:56:15 +0100 oj r262814 : #i95235# filtermanger changed to hold no ref only weak
2008-10-29 10:32:39 +0100 oj r262773 : #i93474# use correct table name
2008-10-28 13:49:33 +0100 lla r262744 : #i95524# make an Invalidate and refresh on Tables
2008-10-28 10:45:02 +0100 fs r262707 : line ends
2008-10-28 10:34:42 +0100 fs r262706 : #i95522# don't expect the component to live in a TopWindow
2008-10-28 08:30:40 +0100 lla r262696 : #i93176# set preview mode on view
2008-10-28 07:56:57 +0100 oj r262694 : merge cvs svn
2008-10-27 14:13:51 +0100 oj r262673 : #i94129# use dummy data
2008-10-27 12:38:45 +0100 fs r262669 : #i94125# rework ScrollColumns
2008-10-23 15:53:57 +0200 oj r262624 : #i94568# do not load the embeddedobj just copy the storage
2008-10-23 14:39:14 +0200 oj r262622 : #i94129# handle chart correctly
2008-10-22 10:51:19 +0200 lla r262582 : #i94115# problem with left walk chart shape fixed
2008-10-22 07:47:48 +0200 oj r262576 : #i94455# rename now do not use remove insert
2008-10-22 07:47:27 +0200 oj r262575 : #i94455# rename now do not use remove insert
2008-10-21 12:46:26 +0200 lla r262567 : #i93845# extra check if default schema doesn't exists, fix assertion
Diffstat (limited to 'dbaccess')
36 files changed, 633 insertions, 362 deletions
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index a3a66290d5b5..eda2c1ac8c14 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -430,6 +430,12 @@ void OQuery::registerProperties() } // ----------------------------------------------------------------------------- +::rtl::OUString OQuery::determineContentType() const +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseQuery" ) ); +} + +// ----------------------------------------------------------------------------- //........................................................................ } // namespace dbaccess //........................................................................ diff --git a/dbaccess/source/core/api/query.hxx b/dbaccess/source/core/api/query.hxx index 2055100e7179..dd200764d364 100644 --- a/dbaccess/source/core/api/query.hxx +++ b/dbaccess/source/core/api/query.hxx @@ -169,6 +169,9 @@ protected: virtual void rebuildColumns( ); + // OContentHelper overridables + virtual ::rtl::OUString determineContentType() const; + private: void registerProperties(); }; diff --git a/dbaccess/source/core/api/querycontainer.cxx b/dbaccess/source/core/api/querycontainer.cxx index 00ce37c4191e..89124a9751c9 100644 --- a/dbaccess/source/core/api/querycontainer.cxx +++ b/dbaccess/source/core/api/querycontainer.cxx @@ -387,6 +387,13 @@ void SAL_CALL OQueryContainer::disposing( const ::com::sun::star::lang::EventObj ODefinitionContainer::disposing(_rSource); } } + +// ----------------------------------------------------------------------------- +::rtl::OUString OQueryContainer::determineContentType() const +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseQueryContainer" ) ); +} + // ----------------------------------------------------------------------------- Reference< XContent > OQueryContainer::implCreateWrapper(const ::rtl::OUString& _rName) { diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx index b26a7c46f9f9..452931848e5c 100644 --- a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx +++ b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx @@ -240,6 +240,15 @@ Reference< XPropertySetInfo > SAL_CALL OComponentDefinition::getPropertySetInfo( Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); return xInfo; } + +// ----------------------------------------------------------------------------- +::rtl::OUString OComponentDefinition::determineContentType() const +{ + return m_bTable + ? ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseTable" ) ) + : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseCommandDefinition" ) ); +} + // ----------------------------------------------------------------------------- Reference< XNameAccess> OComponentDefinition::getColumns() throw (RuntimeException) { diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx index acf908ee762d..e6f49dbbcbe6 100644 --- a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx +++ b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx @@ -195,6 +195,10 @@ protected: virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); + + // OContentHelper overridables + virtual ::rtl::OUString determineContentType() const; + private: void registerProperties(); }; diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index e4c1d781d63b..b43292aada37 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -159,9 +159,16 @@ Reference< XContentIdentifier > SAL_CALL OContentHelper::getIdentifier( ) throw // return Reference< XContentIdentifier >(); } // ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OContentHelper::getContentType( ) throw (RuntimeException) +::rtl::OUString SAL_CALL OContentHelper::getContentType() throw (RuntimeException) { - return getImplementationName(); + ::osl::MutexGuard aGuard(m_aMutex); + + if ( !m_pImpl->m_aProps.aContentType ) + { // content type not yet retrieved + m_pImpl->m_aProps.aContentType.reset( determineContentType() ); + } + + return *m_pImpl->m_aProps.aContentType; } // ----------------------------------------------------------------------------- void SAL_CALL OContentHelper::addContentEventListener( const Reference< XContentEventListener >& _rxListener ) throw (RuntimeException) @@ -415,7 +422,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue try { - rename( aNewValue ); + impl_rename_throw( aNewValue ,false); OSL_ENSURE( m_pImpl->m_aProps.aTitle == aNewValue, "OContentHelper::setPropertyValues('Title'): rename did not work!" ); aEvent.NewValue = makeAny( aNewValue ); @@ -491,7 +498,7 @@ Reference< XRow > OContentHelper::getPropertyValues( const Sequence< Property >& if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) ) { - xRow->appendString ( rProp, m_pImpl->m_aProps.aContentType ); + xRow->appendString ( rProp, getContentType() ); } else if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) { @@ -526,7 +533,7 @@ Reference< XRow > OContentHelper::getPropertyValues( const Sequence< Property >& getCppuType( static_cast< const rtl::OUString * >( 0 ) ), PropertyAttribute::BOUND | PropertyAttribute::READONLY ), - m_pImpl->m_aProps.aContentType ); + getContentType() ); xRow->appendString ( Property( rtl::OUString::createFromAscii( "Title" ), -1, @@ -669,42 +676,69 @@ void SAL_CALL OContentHelper::setParent( const Reference< XInterface >& _xParent } // ----------------------------------------------------------------------------- -void SAL_CALL OContentHelper::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException) +void OContentHelper::impl_rename_throw(const ::rtl::OUString& _sNewName,bool _bNotify ) { - ::osl::MutexGuard aGuard(m_aMutex); - if ( newName.equals( m_pImpl->m_aProps.aTitle ) ) + osl::ClearableGuard< osl::Mutex > aGuard(m_aMutex); + if ( _sNewName.equals( m_pImpl->m_aProps.aTitle ) ) return; - - Reference<XNameContainer> xNameCont(m_xParentContainer,UNO_QUERY); - if ( xNameCont.is() ) + try { - if ( xNameCont->hasByName(newName) ) - throw ElementExistException(newName,*this); + Sequence< PropertyChangeEvent > aChanges( 1 ); - try - { - if ( xNameCont->hasByName(m_pImpl->m_aProps.aTitle) ) - xNameCont->removeByName(m_pImpl->m_aProps.aTitle); + aChanges[0].Source = static_cast< cppu::OWeakObject * >( this ); + aChanges[0].Further = sal_False; + aChanges[0].PropertyName = PROPERTY_NAME; + aChanges[0].PropertyHandle = PROPERTY_ID_NAME; + aChanges[0].OldValue <<= m_pImpl->m_aProps.aTitle; + aChanges[0].NewValue <<= _sNewName; - m_pImpl->m_aProps.aTitle = newName; - xNameCont->insertByName(m_pImpl->m_aProps.aTitle,makeAny(Reference<XContent>(*this,UNO_QUERY))); - notifyDataSourceModified(); - } - catch(IllegalArgumentException) - { - throw SQLException(); - } - catch(NoSuchElementException) - { - throw SQLException(); - } - catch(WrappedTargetException) - { - throw SQLException(); - } + aGuard.clear(); + + m_pImpl->m_aProps.aTitle = _sNewName; + if ( _bNotify ) + notifyPropertiesChange( aChanges ); + notifyDataSourceModified(); } - else - m_pImpl->m_aProps.aTitle = newName; + catch(const PropertyVetoException&) + { + throw ElementExistException(_sNewName,*this); + } +} +// ----------------------------------------------------------------------------- +void SAL_CALL OContentHelper::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException) +{ + + impl_rename_throw(newName); + //Reference<XNameContainer> xNameCont(m_xParentContainer,UNO_QUERY); + //if ( xNameCont.is() ) + //{ + // if ( xNameCont->hasByName(newName) ) + // throw ElementExistException(newName,*this); + + // try + // { + // if ( xNameCont->hasByName(m_pImpl->m_aProps.aTitle) ) + // xNameCont->removeByName(m_pImpl->m_aProps.aTitle); + + // m_pImpl->m_aProps.aTitle = newName; + // xNameCont->insertByName(m_pImpl->m_aProps.aTitle,makeAny(Reference<XContent>(*this,UNO_QUERY))); + // notifyDataSourceModified(); + // } + // catch(IllegalArgumentException) + // { + // throw SQLException(); + // } + // catch(NoSuchElementException) + // { + // throw SQLException(); + // } + // catch(WrappedTargetException) + // { + // throw SQLException(); + // } + //} + //else + // m_pImpl->m_aProps.aTitle = newName; } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/commandcontainer.cxx b/dbaccess/source/core/dataaccess/commandcontainer.cxx index 0a7e0449b53e..2c51a9b18869 100644 --- a/dbaccess/source/core/dataaccess/commandcontainer.cxx +++ b/dbaccess/source/core/dataaccess/commandcontainer.cxx @@ -69,7 +69,7 @@ OCommandContainer::OCommandContainer( const Reference< ::com::sun::star::lang::X ,const TContentPtr& _pImpl ,sal_Bool _bTables ) - :ODefinitionContainer(_xORB,_xParentContainer,_pImpl) + :ODefinitionContainer(_xORB,_xParentContainer,_pImpl,!_bTables) ,m_bTables(_bTables) { DBG_CTOR(OCommandContainer, NULL); @@ -106,6 +106,12 @@ Reference< XInterface > SAL_CALL OCommandContainer::createInstance( ) throw (Exc return m_aContext.createComponent( (::rtl::OUString)( m_bTables ? SERVICE_SDB_TABLEDEFINITION : SERVICE_SDB_COMMAND_DEFINITION ) ); } +// ----------------------------------------------------------------------------- +::rtl::OUString OCommandContainer::determineContentType() const +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseCommandDefinitionContainer" ) ); +} + //........................................................................ } // namespace dbaccess //........................................................................ diff --git a/dbaccess/source/core/dataaccess/commandcontainer.hxx b/dbaccess/source/core/dataaccess/commandcontainer.hxx index 19cd8e717a6b..4015b1072470 100644 --- a/dbaccess/source/core/dataaccess/commandcontainer.hxx +++ b/dbaccess/source/core/dataaccess/commandcontainer.hxx @@ -81,6 +81,10 @@ protected: // ODefinitionContainer virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > createObject(const ::rtl::OUString& _rName); + +protected: + // OContentHelper overridables + virtual ::rtl::OUString determineContentType() const; }; //........................................................................ diff --git a/dbaccess/source/core/dataaccess/commanddefinition.hxx b/dbaccess/source/core/dataaccess/commanddefinition.hxx index bd849f89e464..6a50395d11ed 100644 --- a/dbaccess/source/core/dataaccess/commanddefinition.hxx +++ b/dbaccess/source/core/dataaccess/commanddefinition.hxx @@ -132,6 +132,7 @@ public: // OPropertySetHelper DECLARE_PROPERTYCONTAINER_DEFAULTS( ); + private: // helper void registerProperties(); diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx index 5b023dcaff4f..01a3b65b5c8a 100644 --- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx +++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx @@ -144,11 +144,13 @@ DBG_NAME(ODefinitionContainer) ODefinitionContainer::ODefinitionContainer( const Reference< XMultiServiceFactory >& _xORB , const Reference< XInterface >& _xParentContainer , const TContentPtr& _pImpl + , bool _bCheckSlash ) :OContentHelper(_xORB,_xParentContainer,_pImpl) ,m_aApproveListeners(m_aMutex) ,m_aContainerListeners(m_aMutex) ,m_bInPropertyChange(sal_False) + ,m_bCheckSlash(_bCheckSlash) { m_pImpl->m_aProps.bIsDocument = sal_False; m_pImpl->m_aProps.bIsFolder = sal_True; @@ -645,7 +647,7 @@ void ODefinitionContainer::approveNewObject(const ::rtl::OUString& _sName,const *this, 0 ); - if ( _sName.indexOf( '/' ) != -1 ) + if ( m_bCheckSlash && _sName.indexOf( '/' ) != -1 ) throw IllegalArgumentException( m_aErrorHelper.getErrorMessage( ErrorCondition::DB_OBJECT_NAME_WITH_SLASHES ), *this, @@ -681,7 +683,7 @@ void ODefinitionContainer::approveNewObject(const ::rtl::OUString& _sName,const void SAL_CALL ODefinitionContainer::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException) { ClearableMutexGuard aGuard(m_aMutex); - if(evt.PropertyName == (rtl::OUString) PROPERTY_NAME) + if(evt.PropertyName == (rtl::OUString) PROPERTY_NAME || evt.PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) )) { m_bInPropertyChange = sal_True; try @@ -708,7 +710,7 @@ void SAL_CALL ODefinitionContainer::vetoableChange( const PropertyChangeEvent& a { MutexGuard aGuard(m_aMutex); - if(aEvent.PropertyName == (rtl::OUString) PROPERTY_NAME) + if(aEvent.PropertyName == (rtl::OUString) PROPERTY_NAME || aEvent.PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) { ::rtl::OUString sNewName; aEvent.NewValue >>= sNewName; @@ -725,7 +727,10 @@ void ODefinitionContainer::addObjectListener(const Reference< XContent >& _xNewO { xProp->addPropertyChangeListener(PROPERTY_NAME, this); xProp->addVetoableChangeListener(PROPERTY_NAME, this); - } + //::rtl::OUString sTitle(RTL_CONSTASCII_USTRINGPARAM( "Title" )); + //xProp->addPropertyChangeListener(sTitle, this); + //xProp->addVetoableChangeListener(sTitle, this); + } // if ( xProp.is() ) } // ----------------------------------------------------------------------------- void ODefinitionContainer::removeObjectListener(const Reference< XContent >& _xNewObject) @@ -736,6 +741,9 @@ void ODefinitionContainer::removeObjectListener(const Reference< XContent >& _xN { xProp->removePropertyChangeListener(PROPERTY_NAME, this); xProp->removeVetoableChangeListener(PROPERTY_NAME, this); + //::rtl::OUString sTitle(RTL_CONSTASCII_USTRINGPARAM( "Title" )); + //xProp->removePropertyChangeListener(sTitle, this); + //xProp->removeVetoableChangeListener(sTitle, this); } } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 859855b0bc0c..6ccbb4d03a03 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -181,7 +181,12 @@ Sequence< ::rtl::OUString > SAL_CALL ODocumentContainer::getSupportedServiceName aSupported[0] = m_bFormsContainer ? SERVICE_NAME_FORM_COLLECTION : SERVICE_NAME_REPORT_COLLECTION; return aSupported; } + // ----------------------------------------------------------------------------- +::rtl::OUString ODocumentContainer::determineContentType() const +{ + return ::rtl::OUString(); +} //-------------------------------------------------------------------------- Reference< XContent > ODocumentContainer::createObject( const ::rtl::OUString& _rName) @@ -288,7 +293,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments } if ( ( aClassID.getLength() == 0 ) && ( 0 == sURL.getLength() ) ) - ODocumentDefinition::GetDocumentServiceFromMediaType( getContainerStorage(), sPersistentName, m_aContext.getLegacyServiceFactory(), aClassID ); + ODocumentDefinition::GetDocumentServiceFromMediaType( getContainerStorage(), sPersistentName, m_aContext, aClassID ); } ODefinitionContainer_Impl::const_iterator aFind = rDefinitions.find( sName ); diff --git a/dbaccess/source/core/dataaccess/documentcontainer.hxx b/dbaccess/source/core/dataaccess/documentcontainer.hxx index 888798495a0e..b5c5a16e0383 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.hxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.hxx @@ -134,11 +134,16 @@ public: // helper ::rtl::Reference<OContentHelper> getContent(const ::rtl::OUString& _sName) const; - ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> getContainerStorage() const; + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getContainerStorage() const; protected: virtual ~ODocumentContainer(); -// ODefinitionContainer + + /** OContentHelper + */ + virtual ::rtl::OUString determineContentType() const; + + // ODefinitionContainer virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > createObject( const ::rtl::OUString& _rName ); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index db239fd11654..50c3083fbc9a 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -283,13 +283,38 @@ namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject; #define DEFAULT_WIDTH 10000 #define DEFAULT_HEIGHT 7500 -//........................................................................ +//............................................................................. namespace dbaccess { -//........................................................................ +//............................................................................. typedef ::boost::optional< bool > optional_bool; + //========================================================================= + //= helper + //========================================================================= + namespace + { + // -------------------------------------------------------------------- + ::rtl::OUString lcl_determineContentType_nothrow( const Reference< XStorage >& _rxContainerStorage, + const ::rtl::OUString& _rEntityName ) + { + ::rtl::OUString sContentType; + try + { + Reference< XStorage > xContainerStorage( _rxContainerStorage, UNO_QUERY_THROW ); + ::utl::SharedUNOComponent< XPropertySet > xStorageProps( + xContainerStorage->openStorageElement( _rEntityName, ElementModes::READ ), UNO_QUERY_THROW ); + OSL_VERIFY( xStorageProps->getPropertyValue( INFO_MEDIATYPE ) >>= sContentType ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sContentType; + } + } + //================================================================== // OEmbedObjectHolder //================================================================== @@ -467,61 +492,47 @@ namespace dbaccess m_xParentContainer = _xParent; } -::rtl::OUString ODocumentDefinition::GetDocumentServiceFromMediaType( const Reference< XStorage >& xStorage - ,const ::rtl::OUString& sEntName - ,const Reference< XMultiServiceFactory >& _xORB - ,Sequence< sal_Int8 >& _rClassId - ) +// ----------------------------------------------------------------------------- +::rtl::OUString ODocumentDefinition::GetDocumentServiceFromMediaType( const Reference< XStorage >& _rxContainerStorage, + const ::rtl::OUString& _rEntityName, const ::comphelper::ComponentContext& _rContext, + Sequence< sal_Int8 >& _rClassId ) +{ + return GetDocumentServiceFromMediaType( + lcl_determineContentType_nothrow( _rxContainerStorage, _rEntityName ), + _rContext, _rClassId ); +} + +// ----------------------------------------------------------------------------- +::rtl::OUString ODocumentDefinition::GetDocumentServiceFromMediaType( const ::rtl::OUString& _rMediaType, + const ::comphelper::ComponentContext& _rContext, Sequence< sal_Int8 >& _rClassId ) { ::rtl::OUString sResult; try { - if ( xStorage->isStorageElement( sEntName ) ) + ::comphelper::MimeConfigurationHelper aConfigHelper( _rContext.getLegacyServiceFactory() ); + sResult = aConfigHelper.GetDocServiceNameFromMediaType( _rMediaType ); + _rClassId = aConfigHelper.GetSequenceClassIDRepresentation(aConfigHelper.GetExplicitlyRegisteredObjClassID( _rMediaType )); + if ( !_rClassId.getLength() && sResult.getLength() ) { - // the object must be based on storage - - Reference< XPropertySet > xPropSet( xStorage->openStorageElement( sEntName, ElementModes::READ ), UNO_QUERY_THROW ); - - ::rtl::OUString aMediaType; - try { - Any aAny = xPropSet->getPropertyValue( INFO_MEDIATYPE ); - aAny >>= aMediaType; - } - catch ( Exception& ) + Reference< XNameAccess > xObjConfig = aConfigHelper.GetObjConfiguration(); + if ( xObjConfig.is() ) { - } - ::comphelper::MimeConfigurationHelper aConfigHelper(_xORB); - sResult = aConfigHelper.GetDocServiceNameFromMediaType(aMediaType); - _rClassId = aConfigHelper.GetSequenceClassIDRepresentation(aConfigHelper.GetExplicitlyRegisteredObjClassID(aMediaType)); - if ( !_rClassId.getLength() && sResult.getLength() ) - { - Reference< XNameAccess > xObjConfig = aConfigHelper.GetObjConfiguration(); - if ( xObjConfig.is() ) + Sequence< ::rtl::OUString > aClassIDs = xObjConfig->getElementNames(); + for ( sal_Int32 nInd = 0; nInd < aClassIDs.getLength(); nInd++ ) { - try + Reference< XNameAccess > xObjectProps; + ::rtl::OUString aEntryDocName; + + if ( ( xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is() + && ( xObjectProps->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ObjectDocumentServiceName")) + ) >>= aEntryDocName ) + && aEntryDocName.equals( sResult ) ) { - Sequence< ::rtl::OUString > aClassIDs = xObjConfig->getElementNames(); - for ( sal_Int32 nInd = 0; nInd < aClassIDs.getLength(); nInd++ ) - { - Reference< XNameAccess > xObjectProps; - ::rtl::OUString aEntryDocName; - - if ( ( xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is() - && ( xObjectProps->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ObjectDocumentServiceName")) - ) >>= aEntryDocName ) - && aEntryDocName.equals( sResult ) ) - { - _rClassId = aConfigHelper.GetSequenceClassIDRepresentation(aClassIDs[nInd]); - break; - } - } + _rClassId = aConfigHelper.GetSequenceClassIDRepresentation(aClassIDs[nInd]); + break; } - catch( Exception& ) - {} } } - - ::comphelper::disposeComponent( xPropSet ); } } catch ( Exception& ) @@ -1030,8 +1041,8 @@ void ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, con impl_onActivateEmbeddedObject(); } - // LLA: Alle fillReportData() calls prfen, sollte es welche geben, die danach noch viel machen - // LLA: sollten wir einen _aGuard Pointer bergeben, sonst erstmal als Referenz + // LLA: Alle fillReportData() calls prfen, sollte es welche geben, die danach noch viel machen + // LLA: sollten wir einen _aGuard Pointer bergeben, sonst erstmal als Referenz fillReportData(_aGuard); _out_rComponent <<= xModel; } @@ -1094,10 +1105,13 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co Environment ); // Unreachable } - Reference< XStorage> xStorage(aIni[0],UNO_QUERY); + Reference< XStorage> xDest(aIni[0],UNO_QUERY); ::rtl::OUString sPersistentName; aIni[1] >>= sPersistentName; - loadEmbeddedObject( true ); + Reference< XStorage> xStorage = getContainerStorage(); + // ----------------------------------------------------------------------------- + xStorage->copyElementTo(m_pImpl->m_aProps.sPersistentName,xDest,sPersistentName); + /*loadEmbeddedObject( true ); Reference<XEmbedPersist> xPersist(m_xEmbeddedObject,UNO_QUERY); if ( xPersist.is() ) { @@ -1106,7 +1120,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co m_xEmbeddedObject->changeState(EmbedStates::LOADED); } else - throw CommandAbortedException(); + throw CommandAbortedException();*/ } else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preview" ) ) ) { @@ -1529,7 +1543,15 @@ namespace // ----------------------------------------------------------------------------- sal_Bool ODocumentDefinition::objectSupportsEmbeddedScripts() const { - bool bAllowDocumentMacros = !m_pImpl->m_pDataSource || m_pImpl->m_pDataSource->hasAnyObjectWithMacros(); +// bool bAllowDocumentMacros = !m_pImpl->m_pDataSource || m_pImpl->m_pDataSource->hasAnyObjectWithMacros(); + // TODO: revert to the disabled code. The current version is just to be able + // to integrate an intermediate version of the CWS, which should behave as + // if no macros in DB docs are allowed + bool bAllowDocumentMacros = !m_pImpl->m_pDataSource->hasMacroStorages(); + // even if the current version is not able to create documents which contain macros, + // later versions will be. Such documents contain macro/script storages in the + // document root storage, in which case we need to disable the per-form/report + // scripting. // if *any* of the objects of the database document already has macros, we continue to allow it // to have them, until the user did a migration. @@ -1537,6 +1559,13 @@ sal_Bool ODocumentDefinition::objectSupportsEmbeddedScripts() const return bAllowDocumentMacros; } + +// ----------------------------------------------------------------------------- +::rtl::OUString ODocumentDefinition::determineContentType() const +{ + return lcl_determineContentType_nothrow( getContainerStorage(), m_pImpl->m_aProps.sPersistentName ); +} + // ----------------------------------------------------------------------------- Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XConnection>& _xConnection, const bool _bSuppressMacros, const bool _bReadOnly, const Sequence< PropertyValue >& _rAdditionalArgs, Sequence< PropertyValue >& _out_rEmbeddedObjectDescriptor ) @@ -1629,7 +1658,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x } else { - sDocumentService = GetDocumentServiceFromMediaType( xStorage, m_pImpl->m_aProps.sPersistentName, m_aContext.getLegacyServiceFactory(), aClassID ); + sDocumentService = GetDocumentServiceFromMediaType( getContentType(), m_aContext, aClassID ); // check if we are not a form and // the com.sun.star.report.pentaho.SOReportJobFactory is not present. if ( !m_bForm && !sDocumentService.equalsAscii("com.sun.star.text.TextDocument")) @@ -1642,6 +1671,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x { com::sun::star::io::WrongFormatException aWFE; aWFE.Message = ::rtl::OUString::createFromAscii("Extension not present."); + // TODO: resource throw aWFE; } } diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 97c3aa85659e..510d9f30153c 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -168,11 +168,17 @@ public: static ::com::sun::star::uno::Sequence< sal_Int8 > getDefaultDocumentTypeClassId(); - static ::rtl::OUString GetDocumentServiceFromMediaType( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage - ,const ::rtl::OUString& sEntName - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB - ,::com::sun::star::uno::Sequence< sal_Int8 >& _rClassId - ); + static ::rtl::OUString GetDocumentServiceFromMediaType( + const ::rtl::OUString& _rMediaType, + const ::comphelper::ComponentContext& _rContext, + ::com::sun::star::uno::Sequence< sal_Int8 >& _rClassId + ); + static ::rtl::OUString GetDocumentServiceFromMediaType( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxContainerStorage, + const ::rtl::OUString& _rEntityName, + const ::comphelper::ComponentContext& _rContext, + ::com::sun::star::uno::Sequence< sal_Int8 >& _rClassId + ); private: /** does necessary initializations after our embedded object has been switched to ACTIVE @@ -211,14 +217,18 @@ private: bool impl_close_throw(); -protected: +private: // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const; + // helper virtual void SAL_CALL disposing(); + // OContentHelper overridables + virtual ::rtl::OUString determineContentType() const; + private: /** fills the load arguments */ diff --git a/dbaccess/source/core/inc/ContentHelper.hxx b/dbaccess/source/core/inc/ContentHelper.hxx index 697ec70fcdb2..0f5247528709 100644 --- a/dbaccess/source/core/inc/ContentHelper.hxx +++ b/dbaccess/source/core/inc/ContentHelper.hxx @@ -103,7 +103,8 @@ namespace dbaccess struct ContentProperties { ::rtl::OUString aTitle; // Title - ::rtl::OUString aContentType; // ContentType + ::boost::optional< ::rtl::OUString > + aContentType; // ContentType (aka MediaType aka MimeType) sal_Bool bIsDocument; // IsDocument sal_Bool bIsFolder; // IsFolder sal_Bool bAsTemplate; // AsTemplate @@ -156,6 +157,8 @@ namespace dbaccess getProperties( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv ); + void impl_rename_throw(const ::rtl::OUString& _sNewName,bool _bNotify = true); + protected: ::cppu::OInterfaceContainerHelper m_aContentListeners; PropertyChangeListenerContainer m_aPropertyChangeListeners; @@ -231,6 +234,9 @@ namespace dbaccess ::com::sun::star::beans::Property >& rProperties ); inline TContentPtr getImpl() const { return m_pImpl; } + + protected: + virtual ::rtl::OUString determineContentType() const = 0; }; //........................................................................ diff --git a/dbaccess/source/core/inc/DatabaseDataProvider.hxx b/dbaccess/source/core/inc/DatabaseDataProvider.hxx index 31f3d694bbbf..68d67808e921 100644 --- a/dbaccess/source/core/inc/DatabaseDataProvider.hxx +++ b/dbaccess/source/core/inc/DatabaseDataProvider.hxx @@ -202,8 +202,8 @@ private: virtual void SAL_CALL disposing(); void impl_fillRowSet_throw(); - bool impl_executeRowSet_throw(::osl::ResettableMutexGuard& _rClearForNotifies); - bool fillParameters( ::osl::ResettableMutexGuard& _rClearForNotifies, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler ); + void impl_executeRowSet_nothrow(::osl::ResettableMutexGuard& _rClearForNotifies); + bool impl_fillParameters_nothrow( ::osl::ResettableMutexGuard& _rClearForNotifies); void impl_fillInternalDataProvider_throw(); void impl_invalidateParameter_nothrow(); @@ -228,6 +228,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > m_xInternal; ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeXMLConversion> m_xRangeConversion; + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> m_xHandler; // the object doin' most of the work - an SDB-rowset ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xAggregateSet; diff --git a/dbaccess/source/core/inc/definitioncontainer.hxx b/dbaccess/source/core/inc/definitioncontainer.hxx index 0740eab777e9..0abbe34aa95a 100644 --- a/dbaccess/source/core/inc/definitioncontainer.hxx +++ b/dbaccess/source/core/inc/definitioncontainer.hxx @@ -174,6 +174,7 @@ protected: m_aContainerListeners; sal_Bool m_bInPropertyChange; + bool m_bCheckSlash; protected: /** Additionally to our own approvals which new elements must pass, derived classes @@ -204,7 +205,8 @@ public: ODefinitionContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParentContainer - ,const TContentPtr& _pImpl + , const TContentPtr& _pImpl + , bool _bCheckSlash = true ); // ::com::sun::star::uno::XInterface diff --git a/dbaccess/source/core/inc/querycontainer.hxx b/dbaccess/source/core/inc/querycontainer.hxx index 08830d4ccc2b..869371f7ade4 100644 --- a/dbaccess/source/core/inc/querycontainer.hxx +++ b/dbaccess/source/core/inc/querycontainer.hxx @@ -209,6 +209,10 @@ namespace dbaccess // ::com::sun::star::container::XNameAccess virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException); + protected: + // OContentHelper overridables + virtual ::rtl::OUString determineContentType() const; + private: // helper /** create a query object wrapping a CommandDefinition given by name. To retrieve the object, the CommandDescription diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index d6851cf14901..33c437f970b9 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DatabaseDataProvider.cxx,v $ - * $Revision: 1.5.34.1 $ + * $RCSfile$ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -35,6 +35,7 @@ #include "cppuhelper/implbase1.hxx" #include <comphelper/types.hxx> #include <connectivity/FValue.hxx> +#include <connectivity/dbtools.hxx> #include <rtl/ustrbuf.hxx> #include <com/sun/star/task/XInteractionHandler.hpp> @@ -42,8 +43,6 @@ #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/XResultSetMetaData.hpp> -#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/XChartDataArray.hpp> @@ -86,7 +85,7 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex m_xAggregate.set(m_xRowSet,uno::UNO_QUERY); m_xAggregateSet.set(m_xRowSet,uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xProp(static_cast< ::cppu::OWeakObject* >( this ),uno::UNO_QUERY); - m_aFilterManager.initialize( xProp, m_xAggregateSet ); + m_aFilterManager.initialize( m_xAggregateSet ); m_aParameterManager.initialize( xProp, m_xAggregate ); m_xAggregateSet->setPropertyValue(PROPERTY_COMMAND_TYPE,uno::makeAny(m_CommandType)); m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,uno::makeAny(m_EscapeProcessing)); @@ -158,12 +157,14 @@ uno::Reference< uno::XInterface > DatabaseDataProvider::Create(uno::Reference< u void SAL_CALL DatabaseDataProvider::initialize(const uno::Sequence< uno::Any > & aArguments) throw (uno::RuntimeException, uno::Exception) { osl::MutexGuard g(m_aMutex); - const uno::Any* pIter = aArguments.getConstArray(); - const uno::Any* pEnd = pIter + aArguments.getLength(); + const uno::Any* pIter = aArguments.getConstArray(); + const uno::Any* pEnd = pIter + aArguments.getLength(); for(;pIter != pEnd;++pIter) { - if ( !m_xActiveConnection.is() && ((*pIter) >>= m_xActiveConnection) ) - break; + if ( !m_xActiveConnection.is() ) + (*pIter) >>= m_xActiveConnection; + else if ( !m_xHandler.is() ) + (*pIter) >>= m_xHandler; } m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, uno::makeAny( m_xActiveConnection ) ); } @@ -179,14 +180,12 @@ void SAL_CALL DatabaseDataProvider::initialize(const uno::Sequence< uno::Any > & try { impl_fillRowSet_throw(); - bRet = impl_executeRowSet_throw(aClearForNotifies); - if ( bRet ) - impl_fillInternalDataProvider_throw(); + impl_executeRowSet_nothrow(aClearForNotifies); + impl_fillInternalDataProvider_throw(); + bRet = true; } - catch(const uno::Exception& e) + catch(const uno::Exception& /*e*/) { - (void)e; - OSL_ENSURE(0,"Exception caught!"); } } if ( !bRet ) // no command set or an error occured, use Internal data handler @@ -500,18 +499,16 @@ void SAL_CALL DatabaseDataProvider::setDataSourceName(const ::rtl::OUString& the set(PROPERTY_DATASOURCENAME,the_value,m_DataSourceName); } // ----------------------------------------------------------------------------- -bool DatabaseDataProvider::impl_executeRowSet_throw(::osl::ResettableMutexGuard& _rClearForNotifies) +void DatabaseDataProvider::impl_executeRowSet_nothrow(::osl::ResettableMutexGuard& _rClearForNotifies) { - uno::Reference<task::XInteractionHandler> xHandler( - m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.InteractionHandler")) - ,m_xContext), - uno::UNO_QUERY); - if (!fillParameters(_rClearForNotifies, xHandler)) - return false; - - m_xRowSet->execute(); - return true; + try + { + if ( impl_fillParameters_nothrow(_rClearForNotifies) ) + m_xRowSet->execute(); + } + catch(const uno::Exception&) + { + } } // ----------------------------------------------------------------------------- void DatabaseDataProvider::impl_fillInternalDataProvider_throw() @@ -519,19 +516,25 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw() // clear the data before fill the new one uno::Reference< chart::XChartDataArray> xChartData(m_xInternal,uno::UNO_QUERY); if ( xChartData.is() ) + { xChartData->setData(uno::Sequence< uno::Sequence<double> >()); + xChartData->setColumnDescriptions(uno::Sequence< ::rtl::OUString >()); + m_xInternal->deleteSequence(0); + } + + uno::Sequence< ::rtl::OUString > aColumns = ::dbtools::getFieldNamesByCommandDescriptor(getActiveConnection() + ,getCommandType() + ,m_Command); // fill the data - uno::Reference< sdbc::XResultSet> xRes(m_xRowSet,uno::UNO_QUERY); - uno::Reference< sdbc::XRow> xRow(m_xRowSet,uno::UNO_QUERY); - uno::Reference< sdbc::XResultSetMetaDataSupplier> xResMDSup(m_xRowSet,uno::UNO_QUERY); - uno::Reference< sdbc::XResultSetMetaData> xResultSetMetaData = xResMDSup->getMetaData(); + uno::Reference< sdbc::XResultSet> xRes(m_xRowSet,uno::UNO_QUERY_THROW); + uno::Reference< sdbc::XRow> xRow(m_xRowSet,uno::UNO_QUERY_THROW); uno::Sequence< uno::Any > aLabelArgs(1); - const sal_Int32 nCount = xResultSetMetaData->getColumnCount(); - for (sal_Int32 i = 2; i <= nCount; ++i) + const sal_Int32 nCount = aColumns.getLength(); + for (sal_Int32 i = 1; i < nCount; ++i) { - aLabelArgs[0] <<= xResultSetMetaData->getColumnName(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); } @@ -543,6 +546,22 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw() ++nRowCount; for (sal_Int32 j = 1; j <= nCount; ++j) aDataValues[j-1].push_back(uno::makeAny(xRow->getString(j))); + } // while( xRes->next() && (!m_RowLimit || nRowCount < m_RowLimit) ) + if ( !nRowCount ) + { + nRowCount = 3; + const double fDefaultData[ ] = + { 9.10, 3.20, 4.54, + 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) + { + 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(); @@ -559,7 +578,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw() else m_xInternal->setDataByRangeRepresentation(::rtl::OUString::valueOf(nPos-1),uno::Sequence< uno::Any >(&(*aDataValuesIter->begin()),aDataValuesIter->size())); } - } + } // for (sal_Int32 nPos = 0;nRowCount && aDataValuesIter != aDataValuesEnd ; ++aDataValuesIter,++nPos) } // ----------------------------------------------------------------------------- void DatabaseDataProvider::impl_fillRowSet_throw() @@ -569,14 +588,14 @@ void DatabaseDataProvider::impl_fillRowSet_throw() xParam->clearParameters( ); } // ----------------------------------------------------------------------------- -bool DatabaseDataProvider::fillParameters( ::osl::ResettableMutexGuard& _rClearForNotifies, const uno::Reference< task::XInteractionHandler >& _rxCompletionHandler ) +bool DatabaseDataProvider::impl_fillParameters_nothrow( ::osl::ResettableMutexGuard& _rClearForNotifies) { // do we have to fill the parameters again? if ( !m_aParameterManager.isUpToDate() ) m_aParameterManager.updateParameterInfo( m_aFilterManager ); if ( m_aParameterManager.isUpToDate() ) - return m_aParameterManager.fillParameterValues( _rxCompletionHandler, _rClearForNotifies ); + return m_aParameterManager.fillParameterValues( m_xHandler, _rClearForNotifies ); return true; } @@ -723,11 +742,8 @@ void SAL_CALL DatabaseDataProvider::clearParameters() throw( SQLException, Runti //------------------------------------------------------------------------------ void SAL_CALL DatabaseDataProvider::execute() throw( SQLException, RuntimeException ) { - ::osl::ResettableMutexGuard aGuard(m_aMutex); - impl_fillRowSet_throw(); - bool bRet = impl_executeRowSet_throw(aGuard); - if ( bRet ) - impl_fillInternalDataProvider_throw(); + uno::Sequence< beans::PropertyValue > aEmpty; + createDataSourcePossible(aEmpty); } //------------------------------------------------------------------------------ void SAL_CALL DatabaseDataProvider::addRowSetListener(const uno::Reference<sdbc::XRowSetListener>& _rListener) throw( RuntimeException ) diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index 824e236ef9eb..9c1447bb84da 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/ucb/XCommandProcessor.hpp> +#include <com/sun/star/ucb/XContent.hpp> #include <com/sun/star/embed/XComponentSupplier.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/document/XStorageBasedDocument.hpp> @@ -66,11 +67,13 @@ #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/script/XEventAttacherManager.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> +#include <com/sun/star/io/WrongFormatException.hpp> /** === end UNO includes === **/ #include <comphelper/documentinfo.hxx> #include <comphelper/interaction.hxx> #include <comphelper/namedvaluecollection.hxx> +#include <comphelper/storagehelper.hxx> #include <comphelper/string.hxx> #include <comphelper/types.hxx> #include <cppuhelper/exc_hlp.hxx> @@ -111,6 +114,7 @@ namespace dbmm using ::com::sun::star::frame::XModel; using ::com::sun::star::frame::XComponentLoader; using ::com::sun::star::ucb::XCommandProcessor; + using ::com::sun::star::ucb::XContent; using ::com::sun::star::ucb::Command; using ::com::sun::star::embed::XComponentSupplier; using ::com::sun::star::task::XStatusIndicator; @@ -138,6 +142,7 @@ namespace dbmm using ::com::sun::star::script::XEventAttacherManager; using ::com::sun::star::script::ScriptEventDescriptor; using ::com::sun::star::script::XLibraryContainerPassword; + using ::com::sun::star::io::WrongFormatException; /** === end UNO using === **/ namespace ElementModes = ::com::sun::star::embed::ElementModes; @@ -158,12 +163,15 @@ namespace dbmm Reference< XModel > xDocument; // valid only temporarily ::rtl::OUString sHierarchicalName; SubDocumentType eType; + size_t nNumber; - SubDocument( const Reference< XCommandProcessor >& _rxCommandProcessor, const ::rtl::OUString& _rName, const SubDocumentType _eType ) + SubDocument( const Reference< XCommandProcessor >& _rxCommandProcessor, const ::rtl::OUString& _rName, + const SubDocumentType _eType, const size_t _nNumber ) :xCommandProcessor( _rxCommandProcessor ) ,xDocument() ,sHierarchicalName( _rName ) ,eType( _eType ) + ,nNumber( _nNumber ) { } }; @@ -265,7 +273,31 @@ namespace dbmm } //---------------------------------------------------------------- - static bool lcl_loadSubDocument_nothrow( SubDocument& _rDocument, + ::rtl::OUString lcl_getMimeType_nothrow( const Reference< XCommandProcessor >& _rxContent ) + { + ::rtl::OUString sMimeType; + try + { + Reference< XContent > xContent( _rxContent, UNO_QUERY_THROW ); + sMimeType = xContent->getContentType(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sMimeType; + } + + //---------------------------------------------------------------- + enum OpenDocResult + { + eOpenedDoc, + eIgnoreDoc, + eFailure + }; + + //---------------------------------------------------------------- + static OpenDocResult lcl_loadSubDocument_nothrow( SubDocument& _rDocument, const Reference< XStatusIndicator >& _rxProgress, MigrationLog& _rLogger ) { OSL_PRECOND( !_rDocument.xDocument.is(), "lcl_loadSubDocument_nothrow: already loaded!" ); @@ -292,13 +324,31 @@ namespace dbmm } catch( const Exception& ) { - _rLogger.logFailure( MigrationError( - ERR_OPENING_SUB_DOCUMENT_FAILED, - lcl_getSubDocumentDescription( _rDocument ), - ::cppu::getCaughtException() - ) ); + Any aError( ::cppu::getCaughtException() ); + + bool bCausedByNewStyleReport = + ( _rDocument.eType == eReport ) + && ( aError.isExtractableTo( ::cppu::UnoType< WrongFormatException >::get() ) ) + && ( lcl_getMimeType_nothrow( _rDocument.xCommandProcessor ).equalsAscii( "application/vnd.sun.xml.report" ) ); + + if ( bCausedByNewStyleReport ) + { + _rLogger.logRecoverable( MigrationError( + ERR_NEW_STYLE_REPORT, + lcl_getSubDocumentDescription( _rDocument ) + ) ); + return eIgnoreDoc; + } + else + { + _rLogger.logFailure( MigrationError( + ERR_OPENING_SUB_DOCUMENT_FAILED, + lcl_getSubDocumentDescription( _rDocument ), + aError + ) ); + } } - return _rDocument.xDocument.is(); + return _rDocument.xDocument.is() ? eOpenedDoc : eFailure; } //---------------------------------------------------------------- @@ -822,8 +872,8 @@ namespace dbmm ); ~MigrationEngine_Impl(); - inline sal_Int32 getFormCount() const { return m_nFormCount; } - inline sal_Int32 getReportCount()const { return m_nReportCount; } + inline size_t getFormCount() const { return m_nFormCount; } + inline size_t getReportCount()const { return m_nReportCount; } bool migrateAll(); private: @@ -995,12 +1045,10 @@ namespace dbmm //-------------------------------------------------------------------- namespace { - size_t lcl_collectHierarchicalElementNames_throw( + void lcl_collectHierarchicalElementNames_throw( const Reference< XNameAccess >& _rxContainer, const ::rtl::OUString& _rContainerLoc, - SubDocuments& _out_rDocs, const SubDocumentType _eType ) + SubDocuments& _out_rDocs, const SubDocumentType _eType, size_t& _io_counter ) { - size_t nAddedElements = 0; - const ::rtl::OUString sHierarhicalBase( _rContainerLoc.getLength() ? ::rtl::OUStringBuffer( _rContainerLoc ).appendAscii( "/" ).makeStringAndClear() : ::rtl::OUString() ); @@ -1017,7 +1065,7 @@ namespace dbmm Reference< XNameAccess > xSubContainer( aElement, UNO_QUERY ); if ( xSubContainer.is() ) { - nAddedElements += lcl_collectHierarchicalElementNames_throw( xSubContainer, sElementName, _out_rDocs, _eType ); + lcl_collectHierarchicalElementNames_throw( xSubContainer, sElementName, _out_rDocs, _eType, _io_counter ); } else { @@ -1025,12 +1073,10 @@ namespace dbmm OSL_ENSURE( xCommandProcessor.is(), "lcl_collectHierarchicalElementNames_throw: no container, and no comand processor? What *is* it, then?!" ); if ( xCommandProcessor.is() ) { - _out_rDocs.push_back( SubDocument( xCommandProcessor, sElementName, _eType ) ); - ++nAddedElements; + _out_rDocs.push_back( SubDocument( xCommandProcessor, sElementName, _eType, ++_io_counter ) ); } } } - return nAddedElements; } } @@ -1044,10 +1090,12 @@ namespace dbmm try { Reference< XNameAccess > xDocContainer( m_xDocument->getFormDocuments(), UNO_SET_THROW ); - m_nFormCount = lcl_collectHierarchicalElementNames_throw( xDocContainer, ::rtl::OUString(), m_aSubDocs, eForm ); + m_nFormCount = 0; + lcl_collectHierarchicalElementNames_throw( xDocContainer, ::rtl::OUString(), m_aSubDocs, eForm, m_nFormCount ); xDocContainer.set( m_xDocument->getReportDocuments(), UNO_SET_THROW ); - m_nReportCount = lcl_collectHierarchicalElementNames_throw( xDocContainer, ::rtl::OUString(), m_aSubDocs, eReport ); + m_nReportCount = 0; + lcl_collectHierarchicalElementNames_throw( xDocContainer, ::rtl::OUString(), m_aSubDocs, eReport, m_nReportCount ); } catch( const Exception& ) { @@ -1075,13 +1123,14 @@ namespace dbmm // load the document ::rtl::Reference< ProgressCapture > pStatusIndicator( new ProgressCapture( sObjectName, m_rProgress ) ); SubDocument aSubDocument( _rDocument ); - if ( !lcl_loadSubDocument_nothrow( aSubDocument, pStatusIndicator.get(), m_rLogger ) ) + OpenDocResult eResult = lcl_loadSubDocument_nothrow( aSubDocument, pStatusIndicator.get(), m_rLogger ); + if ( eResult != eOpenedDoc ) { pStatusIndicator->dispose(); m_rProgress.endObject(); m_rLogger.finishedDocument( m_nCurrentDocumentID ); m_nCurrentDocumentID = -1; - return false; + return ( eResult == eIgnoreDoc ); } // ----------------- @@ -1145,32 +1194,69 @@ namespace dbmm namespace { static ::rtl::OUString lcl_createTargetLibName( const SubDocument& _rDocument, - const ::rtl::OUString& _rSourceLibName, const Reference< XNameAccess >& _rxTargetStorage ) + const ::rtl::OUString& _rSourceLibName, const Reference< XNameAccess >& _rxTargetContainer ) { - // a prefix denoting the type + // The new library name is composed from the prefix, the base name, and the old library name. const ::rtl::OUString sPrefix( ::rtl::OUString::createFromAscii( _rDocument.eType == eForm ? "Form_" : "Report_" ) ); - ::rtl::OUStringBuffer aBuffer; - aBuffer.append( sPrefix ); - - // first try with the base name of the sub document - aBuffer.append( _rDocument.sHierarchicalName.copy( + ::rtl::OUString sBaseName( _rDocument.sHierarchicalName.copy( _rDocument.sHierarchicalName.lastIndexOf( '/' ) + 1 ) ); - aBuffer.appendAscii( "_" ); - aBuffer.append( _rSourceLibName ); - ::rtl::OUString sTargetName( aBuffer.makeStringAndClear() ); - if ( !_rxTargetStorage->hasByName( sTargetName ) ) - return sTargetName; - - // if this name is already used (which is valid, since documents with the same base - // name can exist in different logical folders), then use the complete name - aBuffer.append( sPrefix ); - aBuffer.append( ::comphelper::string::searchAndReplaceAllAsciiWithAscii( - _rDocument.sHierarchicalName, "/", "_" ) ); - aBuffer.appendAscii( "_" ); - aBuffer.append( _rSourceLibName ); - return aBuffer.makeStringAndClear(); + // Normalize this name. In our current storage implementation (and script containers in a document + // are finally mapped to sub storages of the document storage), not all characters are allowed. + // The bug requesting to change this is #i95409#. + // Unfortunately, the storage implementation does not complain if you use invalid characters/names, but instead + // it silently accepts them, and produces garbage in the file (#i95408). + // So, until especially the former is fixed, we need to strip the name from all invalid characters. + // #i95865# / 2008-11-06 / frank.schoenheit@sun.com + + // The general idea is to replace invalid characters with '_'. However, since "valid" essentially means + // ASCII only, this implies that for a lot of languages, we would simply replace everything with '_', + // which of course is not desired. + // So, we use a heuristics: If the name contains at most 3 invalid characters, and as many valid as invalid + // characters, then we use the replacement. Otherwise, we just use a unambiguous number for the sub document. + sal_Int32 nValid=0, nInvalid=0; + const sal_Unicode* pBaseName = sBaseName.getStr(); + const sal_Int32 nBaseNameLen = sBaseName.getLength(); + for ( sal_Int32 i=0; i<nBaseNameLen; ++i ) + { + if ( ::comphelper::IsValidZipEntryFileName( pBaseName + i, 1, sal_False ) ) + ++nValid; + else + ++nInvalid; + } + if ( ( nInvalid <= 3 ) && ( nInvalid * 2 <= nValid ) ) + { // not "too many" invalid => replace them + ::rtl::OUStringBuffer aReplacement; + aReplacement.ensureCapacity( nBaseNameLen ); + aReplacement.append( sBaseName ); + const sal_Unicode* pReplacement = aReplacement.getStr(); + for ( sal_Int32 i=0; i<nBaseNameLen; ++i ) + { + if ( !::comphelper::IsValidZipEntryFileName( pReplacement + i, 1, sal_False ) ) + aReplacement.setCharAt( i, '_' ); + } + sBaseName = aReplacement.makeStringAndClear(); + + ::rtl::OUStringBuffer aNewLibNameAttempt; + aNewLibNameAttempt.append( sPrefix ); + aNewLibNameAttempt.append( sBaseName ); + aNewLibNameAttempt.appendAscii( "_" ); + aNewLibNameAttempt.append( _rSourceLibName ); + ::rtl::OUString sTargetName( aNewLibNameAttempt.makeStringAndClear() ); + if ( !_rxTargetContainer->hasByName( sTargetName ) ) + return sTargetName; + } + // "too many" invalid characters, or the name composed with the base name was already used. + // (The latter is valid, since there can be multiple sub documents with the same base name, + // in different levels in the hierarchy.) + // In this case, just use the umambiguous sub document number. + ::rtl::OUStringBuffer aNewLibName; + aNewLibName.append( sPrefix ); + aNewLibName.append( ::rtl::OUString::valueOf( sal_Int64( _rDocument.nNumber ) ) ); + aNewLibName.appendAscii( "_" ); + aNewLibName.append( _rSourceLibName ); + return aNewLibName.makeStringAndClear(); } } @@ -1314,8 +1400,8 @@ namespace dbmm { m_rLogger.logFailure( MigrationError( ERR_COMMITTING_SCRIPT_STORAGES_FAILED, - lcl_getSubDocumentDescription( _rDocument ), - getScriptTypeDisplayName( _eScriptType ) + getScriptTypeDisplayName( _eScriptType ), + lcl_getSubDocumentDescription( _rDocument ) ) ); return false; } @@ -1340,8 +1426,8 @@ namespace dbmm { m_rLogger.logFailure( MigrationError( ERR_GENERAL_SCRIPT_MIGRATION_FAILURE, - lcl_getSubDocumentDescription( _rDocument ), getScriptTypeDisplayName( _eScriptType ), + lcl_getSubDocumentDescription( _rDocument ), aException ) ); } diff --git a/dbaccess/source/ext/macromigration/migrationerror.hxx b/dbaccess/source/ext/macromigration/migrationerror.hxx index ce5bcabb23f2..84b972f0e9bf 100644 --- a/dbaccess/source/ext/macromigration/migrationerror.hxx +++ b/dbaccess/source/ext/macromigration/migrationerror.hxx @@ -65,7 +65,8 @@ namespace dbmm ERR_DOCUMENT_BACKUP_FAILED, ERR_UNKNOWN_SCRIPT_FOLDER, ERR_EXAMINING_SCRIPTS_FOLDER_FAILED, - ERR_PASSWORD_VERIFICATION_FAILED + ERR_PASSWORD_VERIFICATION_FAILED, + ERR_NEW_STYLE_REPORT }; //==================================================================== diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx index 4c94bc0a45de..df41a1199b1f 100644 --- a/dbaccess/source/ext/macromigration/migrationlog.cxx +++ b/dbaccess/source/ext/macromigration/migrationlog.cxx @@ -248,18 +248,18 @@ namespace dbmm switch ( _rError.eType ) { case ERR_OPENING_SUB_DOCUMENT_FAILED: - pAsciiErrorDescription = "opening '#name#' failed"; - aAsciiParameterNames.push_back( "#name#" ); + pAsciiErrorDescription = "opening '#doc#' failed"; + aAsciiParameterNames.push_back( "#doc#" ); break; case ERR_CLOSING_SUB_DOCUMENT_FAILED: - pAsciiErrorDescription = "closing '#name#' failed"; - aAsciiParameterNames.push_back( "#name#" ); + pAsciiErrorDescription = "closing '#doc#' failed"; + aAsciiParameterNames.push_back( "#doc#" ); break; case ERR_STORAGE_COMMIT_FAILED: - pAsciiErrorDescription = "committing the changes for document '#name#' failed"; - aAsciiParameterNames.push_back( "#name#" ); + pAsciiErrorDescription = "committing the changes for document '#doc#' failed"; + aAsciiParameterNames.push_back( "#doc#" ); break; case ERR_STORING_DATABASEDOC_FAILED: @@ -289,7 +289,7 @@ namespace dbmm break; case ERR_GENERAL_SCRIPT_MIGRATION_FAILURE: - pAsciiErrorDescription = "general error during migrationg #scripttype# scripts of document '#doc#'"; + pAsciiErrorDescription = "general error while migrating #scripttype# scripts of document '#doc#'"; aAsciiParameterNames.push_back( "#scripttype#" ); aAsciiParameterNames.push_back( "#doc#" ); break; @@ -325,7 +325,7 @@ namespace dbmm break; case ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED: - pAsciiErrorDescription = "adjusting events for document #doc# failed"; + pAsciiErrorDescription = "adjusting events for document '#doc#' failed"; aAsciiParameterNames.push_back( "#doc#" ); break; @@ -367,6 +367,11 @@ namespace dbmm aAsciiParameterNames.push_back( "#name#" ); break; + case ERR_NEW_STYLE_REPORT: + pAsciiErrorDescription = "#doc# could not be processed, since you don't have the Sun Report Builder (TM) extension installed."; + aAsciiParameterNames.push_back( "#doc#" ); + break; + // do *not* add a default case here: Without a default, some compilers will warn you when // you miss a newly-introduced enum value here } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index ccac5237d7dc..85bc7a0d8d23 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1322,7 +1322,11 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa { getContainer()->selectContainer(E_NONE); getContainer()->selectContainer(E_TABLE); + // #i95524# + getContainer()->Invalidate(); + refreshTables(); } + } break; case ID_BROWSER_SORTUP: @@ -2822,6 +2826,10 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > sal_Int32 nValue = 0; pIter->Value >>= nValue; m_ePreviewMode = static_cast<PreviewMode>(nValue); + if ( getView() ) + { + getContainer()->switchPreview(m_ePreviewMode); + } } } catch( const Exception& ) diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx index b782d309d9db..08416eb7496e 100644 --- a/dbaccess/source/ui/control/RelationControl.cxx +++ b/dbaccess/source/ui/control/RelationControl.cxx @@ -452,7 +452,7 @@ namespace dbaui const OJoinTableView* pView = _pSource->getTableView(); OTableConnection* pConn = pView->GetTabConn(_pSource,_pDest); - if ( pConn ) + if ( pConn && !m_pConnData->GetConnLineDataList()->empty() ) { m_pConnData->CopyFrom(*pConn->GetData()); m_pBoxControl->getContainer()->notifyConnectionChange(); diff --git a/dbaccess/source/ui/dlg/ExtensionNotPresent.src b/dbaccess/source/ui/dlg/ExtensionNotPresent.src index 6a96bccf8b9d..ea4cdee8b310 100644 --- a/dbaccess/source/ui/dlg/ExtensionNotPresent.src +++ b/dbaccess/source/ui/dlg/ExtensionNotPresent.src @@ -1,89 +1,91 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: ExtensionNotPresent.src,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "ExtensionNotPresent.hrc" -#include "dbaccess_helpid.hrc" -#include "dbu_resource.hrc" -#include <svx/globlmn.hrc> -#include <svx/svxids.hrc> - - -String RID_STR_EXTENSION_NOT_PRESENT -{ - Text [ en-US ] = "To open a report you require the extension %RPT_EXTENSION_NAME.\n\nClick 'Download...' to download and install the extension."; -}; -// To open a report you require the extension Sun Report Designer weiss der Geier Hauptsache extra langer Name -// String RID_STR_EXTENSION_NAME -// { -// Text = "Sun(TM) Report Builder"; -// }; - -ModalDialog RID_EXTENSION_NOT_PRESENT_DLG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ; - Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION" ; - HelpId = HID_EXTENSION_NOT_PRESENT_DLG; - Moveable = TRUE ; - Closeable = TRUE ; - - // most of the calulated values here are overridden by the ExtensionNotPresent ctor itself. - FixedImage FI_WARNING - { - Pos = MAP_APPFONT (CELL_PADDING / 2, CELL_PADDING) ; - Size = (32, 32); - Fixed=BMP_EXCEPTION_WARNING; - }; - - - FixedText FT_TEXT - { - Pos = MAP_APPFONT ( 32 , CELL_PADDING ) ; - Size = MAP_APPFONT ( DLG_WIDTH - LEFT_PADDING - RIGHT_PADDING , 3 * (FIXEDTEXT_HEIGHT + 2) ) ; - // Border = TRUE ; - // Text will set outside from RID_STR_EXTENSION_NOT_PRESENT - }; - - PushButton PB_DOWNLOAD - { - Pos = MAP_APPFONT ( DLG_WIDTH / 2 - (CELL_PADDING/2) - BUTTON_WIDTH, ACTION_LINE_START ) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - DefButton = TRUE ; - TabStop = TRUE ; - Text [ en-US ] = "~Download..." ; - }; - - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( DLG_WIDTH / 2 + (CELL_PADDING/2), ACTION_LINE_START) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; -}; +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ExtensionNotPresent.src,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ExtensionNotPresent.hrc"
+#include "dbaccess_helpid.hrc"
+#include "dbu_resource.hrc"
+#include <svx/globlmn.hrc>
+#include <svx/svxids.hrc>
+
+
+String RID_STR_EXTENSION_NOT_PRESENT
+{
+ // #i96130# use hard coded name
+ Text [ en-US ] = "To open a report you require the extension Sun™ Report Builder.\n\nClick 'Download...' to download and install the extension.";
+ // OLD: Text [ en-US ] = "To open a report you require the extension %RPT_EXTENSION_NAME.\n\nClick 'Download...' to download and install the extension.";
+};
+// To open a report you require the extension Sun Report Designer weiss der Geier Hauptsache extra langer Name
+// String RID_STR_EXTENSION_NAME
+// {
+// Text = "Sun(TM) Report Builder";
+// };
+
+ModalDialog RID_EXTENSION_NOT_PRESENT_DLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ;
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION" ;
+ HelpId = HID_EXTENSION_NOT_PRESENT_DLG;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ // most of the calulated values here are overridden by the ExtensionNotPresent ctor itself.
+ FixedImage FI_WARNING
+ {
+ Pos = MAP_APPFONT (CELL_PADDING / 2, CELL_PADDING) ;
+ Size = (32, 32);
+ Fixed=BMP_EXCEPTION_WARNING;
+ };
+
+
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 32 , CELL_PADDING ) ;
+ Size = MAP_APPFONT ( DLG_WIDTH - LEFT_PADDING - RIGHT_PADDING , 3 * (FIXEDTEXT_HEIGHT + 2) ) ;
+ // Border = TRUE ;
+ // Text will set outside from RID_STR_EXTENSION_NOT_PRESENT
+ };
+
+ PushButton PB_DOWNLOAD
+ {
+ Pos = MAP_APPFONT ( DLG_WIDTH / 2 - (CELL_PADDING/2) - BUTTON_WIDTH, ACTION_LINE_START ) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ DefButton = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Download..." ;
+ };
+
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( DLG_WIDTH / 2 + (CELL_PADDING/2), ACTION_LINE_START) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+};
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx index 1078946a5dc5..a84eca1ffb00 100644 --- a/dbaccess/source/ui/inc/QueryDesignView.hxx +++ b/dbaccess/source/ui/inc/QueryDesignView.hxx @@ -146,7 +146,7 @@ namespace dbaui // called when a table from tabeview was deleted void TableDeleted(const ::rtl::OUString& rAliasName); - BOOL getColWidth( const ::rtl::OUString& rAliasName, const ::rtl::OUString& rFieldName, sal_uInt32& nWidth ); + sal_Int32 getColWidth( sal_uInt16 _nColPos) const; void fillValidFields(const ::rtl::OUString& strTableName, ComboBox* pFieldList); void SaveUIConfig(); diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx index b79e6ea6dfc5..70be5b60407a 100644 --- a/dbaccess/source/ui/inc/querycontroller.hxx +++ b/dbaccess/source/ui/inc/querycontroller.hxx @@ -77,10 +77,11 @@ namespace dbaui OTableFields m_vTableFieldDesc; OTableFields m_vUnUsedFieldsDesc; // contains fields which aren't visible and don't have any criteria + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aFieldInformation; + ::svxform::OSystemParseContext* m_pParseContext; ::connectivity::OSQLParser m_aSqlParser; ::connectivity::OSQLParseTreeIterator* m_pSqlIterator; - ::std::vector<sal_uInt32> m_vColumnWidth; ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposer > m_xComposer; /// if we're editing an existing view, this is non-NULL @@ -167,12 +168,10 @@ namespace dbaui void setSplitPos(sal_Int32 _nSplitPos) { m_nSplitPos = _nSplitPos;} void setVisibleRows(sal_Int32 _nVisibleRows) { m_nVisibleRows = _nVisibleRows;} + sal_Int32 getColWidth(sal_uInt16 _nColPos) const; + ::connectivity::OSQLParser& getParser() { return m_aSqlParser; } ::connectivity::OSQLParseTreeIterator& getParseIterator() { return *m_pSqlIterator; } - sal_uInt32 getColWidth(sal_uInt16 _nPos) const - { - return m_vColumnWidth.size() < _nPos ? m_vColumnWidth[_nPos] : sal_uInt32(0); - } virtual sal_Bool Construct(Window* pParent); diff --git a/dbaccess/source/ui/misc/controllerframe.cxx b/dbaccess/source/ui/misc/controllerframe.cxx index f0c93586f26c..e20f5e04b35b 100644 --- a/dbaccess/source/ui/misc/controllerframe.cxx +++ b/dbaccess/source/ui/misc/controllerframe.cxx @@ -108,7 +108,7 @@ namespace dbaui private: void impl_checkDisposed_throw() const; - void impl_actOnFrameWindow_nothrow( bool _bRegister ); + void impl_registerOnFrameContainerWindow_nothrow( bool _bRegister ); private: ControllerFrame_Data* m_pData; @@ -125,6 +125,7 @@ namespace dbaui ,m_xDocEventBroadcaster() ,m_pListener() ,m_bActive( false ) + ,m_bLivesInTopWindow( false ) { } @@ -133,6 +134,7 @@ namespace dbaui Reference< XDocumentEventBroadcaster > m_xDocEventBroadcaster; ::rtl::Reference< FrameWindowActivationListener > m_pListener; bool m_bActive; + bool m_bLivesInTopWindow; }; //==================================================================== @@ -206,7 +208,7 @@ namespace dbaui if ( !xCompController.is() ) return; - if ( _rData.m_bActive ) + if ( _rData.m_bActive && _rData.m_bLivesInTopWindow ) { // set the "current component" at the SfxObjectShell Reference< XModel > xModel( xCompController->getModel() ); @@ -259,7 +261,7 @@ namespace dbaui FrameWindowActivationListener::FrameWindowActivationListener( ControllerFrame_Data& _rData ) :m_pData( &_rData ) { - impl_actOnFrameWindow_nothrow( true ); + impl_registerOnFrameContainerWindow_nothrow( true ); } //-------------------------------------------------------------------- @@ -270,14 +272,14 @@ namespace dbaui //-------------------------------------------------------------------- void FrameWindowActivationListener::dispose() { - impl_actOnFrameWindow_nothrow( false ); + impl_registerOnFrameContainerWindow_nothrow( false ); m_pData = NULL; } //-------------------------------------------------------------------- - void FrameWindowActivationListener::impl_actOnFrameWindow_nothrow( bool _bRegister ) + void FrameWindowActivationListener::impl_registerOnFrameContainerWindow_nothrow( bool _bRegister ) { - OSL_ENSURE( m_pData && m_pData->m_xFrame.is(), "FrameWindowActivationListener::impl_actOnFrameWindow_nothrow: no frame!" ); + OSL_ENSURE( m_pData && m_pData->m_xFrame.is(), "FrameWindowActivationListener::impl_registerOnFrameContainerWindow_nothrow: no frame!" ); if ( !m_pData || !m_pData->m_xFrame.is() ) return; @@ -286,8 +288,11 @@ namespace dbaui void ( SAL_CALL XTopWindow::*pListenerAction )( const Reference< XTopWindowListener >& ) = _bRegister ? &XTopWindow::addTopWindowListener : &XTopWindow::removeTopWindowListener; - Reference< XTopWindow > xFrameContainer( m_pData->m_xFrame->getContainerWindow(), UNO_QUERY_THROW ); - (xFrameContainer.get()->*pListenerAction)( this ); + Reference< XTopWindow > xFrameContainer( m_pData->m_xFrame->getContainerWindow(), UNO_QUERY ); + if ( _bRegister ) + m_pData->m_bLivesInTopWindow = xFrameContainer.is(); + if ( xFrameContainer.is() ) + (xFrameContainer.get()->*pListenerAction)( this ); } catch( const Exception& ) { diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx index a02b5e993c19..fe4e3512cb7f 100644 --- a/dbaccess/source/ui/querydesign/QTableWindow.cxx +++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx @@ -148,8 +148,10 @@ sal_Bool OQueryTableWindow::Init() if (m_strInitialAlias.getLength() ) // Der Alias wurde explizit mit angegeben sAliasName = m_strInitialAlias; - else + else if ( GetTable().is() ) GetTable()->getPropertyValue( PROPERTY_NAME ) >>= sAliasName; + else + return sal_False; // Alias mit fortlaufender Nummer versehen if (pContainer->CountTableAlias(sAliasName, m_nAliasNum)) diff --git a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx index 34b74f0569e5..0973aeb767fb 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx +++ b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx @@ -100,7 +100,7 @@ namespace dbaui public: OTabFieldSizedUndoAct(OSelectionBrowseBox* pSelBrwBox) : OQueryDesignFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_SIZE_COLUMN), m_nNextWidth(0) { } - inline void SetOriginalWidth(long nWidth) { OSL_ENSURE(m_nNextWidth != 0,"Width is 0!");m_nNextWidth = nWidth; } + inline void SetOriginalWidth(long nWidth) { m_nNextWidth = nWidth; } virtual void Undo(); virtual void Redo() { Undo(); } diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 87bfaffa6d7c..713395d0f124 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -2840,20 +2840,13 @@ SqlParseError OQueryDesignView::InsertField( const OTableFieldDescRef& rInfo, sa return m_pSelectionBox->InsertField( rInfo, BROWSER_INVALIDID,bVis, bActivate ).isValid() ? eOk : eTooManyColumns; } // ----------------------------------------------------------------------------- -sal_Bool OQueryDesignView::getColWidth( const ::rtl::OUString& rAliasName, const ::rtl::OUString& rFieldName, sal_uInt32& nWidth ) +sal_Int32 OQueryDesignView::getColWidth(sal_uInt16 _nColPos) const { - OTableFields& aFields = static_cast<OQueryController&>(getController()).getTableFieldDesc(); - OTableFields::iterator aIter = aFields.begin(); - for(;aIter != aFields.end();++aIter) - { - if( rAliasName == (*aIter)->GetFieldAlias() && rFieldName == (*aIter)->GetField()) - { - nWidth = (*aIter)->GetColWidth(); - return sal_True; - } - } - - return sal_False; + static sal_Int32 s_nDefaultWidth = GetTextWidth(String(RTL_CONSTASCII_USTRINGPARAM("0"))) * 15; + sal_Int32 nWidth = static_cast<OQueryController&>(getController()).getColWidth(_nColPos); + if ( !nWidth ) + nWidth = s_nDefaultWidth; + return nWidth; } //------------------------------------------------------------------------------ void OQueryDesignView::fillValidFields(const ::rtl::OUString& sAliasName, ComboBox* pFieldList) diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 241e5f439909..12b3093e9664 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1658,8 +1658,11 @@ void OSelectionBrowseBox::InsertColumn(OTableFieldDescRef pEntry, USHORT& _nColu pEntry->SetFunction(sFunctionName); } + nColumnId = pEntry->GetColumnId(); + + SetColWidth(nColumnId,getDesignView()->getColWidth(GetColumnPos(nColumnId)-1)); // Neuzeichnen - Rectangle aInvalidRect = GetInvalidRect( pEntry->GetColumnId() ); + Rectangle aInvalidRect = GetInvalidRect( nColumnId ); Invalidate( aInvalidRect ); ActivateCell( nCurrentRow, nCurCol ); @@ -1707,11 +1710,6 @@ OTableFieldDescRef OSelectionBrowseBox::InsertField(const OTableFieldDescRef& _r // Neue Spaltenbeschreibung OTableFieldDescRef pEntry = _rInfo; pEntry->SetVisible(bVis); - sal_uInt32 nColWidth; - if( getDesignView()->getColWidth(_rInfo->GetAlias(), _rInfo->GetField(), nColWidth) ) - pEntry->SetColWidth( (sal_uInt16)nColWidth ); - else - pEntry->SetColWidth( (sal_uInt16)DEFAULT_SIZE ); // Spalte einfuegen InsertColumn( pEntry, _nColumnPostion ); diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx index 95fb6bc38681..11e9da016f0d 100644 --- a/dbaccess/source/ui/querydesign/TableConnection.cxx +++ b/dbaccess/source/ui/querydesign/TableConnection.cxx @@ -156,12 +156,24 @@ namespace dbaui //------------------------------------------------------------------------ OTableWindow* OTableConnection::GetSourceWin() const { - return m_pParent->GetTabWindow( GetData()->getReferencingTable()->GetWinName() ); + TTableWindowData::value_type pRef = GetData()->getReferencingTable(); + OTableWindow* pRet = m_pParent->GetTabWindow( pRef->GetWinName() ); + if ( !pRet ) + { + pRet = m_pParent->GetTabWindow( pRef->GetComposedName() ); + } + return pRet; } //------------------------------------------------------------------------ OTableWindow* OTableConnection::GetDestWin() const { - return m_pParent->GetTabWindow( GetData()->getReferencedTable()->GetWinName() ); + TTableWindowData::value_type pRef = GetData()->getReferencedTable(); + OTableWindow* pRet = m_pParent->GetTabWindow( pRef->GetWinName() ); + if ( !pRet ) + { + pRet = m_pParent->GetTabWindow( pRef->GetComposedName() ); + } + return pRet; } //------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx index 0b93274c05ae..0949c8f5dc11 100644 --- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx +++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx @@ -156,42 +156,42 @@ void OTableFieldDesc::Load(const ::com::sun::star::beans::PropertyValue& _rPrope DBG_CHKTHIS(OTableFieldDesc,NULL); Sequence<PropertyValue> aFieldDesc; _rProperty.Value >>= aFieldDesc; - if ( aFieldDesc.getLength() == 13 ) + //if ( aFieldDesc.getLength() == 12 ) { sal_Int32 nCount = aFieldDesc.getLength(); for (sal_Int32 nPos = 0; nPos < nCount; ++nPos) { - if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AliasName")) ) + if ( aFieldDesc[nPos].Name.equalsAscii("AliasName") ) aFieldDesc[nPos].Value >>= m_aAliasName; - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableName")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("TableName") ) aFieldDesc[nPos].Value >>= m_aTableName; - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldName")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("FieldName") ) aFieldDesc[nPos].Value >>= m_aFieldName; - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldAlias")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("FieldAlias") ) aFieldDesc[nPos].Value >>= m_aFieldAlias; - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionName")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("FunctionName") ) aFieldDesc[nPos].Value >>= m_aFunctionName; - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataType")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("DataType") ) aFieldDesc[nPos].Value >>= m_eDataType; - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionType")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("FunctionType") ) aFieldDesc[nPos].Value >>= m_eFunctionType; - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldType")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("FieldType") ) { sal_Int32 nTemp = 0; aFieldDesc[nPos].Value >>= nTemp; m_eFieldType = static_cast<ETableFieldType>(nTemp); } - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OrderDir")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("OrderDir") ) { sal_Int32 nTemp = 0; aFieldDesc[nPos].Value >>= nTemp; m_eOrderDir = static_cast<EOrderDir>(nTemp); } - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColWidth")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("ColWidth") ) aFieldDesc[nPos].Value >>= m_nColWidth; - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GroupBy")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("GroupBy") ) aFieldDesc[nPos].Value >>= m_bGroupBy; - else if ( aFieldDesc[nPos].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Visible")) ) + else if ( aFieldDesc[nPos].Name.equalsAscii("Visible") ) aFieldDesc[nPos].Value >>= m_bVisible; } } diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 4bbd4e1dd419..48f51b31d5fd 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -931,6 +931,7 @@ void OQueryController::impl_initialize() } } + getUndoMgr()->Clear(); if ( ( m_bGraphicalDesign ) @@ -1138,39 +1139,36 @@ void OQueryController::saveViewSettings(Sequence<PropertyValue>& _rViewProps) // ----------------------------------------------------------------------------- void OQueryController::loadViewSettings(const Sequence<PropertyValue>& _rViewProps) { - ////////////////////////////////////////////////////////////////////// - // Liste loeschen - OTableFields().swap(m_vTableFieldDesc); - const PropertyValue *pIter = _rViewProps.getConstArray(); const PropertyValue *pEnd = pIter + _rViewProps.getLength(); for (; pIter != pEnd; ++pIter) { - if ( pIter->Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SplitterPosition")) ) + if ( pIter->Name.equalsAscii("SplitterPosition") ) { pIter->Value >>= m_nSplitPos; } - else if ( pIter->Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleRows")) ) + else if ( pIter->Name.equalsAscii("VisibleRows") ) { pIter->Value >>= m_nVisibleRows; } - else if ( pIter->Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fields")) ) + else if ( pIter->Name.equalsAscii("Fields") ) { - Sequence<PropertyValue> aFields; - pIter->Value >>= aFields; - m_vTableFieldDesc.reserve(aFields.getLength() + 1); - const PropertyValue *pFieldIter = aFields.getConstArray(); - const PropertyValue *pFieldEnd = pFieldIter + aFields.getLength(); - for (; pFieldIter != pFieldEnd; ++pFieldIter) - { - OTableFieldDescRef pData = new OTableFieldDesc(); - pData->Load(*pFieldIter); - m_vTableFieldDesc.push_back(pData); - } + pIter->Value >>= m_aFieldInformation; } } } // ----------------------------------------------------------------------------- +sal_Int32 OQueryController::getColWidth(sal_uInt16 _nColPos) const +{ + if ( _nColPos < m_aFieldInformation.getLength() ) + { + ::std::auto_ptr<OTableFieldDesc> pField( new OTableFieldDesc()); + pField->Load(m_aFieldInformation[_nColPos]); + return pField->GetColWidth(); + } + return 0; +} +// ----------------------------------------------------------------------------- Reference<XNameAccess> OQueryController::getObjectContainer() const { Reference< XNameAccess > xElements; @@ -1595,8 +1593,8 @@ short OQueryController::saveModified() void OQueryController::impl_reset() { bool bValid = false; - Sequence< PropertyValue > aLayoutInformation; + Sequence< PropertyValue > aLayoutInformation; // get command from the query if a query name was supplied if ( !editingCommand() ) { @@ -1657,7 +1655,6 @@ void OQueryController::impl_reset() DBG_UNHANDLED_EXCEPTION(); } } - if ( m_sStatement.getLength() ) { setQueryComposer(); diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 72b2a0382fbf..33990f5f296a 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -677,6 +677,8 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) throw( Runti ::osl::MutexGuard aGuard( getMutex() ); if ( getView() && getView()->IsInModalMode() ) return sal_False; + if ( getView() ) + static_cast<OTableDesignView*>(getView())->GrabFocus(); sal_Bool bCheck = sal_True; if ( isModified() ) { |