bump product version to 5.0.4.1
[LibreOffice.git] / dbaccess / source / filter / xml / xmlConnectionData.cxx
blob759ba462a5a537a5752bb4718e273a4620a29e55
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "xmlConnectionData.hxx"
21 #include "xmlLogin.hxx"
22 #include "xmlTableFilterList.hxx"
23 #include "xmlfilter.hxx"
24 #include <xmloff/xmltoken.hxx>
25 #include <xmloff/xmlnmspe.hxx>
26 #include <xmloff/nmspmap.hxx>
27 #include "xmlEnums.hxx"
28 #include "xmlDatabaseDescription.hxx"
29 #include "xmlConnectionResource.hxx"
30 #include "xmlstrings.hrc"
31 #include <tools/debug.hxx>
32 #include <tools/diagnose_ex.h>
34 namespace dbaxml
36 using namespace ::com::sun::star::uno;
37 using namespace ::com::sun::star::xml::sax;
39 OXMLConnectionData::OXMLConnectionData( ODBFilter& rImport,
40 sal_uInt16 nPrfx, const OUString& _sLocalName) :
41 SvXMLImportContext( rImport, nPrfx, _sLocalName )
42 ,m_bFoundOne(false)
44 rImport.setNewFormat(true);
47 OXMLConnectionData::~OXMLConnectionData()
52 SvXMLImportContext* OXMLConnectionData::CreateChildContext(
53 sal_uInt16 nPrefix,
54 const OUString& rLocalName,
55 const Reference< XAttributeList > & xAttrList )
57 SvXMLImportContext *pContext = 0;
58 const SvXMLTokenMap& rTokenMap = GetOwnImport().GetDataSourceElemTokenMap();
60 switch( rTokenMap.Get( nPrefix, rLocalName ) )
62 case XML_TOK_LOGIN:
63 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
64 pContext = new OXMLLogin( GetOwnImport(), nPrefix, rLocalName,xAttrList );
65 break;
66 case XML_TOK_DATABASE_DESCRIPTION:
67 if ( !m_bFoundOne )
69 m_bFoundOne = true;
70 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
71 pContext = new OXMLDatabaseDescription( GetOwnImport(), nPrefix, rLocalName);
73 break;
74 case XML_TOK_CONNECTION_RESOURCE:
75 if ( !m_bFoundOne )
77 m_bFoundOne = true;
78 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
79 pContext = new OXMLConnectionResource( GetOwnImport(), nPrefix, rLocalName,xAttrList );
81 break;
82 case XML_TOK_COMPOUND_DATABASE:
83 if ( !m_bFoundOne )
85 m_bFoundOne = true;
86 OSL_FAIL("Not supported yet!");
88 break;
91 if( !pContext )
92 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
94 return pContext;
97 ODBFilter& OXMLConnectionData::GetOwnImport()
99 return static_cast<ODBFilter&>(GetImport());
102 } // namespace dbaxml
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */