1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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
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
54 , const OUString
& rLName
55 ,const Reference
< XNameAccess
>& _xContainer
56 ,const OUString
& _sCollectionServiceName
58 SvXMLImportContext( rImport
, nPrfx
, rLName
)
59 ,m_xContainer(_xContainer
)
60 ,m_sCollectionServiceName(_sCollectionServiceName
)
64 OXMLDocuments::~OXMLDocuments()
69 SvXMLImportContext
* OXMLDocuments::CreateChildContext(
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
) )
80 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
81 pContext
= new OXMLTable( GetOwnImport(), nPrefix
, rLocalName
, xAttrList
, m_xContainer
, "com.sun.star.sdb.TableDefinition");
84 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
85 pContext
= new OXMLQuery( GetOwnImport(), nPrefix
, rLocalName
,xAttrList
,m_xContainer
);
87 case XML_TOK_COMPONENT
:
88 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
89 pContext
= new OXMLComponent( GetOwnImport(), nPrefix
, rLocalName
,xAttrList
,m_xContainer
,m_sComponentServiceName
);
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
);
98 pContext
= new SvXMLImportContext( GetImport(), nPrefix
, rLocalName
);
103 ODBFilter
& OXMLDocuments::GetOwnImport()
105 return static_cast<ODBFilter
&>(GetImport());
108 } // namespace dbaxml
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */