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: xmlDatabaseDescription.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_XMLDATABASEDESCRIPTION_HXX_INCLUDED
34 #include "xmlDatabaseDescription.hxx"
36 #ifndef DBA_XMLLOGIN_HXX
37 #include "xmlLogin.hxx"
39 #ifndef DBA_XMLFILTER_HXX
40 #include "xmlfilter.hxx"
42 #ifndef _XMLOFF_XMLTOKEN_HXX
43 #include <xmloff/xmltoken.hxx>
45 #ifndef _XMLOFF_XMLNMSPE_HXX
46 #include <xmloff/xmlnmspe.hxx>
48 #ifndef _XMLOFF_NMSPMAP_HXX
49 #include <xmloff/nmspmap.hxx>
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>
58 #ifndef TOOLS_DIAGNOSE_EX_H
59 #include <tools/diagnose_ex.h>
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
)
73 DBG_CTOR(OXMLDatabaseDescription
,NULL
);
75 // -----------------------------------------------------------------------------
77 OXMLDatabaseDescription::~OXMLDatabaseDescription()
80 DBG_DTOR(OXMLDatabaseDescription
,NULL
);
82 // -----------------------------------------------------------------------------
84 SvXMLImportContext
* OXMLDatabaseDescription::CreateChildContext(
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
:
98 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
99 pContext
= new OXMLFileBasedDatabase( GetOwnImport(), nPrefix
, rLocalName
,xAttrList
);
102 case XML_TOK_SERVER_DATABASE
:
106 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
107 pContext
= new OXMLServerDatabase( GetOwnImport(), nPrefix
, rLocalName
,xAttrList
);
113 pContext
= new SvXMLImportContext( GetImport(), nPrefix
, rLocalName
);
117 // -----------------------------------------------------------------------------
118 ODBFilter
& OXMLDatabaseDescription::GetOwnImport()
120 return static_cast<ODBFilter
&>(GetImport());
122 // -----------------------------------------------------------------------------
123 //----------------------------------------------------------------------------
124 } // namespace dbaxml
125 // -----------------------------------------------------------------------------