Commit 671ed2cd authored by Thomas Zander's avatar Thomas Zander

Fixes: loading of anchored shapes show up correctly.

Details: The KoInlineTextObjectManager was created once per shape, which is wrong as we
    require there to be only one per document.
So I use the datacenter to store the one instance and reuse that everywhere.
Also renamed the setter/getter on the KoTextDocumentLayout to have a name thats
consistent with the class name.

svn path=/trunk/koffice/; revision=940038
parent 6189797b
/* This file is part of the KDE project
Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
Copyright (C) 2006 Thomas Zander <zander@kde.org>
Copyright (C) 2006, 2009 Thomas Zander <zander@kde.org>
Copyright (C) 2008 Casper Boemann <cbr@boemann.dk>
Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
......@@ -25,6 +25,7 @@
#define KODATACENTER_H
#include <QtGlobal>
#include "flake_export.h"
class KoShapeSavingContext;
class KoStore;
......@@ -36,7 +37,7 @@ class KoXmlWriter;
* This abstraction is done so that shapes can get access to any possible type of data center.
* The KoShapeControillerBase has a method that returns a map of data centers
*/
class KoDataCenter
class FLAKE_EXPORT KoDataCenter
{
public:
KoDataCenter() { }
......@@ -44,11 +45,13 @@ public:
/**
* Load any remaining binary blobs needed
* @returns false if an error occured, which typically cancels the load.
*/
virtual bool completeLoading(KoStore *store) = 0;
/**
* Save any remaining binary blobs
* @returns false if an error occured, which typically cancels the save.
*/
virtual bool completeSaving(KoStore *store, KoXmlWriter * manifestWriter, KoShapeSavingContext * context) = 0;
};
......
......@@ -201,6 +201,7 @@ public:
* Save the data centers
*
* This calls KoDataCenter::completeSaving()
* @returns false if an error occured, which typically cancels the save.
*/
bool saveDataCenter(KoStore *store, KoXmlWriter* manifestWriter);
......
......@@ -22,9 +22,10 @@
#include "KoInlineObject.h"
#include "KoBookmarkManager.h"
#include "KoVariableManager.h"
#include "kotext_export.h"
#include <KoDataCenter.h>
// Qt + kde
#include <QHash>
#include <QTextCharFormat>
......@@ -40,7 +41,7 @@ class QAction;
* KoTextDocumentLayout for that specific textDocument, your inline text object will get painted
* properly.
*/
class KOTEXT_EXPORT KoInlineTextObjectManager : public QObject
class KOTEXT_EXPORT KoInlineTextObjectManager : public QObject , public KoDataCenter
{
Q_OBJECT
// TODO, when to delete the inlineObject s
......@@ -151,6 +152,11 @@ private:
InlineInstanceId = 577297549 // If you change this, don't forget to change KoCharacterStyle.h
};
/// reimplemented from KoDataCenter
virtual bool completeLoading(KoStore*) {return true;}
/// reimplemented from KoDataCenter
virtual bool completeSaving(KoStore *, KoXmlWriter *, KoShapeSavingContext *) {return true;}
QHash<int, KoInlineObject*> m_objects;
QList<KoInlineObject*> m_listeners; // holds objects also in m_objects, but which want propertyChanges
int m_lastObjectId;
......@@ -160,4 +166,5 @@ private:
KoBookmarkManager m_bookmarkManager;
};
Q_DECLARE_METATYPE(KoInlineTextObjectManager*)
#endif
......@@ -119,7 +119,7 @@ QString KoTextDebug::inlineObjectAttributes(const QTextCharFormat &textFormat)
if (textFormat.objectType() == QTextFormat::UserObject + 1) {
KoTextDocumentLayout *lay = document ? dynamic_cast<KoTextDocumentLayout *>(document->documentLayout()) : 0;
KoInlineTextObjectManager *inlineObjectManager = lay ? lay->inlineObjectTextManager() : 0;
KoInlineTextObjectManager *inlineObjectManager = lay ? lay->inlineTextObjectManager() : 0;
KoInlineObject *inlineObject = inlineObjectManager->inlineTextObject(textFormat);
if (KoBookmark *bookmark = dynamic_cast<KoBookmark *>(inlineObject)) {
if (bookmark->type() == KoBookmark::SinglePosition) {
......@@ -622,7 +622,7 @@ void KoTextDebug::dumpFragment(const QTextFragment &fragment)
KoTextDocumentLayout *lay = document ? dynamic_cast<KoTextDocumentLayout *>(document->documentLayout()) : 0;
QTextCharFormat charFormat = fragment.charFormat();
KoInlineObject *inlineObject = lay ? lay->inlineObjectTextManager()->inlineTextObject(charFormat) : 0;
KoInlineObject *inlineObject = lay ? lay->inlineTextObjectManager()->inlineTextObject(charFormat) : 0;
if (inlineObject) {
QString cf = inlineObjectAttributes(charFormat);
......
......@@ -34,9 +34,10 @@
const QUrl KoTextDocument::StyleManagerURL = QUrl("kotext://stylemanager");
const QUrl KoTextDocument::ListsURL = QUrl("kotext://lists");
const QUrl KoTextDocument::InlineObjectTextManagerURL = QUrl("kotext://inlineObjectTextManager");
KoTextDocument::KoTextDocument(QTextDocument *document)
: m_document(document)
: m_document(document)
{
Q_ASSERT(m_document);
}
......@@ -63,6 +64,17 @@ void KoTextDocument::setStyleManager(KoStyleManager *sm)
m_document->addResource(KoTextDocument::StyleManager, StyleManagerURL, v);
}
void KoTextDocument::setInlineTextObjectManager(KoInlineTextObjectManager *manager)
{
QVariant v;
v.setValue(manager);
m_document->addResource(KoTextDocument::InlineTextManager, InlineObjectTextManagerURL, v);
KoTextDocumentLayout *lay = dynamic_cast<KoTextDocumentLayout*>(m_document->documentLayout());
if (lay)
lay->setInlineTextObjectManager(manager);
}
KoStyleManager *KoTextDocument::styleManager() const
{
QVariant resource = m_document->resource(KoTextDocument::StyleManager, StyleManagerURL);
......@@ -76,6 +88,7 @@ void KoTextDocument::setLists(const QList<KoList *> &lists)
m_document->addResource(KoTextDocument::Lists, ListsURL, v);
}
QList<KoList *> KoTextDocument::lists() const
{
QVariant resource = m_document->resource(KoTextDocument::Lists, ListsURL);
......@@ -129,8 +142,7 @@ void KoTextDocument::clearText()
KoInlineTextObjectManager *KoTextDocument::inlineTextObjectManager() const
{
KoTextDocumentLayout *lay = dynamic_cast<KoTextDocumentLayout*>(m_document->documentLayout());
if (lay)
return lay->inlineObjectTextManager();
return 0;
QVariant resource = m_document->resource(KoTextDocument::InlineTextManager,
InlineObjectTextManagerURL);
return resource.value<KoInlineTextObjectManager *>();
}
......@@ -77,6 +77,9 @@ public:
/// Returns the KoInlineTextObjectManager
KoInlineTextObjectManager *inlineTextObjectManager() const;
/// Set the KoInlineTextObjectManager
void setInlineTextObjectManager(KoInlineTextObjectManager *manager);
/**
* Clears the text in the document. Unlike QTextDocument::clear(), this
* function does not clear the resources of the QTextDocument.
......@@ -86,10 +89,12 @@ public:
/// Enum (type) used to add resources using QTextDocument::addResource()
enum ResourceType {
StyleManager = QTextDocument::UserResource,
Lists
Lists,
InlineTextManager
};
static const QUrl StyleManagerURL;
static const QUrl ListsURL;
static const QUrl InlineObjectTextManagerURL;
private:
QTextDocument *m_document;
......
......@@ -155,12 +155,12 @@ void KoTextDocumentLayout::addShape(KoShape *shape)
}
}
void KoTextDocumentLayout::setInlineObjectTextManager(KoInlineTextObjectManager *iom)
void KoTextDocumentLayout::setInlineTextObjectManager(KoInlineTextObjectManager *iom)
{
d->inlineTextObjectManager = iom;
}
KoInlineTextObjectManager *KoTextDocumentLayout::inlineObjectTextManager()
KoInlineTextObjectManager *KoTextDocumentLayout::inlineTextObjectManager()
{
return d->inlineTextObjectManager;
}
......
......@@ -66,9 +66,10 @@ public:
/**
* Register the manager for inline objects which is needed to notify variables of layout changes.
*/
void setInlineObjectTextManager(KoInlineTextObjectManager *iom);
void setInlineTextObjectManager(KoInlineTextObjectManager *manager);
/// return the currently set manager, or 0 if none is set.
KoInlineTextObjectManager *inlineObjectTextManager();
KoInlineTextObjectManager *inlineTextObjectManager();
/// Returns the bounding rectangle of block.
virtual QRectF blockBoundingRect(const QTextBlock & block) const;
......
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
*
* This library is free software; you can redistribute it and/or
......@@ -395,8 +395,8 @@ void KoTextSelectionHandler::insertInlineObject(KoInlineObject *inliner)
emit startMacro(i18n("Insert"));
KoTextDocumentLayout *layout = dynamic_cast<KoTextDocumentLayout*>(d->textShapeData->document()->documentLayout());
Q_ASSERT(layout);
Q_ASSERT(layout->inlineObjectTextManager());
layout->inlineObjectTextManager()->insertInlineObject(*d->caret, inliner);
Q_ASSERT(layout->inlineTextObjectManager());
layout->inlineTextObjectManager()->insertInlineObject(*d->caret, inliner);
emit stopMacro();
}
......@@ -493,9 +493,9 @@ bool KoTextSelectionHandler::insertIndexMarker()
emit startMacro(i18n("Insert Index"));
KoTextDocumentLayout *layout = dynamic_cast<KoTextDocumentLayout*>(d->textShapeData->document()->documentLayout());
Q_ASSERT(layout);
Q_ASSERT(layout->inlineObjectTextManager());
Q_ASSERT(layout->inlineTextObjectManager());
KoTextLocator *tl = new KoTextLocator();
layout->inlineObjectTextManager()->insertInlineObject(*d->caret, tl);
layout->inlineTextObjectManager()->insertInlineObject(*d->caret, tl);
emit stopMacro();
return true;
}
......@@ -508,7 +508,7 @@ void KoTextSelectionHandler::addBookmark(const QString &name)
KoTextDocumentLayout *layout = dynamic_cast<KoTextDocumentLayout*>(d->textShapeData->document()->documentLayout());
Q_ASSERT(layout);
Q_ASSERT(layout->inlineObjectTextManager());
Q_ASSERT(layout->inlineTextObjectManager());
if (d->caret->hasSelection()) {
startPos = d->caret->selectionStart();
endPos = d->caret->selectionEnd();
......@@ -518,14 +518,14 @@ void KoTextSelectionHandler::addBookmark(const QString &name)
KoBookmark *endBookmark = new KoBookmark(name, document);
bookmark->setType(KoBookmark::StartBookmark);
endBookmark->setType(KoBookmark::EndBookmark);
layout->inlineObjectTextManager()->insertInlineObject(*d->caret, endBookmark);
layout->inlineTextObjectManager()->insertInlineObject(*d->caret, endBookmark);
bookmark->setEndBookmark(endBookmark);
d->caret->setPosition(startPos);
} else
bookmark->setType(KoBookmark::SinglePosition);
// TODO the macro & undo things
emit startMacro(i18n("Add Bookmark"));
layout->inlineObjectTextManager()->insertInlineObject(*d->caret, bookmark);
layout->inlineTextObjectManager()->insertInlineObject(*d->caret, bookmark);
emit stopMacro();
if (startPos != -1) {
// TODO repaint selection properly
......
/* This file is part of the KDE project
* Copyright (C) 2004-2006 David Faure <faure@kde.org>
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2007,2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Sebastian Sauer <mail@dipe.org>
* Copyright (C) 2007 Pierre Ducroquet <pinaraf@gmail.com>
* Copyright (C) 2007-2009 Thorsten Zachmann <zachmann@kde.org>
......@@ -201,7 +201,7 @@ void KoTextLoader::loadBody(const KoXmlElement& bodyElem, QTextCursor& cursor)
if (var) {
KoTextDocumentLayout *layout = dynamic_cast<KoTextDocumentLayout*>(cursor.block().document()->documentLayout());
if (layout) {
KoInlineTextObjectManager *textObjectManager = layout->inlineObjectTextManager();
KoInlineTextObjectManager *textObjectManager = layout->inlineTextObjectManager();
if (textObjectManager) {
KoVariableManager *varManager = textObjectManager->variableManager();
if (varManager) {
......@@ -483,7 +483,7 @@ void KoTextLoader::loadNote(const KoXmlElement& noteElem, QTextCursor& cursor)
if (layout) {
KoInlineNote *note = new KoInlineNote(KoInlineNote::Footnote);
if (note->loadOdf(noteElem)) {
KoInlineTextObjectManager *textObjectManager = layout->inlineObjectTextManager();
KoInlineTextObjectManager *textObjectManager = layout->inlineTextObjectManager();
textObjectManager->insertInlineObject(cursor, note);
} else {
kDebug(32500) << "Error while loading the note !";
......@@ -617,7 +617,7 @@ void KoTextLoader::loadSpan(const KoXmlElement& element, QTextCursor& cursor, bo
KoTextDocumentLayout *layout = dynamic_cast<KoTextDocumentLayout*>(cursor.block().document()->documentLayout());
if (layout) {
const QTextDocument *document = cursor.block().document();
KoInlineTextObjectManager *textObjectManager = layout->inlineObjectTextManager();
KoInlineTextObjectManager *textObjectManager = layout->inlineTextObjectManager();
KoBookmark *bookmark = new KoBookmark(bookmarkName, document);
if (localName == "bookmark")
......@@ -644,7 +644,7 @@ void KoTextLoader::loadSpan(const KoXmlElement& element, QTextCursor& cursor, bo
if (var) {
KoTextDocumentLayout *layout = dynamic_cast<KoTextDocumentLayout*>(cursor.block().document()->documentLayout());
if (layout) {
KoInlineTextObjectManager *textObjectManager = layout->inlineObjectTextManager();
KoInlineTextObjectManager *textObjectManager = layout->inlineTextObjectManager();
if (textObjectManager) {
KoVariableManager *varManager = textObjectManager->variableManager();
if (varManager) {
......@@ -692,7 +692,7 @@ void KoTextLoader::loadTable(const KoXmlElement& tableElem, QTextCursor& cursor)
anchor->loadOdfFromShape(tableElem);
d->textSharedData->shapeInserted(shape);
KoInlineTextObjectManager *textObjectManager = layout->inlineObjectTextManager();
KoInlineTextObjectManager *textObjectManager = layout->inlineTextObjectManager();
if (textObjectManager) {
textObjectManager->insertInlineObject(cursor, anchor);
}
......@@ -717,7 +717,7 @@ void KoTextLoader::loadShape(const KoXmlElement& element, QTextCursor& cursor)
KoTextDocumentLayout *layout = dynamic_cast<KoTextDocumentLayout*>(cursor.block().document()->documentLayout());
if (layout) {
KoInlineTextObjectManager *textObjectManager = layout->inlineObjectTextManager();
KoInlineTextObjectManager *textObjectManager = layout->inlineTextObjectManager();
if (textObjectManager) {
textObjectManager->insertInlineObject(cursor, anchor);
}
......
......@@ -189,7 +189,7 @@ void KoTextWriter::saveParagraph(const QTextBlock &block, int from, int to)
break;
if (currentFragment.isValid()) {
QTextCharFormat charFormat = currentFragment.charFormat();
KoInlineObject *inlineObject = m_layout->inlineObjectTextManager()->inlineTextObject(charFormat);
KoInlineObject *inlineObject = m_layout->inlineTextObjectManager()->inlineTextObject(charFormat);
if (currentFragment.length() == 1 && inlineObject
&& currentFragment.text()[0].unicode() == QChar::ObjectReplacementCharacter) {
inlineObject->saveOdf(m_context);
......@@ -227,7 +227,7 @@ void KoTextWriter::write(QTextDocument *document, int from, int to)
m_styleManager = KoTextDocument(document).styleManager();
m_layout = dynamic_cast<KoTextDocumentLayout*>(document->documentLayout());
Q_ASSERT(m_layout);
Q_ASSERT(m_layout->inlineObjectTextManager());
Q_ASSERT(m_layout->inlineTextObjectManager());
QTextBlock block = document->findBlock(from);
KoTextDocument textDocument(document);
......
......@@ -716,7 +716,7 @@ QTextDocument *TestLoading::documentFromOdt(const QString &odt)
QTextDocument *document = new QTextDocument;
textShapeData->setDocument(document, false /* ownership */);
KoTextDocumentLayout *layout = new KoTextDocumentLayout(textShapeData->document());
layout->setInlineObjectTextManager(new KoInlineTextObjectManager(layout)); // required while saving
layout->setInlineTextObjectManager(new KoInlineTextObjectManager(layout)); // required while saving
KoTextDocument(document).setStyleManager(styleManager);
textShapeData->document()->setDocumentLayout(layout);
......@@ -769,7 +769,7 @@ QString TestLoading::documentToOdt(QTextDocument *document)
// Setup layout and managers just like kotext
KoTextDocumentLayout *layout = new KoTextDocumentLayout(textShapeData->document());
textShapeData->document()->setDocumentLayout(layout);
layout->setInlineObjectTextManager(new KoInlineTextObjectManager(layout)); // required while saving
layout->setInlineTextObjectManager(new KoInlineTextObjectManager(layout)); // required while saving
KoStyleManager *styleManager = new KoStyleManager;
KoTextDocument(textShapeData->document()).setStyleManager(styleManager);
}
......
......@@ -1331,7 +1331,7 @@ qreal Layout::inlineCharHeight(const QTextFragment &fragment)
qreal Layout::findFootnote(const QTextLine &line, int *oldLength)
{
if (m_parent->inlineObjectTextManager() == 0)
if (m_parent->inlineTextObjectManager() == 0)
return 0;
Q_ASSERT(oldLength);
QString text = m_block.text();
......@@ -1341,7 +1341,7 @@ qreal Layout::findFootnote(const QTextLine &line, int *oldLength)
QTextCursor c1(m_block);
c1.setPosition(m_block.position() + pos);
c1.setPosition(c1.position() + 1, QTextCursor::KeepAnchor);
KoInlineNote *note = dynamic_cast<KoInlineNote*>(m_parent->inlineObjectTextManager()->inlineTextObject(c1));
KoInlineNote *note = dynamic_cast<KoInlineNote*>(m_parent->inlineTextObjectManager()->inlineTextObject(c1));
if (note && note->type() == KoInlineNote::Footnote) {
QTextCursor cursor(m_textShape->footnoteDocument());
#if QT_VERSION >= KDE_MAKE_VERSION(4,5,0)
......
......@@ -73,7 +73,7 @@ struct Finalizer {
#include <kdebug.h>
TextShape::TextShape()
TextShape::TextShape(KoInlineTextObjectManager *inlineTextObjectManager)
: KoShapeContainer(new KoTextShapeContainerModel())
, KoFrameShape(KoXmlNS::draw, "text-box")
, m_footnotes(0)
......@@ -87,7 +87,7 @@ TextShape::TextShape()
lay->addShape(this);
m_textShapeData->document()->setDocumentLayout(lay);
lay->setInlineObjectTextManager(new KoInlineTextObjectManager(lay));
KoTextDocument(m_textShapeData->document()).setInlineTextObjectManager(inlineTextObjectManager);
setCollisionDetection(true);
lay->connect(m_textShapeData, SIGNAL(relayout()), SLOT(scheduleLayout()));
......@@ -307,6 +307,8 @@ void TextShape::init(const QMap<QString, KoDataCenter *> & dataCenterMap)
{
KoStyleManager *styleManager = dynamic_cast<KoStyleManager *>(dataCenterMap["StyleManager"]);
KoTextDocument(m_textShapeData->document()).setStyleManager(styleManager);
KoInlineTextObjectManager *tom = dynamic_cast<KoInlineTextObjectManager *>(dataCenterMap["InlineTextObjectManager"]);
KoTextDocument(m_textShapeData->document()).setInlineTextObjectManager(tom);
}
QTextDocument *TextShape::footnoteDocument()
......
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
......@@ -32,6 +32,8 @@
#define TextShape_SHAPEID "TextShapeID"
class KoInlineTextObjectManager;
/**
* A text shape.
* The Text shape is capable of drawing structured text.
......@@ -40,7 +42,7 @@
class TextShape : public KoShapeContainer, public KoFrameShape
{
public:
TextShape();
TextShape(KoInlineTextObjectManager *inlineTextObjectManager);
virtual ~TextShape();
/// reimplemented
......
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2006-2007,2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
......@@ -28,9 +28,11 @@
#include <KoTextShapeData.h>
#include <KoXmlNS.h>
#include <KoStyleManager.h>
#include <KoInlineTextObjectManager.h>
TextShapeFactory::TextShapeFactory(QObject *parent)
: KoShapeFactory(parent, TextShape_SHAPEID, i18n("Text"))
: KoShapeFactory(parent, TextShape_SHAPEID, i18n("Text")),
m_inlineTextObjectManager(0)
{
setToolTip(i18n("A shape that shows text"));
setOdfElementNames(KoXmlNS::draw, QStringList("text-box"));
......@@ -48,19 +50,15 @@ TextShapeFactory::TextShapeFactory(QObject *parent)
KoShape *TextShapeFactory::createDefaultShape() const
{
TextShape *text = new TextShape();
TextShape *text = new TextShape(m_inlineTextObjectManager);
return text;
}
KoShape *TextShapeFactory::createShape(const KoProperties * params) const
{
TextShape *shape = new TextShape();
TextShape *shape = new TextShape(m_inlineTextObjectManager);
shape->setSize(QSizeF(300, 200));
shape->setDemoText(params->boolProperty("demo"));
shape->addConnectionPoint(QPointF(0, 0));
shape->addConnectionPoint(QPointF(150, 100));
shape->addConnectionPoint(QPointF(0, 200));
shape->addConnectionPoint(QPointF(300, 200));
return shape;
}
......@@ -72,7 +70,8 @@ bool TextShapeFactory::supports(const KoXmlElement & e) const
void TextShapeFactory::populateDataCenterMap(QMap<QString, KoDataCenter *> & dataCenterMap)
{
dataCenterMap["StyleManager"] = new KoStyleManager();
m_inlineTextObjectManager = new KoInlineTextObjectManager(this);
dataCenterMap["InlineTextObjectManager"] = m_inlineTextObjectManager;
}
#include "TextShapeFactory.moc"
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006, 2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
......@@ -24,6 +24,7 @@
#include <KoShapeFactory.h>
class KoShape;
class KoInlineTextObjectManager;
class TextShapeFactory : public KoShapeFactory
{
......@@ -38,6 +39,9 @@ public:
KoShape *createShape(const KoProperties * params) const;
virtual bool supports(const KoXmlElement & e) const;
virtual void populateDataCenterMap(QMap<QString, KoDataCenter *> & dataCenterMap);
private:
KoInlineTextObjectManager *m_inlineTextObjectManager;
};
#endif
......@@ -934,7 +934,7 @@ void TextTool::keyPressEvent(QKeyEvent *event)
fn->setLabel("1");
KoTextDocumentLayout *lay = dynamic_cast<KoTextDocumentLayout*>(m_textShapeData->document()->documentLayout());
Q_ASSERT(lay);
lay->inlineObjectTextManager()->insertInlineObject(m_caret, fn);
lay->inlineTextObjectManager()->insertInlineObject(m_caret, fn);
}
#endif
else if ((event->modifiers() & (Qt::ControlModifier | Qt::AltModifier)) || event->text().length() == 0) {
......@@ -1872,6 +1872,7 @@ void TextTool::debugTextDocument()
foreach (QTextCharFormat cf, inlineCharacters) {
KoInlineObject *object= inlineManager->inlineTextObject(cf);
kDebug(32500) << "At pos:" << cf.intProperty(CHARPOSITION) << object;
// kDebug(32500) << "-> id:" << cf.intProperty(577297549);
}
QTextList *list = block.textList();
if (list) {
......
......@@ -95,7 +95,9 @@ private:
class MockTextShape : public TextShape
{
public:
MockTextShape() {
MockTextShape()
: TextShape(0)
{
layout = dynamic_cast<KoTextDocumentLayout*>(textShapeData()->document()->documentLayout());
}
void paint(QPainter &painter, const KoViewConverter &converter) {
......
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