1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlConnectionData.cxx,v $
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"
36 #ifndef DBA_XMLLOGIN_HXX
37 #include "xmlLogin.hxx"
39 #ifndef DBA_XMLTABLEFILTERLIST_HXX
40 #include "xmlTableFilterList.hxx"
42 #ifndef DBA_XMLFILTER_HXX
43 #include "xmlfilter.hxx"
45 #ifndef _XMLOFF_XMLTOKEN_HXX
46 #include <xmloff/xmltoken.hxx>
48 #ifndef _XMLOFF_XMLNMSPE_HXX
49 #include <xmloff/xmlnmspe.hxx>
51 #ifndef _XMLOFF_NMSPMAP_HXX
52 #include <xmloff/nmspmap.hxx>
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>
61 #ifndef TOOLS_DIAGNOSE_EX_H
62 #include <tools/diagnose_ex.h>
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
)
76 rImport
.setNewFormat(true);
77 DBG_CTOR(OXMLConnectionData
,NULL
);
79 // -----------------------------------------------------------------------------
81 OXMLConnectionData::~OXMLConnectionData()
84 DBG_DTOR(OXMLConnectionData
,NULL
);
86 // -----------------------------------------------------------------------------
88 SvXMLImportContext
* OXMLConnectionData::CreateChildContext(
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
) )
99 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
100 pContext
= new OXMLLogin( GetOwnImport(), nPrefix
, rLocalName
,xAttrList
);
102 case XML_TOK_DATABASE_DESCRIPTION
:
106 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
107 pContext
= new OXMLDatabaseDescription( GetOwnImport(), nPrefix
, rLocalName
);
110 case XML_TOK_CONNECTION_RESOURCE
:
114 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
115 pContext
= new OXMLConnectionResource( GetOwnImport(), nPrefix
, rLocalName
,xAttrList
);
118 case XML_TOK_COMPOUND_DATABASE
:
122 OSL_ENSURE(0,"Not supported yet!");
128 pContext
= new SvXMLImportContext( GetImport(), nPrefix
, rLocalName
);
132 // -----------------------------------------------------------------------------
133 ODBFilter
& OXMLConnectionData::GetOwnImport()
135 return static_cast<ODBFilter
&>(GetImport());
137 // -----------------------------------------------------------------------------
138 //----------------------------------------------------------------------------
139 } // namespace dbaxml
140 // -----------------------------------------------------------------------------