~ubuntu-branches/debian/sid/calligraplan/sid

« back to all changes in this revision

Viewing changes to src/libs/odf/KoOdfLineNumberingConfiguration.h

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2018-02-01 18:20:19 UTC
  • Revision ID: package-import@ubuntu.com-20180201182019-1qo7qaim5wejm5k9
Tags: upstream-3.1.0
ImportĀ upstreamĀ versionĀ 3.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
 
 
3
   Copyright (C) 2010 KO GmbH <boud@kogmbh.com>
 
4
 
 
5
   This library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Library General Public
 
7
   License version 2 as published by the Free Software Foundation.
 
8
 
 
9
   This library is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Library General Public License
 
15
   along with this library; see the file COPYING.LIB.  If not, write to
 
16
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
   Boston, MA 02110-1301, USA.
 
18
 */
 
19
#ifndef KOODFLINENUMBERINGCONFIGURATION_H
 
20
#define KOODFLINENUMBERINGCONFIGURATION_H
 
21
 
 
22
#include <QMetaType>
 
23
#include <QObject>
 
24
 
 
25
#include "KoXmlReader.h"
 
26
#include "koodf_export.h"
 
27
 
 
28
class KoXmlWriter;
 
29
class KoOdfNumberDefinition;
 
30
 
 
31
/**
 
32
 * Implement section 14.9.1: Line Numbering Configuration.
 
33
 *
 
34
 * A document can contain none or one line numbering configuration element
 
35
 * <text:linenumbering-configuration> within the <office:styles> element. If the
 
36
 * element is not present, a default line numbering configuration is used. The default line numbering
 
37
 * may vary on the office application software, but every document saved by an application that
 
38
 * supports line numbering should contain a line numbering configuration element.
 
39
 *
 
40
 * The attributes that may be associated with the <text:linenumbering-configuration>
 
41
 * element are:
 
42
 * <ul>
 
43
 * <li> Line numbering enable
 
44
 * <li> Number format
 
45
 * <li> Text style
 
46
 * <li> Increment
 
47
 * <li> Position
 
48
 * <li> Offset
 
49
 * <li> Count empty lines
 
50
 * <li> Count line in text boxes
 
51
 * <li> Restart numbering on every page
 
52
 * </ul>
 
53
 * The following element may be included in the <text:linenumbering-separator> element:
 
54
 * <li> Separator
 
55
 */
 
56
class KOODF_EXPORT KoOdfLineNumberingConfiguration : public QObject
 
57
{
 
58
    Q_OBJECT
 
59
public:
 
60
 
 
61
    KoOdfLineNumberingConfiguration();
 
62
    ~KoOdfLineNumberingConfiguration();
 
63
    KoOdfLineNumberingConfiguration(const KoOdfLineNumberingConfiguration &other);
 
64
    KoOdfLineNumberingConfiguration &operator=(const KoOdfLineNumberingConfiguration &other);
 
65
 
 
66
 
 
67
    /**
 
68
     * load the line numbering configuration element
 
69
     */
 
70
    void loadOdf(const KoXmlElement &element);
 
71
 
 
72
    /**
 
73
     * save the line number configuration element
 
74
     */
 
75
    void saveOdf(KoXmlWriter * writer) const;
 
76
 
 
77
    /**
 
78
     * The text:number-lines attribute controls whether or not lines are numbered.
 
79
     */
 
80
    bool enabled() const;
 
81
    void setEnabled(bool enabled);
 
82
 
 
83
    /**
 
84
     * See section 12.2 for detailed information on number format attributes. The attributes
 
85
     * described in section 12.2 can also be associated with the <text:linenumbering-configuration>
 
86
     * element.
 
87
     */
 
88
    KoOdfNumberDefinition numberFormat() const;
 
89
    void setNumberFormat(const KoOdfNumberDefinition &numberFormat);
 
90
 
 
91
    /**
 
92
     * The text:style-name attribute specifies the text style for all line numbers. The value
 
93
     * of this attribute is the name of the text style that is applied to all line numbers.
 
94
     */
 
95
    QString textStyle() const;
 
96
    void setTextStyle(const QString &textStyle);
 
97
 
 
98
    /**
 
99
     * The text:increment attribute causes line numbers that are a multiple of the given increment to
 
100
     * be numbered. For example, if the increment is 5, only lines number 5, 10, 15, and so on are
 
101
     * numbered.
 
102
     */
 
103
    int increment() const;
 
104
    void setIncrement(int increment);
 
105
 
 
106
    /**
 
107
     * The text:position attribute determines whether the line numbers are printed on the left, right,
 
108
     * inner, or outer margins.
 
109
     */
 
110
    enum Position {
 
111
        Left,
 
112
        Right,
 
113
        Inner,
 
114
        Outer
 
115
    };
 
116
 
 
117
    Position position() const;
 
118
    void setPosition(Position position);
 
119
 
 
120
    /**
 
121
     * The text:offset attribute determines the distance between the line number and the margin.
 
122
     */
 
123
    int offset() const;
 
124
    void setOffset(int offset);
 
125
 
 
126
    /**
 
127
     * The text:count-empty-lines attribute determines whether or not empty lines are included in
 
128
     * the line count. If the value of this attribute is true, empty lines are included in the line count.
 
129
     */
 
130
    bool countEmptyLines() const;
 
131
    void setCountEmptyLines(bool countEmptyLines);
 
132
 
 
133
    /**
 
134
     * The text:count-in-text-boxes attribute determines whether or not text in text boxes is
 
135
     * included in the line count. If the value of this attribute is true, text within text boxes is included in
 
136
     * the line count.
 
137
     */
 
138
    bool countLinesInTextBoxes() const;
 
139
    void setCountLinesInTextBoxes(bool countLinesInTextBoxes);
 
140
 
 
141
    /**
 
142
     * The text:restart-on-page attribute determines whether or not the line count is reset to 1 at
 
143
     * the start of every page.
 
144
     *
 
145
     * If the value of this attribute is true, the line count is reset to 1 at the beginning of every page,
 
146
     * resulting in page -specific numbering of lines. The default value of this attribute is false,
 
147
     * resulting in document-specific numbering of lines.
 
148
     */
 
149
    bool restartNumberingOnEveryPage() const;
 
150
    void setRestartNumberingOnEveryPage(bool restartNumberingOnEveryPage);
 
151
 
 
152
    /**
 
153
     * The <text:linenumbering-separator> element contains the text that is displayed as a
 
154
     * separator. A separator is text that is displayed instead of a line number for lines where no number
 
155
     * is displayed.
 
156
     *
 
157
     * This element is contained in the line numbering configuration element. If the element is not
 
158
     * present, no separator is displayed.
 
159
     *
 
160
     * The element's text:increment attribute causes the separator to appear on lines that are a
 
161
     * multiple of the given increment. For example, if the increment is 2, only lines 2, 4, 6, and so on get
 
162
     * a separator, provided that no number is displayed already.
 
163
     */
 
164
    QString separator() const;
 
165
    void setSeparator(const QString &separator);
 
166
 
 
167
    int separatorIncrement() const;
 
168
    void setSeparatorIncrement(int separatorIncrement);
 
169
 
 
170
private:
 
171
 
 
172
    class Private;
 
173
    Private * const d;
 
174
 
 
175
};
 
176
 
 
177
Q_DECLARE_METATYPE(KoOdfLineNumberingConfiguration*)
 
178
 
 
179
#endif // KOODFLINENUMBERINGCONFIGURATION_H