Warning, file /office/calligra/libs/textlayout/KoTextLayoutRootAreaProvider.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 KOTEXTLAYOUTROOTAREAPROVIDER_H 0021 #define KOTEXTLAYOUTROOTAREAPROVIDER_H 0022 0023 #include "kotextlayout_export.h" 0024 0025 #include <QList> 0026 #include <QString> 0027 0028 class KoTextLayoutRootArea; 0029 class KoTextDocumentLayout; 0030 class KoTextLayoutObstruction; 0031 class QRectF; 0032 0033 /** 0034 * Represents the contract that a root area requested by the layout system 0035 * has to respect. For simple layout situations (like a single text shape), 0036 * it's fine to ignore the contract since pages do not exist. 0037 */ 0038 struct RootAreaConstraint { 0039 QString masterPageName; 0040 int visiblePageNumber; 0041 bool newPageForced; 0042 }; 0043 0044 /** 0045 * When laying out text we need an area where upon the text will be placed. 0046 * A KoTextLayoutRootAreaProvider provides the layout process with such areas 0047 */ 0048 class KOTEXTLAYOUT_EXPORT KoTextLayoutRootAreaProvider 0049 { 0050 public: 0051 /// constructor 0052 explicit KoTextLayoutRootAreaProvider(); 0053 virtual ~KoTextLayoutRootAreaProvider(); 0054 0055 /** 0056 * Provides a new root area for the layout 0057 * 0058 * @param documentLayout the current document layouter 0059 * @param constraints the rules the new area has to respect (page style, visible page number...) 0060 * @param requestedPosition the position of the new area in the text flow 0061 * @param isNewArea will contain a boolean to tell whether this is a new area or a recycled one 0062 */ 0063 virtual KoTextLayoutRootArea *provide(KoTextDocumentLayout *documentLayout, const RootAreaConstraint &constraints, int requestedPosition, bool *isNewArea) = 0; 0064 0065 /// Release all root areas that are after the "afterThis" root area 0066 /// If afterThis == 0 all should be released 0067 virtual void releaseAllAfter(KoTextLayoutRootArea *afterThis) = 0; 0068 0069 /// This method allows the provider to do any post processing like 0070 /// - painting it 0071 /// - changing it's size 0072 /// - do other things to other structures (eg resizing the textshape) 0073 virtual void doPostLayout(KoTextLayoutRootArea *rootArea, bool isNewRootArea) = 0; 0074 0075 /// Makes all canvases redraw the shapes maintained by this provider 0076 /// use with care - it eats a lot of processing for no real gain 0077 virtual void updateAll() = 0; 0078 0079 /// Returns a suggested offset and size for the root area 0080 virtual QRectF suggestRect(KoTextLayoutRootArea *rootArea) = 0; 0081 0082 /// Return a list of obstructions intersecting root area 0083 virtual QList<KoTextLayoutObstruction *> relevantObstructions(KoTextLayoutRootArea *rootArea) = 0; 0084 }; 0085 0086 #endif