bump product version to 5.0.4.1
[LibreOffice.git] / dbaccess / source / filter / xml / xmlDatabaseDescription.cxx
blob25cd46d7a63c81f9b29ac288bb2b615c263df197
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 "xmlDatabaseDescription.hxx"
21 #include "xmlLogin.hxx"
22 #include "xmlfilter.hxx"
23 #include <xmloff/xmltoken.hxx>
24 #include <xmloff/xmlnmspe.hxx>
25 #include <xmloff/nmspmap.hxx>
26 #include "xmlEnums.hxx"
27 #include "xmlFileBasedDatabase.hxx"
28 #include "xmlServerDatabase.hxx"
29 #include "xmlstrings.hrc"
30 #include <tools/debug.hxx>
31 #include <tools/diagnose_ex.h>
33 namespace dbaxml
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::xml::sax;
38 OXMLDatabaseDescription::OXMLDatabaseDescription( ODBFilter& rImport,
39 sal_uInt16 nPrfx, const OUString& _sLocalName) :
40 SvXMLImportContext( rImport, nPrfx, _sLocalName )
41 ,m_bFoundOne(false)
45 OXMLDatabaseDescription::~OXMLDatabaseDescription()
50 SvXMLImportContext* OXMLDatabaseDescription::CreateChildContext(
51 sal_uInt16 nPrefix,
52 const OUString& rLocalName,
53 const Reference< XAttributeList > & xAttrList )
55 SvXMLImportContext *pContext = 0;
56 const SvXMLTokenMap& rTokenMap = GetOwnImport().GetDatabaseDescriptionElemTokenMap();
58 switch( rTokenMap.Get( nPrefix, rLocalName ) )
60 case XML_TOK_FILE_BASED_DATABASE:
61 if ( !m_bFoundOne )
63 m_bFoundOne = true;
64 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
65 pContext = new OXMLFileBasedDatabase( GetOwnImport(), nPrefix, rLocalName,xAttrList );
67 break;
68 case XML_TOK_SERVER_DATABASE:
69 if ( !m_bFoundOne )
71 m_bFoundOne = true;
72 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
73 pContext = new OXMLServerDatabase( GetOwnImport(), nPrefix, rLocalName,xAttrList );
75 break;
78 if( !pContext )
79 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
81 return pContext;
84 ODBFilter& OXMLDatabaseDescription::GetOwnImport()
86 return static_cast<ODBFilter&>(GetImport());
89 } // namespace dbaxml
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */