Warning, file /office/calligra/libs/textlayout/KoTextLayoutTableArea.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 KOTEXTLAYOUTTABLEAREA_H
0021 #define KOTEXTLAYOUTTABLEAREA_H
0022 
0023 #include "kotextlayout_export.h"
0024 
0025 #include "KoTextLayoutArea.h"
0026 
0027 #include <QVector>
0028 
0029 class KoPointedAt;
0030 class TableIterator;
0031 class QTextTableCell;
0032 class QLineF;
0033 
0034 /**
0035  * This class represent a (full width) piece of a table
0036  */
0037 class KOTEXTLAYOUT_EXPORT KoTextLayoutTableArea : public KoTextLayoutArea
0038 {
0039 public:
0040     /// constructor
0041     explicit KoTextLayoutTableArea(QTextTable *table, KoTextLayoutArea *parent, KoTextDocumentLayout *documentLayout);
0042     ~KoTextLayoutTableArea() override;
0043 
0044     /// Layouts as much as it can
0045     /// Returns true if it has reached the end of the table
0046     bool layoutTable(TableIterator *cursor);
0047 
0048     void paint(QPainter *painter, const KoTextDocumentLayout::PaintContext &context);
0049 
0050     KoPointedAt hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const;
0051 
0052     /// Calc a bounding box rect of the selection
0053     QRectF selectionBoundingBox(QTextCursor &cursor) const;
0054 
0055     QVector<KoCharAreaInfo> generateCharAreaInfos() const;
0056 
0057 private:
0058     void layoutColumns();
0059     void collectBorderThicknesss(int row, qreal &topBorderWidth, qreal &bottomBorderWidth);
0060     void nukeRow(TableIterator *cursor);
0061     bool layoutRow(TableIterator *cursor, qreal topBorderWidth, qreal bottomBorderWidth);
0062     bool layoutMergedCellsNotEnding(TableIterator *cursor, qreal topBorderWidth, qreal bottomBorderWidth, qreal rowBottom);
0063     QRectF cellBoundingRect(const QTextTableCell &cell) const;
0064     void paintCell(QPainter *painter, const KoTextDocumentLayout::PaintContext &context, const QTextTableCell &tableCell, KoTextLayoutArea *frameArea);
0065     void paintCellBorders(QPainter *painter, const KoTextDocumentLayout::PaintContext &context, const QTextTableCell &tableCell, bool topRow, int maxRow, QVector<QLineF> *accuBlankBorders);
0066 
0067     class Private;
0068     Private * const d;
0069 };
0070 
0071 #endif