summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/SmartTagHandler.hxx
blob: a9c07a3c8a92d111827bd0fdd46ae42988b65b31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
#ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_SMARTTAGHANDLER_HXX
#define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_SMARTTAGHANDLER_HXX

#include <vector>

#include "LoggedResources.hxx"

namespace com
{
namespace sun
{
namespace star
{
namespace rdf
{
class XDocumentMetadataAccess;
}
namespace text
{
class XTextDocument;
class XTextRange;
}
namespace uno
{
class XComponentContext;
}
}
}
}

namespace writerfilter
{
namespace dmapper
{

/// Handler for smart tags, i.e. <w:smartTag> and below.
class SmartTagHandler
    : public LoggedProperties
{
    css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
    css::uno::Reference<css::rdf::XDocumentMetadataAccess> m_xDocumentMetadataAccess;
    OUString m_aURI;
    OUString m_aElement;
    std::vector< std::pair<OUString, OUString> > m_aAttributes;

public:
    SmartTagHandler(css::uno::Reference<css::uno::XComponentContext> xComponentContext, const css::uno::Reference<css::text::XTextDocument>& xTextDocument);
    ~SmartTagHandler() override;

    void lcl_attribute(Id nId, Value& rValue) override;
    void lcl_sprm(Sprm& rSprm) override;

    void setURI(const OUString& rURI);
    void setElement(const OUString& rElement);

    /// Set m_aAttributes as RDF statements on xParagraph.
    void handle(const css::uno::Reference<css::text::XTextRange>& xParagraph);
};

} // namespace dmapper
} // namespace writerfilter

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */