LibreOffice Module filter (master) 1
typedetectionimport.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/io/XInputStream.hpp>
24#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
25
26#include "xmlfilterjar.hxx"
27
28#include <map>
29#include <memory>
30#include <vector>
31#include <stack>
32
33namespace com::sun::star {
34 namespace xml::sax { class XAttributeList; }
35 namespace beans { struct PropertyValue; }
36}
37
39{
48};
49
50typedef std::map<OUString, OUString> PropertyMap;
51
52struct Node
53{
54 OUString maName;
55 PropertyMap maPropertyMap;
56};
57
58class TypeDetectionImporter : public cppu::WeakImplHelper < css::xml::sax::XDocumentHandler >
59{
60public:
62 virtual ~TypeDetectionImporter() override;
63
64 static void doImport( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference < css::io::XInputStream >& xOS,
65 std::vector< std::unique_ptr<filter_info_impl> >& rFilters );
66
67 virtual void SAL_CALL startDocument( ) override;
68 virtual void SAL_CALL endDocument( ) override;
69 virtual void SAL_CALL startElement( const OUString& aName, const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs ) override;
70 virtual void SAL_CALL endElement( const OUString& aName ) override;
71 virtual void SAL_CALL characters( const OUString& aChars ) override;
72 virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) override;
73 virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) override;
74 virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& xLocator ) override;
75
76private:
77 void fillFilterVector( std::vector< std::unique_ptr<filter_info_impl> >& rFilters );
78 std::unique_ptr<filter_info_impl> createFilterForNode( Node * pNode );
79 Node* findTypeNode( const OUString& rType );
80
81 std::stack< ImportState > maStack;
83
84 std::vector< std::unique_ptr<Node> > maFilterNodes;
85 std::vector< std::unique_ptr<Node> > maTypeNodes;
86
87 OUString maValue;
88 OUString maNodeName;
90};
91
92/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< std::unique_ptr< Node > > maFilterNodes
virtual void SAL_CALL startElement(const OUString &aName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override
void fillFilterVector(std::vector< std::unique_ptr< filter_info_impl > > &rFilters)
virtual void SAL_CALL endDocument() override
virtual void SAL_CALL endElement(const OUString &aName) override
std::unique_ptr< filter_info_impl > createFilterForNode(Node *pNode)
virtual void SAL_CALL ignorableWhitespace(const OUString &aWhitespaces) override
std::vector< std::unique_ptr< Node > > maTypeNodes
virtual ~TypeDetectionImporter() override
Node * findTypeNode(const OUString &rType)
virtual void SAL_CALL startDocument() override
std::stack< ImportState > maStack
virtual void SAL_CALL characters(const OUString &aChars) override
static void doImport(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::io::XInputStream > &xOS, std::vector< std::unique_ptr< filter_info_impl > > &rFilters)
virtual void SAL_CALL processingInstruction(const OUString &aTarget, const OUString &aData) override
OUString aName
constexpr OUStringLiteral aData
Shape IDs per cluster in DGG atom.
std::map< sal_Int32, STLPropertyMapEntry > PropertyMap
@ e_Property
std::map< OUString, OUString > PropertyMap