Brush over KoTextInlineRdf (make methods const where possible, cleanup of includes)

parent 6d7cccbc
/* This file is part of the KDE project
Copyright (C) 2010 KO GmbH <ben.martin@kogmbh.com>
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
......@@ -15,30 +15,27 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
Boston, MA 02110-1301, USA.
*/
#include "KoTextInlineRdf.h"
// lib
#include "opendocument/KoTextSharedSavingData.h"
#include <KoShapeSavingContext.h>
#include <KoXmlReader.h>
#include <KoXmlWriter.h>
#include <KoXmlNS.h>
#include <KoElementReference.h>
#include "styles/KoCharacterStyle.h"
#include "KoBookmark.h"
#include "KoAnnotation.h"
#include "KoTextMeta.h"
#include "KoTextEditor.h"
#include "KoTextDocument.h"
#include "KoTextBlockData.h"
#include "styles/KoCharacterStyle.h"
#include "KoTextEditor.h"
// komain
#include <KoShapeSavingContext.h>
#include <KoXmlWriter.h>
#include <KoXmlNS.h>
#include <KoElementReference.h>
// KDE
#include <kdebug.h>
// Qt
#include <QTextCursor>
#include <QUuid>
#include <QTextDocument>
......@@ -178,7 +175,7 @@ bool KoTextInlineRdf::loadOdf(const KoXmlElement &e)
return true;
}
bool KoTextInlineRdf::saveOdf(KoShapeSavingContext &context, KoXmlWriter *writer, KoElementReference id)
bool KoTextInlineRdf::saveOdf(KoShapeSavingContext &context, KoXmlWriter *writer, KoElementReference id) const
{
kDebug(30015) << " this:" << (void*)this << " xmlid:" << d->id << "passed id" << id.toString();
QString oldID = d->id;
......@@ -216,17 +213,17 @@ QString KoTextInlineRdf::createXmlId()
return ref.toString();
}
QString KoTextInlineRdf::subject()
QString KoTextInlineRdf::subject() const
{
return d->subject;
}
QString KoTextInlineRdf::predicate()
QString KoTextInlineRdf::predicate() const
{
return d->predicate;
}
QPair<int, int> KoTextInlineRdf::findExtent()
QPair<int, int> KoTextInlineRdf::findExtent() const
{
if (d->bookmark && d->document) {
return QPair<int, int>(d->bookmark.data()->rangeStart(), d->bookmark.data()->rangeEnd());
......@@ -252,7 +249,7 @@ QPair<int, int> KoTextInlineRdf::findExtent()
return QPair<int, int>(0, 0);
}
QString KoTextInlineRdf::object()
QString KoTextInlineRdf::object() const
{
if (d->isObjectAttributeUsed) {
return d->object;
......@@ -288,12 +285,12 @@ QString KoTextInlineRdf::object()
return d->block.text();
}
int KoTextInlineRdf::sopranoObjectType()
int KoTextInlineRdf::sopranoObjectType() const
{
return d->sopranoObjectType;
}
QString KoTextInlineRdf::xmlId()
QString KoTextInlineRdf::xmlId() const
{
return d->id;
}
......
......@@ -14,17 +14,17 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
Boston, MA 02110-1301, USA.
*/
#ifndef KO_TEXT_INLINE_RDF_H
#define KO_TEXT_INLINE_RDF_H
#include "kotext_export.h"
// komain
#include <KoXmlReaderForward.h>
#include <KoElementReference.h>
#include <QTextBlockUserData>
// Qt
#include <QTextTableCell>
class KoXmlWriter;
......@@ -32,9 +32,6 @@ class KoShapeSavingContext;
class KoBookmark;
class KoAnnotation;
class KoTextMeta;
class KoTextInlineRdf;
class RdfSemanticItem;
class RdfFoaF;
class KoTextEditor;
/**
......@@ -73,7 +70,6 @@ class KoTextEditor;
*/
class KOTEXT_EXPORT KoTextInlineRdf : public QObject
{
Q_OBJECT
public:
......@@ -103,37 +99,37 @@ public:
static void attach(KoTextInlineRdf *inlineRdf, QTextCursor &cursor);
bool loadOdf(const KoXmlElement &element);
bool saveOdf(KoShapeSavingContext &context, KoXmlWriter *writer, KoElementReference id = KoElementReference());
bool saveOdf(KoShapeSavingContext &context, KoXmlWriter *writer, KoElementReference id = KoElementReference()) const;
/**
* Get the RDF subject for this inline RDF
*/
QString subject();
QString subject() const;
/**
* Get the RDF predicate for this inline RDF
*/
QString predicate();
QString predicate() const;
/**
* Get the RDF object for this inline RDF
*/
QString object();
QString object() const;
/**
* Get the type of RDF node (bnode, literal, uri etc) for this inline RDF
*/
int sopranoObjectType();
int sopranoObjectType() const;
/**
* Because RDF is linked to the xml id attribute of elements in
* content.xml the xml:id attribute that was read from the
* content.xml file is available here
*/
QString xmlId();
QString xmlId() const;
/**
* Find the start and end position of this inline RDF object in the
* document.
*/
QPair<int, int> findExtent();
QPair<int, int> findExtent() const;
/**
......@@ -144,7 +140,7 @@ public:
/**
* Create a new and unique xml:id
*/
QString createXmlId();
static QString createXmlId();
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment