Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / inc / rdfhelper.hxx
blobee346c499fe2c29dae9fc191670a472875ddd7ff
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/.
8 */
10 #ifndef INCLUDED_SW_INC_RDFHELPER_HXX
11 #define INCLUDED_SW_INC_RDFHELPER_HXX
13 #include <map>
15 #include <rtl/ustring.hxx>
17 #include "swdllapi.h"
19 #include <com/sun/star/uno/Reference.h>
20 #include <com/sun/star/uno/Sequence.h>
22 class SwTextNode;
24 namespace com::sun::star {
25 namespace frame {
26 class XModel;
28 namespace rdf {
29 class XDocumentMetadataAccess;
30 class XResource;
31 class XURI;
35 /// Provides access to RDF metadata on core objects.
36 class SW_DLLPUBLIC SwRDFHelper
38 public:
39 /// Gets all graph-names in RDF of a given type.
40 static css::uno::Sequence<css::uno::Reference<css::rdf::XURI>>
41 getGraphNames(const css::uno::Reference<css::rdf::XDocumentMetadataAccess>& xDocumentMetadataAccess,
42 const css::uno::Reference<css::rdf::XURI>& xType);
44 /// Gets all graph-names in RDF of a given type.
45 static css::uno::Sequence<css::uno::Reference<css::rdf::XURI>>
46 getGraphNames(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rType);
48 /// Gets all (XResource, key, value) statements in RDF graphs given the graph-names.
49 static std::map<OUString, OUString>
50 getStatements(const css::uno::Reference<css::frame::XModel>& xModel,
51 const css::uno::Sequence<css::uno::Reference<css::rdf::XURI>>& rGraphNames,
52 const css::uno::Reference<css::rdf::XResource>& xSubject);
54 /// Gets all (XResource, key, value) statements in RDF graphs of type rType.
55 static std::map<OUString, OUString>
56 getStatements(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rType,
57 const css::uno::Reference<css::rdf::XResource>& xSubject);
59 /// Add an (XResource, key, value) statement in the graph of type rType -- or if it does not exist, create a graph at rPath first.
60 static void addStatement(const css::uno::Reference<css::frame::XModel>& xModel,
61 const OUString& rType, const OUString& rPath,
62 const css::uno::Reference<css::rdf::XResource>& xSubject,
63 const OUString& rKey, const OUString& rValue);
65 /// Check if a graph of type rType exists.
66 static bool hasMetadataGraph(const css::uno::Reference<css::frame::XModel>& xModel,
67 const OUString& rType);
69 /// Remove an (XResource, key, value) statement in the graph of type rType, if it exists.
70 static void removeStatement(const css::uno::Reference<css::frame::XModel>& xModel,
71 const OUString& rType,
72 const css::uno::Reference<css::rdf::XResource>& xSubject,
73 const OUString& rKey, const OUString& rValue);
75 /// Clone all statements in the graph of type rType, if any exists, from one subject to another.
76 static void cloneStatements(const css::uno::Reference<css::frame::XModel>& xSrcModel,
77 const css::uno::Reference<css::frame::XModel>& xDstModel,
78 const OUString& rType,
79 const css::uno::Reference<css::rdf::XResource>& xSrcSubject,
80 const css::uno::Reference<css::rdf::XResource>& xDstSubject);
82 /// Remove all statements in the graph of type rType, if any exists.
83 static void clearStatements(const css::uno::Reference<css::frame::XModel>& xModel,
84 const OUString& rType,
85 const css::uno::Reference<css::rdf::XResource>& xSubject);
87 /// Gets all (rTextNode, key, value) statements in RDF graphs of type rType.
88 static std::map<OUString, OUString> getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode);
90 /// Add an (rTextNode, key, value) statement in the graph of type rType -- or if it does not exist, create a graph at rPath first.
91 static void addTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue);
93 /// Remove an (rTextNode, key, value) statement in the graph of type rType.
94 static void removeTextNodeStatement(const OUString& rType, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue);
96 /// 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.
97 static void updateTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rOldValue, const OUString& rNewValue);
101 #endif // INCLUDED_SW_INC_RDFHELPER_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */