cid#1607171 Data race condition
[LibreOffice.git] / dbaccess / source / filter / xml / xmlDatabaseDescription.cxx
bloba8168e129501498926b38e3e0e4d9544f93381ab
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 "xmlDatabaseDescription.hxx"
21 #include "xmlfilter.hxx"
22 #include <xmloff/xmltoken.hxx>
23 #include <xmloff/ProgressBarHelper.hxx>
24 #include "xmlEnums.hxx"
25 #include "xmlFileBasedDatabase.hxx"
26 #include "xmlServerDatabase.hxx"
28 namespace dbaxml
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::xml::sax;
33 OXMLDatabaseDescription::OXMLDatabaseDescription( ODBFilter& rImport ) :
34 SvXMLImportContext( rImport )
35 ,m_bFoundOne(false)
39 OXMLDatabaseDescription::~OXMLDatabaseDescription()
44 css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLDatabaseDescription::createFastChildContext(
45 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
47 SvXMLImportContext *pContext = nullptr;
49 switch( nElement & TOKEN_MASK )
51 case XML_FILE_BASED_DATABASE:
52 if ( !m_bFoundOne )
54 m_bFoundOne = true;
55 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
56 pContext = new OXMLFileBasedDatabase( GetOwnImport(), xAttrList );
58 break;
59 case XML_SERVER_DATABASE:
60 if ( !m_bFoundOne )
62 m_bFoundOne = true;
63 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
64 pContext = new OXMLServerDatabase( GetOwnImport(), xAttrList );
66 break;
69 return pContext;
72 ODBFilter& OXMLDatabaseDescription::GetOwnImport()
74 return static_cast<ODBFilter&>(GetImport());
77 } // namespace dbaxml
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */