nss: upgrade to release 3.73
[LibreOffice.git] / dbaccess / source / filter / xml / xmlConnectionResource.cxx
blob70f7fe210415edb6fe6a12354a3ce047a78c9be0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "xmlConnectionResource.hxx"
21 #include "xmlfilter.hxx"
22 #include <xmloff/xmltoken.hxx>
23 #include <xmloff/xmlnamespace.hxx>
24 #include <strings.hxx>
25 #include <tools/diagnose_ex.h>
27 namespace dbaxml
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::xml::sax;
32 OXMLConnectionResource::OXMLConnectionResource( ODBFilter& rImport,
33 const Reference< XFastAttributeList > & _xAttrList) :
34 SvXMLImportContext( rImport )
36 Reference<XPropertySet> xDataSource = rImport.getDataSource();
38 PropertyValue aProperty;
40 if (!xDataSource.is())
41 return;
43 for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
45 OUString sValue = aIter.toString();
46 aProperty.Name.clear();
47 aProperty.Value = Any();
49 switch( aIter.getToken() )
51 case XML_ELEMENT(XLINK, XML_HREF):
52 try
54 xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sValue));
56 catch(const Exception&)
58 DBG_UNHANDLED_EXCEPTION("dbaccess");
60 break;
61 case XML_ELEMENT(XLINK, XML_TYPE):
62 aProperty.Name = PROPERTY_TYPE;
63 break;
64 case XML_ELEMENT(XLINK, XML_SHOW):
65 aProperty.Name = "Show";
66 break;
67 case XML_ELEMENT(XLINK, XML_ACTUATE):
68 aProperty.Name = "Actuate";
69 break;
70 default:
71 XMLOFF_WARN_UNKNOWN_ATTR("dbaccess", aIter.getToken(), aIter.toString());
73 if ( !aProperty.Name.isEmpty() )
75 if ( !aProperty.Value.hasValue() )
76 aProperty.Value <<= sValue;
77 rImport.addInfo(aProperty);
82 OXMLConnectionResource::~OXMLConnectionResource()
87 } // namespace dbaxml
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */