LibreOffice Module dbaccess (master) 1
xmlConnectionResource.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
21#include "xmlfilter.hxx"
22#include <xmloff/xmltoken.hxx>
24#include <strings.hxx>
26
27namespace dbaxml
28{
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::xml::sax;
31
33 const Reference< XFastAttributeList > & _xAttrList) :
34 SvXMLImportContext( rImport )
35{
36 Reference<XPropertySet> xDataSource = rImport.getDataSource();
37
38 PropertyValue aProperty;
39
40 if (!xDataSource.is())
41 return;
42
43 for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
44 {
45 aProperty.Name.clear();
46 aProperty.Value = Any();
47
48 switch( aIter.getToken() )
49 {
50 case XML_ELEMENT(XLINK, XML_HREF):
51 try
52 {
53 xDataSource->setPropertyValue(PROPERTY_URL,Any(aIter.toString()));
54 }
55 catch(const Exception&)
56 {
57 DBG_UNHANDLED_EXCEPTION("dbaccess");
58 }
59 break;
60 case XML_ELEMENT(XLINK, XML_TYPE):
61 aProperty.Name = PROPERTY_TYPE;
62 break;
63 case XML_ELEMENT(XLINK, XML_SHOW):
64 aProperty.Name = "Show";
65 break;
66 case XML_ELEMENT(XLINK, XML_ACTUATE):
67 aProperty.Name = "Actuate";
68 break;
69 default:
70 XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
71 }
72 if ( !aProperty.Name.isEmpty() )
73 {
74 if ( !aProperty.Value.hasValue() )
75 aProperty.Value <<= aIter.toString();
76 rImport.addInfo(aProperty);
77 }
78 }
79}
80
82{
83
84}
85
86} // namespace dbaxml
87
88/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void addInfo(const css::beans::PropertyValue &_rInfo)
add an Info to the sequence which will be appended to the data source
Definition: xmlfilter.hxx:108
const Reference< XPropertySet > & getDataSource() const
Definition: xmlfilter.hxx:97
OXMLConnectionResource(ODBFilter &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
#define DBG_UNHANDLED_EXCEPTION(...)
@ Exception
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
XML_ACTUATE
XML_HREF
XML_SHOW
XML_TYPE
constexpr OUStringLiteral PROPERTY_URL(u"URL")
constexpr OUStringLiteral PROPERTY_TYPE(u"Type")
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)