Update ooo320-m1
[ooovba.git] / dbaccess / source / filter / xml / xmlDatabaseDescription.cxx
blobdb4c5c86db9bb6012dd4711fad89890e415170bc
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: xmlDatabaseDescription.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_XMLDATABASEDESCRIPTION_HXX_INCLUDED
34 #include "xmlDatabaseDescription.hxx"
35 #endif
36 #ifndef DBA_XMLLOGIN_HXX
37 #include "xmlLogin.hxx"
38 #endif
39 #ifndef DBA_XMLFILTER_HXX
40 #include "xmlfilter.hxx"
41 #endif
42 #ifndef _XMLOFF_XMLTOKEN_HXX
43 #include <xmloff/xmltoken.hxx>
44 #endif
45 #ifndef _XMLOFF_XMLNMSPE_HXX
46 #include <xmloff/xmlnmspe.hxx>
47 #endif
48 #ifndef _XMLOFF_NMSPMAP_HXX
49 #include <xmloff/nmspmap.hxx>
50 #endif
51 #include "xmlEnums.hxx"
52 #include "xmlFileBasedDatabase.hxx"
53 #include "xmlServerDatabase.hxx"
54 #include "xmlstrings.hrc"
55 #ifndef _TOOLS_DEBUG_HXX
56 #include <tools/debug.hxx>
57 #endif
58 #ifndef TOOLS_DIAGNOSE_EX_H
59 #include <tools/diagnose_ex.h>
60 #endif
62 namespace dbaxml
64 using namespace ::com::sun::star::uno;
65 using namespace ::com::sun::star::xml::sax;
66 DBG_NAME(OXMLDatabaseDescription)
68 OXMLDatabaseDescription::OXMLDatabaseDescription( ODBFilter& rImport,
69 sal_uInt16 nPrfx, const ::rtl::OUString& _sLocalName) :
70 SvXMLImportContext( rImport, nPrfx, _sLocalName )
71 ,m_bFoundOne(false)
73 DBG_CTOR(OXMLDatabaseDescription,NULL);
75 // -----------------------------------------------------------------------------
77 OXMLDatabaseDescription::~OXMLDatabaseDescription()
80 DBG_DTOR(OXMLDatabaseDescription,NULL);
82 // -----------------------------------------------------------------------------
84 SvXMLImportContext* OXMLDatabaseDescription::CreateChildContext(
85 sal_uInt16 nPrefix,
86 const ::rtl::OUString& rLocalName,
87 const Reference< XAttributeList > & xAttrList )
89 SvXMLImportContext *pContext = 0;
90 const SvXMLTokenMap& rTokenMap = GetOwnImport().GetDatabaseDescriptionElemTokenMap();
92 switch( rTokenMap.Get( nPrefix, rLocalName ) )
94 case XML_TOK_FILE_BASED_DATABASE:
95 if ( !m_bFoundOne )
97 m_bFoundOne = true;
98 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
99 pContext = new OXMLFileBasedDatabase( GetOwnImport(), nPrefix, rLocalName,xAttrList );
101 break;
102 case XML_TOK_SERVER_DATABASE:
103 if ( !m_bFoundOne )
105 m_bFoundOne = true;
106 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
107 pContext = new OXMLServerDatabase( GetOwnImport(), nPrefix, rLocalName,xAttrList );
109 break;
112 if( !pContext )
113 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
115 return pContext;
117 // -----------------------------------------------------------------------------
118 ODBFilter& OXMLDatabaseDescription::GetOwnImport()
120 return static_cast<ODBFilter&>(GetImport());
122 // -----------------------------------------------------------------------------
123 //----------------------------------------------------------------------------
124 } // namespace dbaxml
125 // -----------------------------------------------------------------------------