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/ProgressBarHelper.hxx>
24 #include "xmlQuery.hxx"
25 #include "xmlTable.hxx"
26 #include "xmlComponent.hxx"
27 #include "xmlHierarchyCollection.hxx"
28 #include "xmlEnums.hxx"
32 using namespace ::com::sun::star::uno
;
33 using namespace ::com::sun::star::container
;
34 using namespace ::com::sun::star::xml::sax
;
36 OXMLDocuments::OXMLDocuments( ODBFilter
& rImport
37 ,const Reference
< XNameAccess
>& _xContainer
38 ,const OUString
& _sCollectionServiceName
39 ,const OUString
& _sComponentServiceName
) :
40 SvXMLImportContext( rImport
)
41 ,m_xContainer(_xContainer
)
42 ,m_sCollectionServiceName(_sCollectionServiceName
)
43 ,m_sComponentServiceName(_sComponentServiceName
)
48 OXMLDocuments::OXMLDocuments( ODBFilter
& rImport
49 ,const Reference
< XNameAccess
>& _xContainer
50 ,const OUString
& _sCollectionServiceName
52 SvXMLImportContext( rImport
)
53 ,m_xContainer(_xContainer
)
54 ,m_sCollectionServiceName(_sCollectionServiceName
)
58 OXMLDocuments::~OXMLDocuments()
63 css::uno::Reference
< css::xml::sax::XFastContextHandler
> OXMLDocuments::createFastChildContext(
64 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
)
66 SvXMLImportContext
*pContext
= nullptr;
68 switch( nElement
& TOKEN_MASK
)
71 case XML_TABLE_REPRESENTATION
:
72 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
73 pContext
= new OXMLTable( GetOwnImport(), xAttrList
, m_xContainer
, "com.sun.star.sdb.TableDefinition");
76 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
77 pContext
= new OXMLQuery( GetOwnImport(), xAttrList
, m_xContainer
);
80 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
81 pContext
= new OXMLComponent( GetOwnImport(), xAttrList
, m_xContainer
,m_sComponentServiceName
);
83 case XML_COMPONENT_COLLECTION
:
84 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP
);
85 pContext
= new OXMLHierarchyCollection( GetOwnImport(), xAttrList
, m_xContainer
,m_sCollectionServiceName
,m_sComponentServiceName
);
92 ODBFilter
& OXMLDocuments::GetOwnImport()
94 return static_cast<ODBFilter
&>(GetImport());
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */