LibreOffice Module dbaccess (master) 1
xmlDocuments.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "xmlDocuments.hxx"
21#include "xmlfilter.hxx"
22#include <utility>
23#include <xmloff/xmltoken.hxx>
25#include "xmlQuery.hxx"
26#include "xmlTable.hxx"
27#include "xmlComponent.hxx"
29#include "xmlEnums.hxx"
30
31namespace dbaxml
32{
33 using namespace ::com::sun::star::uno;
34 using namespace ::com::sun::star::container;
35 using namespace ::com::sun::star::xml::sax;
36
37OXMLDocuments::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))
45{
46
47}
48
49OXMLDocuments::OXMLDocuments( ODBFilter& rImport
50 ,const Reference< XNameAccess >& _xContainer
51 ,OUString _sCollectionServiceName
52 ) :
53 SvXMLImportContext( rImport )
54 ,m_xContainer(_xContainer)
55 ,m_sCollectionServiceName(std::move(_sCollectionServiceName))
56{
57}
58
59OXMLDocuments::~OXMLDocuments()
60{
61
62}
63
64css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLDocuments::createFastChildContext(
65 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
66{
67 SvXMLImportContext *pContext = nullptr;
68
69 switch( nElement & TOKEN_MASK )
70 {
71 case XML_TABLE:
73 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
74 pContext = new OXMLTable( GetOwnImport(), xAttrList, m_xContainer, "com.sun.star.sdb.TableDefinition");
75 break;
76 case XML_QUERY:
77 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
78 pContext = new OXMLQuery( GetOwnImport(), xAttrList, m_xContainer );
79 break;
80 case XML_COMPONENT:
81 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
82 pContext = new OXMLComponent( GetOwnImport(), xAttrList, m_xContainer,m_sComponentServiceName );
83 break;
85 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
86 pContext = new OXMLHierarchyCollection( GetOwnImport(), xAttrList, m_xContainer,m_sCollectionServiceName,m_sComponentServiceName );
87 break;
88 }
89
90 return pContext;
91}
92
93ODBFilter& OXMLDocuments::GetOwnImport()
94{
95 return static_cast<ODBFilter&>(GetImport());
96}
97
98} // namespace dbaxml
99
100/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OXMLDocuments(ODBFilter &rImport, const css::uno::Reference< css::container::XNameAccess > &_xContainer, OUString _sCollectionServiceName, OUString _sComponentServiceName)
XML_QUERY
XML_TABLE
XML_COMPONENT_COLLECTION
XML_COMPONENT
XML_TABLE_REPRESENTATION
Reference< XNameAccess > m_xContainer
Definition: objectnames.cxx:80
#define PROGRESS_BAR_STEP
Definition: xmlEnums.hxx:21
constexpr sal_Int32 TOKEN_MASK