Warning, file /office/calligra/libs/text/KoTextSoftPageBreak.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 Thorsten Zachmann <zachmann@kde.org> 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 #include "KoTextSoftPageBreak.h" 0021 0022 #include <KoShapeSavingContext.h> 0023 #include <KoXmlReader.h> 0024 #include <KoXmlWriter.h> 0025 0026 #include <QTextInlineObject> 0027 #include <QPainter> 0028 0029 // Include Q_UNSUSED classes, for building on Windows 0030 #include <KoShapeLoadingContext.h> 0031 0032 KoTextSoftPageBreak::KoTextSoftPageBreak() 0033 { 0034 } 0035 0036 KoTextSoftPageBreak::~KoTextSoftPageBreak() 0037 { 0038 } 0039 0040 bool KoTextSoftPageBreak::loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) 0041 { 0042 Q_UNUSED(element) 0043 Q_UNUSED(context) 0044 return true; 0045 } 0046 0047 void KoTextSoftPageBreak::saveOdf(KoShapeSavingContext &context) 0048 { 0049 KoXmlWriter &writer = context.xmlWriter(); 0050 writer.startElement("text:soft-page-break"); 0051 writer.endElement(); 0052 } 0053 0054 void KoTextSoftPageBreak::updatePosition(const QTextDocument *document, 0055 int posInDocument, const QTextCharFormat &format) 0056 { 0057 Q_UNUSED(document) 0058 Q_UNUSED(posInDocument) 0059 Q_UNUSED(format) 0060 } 0061 0062 void KoTextSoftPageBreak::resize(const QTextDocument *document, QTextInlineObject &object, 0063 int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) 0064 { 0065 Q_UNUSED(document) 0066 Q_UNUSED(object) 0067 Q_UNUSED(posInDocument) 0068 Q_UNUSED(format) 0069 Q_UNUSED(pd) 0070 object.setWidth(0); // set the width to 0 as otherwise it is negative which results in the text being moved to left 0071 object.setAscent(0); 0072 object.setDescent(0); 0073 } 0074 0075 void KoTextSoftPageBreak::paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document, 0076 const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format) 0077 { 0078 Q_UNUSED(painter) 0079 Q_UNUSED(pd) 0080 Q_UNUSED(document) 0081 Q_UNUSED(rect) 0082 Q_UNUSED(object) 0083 Q_UNUSED(posInDocument) 0084 Q_UNUSED(format) 0085 // TODO have a way to display the soft page break 0086 }