Update ooo320-m1
[ooovba.git] / dbaccess / source / filter / xml / xmlConnectionData.cxx
blob87d7ec5b89cfd3a3e45826081e8e70b3344608cd
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlConnectionData.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBA_XMLCONNECTIONDATA_HXX_INCLUDED
34 #include "xmlConnectionData.hxx"
35 #endif
36 #ifndef DBA_XMLLOGIN_HXX
37 #include "xmlLogin.hxx"
38 #endif
39 #ifndef DBA_XMLTABLEFILTERLIST_HXX
40 #include "xmlTableFilterList.hxx"
41 #endif
42 #ifndef DBA_XMLFILTER_HXX
43 #include "xmlfilter.hxx"
44 #endif
45 #ifndef _XMLOFF_XMLTOKEN_HXX
46 #include <xmloff/xmltoken.hxx>
47 #endif
48 #ifndef _XMLOFF_XMLNMSPE_HXX
49 #include <xmloff/xmlnmspe.hxx>
50 #endif
51 #ifndef _XMLOFF_NMSPMAP_HXX
52 #include <xmloff/nmspmap.hxx>
53 #endif
54 #include "xmlEnums.hxx"
55 #include "xmlDatabaseDescription.hxx"
56 #include "xmlConnectionResource.hxx"
57 #include "xmlstrings.hrc"
58 #ifndef _TOOLS_DEBUG_HXX
59 #include <tools/debug.hxx>
60 #endif
61 #ifndef TOOLS_DIAGNOSE_EX_H
62 #include <tools/diagnose_ex.h>
63 #endif
65 namespace dbaxml
67 using namespace ::com::sun::star::uno;
68 using namespace ::com::sun::star::xml::sax;
69 DBG_NAME(OXMLConnectionData)
71 OXMLConnectionData::OXMLConnectionData( ODBFilter& rImport,
72 sal_uInt16 nPrfx, const ::rtl::OUString& _sLocalName) :
73 SvXMLImportContext( rImport, nPrfx, _sLocalName )
74 ,m_bFoundOne(false)
76 rImport.setNewFormat(true);
77 DBG_CTOR(OXMLConnectionData,NULL);
79 // -----------------------------------------------------------------------------
81 OXMLConnectionData::~OXMLConnectionData()
84 DBG_DTOR(OXMLConnectionData,NULL);
86 // -----------------------------------------------------------------------------
88 SvXMLImportContext* OXMLConnectionData::CreateChildContext(
89 sal_uInt16 nPrefix,
90 const ::rtl::OUString& rLocalName,
91 const Reference< XAttributeList > & xAttrList )
93 SvXMLImportContext *pContext = 0;
94 const SvXMLTokenMap& rTokenMap = GetOwnImport().GetDataSourceElemTokenMap();
96 switch( rTokenMap.Get( nPrefix, rLocalName ) )
98 case XML_TOK_LOGIN:
99 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
100 pContext = new OXMLLogin( GetOwnImport(), nPrefix, rLocalName,xAttrList );
101 break;
102 case XML_TOK_DATABASE_DESCRIPTION:
103 if ( !m_bFoundOne )
105 m_bFoundOne = true;
106 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
107 pContext = new OXMLDatabaseDescription( GetOwnImport(), nPrefix, rLocalName);
109 break;
110 case XML_TOK_CONNECTION_RESOURCE:
111 if ( !m_bFoundOne )
113 m_bFoundOne = true;
114 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
115 pContext = new OXMLConnectionResource( GetOwnImport(), nPrefix, rLocalName,xAttrList );
117 break;
118 case XML_TOK_COMPOUND_DATABASE:
119 if ( !m_bFoundOne )
121 m_bFoundOne = true;
122 OSL_ENSURE(0,"Not supported yet!");
124 break;
127 if( !pContext )
128 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
130 return pContext;
132 // -----------------------------------------------------------------------------
133 ODBFilter& OXMLConnectionData::GetOwnImport()
135 return static_cast<ODBFilter&>(GetImport());
137 // -----------------------------------------------------------------------------
138 //----------------------------------------------------------------------------
139 } // namespace dbaxml
140 // -----------------------------------------------------------------------------