1 /* This file is part of the KDE project
2  * Copyright (C) 2007 Pierre Ducroquet <pinaraf@gmail.com>
3  * Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
4  * Copyright (C) 2008 Sebastian Sauer <mail@dipe.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 #ifndef PAGEVARIABLE_H
22 #define PAGEVARIABLE_H
23 
24 #include <KoVariable.h>
25 #include <KoTextPage.h>
26 #include <KoOdfNumberDefinition.h>
27 
28 class KoShapeSavingContext;
29 
30 /**
31  * This is a KoVariable for page numbers.
32  */
33 class PageVariable : public KoVariable
34 {
35 public:
36     enum PageType {
37         PageCount,
38         PageNumber,
39         PageContinuation
40     };
41 
42     /**
43      * Constructor.
44      */
45     PageVariable();
46 
47     void readProperties(const KoProperties *props);
48 
49     void propertyChanged(Property property, const QVariant &value) override;
50 
51     /// reimplmented
52     void saveOdf(KoShapeSavingContext & context) override;
53 
54     ///reimplemented
55     bool loadOdf(const KoXmlElement & element, KoShapeLoadingContext & context) override;
56 
57 private:
58     void resize(const QTextDocument *document, QTextInlineObject &object, int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) override;
59 
60     PageType m_type;
61 
62     KoTextPage::PageSelection m_pageselect;
63     int m_pageadjust;
64     bool m_fixed;
65     KoOdfNumberDefinition m_numberFormat;
66 
67     QString m_continuation;
68 };
69 
70 #endif
71