Tag: cws_src680_dbodf11 User: oj Date: 2008-01-31 07:47:48+0000 Modified: dba/dbaccess/prj/build.lst dba/dbaccess/source/filter/xml/dbloader2.cxx dba/dbaccess/source/filter/xml/makefile.mk dba/dbaccess/source/filter/xml/xmlExport.cxx dba/dbaccess/source/filter/xml/xmlExport.hxx dba/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx dba/dbaccess/source/filter/xml/xmlfilter.cxx dba/dbaccess/source/filter/xml/xmlfilter.hxx dba/dbaccess/source/ui/misc/dsntypes.cxx
Log: #i85757# as odf 1.2 form File Changes: Directory: /dba/dbaccess/prj/ ============================= File [changed]: build.lst Url: http://dba.openoffice.org/source/browse/dba/dbaccess/prj/build.lst?r1=1.12&r2=1.12.44.1 Delta lines: +1 -1 ------------------- --- build.lst 2007-07-24 12:03:35+0000 1.12 +++ build.lst 2008-01-31 07:47:45+0000 1.12.44.1 @@ -6,7 +6,7 @@ ba dbaccess\source\core\dataaccess nmake - all ba_cdaccess ba_capi ba_inc NULL ba dbaccess\source\core\misc nmake - all ba_cmisc ba_cdaccess ba_inc NULL ba dbaccess\source\core\resource nmake - all ba_cres ba_cmisc ba_inc NULL -ba dbaccess\source\filter\xml nmake - all ba_ffilter ba_shared ba_inc NULL +ba dbaccess\source\filter\xml nmake - all ba_ffilter ba_shared ba_util ba_inc NULL ba dbaccess\source\filter\migration nmake - all ba_fmigration ba_shared ba_inc NULL ba dbaccess\source\shared nmake - all ba_shared ba_cres ba_inc NULL ba dbaccess\source\sdbtools\connection nmake - all ba_conntools ba_inc NULL Directory: /dba/dbaccess/source/filter/xml/ =========================================== File [changed]: dbloader2.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/dbloader2.cxx?r1=1.31&r2=1.31.22.1 Delta lines: +4 -4 ------------------- --- dbloader2.cxx 2007-11-21 15:42:43+0000 1.31 +++ dbloader2.cxx 2008-01-31 07:47:45+0000 1.31.22.1 @@ -4,9 +4,9 @@ * * $RCSfile: dbloader2.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.31.22.1 $ * - * last change: $Author: ihi $ $Date: 2007/11/21 15:42:43 $ + * last change: $Author: oj $ $Date: 2008/01/31 07:47:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -171,7 +171,7 @@ { ::rtl::OUString sMediaType; xProp->getPropertyValue( INFO_MEDIATYPE ) >>= sMediaType; - if ( sMediaType.equalsAscii(MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) ) + if ( sMediaType.equalsAscii(MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) || sMediaType.equalsAscii(MIMETYPE_VND_SUN_XML_BASE_ASCII) ) return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StarBase")); ::comphelper::disposeComponent(xProp); } File [changed]: makefile.mk Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/makefile.mk?r1=1.7&r2=1.7.22.1 Delta lines: +11 -3 -------------------- --- makefile.mk 2007-11-09 08:12:37+0000 1.7 +++ makefile.mk 2008-01-31 07:47:45+0000 1.7.22.1 @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.7 $ +# $Revision: 1.7.22.1 $ # -# last change: $Author: rt $ $Date: 2007/11/09 08:12:37 $ +# last change: $Author: oj $ $Date: 2008/01/31 07:47:45 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -99,6 +99,14 @@ $(SO2LIB) \ $(SALLIB) +.IF "$(GUI)"!="WNT" || "$(COM)"=="GCC" +SHL1STDLIBS+= \ + -ldbu$(UPD)$(DLLPOSTFIX) +.ELSE +SHL1STDLIBS+= \ + idbu.lib +.ENDIF + SHL1DEPN= SHL1LIBS=$(LIB1TARGET) File [changed]: xmlExport.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlExport.cxx?r1=1.14.76.5&r2=1.14.76.6 Delta lines: +58 -7 -------------------- --- xmlExport.cxx 2008-01-28 12:29:33+0000 1.14.76.5 +++ xmlExport.cxx 2008-01-31 07:47:45+0000 1.14.76.6 @@ -4,9 +4,9 @@ * * $RCSfile: xmlExport.cxx,v $ * - * $Revision: 1.14.76.5 $ + * $Revision: 1.14.76.6 $ * - * last change: $Author: oj $ $Date: 2008/01/28 12:29:33 $ + * last change: $Author: oj $ $Date: 2008/01/31 07:47:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -256,7 +256,7 @@ GetMM100UnitConverter().setCoreMeasureUnit(MAP_10TH_MM); GetMM100UnitConverter().setXMLMeasureUnit(MAP_CM); - _GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken((getExportFlags() & EXPORT_CONTENT) != 0 ? XML_N_OOO : XML_N_OFFICE), XML_NAMESPACE_OFFICE ); + _GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE ); _GetNamespaceMap().Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO ); _GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG), XML_NAMESPACE_SVG ); @@ -384,8 +384,6 @@ ::xmloff::token::XMLTokenEnum eToken = XML_TOKEN_INVALID; if ( pProperties->Name == INFO_JDBCDRIVERCLASS ) eToken = XML_JAVA_DRIVER_CLASS; - else if ( pProperties->Name == INFO_TEXTFILEEXTENSION ) - eToken = XML_EXTENSION; else if ( pProperties->Name == INFO_TEXTFILEHEADER ) { if ( sValue == s_sTrue ) @@ -618,9 +616,62 @@ ::rtl::OUString sValue; Reference<XPropertySet> xProp(getDataSource()); xProp->getPropertyValue(PROPERTY_URL) >>= sValue; + const dbaui::DATASOURCE_TYPE eType = m_aTypeCollection.getType(sValue); + if ( m_aTypeCollection.isFileSystemBased(eType) ) + { + SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, sal_True, sal_True); + { + AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,m_aTypeCollection.cutPrefix(sValue)); + AddAttribute(XML_NAMESPACE_DB,XML_MEDIA_TYPE,m_aTypeCollection.getMediaType(eType)); + try + { + ::rtl::OUString sExtension; + if ( eType == dbaui::DST_MSACCESS ) + sExtension = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("mdb")); + else + { + Reference< XPropertySet > xDataSourceSettings; + OSL_VERIFY( xProp->getPropertyValue( PROPERTY_SETTINGS ) >>= xDataSourceSettings ); + xDataSourceSettings->getPropertyValue( INFO_TEXTFILEEXTENSION ) >>= sExtension; + } + if ( sExtension.getLength() ) + AddAttribute(XML_NAMESPACE_DB,XML_EXTENSION,sExtension); + } + catch(const Exception&) + { + // nii + } + SvXMLElementExport aFileBasedDB(*this,XML_NAMESPACE_DB, XML_FILE_BASED_DATABASE, sal_True, sal_True); + } + } + else + { + String sDatabaseName,sHostName; + sal_Int32 nPort = -1; + m_aTypeCollection.extractHostNamePort(sValue,sDatabaseName,sHostName,nPort); + if ( sHostName.Len() ) + { + SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, sal_True, sal_True); + { + String sType = m_aTypeCollection.getDatasourcePrefix(eType); + sType.EraseTrailingChars(':'); + AddAttribute(XML_NAMESPACE_DB,XML_TYPE,sType); + AddAttribute(XML_NAMESPACE_DB,XML_HOSTNAME,sHostName); + if ( nPort != -1 ) + AddAttribute(XML_NAMESPACE_DB,XML_PORT,::rtl::OUString::valueOf(nPort)); + if ( sDatabaseName.Len() ) + AddAttribute(XML_NAMESPACE_DB,XML_DATABASE_NAME,sDatabaseName); + SvXMLElementExport aServerDB(*this,XML_NAMESPACE_DB, XML_SERVER_DATABASE, sal_True, sal_True); + } + } + else + { AddAttribute(XML_NAMESPACE_XLINK, XML_HREF,sValue); SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_CONNECTION_RESOURCE, sal_True, sal_True); } + } + + } exportLogin(); } File [changed]: xmlExport.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlExport.hxx?r1=1.7.86.2&r2=1.7.86.3 Delta lines: +5 -3 ------------------- --- xmlExport.hxx 2007-10-22 13:03:09+0000 1.7.86.2 +++ xmlExport.hxx 2008-01-31 07:47:45+0000 1.7.86.3 @@ -4,9 +4,9 @@ * * $RCSfile: xmlExport.hxx,v $ * - * $Revision: 1.7.86.2 $ + * $Revision: 1.7.86.3 $ * - * last change: $Author: oj $ $Date: 2007/10/22 13:03:09 $ + * last change: $Author: oj $ $Date: 2008/01/31 07:47:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -93,6 +93,7 @@ #ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" #endif +#include "dsntypes.hxx" #ifndef _COMPHELPER_STLTYPES_HXX_ #include <comphelper/stl_types.hxx> #endif @@ -154,6 +155,7 @@ mutable UniReference < XMLPropertySetMapper > m_xRowStylesPropertySetMapper; Reference<XPropertySet> m_xDataSource; + ::dbaui::ODsnTypeCollection m_aTypeCollection; sal_Bool m_bAllreadyFilled; void exportDataSource(); File [changed]: xmlFileBasedDatabase.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx?r1=1.2.22.2&r2=1.2.22.3 Delta lines: +4 -23 -------------------- --- xmlFileBasedDatabase.cxx 2008-01-28 13:16:16+0000 1.2.22.2 +++ xmlFileBasedDatabase.cxx 2008-01-31 07:47:45+0000 1.2.22.3 @@ -4,9 +4,9 @@ * * $RCSfile: xmlFileBasedDatabase.cxx,v $ * - * $Revision: 1.2.22.2 $ + * $Revision: 1.2.22.3 $ * - * last change: $Author: oj $ $Date: 2008/01/28 13:16:16 $ + * last change: $Author: oj $ $Date: 2008/01/31 07:47:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -63,7 +63,7 @@ #include <tools/diagnose_ex.h> #endif #include <comphelper/sequence.hxx> - +#include "dsntypes.hxx" namespace dbaxml { using namespace ::com::sun::star::uno; @@ -119,26 +119,7 @@ } if ( sLocation.getLength() && sMediaType.getLength() ) { - ::rtl::OUString sURL(RTL_CONSTASCII_USTRINGPARAM("sdbc:")); - if ( sMediaType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "text/csv" ) ) ) - { - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("flat:")); - } - else if ( sMediaType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "application/dbase" ) ) ) - { - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dbase:")); - } - else if ( sMediaType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) ) - { - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("calc:")); - } - else if ( sMediaType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "application/msaccess" ) ) ) - { - if ( sFileTypeExtension.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "mdb" ) ) ) - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=")); - else - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")); - } + ::rtl::OUString sURL(dbaui::ODsnTypeCollection::getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension)); sURL += sLocation; try { File [changed]: xmlfilter.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlfilter.cxx?r1=1.17&r2=1.17.22.1 Delta lines: +7 -7 ------------------- --- xmlfilter.cxx 2007-11-09 08:18:54+0000 1.17 +++ xmlfilter.cxx 2008-01-31 07:47:45+0000 1.17.22.1 @@ -4,9 +4,9 @@ * * $RCSfile: xmlfilter.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.17.22.1 $ * - * last change: $Author: rt $ $Date: 2007/11/09 08:18:54 $ + * last change: $Author: oj $ $Date: 2008/01/31 07:47:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -473,11 +473,11 @@ break; case XML_TOK_DOC_STYLES: GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = CreateStylesContext( rLocalName, xAttrList, sal_False); + pContext = CreateStylesContext(nPrefix, rLocalName, xAttrList, sal_False); break; case XML_TOK_DOC_AUTOSTYLES: GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = CreateStylesContext( rLocalName, xAttrList, sal_True); + pContext = CreateStylesContext(nPrefix, rLocalName, xAttrList, sal_True); break; } @@ -769,13 +769,13 @@ return *m_pColumnElemTokenMap; } // ----------------------------------------------------------------------------- -SvXMLImportContext* ODBFilter::CreateStylesContext(const ::rtl::OUString& rLocalName, +SvXMLImportContext* ODBFilter::CreateStylesContext(sal_uInt16 _nPrefix,const ::rtl::OUString& rLocalName, const uno::Reference< XAttributeList>& xAttrList, sal_Bool bIsAutoStyle ) { SvXMLImportContext *pContext = NULL; if (!pContext) { - pContext = new OTableStylesContext(*this, XML_NAMESPACE_OOO, rLocalName, xAttrList, bIsAutoStyle); + pContext = new OTableStylesContext(*this, _nPrefix, rLocalName, xAttrList, bIsAutoStyle); if (bIsAutoStyle) //xAutoStyles = pContext; SetAutoStyles((SvXMLStylesContext*)pContext); File [changed]: xmlfilter.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlfilter.hxx?r1=1.6&r2=1.6.22.1 Delta lines: +4 -4 ------------------- --- xmlfilter.hxx 2007-11-09 08:19:11+0000 1.6 +++ xmlfilter.hxx 2008-01-31 07:47:45+0000 1.6.22.1 @@ -4,9 +4,9 @@ * * $RCSfile: xmlfilter.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.6.22.1 $ * - * last change: $Author: rt $ $Date: 2007/11/09 08:19:11 $ + * last change: $Author: oj $ $Date: 2008/01/31 07:47:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -149,7 +149,7 @@ */ void fillPropertyMap(const Any& _rValue,TPropertyNameMap& _rMap); - SvXMLImportContext* CreateStylesContext(const ::rtl::OUString& rLocalName, + SvXMLImportContext* CreateStylesContext(sal_uInt16 nPrefix,const ::rtl::OUString& rLocalName, const Reference< XAttributeList>& xAttrList, sal_Bool bIsAutoStyle ); protected: // SvXMLImport Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: dsntypes.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/dsntypes.cxx?r1=1.38&r2=1.38.20.1 Delta lines: +54 -4 -------------------- --- dsntypes.cxx 2007-11-27 12:27:59+0000 1.38 +++ dsntypes.cxx 2008-01-31 07:47:46+0000 1.38.20.1 @@ -4,9 +4,9 @@ * * $RCSfile: dsntypes.cxx,v $ * - * $Revision: 1.38 $ + * $Revision: 1.38.20.1 $ * - * last change: $Author: ihi $ $Date: 2007/11/27 12:27:59 $ + * last change: $Author: oj $ $Date: 2008/01/31 07:47:46 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -70,6 +70,7 @@ #ifndef _DBAUI_MODULE_DBU_HXX_ #include "moduledbu.hxx" #endif +#include <comphelper/documentconstants.hxx> //......................................................................... namespace dbaui { @@ -251,6 +252,55 @@ return _rDsn.Copy(sPrefix.Len()); } // ----------------------------------------------------------------------------- +String ODsnTypeCollection::getMediaType(DATASOURCE_TYPE _eType) const +{ + String sRet; + switch (_eType) + { + case DST_DBASE: + sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("application/dbase")); + break; + case DST_FLAT: + sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("text/csv")); + break; + case DST_CALC: + sRet = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET; + break; + case DST_MSACCESS: + case DST_MSACCESS_2007: + sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("application/msaccess")); + break; + default: + break; + } + return sRet; +} +// ----------------------------------------------------------------------------- +String ODsnTypeCollection::getDatasourcePrefixFromMediaType(const String& _sMediaType,const String& _sExtension) +{ + ::rtl::OUString sURL(RTL_CONSTASCII_USTRINGPARAM("sdbc:")); + if ( _sMediaType.EqualsIgnoreCaseAscii( "text/csv" ) ) + { + sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("flat:")); + } + else if ( _sMediaType.EqualsIgnoreCaseAscii( "application/dbase" ) ) + { + sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dbase:")); + } + else if ( _sMediaType.EqualsIgnoreCaseAscii( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) + { + sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("calc:")); + } + else if ( _sMediaType.EqualsIgnoreCaseAscii( "application/msaccess" ) ) + { + if ( _sExtension.EqualsIgnoreCaseAscii( "mdb" ) ) + sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=")); + else + sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")); + } + return sURL; +} +// ----------------------------------------------------------------------------- void ODsnTypeCollection::extractHostNamePort(const String& _rDsn,String& _sDatabaseName,String& _rsHostname,sal_Int32& _nPortNumber) const { DATASOURCE_TYPE eType = getType(_rDsn); @@ -563,7 +613,7 @@ // ----------------------------------------------------------------------------- String ODsnTypeCollection::getTypeExtension(DATASOURCE_TYPE _eType) const { - StringVector::size_type nPos = static_cast<sal_Int16>(_eType-DST_USERDEFINE1); + StringVector::size_type nPos = static_cast<sal_uInt16>(_eType-DST_USERDEFINE1); return nPos < m_aUserExtensions.size() ? m_aUserExtensions[nPos] : String(); } //------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
