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
|
/* This file is part of the KDE project
* Copyright (C) 2011 KO GmbH <cbo@kogmbh.com>
* Copyright (C) 2011 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
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* 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.
*/
#include "DummyDocumentLayout.h"
#include <KoPostscriptPaintDevice.h>
#include <QTextBlock>
#include <TextLayoutDebug.h>
// ------------------- DummyDocumentLayout --------------------
DummyDocumentLayout::DummyDocumentLayout(QTextDocument *doc)
: QAbstractTextDocumentLayout(doc)
{
setPaintDevice(new KoPostscriptPaintDevice());
}
DummyDocumentLayout::~DummyDocumentLayout()
{
}
QRectF DummyDocumentLayout::blockBoundingRect(const QTextBlock &block) const
{
Q_UNUSED(block);
return QRect();
}
QSizeF DummyDocumentLayout::documentSize() const
{
return QSizeF();
}
void DummyDocumentLayout::draw(QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context)
{
// WARNING Text shapes ask their root area directly to paint.
// It saves a lot of extra traversal, that is quite costly for big
// documents
Q_UNUSED(painter);
Q_UNUSED(context);
}
int DummyDocumentLayout::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const
{
Q_UNUSED(point);
Q_UNUSED(accuracy);
Q_ASSERT(false); //we should not call this method.
return -1;
}
QRectF DummyDocumentLayout::frameBoundingRect(QTextFrame*) const
{
return QRectF();
}
int DummyDocumentLayout::pageCount() const
{
return 1;
}
void DummyDocumentLayout::documentChanged(int position, int charsRemoved, int charsAdded)
{
Q_UNUSED(position);
Q_UNUSED(charsRemoved);
Q_UNUSED(charsAdded);
}
/*
void DummyDocumentLayout::drawInlineObject(QPainter *, const QRectF &, QTextInlineObject , int , const QTextFormat &)
{
}
// This method is called by qt every time QTextLine.setWidth()/setNumColumns() is called
void DummyDocumentLayout::positionInlineObject(QTextInlineObject , int , const QTextFormat &)
{
}
void DummyDocumentLayout::resizeInlineObject(QTextInlineObject , int , const QTextFormat &)
{
}
*/
|