User: vg Date: 05/03/23 01:47:53 Modified: /dba/dbaccess/source/filter/migration/ cfgimport.cxx
Log: INTEGRATION: CWS dba26 (1.5.14); FILE MERGED 2005/03/17 15:19:37 fs 1.5.14.3: #i44419# also work correctly for the case that a bookmarked document does not exist 2005/03/14 14:17:30 fs 1.5.14.2: RESYNC: (1.5-1.7); FILE MERGED 2005/03/08 10:25:42 oj 1.5.14.1: #i44420# #i44419# fix for migration File Changes: Directory: /dba/dbaccess/source/filter/migration/ ================================================= File [changed]: cfgimport.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/migration/cfgimport.cxx?r1=1.7&r2=1.8 Delta lines: +54 -40 --------------------- --- cfgimport.cxx 11 Mar 2005 11:00:24 -0000 1.7 +++ cfgimport.cxx 23 Mar 2005 09:47:50 -0000 1.8 @@ -663,30 +663,30 @@ } } // ----------------------------------------------------------------------------- -void OCfgImport::setProperties() +void OCfgImport::setProperties(sal_Int16 _eType) { - if ( m_aValues.getLength() ) + if ( m_aValues[_eType].getLength() ) { - OSL_ENSURE(m_aProperties.getLength() == m_aValues.getLength(),"Count is not equal!"); + OSL_ENSURE(m_aProperties[_eType].getLength() == m_aValues[_eType].getLength(),"Count is not equal!"); try { Reference< XMultiPropertySet > xFormMultiSet; - if ( m_xCurrentColumn.is() ) + if ( _eType == COLUMN ) xFormMultiSet.set(m_xCurrentColumn,UNO_QUERY); - else if ( m_xCurrentObject.is() ) + else if ( _eType == TABLE || _eType == QUERY ) xFormMultiSet.set(m_xCurrentObject,UNO_QUERY); - else if ( m_xCurrentDS.is() ) + else if ( _eType == DATASOURCE ) xFormMultiSet.set(m_xCurrentDS,UNO_QUERY); if ( xFormMultiSet.is() ) - xFormMultiSet->setPropertyValues(m_aProperties, m_aValues); + xFormMultiSet->setPropertyValues(m_aProperties[_eType], m_aValues[_eType]); } catch(const Exception& e) { throw WrappedTargetException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property could not be set.")),*this,makeAny(e)); } - m_aValues = Sequence< Any>(); - m_aProperties = Sequence< ::rtl::OUString>(); + m_aValues[_eType] = Sequence< Any>(); + m_aProperties[_eType] = Sequence< ::rtl::OUString>(); } } // ----------------------------------------------------------------------------- @@ -830,11 +830,15 @@ { if ( !m_aStack.empty() ) { - switch(m_aStack.top().second) + sal_Int16 nElementType = m_aStack.top().second; + ::rtl::OUString sName = m_aStack.top().first; + m_aStack.pop(); + + switch(nElementType) { case DATASOURCE: { - setProperties(); + setProperties(nElementType); Reference<XStorable> xStr(m_xModel,UNO_QUERY); if ( xStr.is() ) { @@ -872,7 +876,7 @@ break; case TABLE: { - setProperties(); + setProperties(nElementType); Reference<XTablesSupplier> xSupplier(m_xCurrentDS,UNO_QUERY); Reference<XNameContainer> xTables(xSupplier->getTables(),UNO_QUERY); ::rtl::OUString sName; @@ -884,10 +888,10 @@ break; case QUERY: { - setProperties(); + setProperties(nElementType); Reference<XQueryDefinitionsSupplier> xQueriesSupplier(m_xCurrentDS,UNO_QUERY); Reference<XNameContainer> xQueries(xQueriesSupplier->getQueryDefinitions(),UNO_QUERY); - xQueries->insertByName(m_aStack.top().first,makeAny(m_xCurrentObject)); + xQueries->insertByName(sName,makeAny(m_xCurrentObject)); m_xCurrentObject = NULL; } break; @@ -895,7 +899,7 @@ try { if ( !UCBContentHelper::IsDocument(m_sDocumentLocation) ) - return; + break; sal_Bool bForm = sal_True; bForm = !isDocumentReport(m_xORB,m_sDocumentLocation); @@ -951,7 +955,7 @@ case COLUMN: if ( m_xCurrentColumn.is() ) { - setProperties(); + setProperties(nElementType); Reference<XColumnsSupplier> xSupplier(m_xCurrentObject,UNO_QUERY); Reference<XAppend> xAppend(xSupplier->getColumns(),UNO_QUERY); if ( xAppend.is() ) @@ -960,8 +964,6 @@ } break; } - - m_aStack.pop(); } } // ----------------------------------------------------------------------------- @@ -1010,9 +1012,11 @@ if ( sProp.getLength() ) { - sal_Int32 nPos = m_aProperties.getLength(); - m_aProperties.realloc(nPos+1); - m_aProperties[nPos] = sProp; + if ( m_aProperties.find(m_aStack.top().second) == m_aProperties.end() ) + m_aProperties.insert(::std::map< sal_Int16 ,Sequence< ::rtl::OUString> >::value_type(m_aStack.top().second,Sequence< ::rtl::OUString>())); + sal_Int32 nPos = m_aProperties[m_aStack.top().second].getLength(); + m_aProperties[m_aStack.top().second].realloc(nPos+1); + m_aProperties[m_aStack.top().second][nPos] = sProp; } else if ( aName == CONFIGKEY_DBLINK_LOGINTIMEOUT ) m_aStack.push(TElementStack::value_type(aName,LOGINTIMEOUT)); @@ -1039,9 +1043,11 @@ if ( sProp.getLength() ) { - sal_Int32 nPos = m_aProperties.getLength(); - m_aProperties.realloc(nPos+1); - m_aProperties[nPos] = sProp; + if ( m_aProperties.find(m_aStack.top().second) == m_aProperties.end() ) + m_aProperties.insert(::std::map< sal_Int16 ,Sequence< ::rtl::OUString> >::value_type(m_aStack.top().second,Sequence< ::rtl::OUString>())); + sal_Int32 nPos = m_aProperties[m_aStack.top().second].getLength(); + m_aProperties[m_aStack.top().second].realloc(nPos+1); + m_aProperties[m_aStack.top().second][nPos] = sProp; } else m_aStack.push(TElementStack::value_type(aName,NO_PROP)); @@ -1079,9 +1085,11 @@ if ( sProp.getLength() ) { - sal_Int32 nPos = m_aProperties.getLength(); - m_aProperties.realloc(nPos+1); - m_aProperties[nPos] = sProp; + if ( m_aProperties.find(m_aStack.top().second) == m_aProperties.end() ) + m_aProperties.insert(::std::map< sal_Int16 ,Sequence< ::rtl::OUString> >::value_type(m_aStack.top().second,Sequence< ::rtl::OUString>())); + sal_Int32 nPos = m_aProperties[m_aStack.top().second].getLength(); + m_aProperties[m_aStack.top().second].realloc(nPos+1); + m_aProperties[m_aStack.top().second][nPos] = sProp; } else m_aStack.push(TElementStack::value_type(aName,NO_PROP)); @@ -1102,9 +1110,11 @@ if ( sProp.getLength() ) { - sal_Int32 nPos = m_aProperties.getLength(); - m_aProperties.realloc(nPos+1); - m_aProperties[nPos] = sProp; + if ( m_aProperties.find(m_aStack.top().second) == m_aProperties.end() ) + m_aProperties.insert(::std::map< sal_Int16 ,Sequence< ::rtl::OUString> >::value_type(m_aStack.top().second,Sequence< ::rtl::OUString>())); + sal_Int32 nPos = m_aProperties[m_aStack.top().second].getLength(); + m_aProperties[m_aStack.top().second].realloc(nPos+1); + m_aProperties[m_aStack.top().second][nPos] = sProp; } else m_aStack.push(TElementStack::value_type(aName,NO_PROP)); @@ -1151,20 +1161,22 @@ m_aStack.pop(); break; default: - OSL_ENSURE(m_aProperties.getLength(),"Properties are zero!"); - if ( m_aProperties.getLength() ) + OSL_ENSURE(m_aProperties[m_aStack.top().second].getLength(),"Properties are zero!"); + if ( m_aProperties[m_aStack.top().second].getLength() ) { - if ( m_aProperties[m_aProperties.getLength()-1] != PROPERTY_LAYOUTINFORMATION ) + if ( m_aProperties[m_aStack.top().second][m_aProperties[m_aStack.top().second].getLength()-1] != PROPERTY_LAYOUTINFORMATION ) { if ( !m_bPropertyMayBeVoid && !aValue.hasValue() ) { - m_aProperties.realloc(m_aProperties.getLength()-1); + m_aProperties[m_aStack.top().second].realloc(m_aProperties[m_aStack.top().second].getLength()-1); } else { - sal_Int32 nPos = m_aValues.getLength(); - m_aValues.realloc(nPos+1); - m_aValues[nPos] = aValue; + if ( m_aValues.find(m_aStack.top().second) == m_aValues.end() ) + m_aValues.insert(::std::map< sal_Int16 ,Sequence< Any> >::value_type(m_aStack.top().second,Sequence< Any>())); + sal_Int32 nPos = m_aValues[m_aStack.top().second].getLength(); + m_aValues[m_aStack.top().second].realloc(nPos+1); + m_aValues[m_aStack.top().second][nPos] = aValue; } } else @@ -1173,8 +1185,10 @@ { Sequence< sal_Int8 > aInputSequence; aValue >>= aInputSequence; - sal_Int32 nPos = m_aValues.getLength(); - m_aValues.realloc(nPos+1); + if ( m_aValues.find(m_aStack.top().second) == m_aValues.end() ) + m_aValues.insert(::std::map< sal_Int16 ,Sequence< Any> >::value_type(m_aStack.top().second,Sequence< Any>())); + sal_Int32 nPos = m_aValues[m_aStack.top().second].getLength(); + m_aValues[m_aStack.top().second].realloc(nPos+1); Sequence< PropertyValue > aLayout; if ( aInputSequence.getLength() ) { @@ -1191,7 +1205,7 @@ else if ( QUERY == m_aStack.top().second ) LoadTableFields(xInStream,aLayout); } - m_aValues[nPos] <<= aLayout; + m_aValues[m_aStack.top().second][nPos] <<= aLayout; } catch(const Exception& e) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
