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"
23 #include <xmloff/xmltoken.hxx>
24 #include <xmloff/ProgressBarHelper.hxx>
25 #include "xmlQuery.hxx"
26 #include "xmlTable.hxx"
27 #include "xmlComponent.hxx"
28 #include "xmlHierarchyCollection.hxx"
29 #include "xmlEnums.hxx"
33 using namespace ::com::sun::star::uno
;
34 using namespace ::com::sun::star::container
;
35 using namespace ::com::sun::star::xml::sax
;
37 OXMLDocuments::OXMLDocuments( ODBFilter
& rImport
38 ,const Reference
< XNameAccess
>& _xContainer
39 ,OUString _sCollectionServiceName
40 ,OUString _sComponentServiceName
) :
41 SvXMLImportContext( rImport
)
42 ,m_xContainer(_xContainer
)
43 ,m_sCollectionServiceName(std::move(_sCollectionServiceName
))
44 ,m_sComponentServiceName(std::move(_sComponentServiceName
))
49 OXMLDocuments::OXMLDocuments( ODBFilter
& rImport
50 ,const Reference
< XNameAccess
>& _xContainer
51 ,OUString _sCollectionServiceName
53 SvXMLImportContext( rImport
)
54 ,m_xContainer(_xContainer
)
55 ,m_sCollectionServiceName(std::move(_sCollectionServiceName
))
59 OXMLDocuments::~OXMLDocuments()
64 css::uno::Reference
< css::xml::sax::XFastContextHandler
> OXMLDocuments::createFastChildContext(
65 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
)
67 SvXMLImportContext
*pContext
= nullptr;
69 switch( nElement
& TOKEN_MASK
)
72 case XML_TABLE_REPRESENTATION
:
73 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
74 pContext
= new OXMLTable( GetOwnImport(), xAttrList
, m_xContainer
, u
"com.sun.star.sdb.TableDefinition"_ustr
);
77 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
78 pContext
= new OXMLQuery( GetOwnImport(), xAttrList
, m_xContainer
);
81 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
82 pContext
= new OXMLComponent( GetOwnImport(), xAttrList
, m_xContainer
,m_sComponentServiceName
);
84 case XML_COMPONENT_COLLECTION
:
85 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
86 pContext
= new OXMLHierarchyCollection( GetOwnImport(), xAttrList
, m_xContainer
,m_sCollectionServiceName
,m_sComponentServiceName
);
93 ODBFilter
& OXMLDocuments::GetOwnImport()
95 return static_cast<ODBFilter
&>(GetImport());
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */