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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/* -*- 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_SW_INC_RDFHELPER_HXX
#define INCLUDED_SW_INC_RDFHELPER_HXX
#include <map>
#include <rtl/ustring.hxx>
#include "swdllapi.h"
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
class SwTextNode;
namespace com { namespace sun { namespace star {
namespace frame {
class XModel;
}
namespace rdf {
class XDocumentMetadataAccess;
class XResource;
class XURI;
}
}}}
/// Provides access to RDF metadata on core objects.
class SW_DLLPUBLIC SwRDFHelper
{
public:
/// Gets all graph-names in RDF of a given type.
static css::uno::Sequence<css::uno::Reference<css::rdf::XURI>>
getGraphNames(const css::uno::Reference<css::rdf::XDocumentMetadataAccess>& xDocumentMetadataAccess,
const css::uno::Reference<css::rdf::XURI>& xType);
/// Gets all graph-names in RDF of a given type.
static css::uno::Sequence<css::uno::Reference<css::rdf::XURI>>
getGraphNames(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rType);
/// Gets all (XResource, key, value) statements in RDF graphs given the graph-names.
static std::map<OUString, OUString>
getStatements(const css::uno::Reference<css::frame::XModel>& xModel,
const css::uno::Sequence<css::uno::Reference<css::rdf::XURI>>& rGraphNames,
const css::uno::Reference<css::rdf::XResource>& xSubject);
/// Gets all (XResource, key, value) statements in RDF graphs of type rType.
static std::map<OUString, OUString>
getStatements(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rType,
const css::uno::Reference<css::rdf::XResource>& xSubject);
/// Add an (XResource, key, value) statement in the graph of type rType -- or if it does not exist, create a graph at rPath first.
static void addStatement(const css::uno::Reference<css::frame::XModel>& xModel,
const OUString& rType, const OUString& rPath,
const css::uno::Reference<css::rdf::XResource>& xSubject,
const OUString& rKey, const OUString& rValue);
/// Check if a graph of type rType exists.
static bool hasMetadataGraph(const css::uno::Reference<css::frame::XModel>& xModel,
const OUString& rType);
/// Remove an (XResource, key, value) statement in the graph of type rType, if it exists.
static void removeStatement(const css::uno::Reference<css::frame::XModel>& xModel,
const OUString& rType,
const css::uno::Reference<css::rdf::XResource>& xSubject,
const OUString& rKey, const OUString& rValue);
/// Clone all statements in the graph of type rType, if any exists, from one subject to another.
static void cloneStatements(const css::uno::Reference<css::frame::XModel>& xSrcModel,
const css::uno::Reference<css::frame::XModel>& xDstModel,
const OUString& rType,
const css::uno::Reference<css::rdf::XResource>& xSrcSubject,
const css::uno::Reference<css::rdf::XResource>& xDstSubject);
/// Remove all statements in the graph of type rType, if any exists.
static void clearStatements(const css::uno::Reference<css::frame::XModel>& xModel,
const OUString& rType,
const css::uno::Reference<css::rdf::XResource>& xSubject);
/// Gets all (rTextNode, key, value) statements in RDF graphs of type rType.
static std::map<OUString, OUString> getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode);
/// Add an (rTextNode, key, value) statement in the graph of type rType -- or if it does not exist, create a graph at rPath first.
static void addTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue);
/// Remove an (rTextNode, key, value) statement in the graph of type rType.
static void removeTextNodeStatement(const OUString& rType, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue);
/// Update an (rTextNode, key, value) statement in the graph of type rType from old value to new. Creates the graph at rPath if doesn't exist.
static void updateTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rOldValue, const OUString& rNewValue);
};
#endif // INCLUDED_SW_INC_RDFHELPER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|