cid#1607171 Data race condition
[LibreOffice.git] / dbaccess / source / filter / xml / xmlfilter.hxx
blobec776cd75f8751d50fa6f37cf248cf3e25b53ab7
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 #pragma once
22 #include <com/sun/star/container/XNamed.hpp>
23 #include <com/sun/star/document/XFilter.hpp>
24 #include <com/sun/star/document/XImporter.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/io/XActiveDataSource.hpp>
27 #include <xmloff/xmlimp.hxx>
28 #include <xmloff/xmlprmap.hxx>
30 #include <map>
31 #include <memory>
34 namespace dbaxml
37 using namespace ::xmloff::token;
38 using namespace ::com::sun::star::uno;
39 using namespace ::com::sun::star::container;
40 using namespace ::com::sun::star::lang;
41 using namespace ::com::sun::star::beans;
42 using namespace ::com::sun::star::document;
43 using namespace ::com::sun::star::text;
44 using namespace ::com::sun::star::io;
45 using namespace ::com::sun::star::xml::sax;
48 class ODBFilter : public SvXMLImport
50 public:
51 typedef std::map< OUString, Sequence<PropertyValue> > TPropertyNameMap;
52 private:
53 TPropertyNameMap m_aQuerySettings;
54 TPropertyNameMap m_aTablesSettings;
55 std::vector< css::beans::PropertyValue> m_aInfoSequence;
57 mutable rtl::Reference < XMLPropertySetMapper > m_xTableStylesPropertySetMapper;
58 mutable rtl::Reference < XMLPropertySetMapper > m_xColumnStylesPropertySetMapper;
59 mutable rtl::Reference < XMLPropertySetMapper > m_xCellStylesPropertySetMapper;
60 Reference<XPropertySet> m_xDataSource;
61 bool m_bNewFormat;
63 /// @throws RuntimeException
64 bool implImport( const Sequence< PropertyValue >& rDescriptor );
66 /** fills the map with the Properties
67 @param _rValue
68 The Any where the sequence resists in.
69 @param _rMap
70 The map to fill.
72 static void fillPropertyMap(const Any& _rValue,TPropertyNameMap& _rMap);
74 public:
75 SvXMLImportContext* CreateStylesContext( bool bIsAutoStyle );
77 protected:
78 // SvXMLImport
79 virtual SvXMLImportContext *CreateFastContext(sal_Int32 Element,
80 const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList ) override;
82 virtual ~ODBFilter() noexcept override;
83 public:
85 explicit ODBFilter( const Reference< XComponentContext >& _rxContext );
87 // XFilter
88 virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) override;
90 /// @throws css::uno::RuntimeException
91 static OUString getImplementationName_Static();
93 // helper class
94 virtual void SetViewSettings(const css::uno::Sequence<css::beans::PropertyValue>& aViewProps) override;
95 virtual void SetConfigurationSettings(const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps) override;
97 const Reference<XPropertySet>& getDataSource() const { return m_xDataSource; }
99 const TPropertyNameMap& getQuerySettings() const { return m_aQuerySettings;}
101 rtl::Reference < XMLPropertySetMapper > const & GetTableStylesPropertySetMapper() const;
102 rtl::Reference < XMLPropertySetMapper > const & GetColumnStylesPropertySetMapper() const;
103 rtl::Reference < XMLPropertySetMapper > const & GetCellStylesPropertySetMapper() const;
105 /** add an Info to the sequence which will be appended to the data source
106 @param _rInfo The property to append.
108 void addInfo(const css::beans::PropertyValue& _rInfo)
110 m_aInfoSequence.push_back(_rInfo);
113 void setPropertyInfo();
115 bool isNewFormat() const { return m_bNewFormat; }
116 void setNewFormat(bool _bNewFormat) { m_bNewFormat = _bNewFormat; }
119 } // namespace dbaxml
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */