[Libreoffice-commits] core.git: sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Dec 10 04:43:17 PST 2015


 sw/inc/rdfhelper.hxx             |    2 +-
 sw/source/core/doc/rdfhelper.cxx |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit da0b49f808825884f045bba6689be13d33d58a47
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Dec 10 12:13:33 2015 +0100

    sw: accept a const text node in SwRDFHelper::getTextNodeStatements()
    
    It's an implementation detail that the used UNO API needs a non-cost
    text node, even if only read methods are called on the wrapper object.
    
    Change-Id: If15eaca48339f1531fd54da3422a6b7c41eb48f7

diff --git a/sw/inc/rdfhelper.hxx b/sw/inc/rdfhelper.hxx
index edee106..bb64496 100644
--- a/sw/inc/rdfhelper.hxx
+++ b/sw/inc/rdfhelper.hxx
@@ -23,7 +23,7 @@ class SW_DLLPUBLIC SwRDFHelper
 {
 public:
     /// Gets all (rTextNode, key, value) statements in RDF graphs of type rType.
-    static std::map<OUString, OUString> getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode);
+    static std::map<OUString, OUString> getTextNodeStatements(const OUString& rType, const 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);
 };
diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx
index 70a885c..83605ed 100644
--- a/sw/source/core/doc/rdfhelper.cxx
+++ b/sw/source/core/doc/rdfhelper.cxx
@@ -22,10 +22,13 @@
 
 using namespace com::sun::star;
 
-std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode)
+std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& rType, const SwTextNode& rNode)
 {
     std::map<OUString, OUString> aRet;
 
+    // We only read the node, but CreateXParagraph() needs a non-cost one.
+    SwTextNode& rTextNode = const_cast<SwTextNode&>(rNode);
+
     uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
     uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
     uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(rTextNode.GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);


More information about the Libreoffice-commits mailing list