Warning, file /office/calligra/libs/textlayout/DummyDocumentLayout.h 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 C. Boemann <cbo@kogmbh.com>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef DUMMYDOCUMENTLAYOUT_H
0021 #define DUMMYDOCUMENTLAYOUT_H
0022 
0023 #include "kotextlayout_export.h"
0024 
0025 #include <QAbstractTextDocumentLayout>
0026 
0027 
0028 /**
0029  * Dummy TextLayouter that does nothing really, but without it the Table of Contents/Bibliography
0030  * can not be layout.TextLayouter
0031  * The real layout of the ToC/Bib still happens by the KoTextLayoutArea as part of
0032  * KoTextDocumentLayout of the main document
0033  *
0034  * You really shouldn't add anything to this class
0035  */
0036 
0037 class KOTEXTLAYOUT_EXPORT DummyDocumentLayout : public QAbstractTextDocumentLayout
0038 {
0039     Q_OBJECT
0040 public:
0041     /// constructor
0042     explicit DummyDocumentLayout(QTextDocument *doc);
0043     ~DummyDocumentLayout() override;
0044 
0045     /// Returns the bounding rectangle of block.
0046     QRectF blockBoundingRect(const QTextBlock & block) const override;
0047     /**
0048      * Returns the total size of the document. This is useful to display
0049      * widgets since they can use to information to update their scroll bars
0050      * correctly
0051      */
0052     QSizeF documentSize() const override;
0053 
0054     /// Draws the layout on the given painter with the given context.
0055     void draw(QPainter * painter, const QAbstractTextDocumentLayout::PaintContext & context) override;
0056 
0057     QRectF frameBoundingRect(QTextFrame*) const override;
0058 
0059     /// reimplemented DO NOT CALL - USE HITTEST IN THE ROOTAREAS INSTEAD
0060     int hitTest(const QPointF & point, Qt::HitTestAccuracy accuracy) const override;
0061 
0062     /// reimplemented to always return 1
0063     int pageCount() const override;
0064 
0065     /// reimplemented from QAbstractTextDocumentLayout
0066     void documentChanged(int position, int charsRemoved, int charsAdded) override;
0067 /*
0068 protected:
0069     /// reimplemented
0070     virtual void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int position, const QTextFormat &format);
0071     /// reimplemented
0072     virtual void positionInlineObject(QTextInlineObject item, int position, const QTextFormat &format);
0073     /// reimplemented
0074     virtual void resizeInlineObject(QTextInlineObject item, int position, const QTextFormat &format);
0075 */
0076 };
0077 
0078 #endif