LibreOffice Module dbaccess (master) 1
xmlDatabase.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 "xmlDatabase.hxx"
21#include "xmlfilter.hxx"
22#include <xmloff/xmltoken.hxx>
24#include "xmlDataSource.hxx"
25#include "xmlDocuments.hxx"
26#include "xmlEnums.hxx"
27#include <com/sun/star/frame/XModel.hpp>
28#include <com/sun/star/sdb/XReportDocumentsSupplier.hpp>
29#include <com/sun/star/sdb/XFormDocumentsSupplier.hpp>
30#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
31#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
32#include <strings.hxx>
34
35namespace dbaxml
36{
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::sdb;
39 using namespace ::com::sun::star::sdbcx;
40 using namespace ::com::sun::star::xml::sax;
41
43 SvXMLImportContext( rImport )
44{
45
46}
47
49{
50
51}
52
53css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLDatabase::createFastChildContext(
54 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
55{
56 SvXMLImportContext *pContext = nullptr;
57
58 switch( nElement & TOKEN_MASK )
59 {
60 case XML_DATA_SOURCE:
61 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
62 pContext = new OXMLDataSource( GetOwnImport(), xAttrList, OXMLDataSource::eDataSource );
63 break;
64 case XML_FORMS:
65 {
66 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
67 Any aValue;
68 OUString sService;
70 aValue >>= sService;
71 if ( sService.isEmpty() )
72 {
73 Reference<XFormDocumentsSupplier> xSup(GetOwnImport().GetModel(),UNO_QUERY);
74 if ( xSup.is() )
76 }
77 }
78 break;
79 case XML_REPORTS:
80 {
81 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
82 Any aValue;
83 OUString sService;
85 aValue >>= sService;
86 if ( sService.isEmpty() )
87 {
88 Reference<XReportDocumentsSupplier> xSup(GetOwnImport().GetModel(),UNO_QUERY);
89 if ( xSup.is() )
91 }
92 }
93 break;
94 case XML_QUERIES:
95 {
96 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
97 Any aValue;
98 OUString sService;
99 dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"CommandDefinitions",aValue);
100 aValue >>= sService;
101 if ( sService.isEmpty() )
102 {
103 Reference<XQueryDefinitionsSupplier> xSup(GetOwnImport().getDataSource(),UNO_QUERY);
104 if ( xSup.is() )
105 pContext = new OXMLDocuments( GetOwnImport(), xSup->getQueryDefinitions(),SERVICE_NAME_QUERY_COLLECTION);
106 }
107 }
108 break;
111 {
112 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
113 Reference<XTablesSupplier> xSup(GetOwnImport().getDataSource(),UNO_QUERY);
114 if ( xSup.is() )
115 pContext = new OXMLDocuments( GetOwnImport(), xSup->getTables());
116 }
117 break;
118 }
119
120 return pContext;
121}
122
124{
125 return static_cast<ODBFilter&>(GetImport());
126}
127
129{
131}
132
133} // namespace dbaxml
134
135/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvXMLImport & GetImport()
void setPropertyInfo()
Definition: xmlfilter.cxx:586
ODBFilter & GetOwnImport()
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
virtual ~OXMLDatabase() override
Definition: xmlDatabase.cxx:48
OXMLDatabase(ODBFilter &rImport)
Definition: xmlDatabase.cxx:42
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: xmlDatabase.cxx:53
css::uno::Reference< css::uno::XInterface > getDataSource(const css::uno::Reference< css::uno::XInterface > &_rxDependentObject)
bool getDataSourceSetting(const Reference< XInterface > &_xChild, const OUString &_sAsciiSettingsName, Any &_rSettingsValue)
XML_TABLE_REPRESENTATIONS
XML_REPORTS
XML_QUERIES
XML_DATA_SOURCE
XML_SCHEMA_DEFINITION
XML_FORMS
constexpr OUStringLiteral SERVICE_NAME_FORM_COLLECTION
Definition: strings.hxx:197
constexpr OUStringLiteral SERVICE_NAME_QUERY_COLLECTION
Definition: strings.hxx:199
constexpr OUStringLiteral SERVICE_SDB_DOCUMENTDEFINITION
Definition: strings.hxx:196
constexpr OUStringLiteral SERVICE_NAME_REPORT_COLLECTION
Definition: strings.hxx:198
#define PROGRESS_BAR_STEP
Definition: xmlEnums.hxx:21
constexpr sal_Int32 TOKEN_MASK