Tag: cws_src680_mysqlnative User: fs Date: 2008-07-31 21:34:59+0000 Removed: dba/dbaccess/source/core/api/CKey.cxx dba/dbaccess/source/core/api/CKey.hxx dba/dbaccess/source/core/api/CKeyColumn.hxx dba/dbaccess/source/core/api/CKeyColumns.cxx dba/dbaccess/source/core/api/CKeyColumns.hxx dba/dbaccess/source/core/api/CKeys.cxx dba/dbaccess/source/core/api/CKeys.hxx dba/dbaccess/source/ui/app/IAppElementNotification.hxx dba/dbaccess/util/defs/wntmsci11 dba/dbaccess/util/defs/wntmsci12
Modified: dba/dbaccess/source/core/dataaccess/ModelImpl.cxx dba/dbaccess/source/filter/xml/xmlExport.cxx dba/dbaccess/source/ui/dlg/DbAdminImpl.cxx Log: RESYNC:; FILE REMOVED File Changes: Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKey.cxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKey.hxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeyColumn.hxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeyColumns.cxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeyColumns.hxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeys.cxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeys.hxx Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: ModelImpl.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.cxx?r1=1.27.14.1&r2=1.27.14.2 Delta lines: +69 -51 --------------------- --- ModelImpl.cxx 2008-06-03 11:43:39+0000 1.27.14.1 +++ ModelImpl.cxx 2008-07-31 21:33:56+0000 1.27.14.2 @@ -44,22 +44,9 @@ /** === begin UNO includes === **/ #include <com/sun/star/document/MacroExecMode.hpp> -#include <com/sun/star/document/XExporter.hpp> -#include <com/sun/star/document/XFilter.hpp> -#include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/XTransactionBroadcaster.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/reflection/XProxyFactory.hpp> #include <com/sun/star/sdb/BooleanComparisonMode.hpp> -#include <com/sun/star/sdbc/XDriverAccess.hpp> -#include <com/sun/star/sdbc/XDriverManager.hpp> -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#include <com/sun/star/task/XStatusIndicator.hpp> -#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp> -#include <com/sun/star/view/XSelectionSupplier.hpp> -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/script/DocumentScriptLibraryContainer.hpp> #include <com/sun/star/script/DocumentDialogLibraryContainer.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> @@ -100,7 +87,6 @@ using namespace ::com::sun::star::view; using namespace ::com::sun::star::task; using namespace ::com::sun::star::reflection; -using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::script; using namespace ::cppu; using namespace ::osl; @@ -312,16 +298,18 @@ //============================================================ DBG_NAME(ODatabaseModelImpl) //-------------------------------------------------------------------------- -ODatabaseModelImpl::ODatabaseModelImpl(const Reference< XMultiServiceFactory >& _rxFactory - , const Reference< XModel>& _xModel) - :m_xModel(_xModel) +ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XMultiServiceFactory >& _rxFactory, ODatabaseContext& _rDBContext ) + :m_xModel() ,m_xDataSource() ,m_pStorageAccess( NULL ) ,m_xMutex( new SharedMutex ) ,m_aContainer(4) ,m_aStorages() ,m_aMacroMode( *this ) + ,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE ) + ,m_pDBContext( &_rDBContext ) ,m_bHasAnyObjectWithMacros( false ) + ,m_bHasMacroStorages( false ) ,m_bModificationLock( false ) ,m_aContext( _rxFactory ) ,m_nLoginTimeout(0) @@ -331,7 +319,6 @@ ,m_bModified(sal_False) ,m_bDocumentReadOnly(sal_False) ,m_bDisposingSubStorages( sal_False ) - ,m_pDBContext(NULL) ,m_pSharedConnectionManager(NULL) ,m_refCount(0) ,m_nControllerLockCount(0) @@ -348,7 +335,7 @@ ODatabaseModelImpl::ODatabaseModelImpl( const ::rtl::OUString& _rRegistrationName, const Reference< XMultiServiceFactory >& _rxFactory, - ODatabaseContext* _pDBContext + ODatabaseContext& _rDBContext ) :m_xModel() ,m_xDataSource() @@ -357,7 +344,10 @@ ,m_aContainer(4) ,m_aStorages() ,m_aMacroMode( *this ) + ,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE ) + ,m_pDBContext( &_rDBContext ) ,m_bHasAnyObjectWithMacros( false ) + ,m_bHasMacroStorages( false ) ,m_bModificationLock( false ) ,m_aContext( _rxFactory ) ,m_sName(_rRegistrationName) @@ -368,14 +358,11 @@ ,m_bModified(sal_False) ,m_bDocumentReadOnly(sal_False) ,m_bDisposingSubStorages( sal_False ) - ,m_pDBContext(_pDBContext) ,m_pSharedConnectionManager(NULL) ,m_refCount(0) ,m_nControllerLockCount(0) { DBG_CTOR(ODatabaseModelImpl,NULL); - // adjust our readonly flag - impl_construct_nothrow(); } @@ -451,7 +438,7 @@ } // ......................................................................... - bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& _rObjectDefinitions, const SharedStorage& _rxContainerStorage ) + bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& _rObjectDefinitions, const Reference< XStorage >& _rxContainerStorage ) { bool bSomeDocHasMacros = false; @@ -489,8 +476,15 @@ try { - SharedStorage xContainerStorage( _rModel.getStorage( - _rModel.getObjectContainerStorageName( _eType ), ElementModes::READ ) ); + Reference< XStorage > xContainerStorage( _rModel.getStorage( + _rModel.getObjectContainerStorageName( _eType ), ElementModes::READWRITE ) ); + // note the READWRITE here: If the storage already existed before, then the OpenMode will + // be ignored, anyway. + // If the storage did not yet exist, then it will be created. If the database document + // is read-only, the OpenMode will be automatically downgraded to READ. Otherwise, + // the storage will in fact be created as READWRITE. While this is not strictly necessary + // for this particular use case here, it is required since the storage is *cached*, and + // later use cases will need the READWRITE mode. if ( xContainerStorage.is() ) bSomeDocHasMacros = lcl_hasObjectWithMacros_throw( rObjectDefinitions, xContainerStorage ); @@ -518,7 +512,7 @@ if ( !_rxContainerStorage->hasByName( _rPersistentName ) ) return false; - SharedStorage xObjectStor( _rxContainerStorage->openStorageElement( + Reference< XStorage > xObjectStor( _rxContainerStorage->openStorageElement( _rPersistentName, ElementModes::READ ) ); bHasMacros = ::sfx2::DocumentMacroMode::storageHasMacros( xObjectStor ); @@ -718,7 +712,7 @@ if ( !m_xDocumentStorage.is() ) { Reference< XSingleServiceFactory> xStorageFactory = createStorageFactory(); - if ( xStorageFactory.is() && m_sDocumentURL.getLength() ) + if ( xStorageFactory.is() ) { Any aSource; ::comphelper::NamedValueCollection aArgs( m_aArgs ); @@ -726,8 +720,9 @@ aSource = aArgs.get( "Stream" ); if ( !aSource.hasValue() ) aSource = aArgs.get( "InputStream" ); - if ( !aSource.hasValue() && m_sDocumentURL.getLength() ) - aSource <<= m_sDocumentURL; + if ( !aSource.hasValue() && m_sDocFileLocation.getLength() ) + aSource <<= m_sDocFileLocation; + // TODO: shouldn't we also check URL? OSL_ENSURE( aSource.hasValue(), "ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from!" ); @@ -1030,6 +1025,7 @@ AsciiPropertyValue( "NoNameLengthLimit", makeAny( (sal_Bool)sal_False ) ), AsciiPropertyValue( "AppendTableAliasName", makeAny( (sal_Bool)sal_False ) ), AsciiPropertyValue( "GenerateASBeforeCorrelationName", makeAny( (sal_Bool)sal_True ) ), + AsciiPropertyValue( "ColumnAliasInOrderBy", makeAny( (sal_Bool)sal_True ) ), AsciiPropertyValue( "EnableSQL92Check", makeAny( (sal_Bool)sal_False ) ), AsciiPropertyValue( "BooleanComparisonMode", makeAny( BooleanComparisonMode::EQUAL_INTEGER ) ), AsciiPropertyValue( "TableTypeFilterMode", makeAny( (sal_Int32)3 ) ), @@ -1065,25 +1061,25 @@ } // ----------------------------------------------------------------------------- -bool ODatabaseModelImpl::adjustMacroMode_AutoReject() +void ODatabaseModelImpl::revokeDataSource() const { - return m_aMacroMode.adjustMacroMode( NULL ); + if ( m_pDBContext && m_sDocumentURL.getLength() ) + m_pDBContext->deregisterPrivate( m_sDocumentURL ); } // ----------------------------------------------------------------------------- -void ODatabaseModelImpl::revokeDataSource() const +bool ODatabaseModelImpl::adjustMacroMode_AutoReject() { - if ( m_pDBContext && m_sDocumentURL.getLength() ) - m_pDBContext->deregisterPrivate( m_sDocumentURL ); + return m_aMacroMode.adjustMacroMode( NULL ); } // ----------------------------------------------------------------------------- -void ODatabaseModelImpl::checkMacrosOnLoading() +bool ODatabaseModelImpl::checkMacrosOnLoading() { ::comphelper::NamedValueCollection aArgs( m_aArgs ); Reference< XInteractionHandler > xInteraction; xInteraction = aArgs.getOrDefault( "InteractionHandler", xInteraction ); - m_aMacroMode.checkMacrosOnLoading( xInteraction ); + return m_aMacroMode.checkMacrosOnLoading( xInteraction ); } // ----------------------------------------------------------------------------- @@ -1178,6 +1174,22 @@ } // ----------------------------------------------------------------------------- +namespace +{ + static void lcl_rebaseScriptStorage_throw( const Reference< XStorageBasedLibraryContainer >& _rxContainer, + const Reference< XStorage >& _rxNewRootStorage ) + { + if ( _rxContainer.is() ) + { + if ( _rxNewRootStorage.is() ) + _rxContainer->setRootStorage( _rxNewRootStorage ); +// else + // TODO: what to do here? dispose the container? + } + } +} + +// ----------------------------------------------------------------------------- Reference< XStorage > ODatabaseModelImpl::impl_switchToStorage_throw( const Reference< XStorage >& _rxNewRootStorage ) { // stop listening for modifications at the old storage @@ -1190,10 +1202,8 @@ lcl_modifyListening( *this, m_xDocumentStorage.getTyped(), m_pStorageModifyListener, true ); // forward new storage to Basic and Dialog library containers - if ( m_xBasicLibraries.is() ) - m_xBasicLibraries->setRootStorage( m_xDocumentStorage.getTyped() ); - if ( m_xDialogLibraries.is() ) - m_xDialogLibraries->setRootStorage( m_xDocumentStorage.getTyped() ); + lcl_rebaseScriptStorage_throw( m_xBasicLibraries, m_xDocumentStorage.getTyped() ); + lcl_rebaseScriptStorage_throw( m_xDialogLibraries, m_xDocumentStorage.getTyped() ); m_bReadOnly = !lcl_storageIsWritable_nothrow( m_xDocumentStorage.getTyped() ); // TODO: our data source, if it exists, must broadcast the change of its ReadOnly property @@ -1215,13 +1225,18 @@ m_pDBContext->registerPrivate( _rDocumentURL, this ); } + // if we do not have a name, yet (i.e. are not registered at the database context), + // then use the URL as name + if ( !m_sName.getLength() ) + { INetURLObject aURL( _rDocumentURL ); if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) m_sName = _rDocumentURL; } + } // remember both - m_sDocFileLocation = _rDocumentLocation; + m_sDocFileLocation = _rDocumentLocation.getLength() ? _rDocumentLocation : _rDocumentURL; m_sDocumentURL = _rDocumentURL; } @@ -1245,23 +1260,23 @@ } // ----------------------------------------------------------------------------- -sal_Int16 ODatabaseModelImpl::getImposedMacroExecMode() const +sal_Int16 ODatabaseModelImpl::getCurrentMacroExecMode() const { - sal_Int16 nMacroExecMode( MacroExecMode::USE_CONFIG ); + sal_Int16 nCurrentMode = MacroExecMode::NEVER_EXECUTE; try { ::comphelper::NamedValueCollection aArgs( m_aArgs ); - nMacroExecMode = aArgs.getOrDefault( "MacroExecutionMode", nMacroExecMode ); + nCurrentMode = aArgs.getOrDefault( "MacroExecutionMode", nCurrentMode ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } - return nMacroExecMode; + return nCurrentMode; } // ----------------------------------------------------------------------------- -sal_Bool ODatabaseModelImpl::setImposedMacroExecMode( sal_uInt16 nMacroMode ) +sal_Bool ODatabaseModelImpl::setCurrentMacroExecMode( sal_uInt16 nMacroMode ) { try { @@ -1300,7 +1315,10 @@ { // does our root storage contain macros? if ( ::sfx2::DocumentMacroMode::storageHasMacros( m_xDocumentStorage ) ) + { + const_cast< ODatabaseModelImpl* >( this )->m_bHasMacroStorages = true; return true; + } // do we have forms or reports with macros? if ( lcl_hasObjectsWithMacros_nothrow( const_cast< ODatabaseModelImpl& >( *this ), E_FORM ) Directory: /dba/dbaccess/source/filter/xml/ =========================================== File [changed]: xmlExport.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlExport.cxx?r1=1.20.24.2&r2=1.20.24.3 Delta lines: +13 -6 -------------------- --- xmlExport.cxx 2008-06-10 07:28:04+0000 1.20.24.2 +++ xmlExport.cxx 2008-07-31 21:34:01+0000 1.20.24.3 @@ -847,7 +847,8 @@ ,enum ::xmloff::token::XMLTokenEnum _eComponents ,enum ::xmloff::token::XMLTokenEnum _eSubComponents ,sal_Bool _bExportContext - ,const ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >& _aMemFunc) + ,const ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >& _aMemFunc + ) { if ( _xCollection.is() ) { @@ -1125,7 +1126,7 @@ { const TExportPropMapperPair pExportHelper[] = { TExportPropMapperPair(m_xExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XML_STYLE_FAMILY_TABLE_TABLE )) - ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XML_STYLE_FAMILY_TABLE_CELL)) + // ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XML_STYLE_FAMILY_TABLE_CELL)) ,TExportPropMapperPair(m_xRowExportHelper,TEnumMapperPair(&m_aRowAutoStyleNames,XML_STYLE_FAMILY_TABLE_ROW)) }; @@ -1148,8 +1149,10 @@ { // not interested in } + m_aCurrentPropertyStates = m_xCellExportHelper->Filter(_xProp); ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > aMemFunc(&ODBExport::exportAutoStyle); exportCollection(xCollection,XML_TOKEN_INVALID,XML_TOKEN_INVALID,sal_False,aMemFunc); + m_aCurrentPropertyStates.clear(); } else { // here I know I have a column @@ -1185,11 +1188,15 @@ } } ++aItr; - } + } // while ( aItr != aEnd ) + + } // if ( !aPropStates.empty() ) + if ( XML_STYLE_FAMILY_TABLE_CELL == pExportHelper[i].second.second ) + ::std::copy( m_aCurrentPropertyStates.begin(), m_aCurrentPropertyStates.end(), ::std::back_inserter( aPropStates )); + if ( !aPropStates.empty() ) pExportHelper[i].second.first->insert( TPropertyStyleMap::value_type(_xProp,GetAutoStylePool()->Add( pExportHelper[i].second.second, aPropStates ))); } } - } } // ----------------------------------------------------------------------------- void ODBExport::_ExportContent() Directory: /dba/dbaccess/source/ui/app/ ======================================= File [removed]: IAppElementNotification.hxx Directory: /dba/dbaccess/source/ui/dlg/ ======================================= File [changed]: DbAdminImpl.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/DbAdminImpl.cxx?r1=1.24.24.1&r2=1.24.24.2 Delta lines: +10 -6 -------------------- --- DbAdminImpl.cxx 2008-06-03 11:43:39+0000 1.24.24.1 +++ DbAdminImpl.cxx 2008-07-31 21:34:09+0000 1.24.24.2 @@ -979,13 +979,14 @@ _rValue >>= sValue; _rSet.Put(SfxStringItem(nId, sValue.getStr())); } - else + else { DBG_ERROR( ( ::rtl::OString( "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid property value (" ) += ::rtl::OString( translatePropertyId( _nId ) ) += ::rtl::OString( " should be no string)!" ) ).getStr() ); + } break; case TypeClass_BOOLEAN: @@ -995,13 +996,14 @@ _rValue >>= bVal; _rSet.Put(SfxBoolItem(nId, bVal)); } - else + else { DBG_ERROR( ( ::rtl::OString( "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid property value (" ) += ::rtl::OString( translatePropertyId( _nId ) ) += ::rtl::OString( " should be no boolean)!" ) ).getStr() ); + } break; case TypeClass_LONG: @@ -1011,13 +1013,14 @@ _rValue >>= nValue; _rSet.Put( SfxInt32Item( nId, nValue ) ); } - else + else { DBG_ERROR( ( ::rtl::OString( "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid property value (" ) += ::rtl::OString( translatePropertyId( _nId ) ) += ::rtl::OString( " should be no int)!" ) ).getStr() ); + } break; case TypeClass_SEQUENCE: @@ -1043,13 +1046,14 @@ DBG_ERROR("ODbDataSourceAdministrationHelper::implTranslateProperty: unsupported property value type!"); } } - else + else { DBG_ERROR( ( ::rtl::OString( "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid property value (" ) += ::rtl::OString( translatePropertyId( _nId ) ) += ::rtl::OString( " should be no string sequence)!" ) ).getStr() ); + } break; case TypeClass_VOID: Directory: /dba/dbaccess/util/defs/ =================================== File [removed]: wntmsci11 Directory: /dba/dbaccess/util/defs/ =================================== File [removed]: wntmsci12 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
