Warning, file /office/calligra/libs/textlayout/DummyDocumentLayout.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2011 KO GmbH <cbo@kogmbh.com>
0003  * Copyright (C) 2011 C. Boemann <cbo@boemann.dk>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 
0021 #include "DummyDocumentLayout.h"
0022 
0023 #include <KoPostscriptPaintDevice.h>
0024 
0025 #include <QTextBlock>
0026 
0027 #include <TextLayoutDebug.h>
0028 
0029 // ------------------- DummyDocumentLayout --------------------
0030 DummyDocumentLayout::DummyDocumentLayout(QTextDocument *doc)
0031         : QAbstractTextDocumentLayout(doc)
0032 {
0033     setPaintDevice(new KoPostscriptPaintDevice());
0034 }
0035 
0036 DummyDocumentLayout::~DummyDocumentLayout()
0037 {
0038 }
0039 
0040 QRectF DummyDocumentLayout::blockBoundingRect(const QTextBlock &block) const
0041 {
0042     Q_UNUSED(block);
0043     return QRect();
0044 }
0045 
0046 QSizeF DummyDocumentLayout::documentSize() const
0047 {
0048     return QSizeF();
0049 }
0050 
0051 void DummyDocumentLayout::draw(QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context)
0052 {
0053     // WARNING Text shapes ask their root area directly to paint.
0054     // It saves a lot of extra traversal, that is quite costly for big
0055     // documents
0056     Q_UNUSED(painter);
0057     Q_UNUSED(context);
0058 }
0059 
0060 
0061 int DummyDocumentLayout::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const
0062 {
0063     Q_UNUSED(point);
0064     Q_UNUSED(accuracy);
0065     Q_ASSERT(false); //we should not call this method.
0066     return -1;
0067 }
0068 
0069 QRectF DummyDocumentLayout::frameBoundingRect(QTextFrame*) const
0070 {
0071     return QRectF();
0072 }
0073 
0074 int DummyDocumentLayout::pageCount() const
0075 {
0076     return 1;
0077 }
0078 
0079 void DummyDocumentLayout::documentChanged(int position, int charsRemoved, int charsAdded)
0080 {
0081     Q_UNUSED(position);
0082     Q_UNUSED(charsRemoved);
0083     Q_UNUSED(charsAdded);
0084 }
0085 
0086 /*
0087 void DummyDocumentLayout::drawInlineObject(QPainter *, const QRectF &, QTextInlineObject , int , const QTextFormat &)
0088 {
0089 }
0090 
0091 // This method is called by qt every time  QTextLine.setWidth()/setNumColumns() is called
0092 void DummyDocumentLayout::positionInlineObject(QTextInlineObject , int , const QTextFormat &)
0093 {
0094 }
0095 
0096 void DummyDocumentLayout::resizeInlineObject(QTextInlineObject , int , const QTextFormat &)
0097 {
0098 }
0099 */