tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / filter / xml / xmlQuery.cxx
blobb1cdd90bf1b74ebbd2a80e8e5ef3c0cfab1c9b14
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 "xmlQuery.hxx"
21 #include "xmlfilter.hxx"
22 #include <xmloff/xmltoken.hxx>
23 #include <xmloff/ProgressBarHelper.hxx>
24 #include "xmlEnums.hxx"
25 #include <strings.hxx>
26 #include <comphelper/diagnose_ex.hxx>
28 namespace dbaxml
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::beans;
32 using namespace ::com::sun::star::container;
33 using namespace ::com::sun::star::xml::sax;
36 OXMLQuery::OXMLQuery( ODBFilter& rImport
37 ,const Reference< XFastAttributeList > & _xAttrList
38 ,const css::uno::Reference< css::container::XNameAccess >& _xParentContainer
39 ) :
40 OXMLTable( rImport, _xAttrList,_xParentContainer, u"com.sun.star.sdb.CommandDefinition"_ustr )
41 ,m_bEscapeProcessing(true)
43 for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
45 switch( aIter.getToken() & TOKEN_MASK )
47 case XML_COMMAND:
48 m_sCommand = aIter.toString();
49 break;
50 case XML_ESCAPE_PROCESSING:
51 m_bEscapeProcessing = aIter.toView() == "true";
52 break;
53 default:
54 XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
59 OXMLQuery::~OXMLQuery()
64 css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLQuery::createFastChildContext(
65 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
67 css::uno::Reference< css::xml::sax::XFastContextHandler > xContext = OXMLTable::createFastChildContext(nElement,xAttrList );
68 if (!xContext)
70 switch( nElement & TOKEN_MASK )
72 case XML_UPDATE_TABLE:
74 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
75 OUString s1;
76 fillAttributes(xAttrList,s1,m_sTable,m_sSchema,m_sCatalog);
77 break;
82 return xContext;
85 void OXMLQuery::setProperties(Reference< XPropertySet > & _xProp )
87 try
89 if ( _xProp.is() )
91 OXMLTable::setProperties(_xProp);
93 _xProp->setPropertyValue(PROPERTY_COMMAND,Any(m_sCommand));
94 _xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,Any(m_bEscapeProcessing));
96 if ( !m_sTable.isEmpty() )
97 _xProp->setPropertyValue(PROPERTY_UPDATE_TABLENAME,Any(m_sTable));
98 if ( !m_sCatalog.isEmpty() )
99 _xProp->setPropertyValue(PROPERTY_UPDATE_CATALOGNAME,Any(m_sCatalog));
100 if ( !m_sSchema.isEmpty() )
101 _xProp->setPropertyValue(PROPERTY_UPDATE_SCHEMANAME,Any(m_sSchema));
103 const ODBFilter::TPropertyNameMap& rSettings = GetOwnImport().getQuerySettings();
104 ODBFilter::TPropertyNameMap::const_iterator aFind = rSettings.find(m_sName);
105 if ( aFind != rSettings.end() )
106 _xProp->setPropertyValue(PROPERTY_LAYOUTINFORMATION,Any(aFind->second));
109 catch(Exception&)
111 TOOLS_WARN_EXCEPTION( "dbaccess", "OXMLTable::EndElement");
115 } // namespace dbaxml
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */