LibreOffice Module dbaccess (master) 1
xmlfilter.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
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>
29
30#include <map>
31#include <memory>
32
33
34namespace dbaxml
35{
36
37using namespace ::xmloff::token;
38using namespace ::com::sun::star::uno;
39using namespace ::com::sun::star::container;
40using namespace ::com::sun::star::lang;
41using namespace ::com::sun::star::beans;
42using namespace ::com::sun::star::document;
43using namespace ::com::sun::star::text;
44using namespace ::com::sun::star::io;
45using namespace ::com::sun::star::xml::sax;
46
47
48class ODBFilter : public SvXMLImport
49{
50public:
51 typedef std::map< OUString, Sequence<PropertyValue> > TPropertyNameMap;
52private:
55 std::vector< css::beans::PropertyValue> m_aInfoSequence;
56
60 Reference<XPropertySet> m_xDataSource;
62
64 bool implImport( const Sequence< PropertyValue >& rDescriptor );
65
72 static void fillPropertyMap(const Any& _rValue,TPropertyNameMap& _rMap);
73
74public:
75 SvXMLImportContext* CreateStylesContext( bool bIsAutoStyle );
76
77protected:
78 // SvXMLImport
79 virtual SvXMLImportContext *CreateFastContext(sal_Int32 Element,
80 const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList ) override;
81
82 virtual ~ODBFilter() noexcept override;
83public:
84
85 explicit ODBFilter( const Reference< XComponentContext >& _rxContext );
86
87 // XFilter
88 virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) override;
89
91 static OUString getImplementationName_Static();
92
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;
96
97 const Reference<XPropertySet>& getDataSource() const { return m_xDataSource; }
98
100
104
108 void addInfo(const css::beans::PropertyValue& _rInfo)
109 {
110 m_aInfoSequence.push_back(_rInfo);
111 }
112
113 void setPropertyInfo();
114
115 bool isNewFormat() const { return m_bNewFormat; }
116 void setNewFormat(bool _bNewFormat) { m_bNewFormat = _bNewFormat; }
117};
118
119} // namespace dbaxml
120
121/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SetConfigurationSettings(const css::uno::Sequence< css::beans::PropertyValue > &aConfigProps) override
Definition: xmlfilter.cxx:511
Reference< XPropertySet > m_xDataSource
Definition: xmlfilter.hxx:60
virtual SvXMLImportContext * CreateFastContext(sal_Int32 Element, const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlfilter.cxx:467
const TPropertyNameMap & getQuerySettings() const
Definition: xmlfilter.hxx:99
rtl::Reference< XMLPropertySetMapper > const & GetColumnStylesPropertySetMapper() const
Definition: xmlfilter.cxx:566
TPropertyNameMap m_aTablesSettings
Definition: xmlfilter.hxx:54
bool implImport(const Sequence< PropertyValue > &rDescriptor)
Definition: xmlfilter.cxx:237
rtl::Reference< XMLPropertySetMapper > m_xTableStylesPropertySetMapper
Definition: xmlfilter.hxx:57
rtl::Reference< XMLPropertySetMapper > const & GetCellStylesPropertySetMapper() const
Definition: xmlfilter.cxx:576
virtual void SetViewSettings(const css::uno::Sequence< css::beans::PropertyValue > &aViewProps) override
Definition: xmlfilter.cxx:493
static void fillPropertyMap(const Any &_rValue, TPropertyNameMap &_rMap)
fills the map with the Properties
Definition: xmlfilter.cxx:529
rtl::Reference< XMLPropertySetMapper > m_xCellStylesPropertySetMapper
Definition: xmlfilter.hxx:59
std::vector< css::beans::PropertyValue > m_aInfoSequence
Definition: xmlfilter.hxx:55
SvXMLImportContext * CreateStylesContext(bool bIsAutoStyle)
Definition: xmlfilter.cxx:544
bool isNewFormat() const
Definition: xmlfilter.hxx:115
static OUString getImplementationName_Static()
Definition: xmlfilter.cxx:195
TPropertyNameMap m_aQuerySettings
Definition: xmlfilter.hxx:53
void setPropertyInfo()
Definition: xmlfilter.cxx:586
rtl::Reference< XMLPropertySetMapper > const & GetTableStylesPropertySetMapper() const
Definition: xmlfilter.cxx:556
rtl::Reference< XMLPropertySetMapper > m_xColumnStylesPropertySetMapper
Definition: xmlfilter.hxx:58
std::map< OUString, Sequence< PropertyValue > > TPropertyNameMap
Definition: xmlfilter.hxx:51
void addInfo(const css::beans::PropertyValue &_rInfo)
add an Info to the sequence which will be appended to the data source
Definition: xmlfilter.hxx:108
void setNewFormat(bool _bNewFormat)
Definition: xmlfilter.hxx:116
const Reference< XPropertySet > & getDataSource() const
Definition: xmlfilter.hxx:97
virtual ~ODBFilter() noexcept override
Definition: xmlfilter.cxx:189
unsigned char sal_Bool