bump product version to 5.0.4.1
[LibreOffice.git] / dbaccess / source / filter / xml / xmlDocuments.cxx
blob61d93708f7d484079cb92b358e9cd390372ed469
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 "xmlDocuments.hxx"
21 #include "xmlfilter.hxx"
22 #include <xmloff/xmltoken.hxx>
23 #include <xmloff/xmlnmspe.hxx>
24 #include "xmlQuery.hxx"
25 #include "xmlTable.hxx"
26 #include "xmlComponent.hxx"
27 #include "xmlHierarchyCollection.hxx"
28 #include "xmlEnums.hxx"
29 #include "xmlstrings.hrc"
30 #include <tools/debug.hxx>
32 namespace dbaxml
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::container;
36 using namespace ::com::sun::star::xml::sax;
38 OXMLDocuments::OXMLDocuments( ODBFilter& rImport
39 ,sal_uInt16 nPrfx
40 , const OUString& rLName
41 ,const Reference< XNameAccess >& _xContainer
42 ,const OUString& _sCollectionServiceName
43 ,const OUString& _sComponentServiceName) :
44 SvXMLImportContext( rImport, nPrfx, rLName )
45 ,m_xContainer(_xContainer)
46 ,m_sCollectionServiceName(_sCollectionServiceName)
47 ,m_sComponentServiceName(_sComponentServiceName)
52 OXMLDocuments::OXMLDocuments( ODBFilter& rImport
53 ,sal_uInt16 nPrfx
54 , const OUString& rLName
55 ,const Reference< XNameAccess >& _xContainer
56 ,const OUString& _sCollectionServiceName
57 ) :
58 SvXMLImportContext( rImport, nPrfx, rLName )
59 ,m_xContainer(_xContainer)
60 ,m_sCollectionServiceName(_sCollectionServiceName)
64 OXMLDocuments::~OXMLDocuments()
69 SvXMLImportContext* OXMLDocuments::CreateChildContext(
70 sal_uInt16 nPrefix,
71 const OUString& rLocalName,
72 const Reference< XAttributeList > & xAttrList )
74 SvXMLImportContext *pContext = 0;
75 const SvXMLTokenMap& rTokenMap = GetOwnImport().GetDocumentsElemTokenMap();
77 switch( rTokenMap.Get( nPrefix, rLocalName ) )
79 case XML_TOK_TABLE:
80 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
81 pContext = new OXMLTable( GetOwnImport(), nPrefix, rLocalName, xAttrList, m_xContainer, "com.sun.star.sdb.TableDefinition");
82 break;
83 case XML_TOK_QUERY:
84 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
85 pContext = new OXMLQuery( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer );
86 break;
87 case XML_TOK_COMPONENT:
88 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
89 pContext = new OXMLComponent( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,m_sComponentServiceName );
90 break;
91 case XML_TOK_COMPONENT_COLLECTION:
92 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
93 pContext = new OXMLHierarchyCollection( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,m_sCollectionServiceName,m_sComponentServiceName );
94 break;
97 if( !pContext )
98 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
100 return pContext;
103 ODBFilter& OXMLDocuments::GetOwnImport()
105 return static_cast<ODBFilter&>(GetImport());
108 } // namespace dbaxml
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */