tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / filter / xml / xmlLogin.cxx
bloba4519b26e7a98b27230429692f425225aa114dcd
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 "xmlLogin.hxx"
21 #include "xmlfilter.hxx"
22 #include <xmloff/xmltoken.hxx>
23 #include <strings.hxx>
24 #include <comphelper/diagnose_ex.hxx>
25 #include <com/sun/star/sdbc/XDataSource.hpp>
27 namespace dbaxml
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::sdbc;
31 using namespace ::com::sun::star::xml::sax;
33 OXMLLogin::OXMLLogin( ODBFilter& rImport,
34 const Reference< XFastAttributeList > & _xAttrList ) :
35 SvXMLImportContext( rImport )
37 Reference<XPropertySet> xDataSource(rImport.getDataSource());
39 bool bUserFound = false;
40 if (!xDataSource.is())
41 return;
43 for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
45 try
47 switch( aIter.getToken() & TOKEN_MASK )
49 case XML_USER_NAME:
50 if ( !bUserFound )
52 bUserFound = true;
53 try
55 xDataSource->setPropertyValue(PROPERTY_USER,Any(aIter.toString()));
57 catch(const Exception&)
59 DBG_UNHANDLED_EXCEPTION("dbaccess");
62 break;
63 case XML_IS_PASSWORD_REQUIRED:
64 try
66 xDataSource->setPropertyValue(PROPERTY_ISPASSWORDREQUIRED,Any(IsXMLToken(aIter, XML_TRUE)));
68 catch(const Exception&)
70 DBG_UNHANDLED_EXCEPTION("dbaccess");
72 break;
73 case XML_USE_SYSTEM_USER:
74 if ( !bUserFound )
76 bUserFound = true;
77 PropertyValue aProperty;
78 aProperty.Name = "UseSystemUser";
79 aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
80 rImport.addInfo(aProperty);
82 break;
83 case XML_LOGIN_TIMEOUT:
84 try
86 Reference< XDataSource>(xDataSource,UNO_QUERY_THROW)->setLoginTimeout(aIter.toInt32());
88 catch(const Exception&)
90 DBG_UNHANDLED_EXCEPTION("dbaccess");
92 break;
93 default:
94 XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
97 catch(const Exception&)
99 DBG_UNHANDLED_EXCEPTION("dbaccess");
104 OXMLLogin::~OXMLLogin()
109 } // namespace dbaxml
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */