Warning, file /office/calligra/libs/text/KoTextPage.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 Calligra project
0002  * Copyright (C) 2008 Sebastian Sauer <mail@dipe.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 #ifndef KOTEXTPAGE_H
0021 #define KOTEXTPAGE_H
0022 
0023 #include "kotext_export.h"
0024 
0025 #include <QRectF>
0026 #include <QMetaType>
0027 
0028 class QString;
0029 
0030 /**
0031  * Interface for a single OpenDocumentText page.
0032  *
0033  * The Words KWPageTextInfo class does implement this interface to provide
0034  * application specific functionality for single pages.
0035  * @see KoTextShapeData::setPage();
0036  */
0037 class KOTEXT_EXPORT KoTextPage
0038 {
0039 public:
0040     /// Constructor.
0041     explicit KoTextPage();
0042     /// Destructor.
0043     virtual ~KoTextPage();
0044 
0045     enum PageSelection {
0046         PreviousPage = -1,
0047         CurrentPage = 0,
0048         NextPage = 1
0049     };
0050 
0051     /**
0052      * Returns the unique number of this page for internal purposes. All pages
0053      * are numbered consecutively starting by 1.
0054      *
0055      * This is used for example to anchor images to pages. The image then refers
0056      * to the unique page-number.
0057      */
0058     virtual int pageNumber() const = 0;
0059 
0060     /**
0061      * Returns the number of this page for display purposes.
0062      *
0063      * Example how the parameters are used within ODF to display the
0064      * current page number on all pages except the first page;
0065      * \code
0066      * <text:page-number text:select-page="previous" text:page-adjust="1" />
0067      * \endcode
0068      *
0069      * \param select Defines the offset of the page to select for the
0070      * resulting page number.  If such a page does not exist, then -1 will be
0071      * returned before the adjustment will be taken into account. This
0072      * implements the ODF text:select-page attribute.
0073      * \param adjustment The value of the page number will be adjusted by this
0074      * specified number and if there exist a page with the resulting value it's
0075      * page number gets returned, otherwise -1 will be returned. This implements the
0076      * ODF text:page-adjust attribute.
0077      * \return the user visible page number, or -1 if the page referenced does not
0078      * exist.
0079      */
0080     virtual int visiblePageNumber(PageSelection select = CurrentPage, int adjustment = 0) const = 0;
0081 
0082     /**
0083      * Returns the name of the master-page that should be used for this page or a null
0084      * QString if this page does not explicit define a master-page in which case the
0085      * default master-page will be used.
0086      *
0087      * Per default a null QString is returned.
0088      */
0089     virtual QString masterPageName() const;
0090 
0091     /**
0092      * Returns the rect of the page in document coords
0093      */
0094     virtual QRectF rect() const = 0;
0095 
0096     /**
0097      * Returns the (text) content rect of the page in document coords
0098      */
0099     virtual QRectF contentRect() const {return rect();}
0100 
0101 };
0102 
0103 Q_DECLARE_METATYPE(KoTextPage*)
0104 
0105 #endif