Subversion Repositories Scribus

Rev

Rev 23890 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
364 Franz 7
/***************************************************************************
8
 *   Copyright (C) 2004 by Riku Leino                                      *
1184 tsoots 9
 *   tsoots@gmail.com                                                      *
364 Franz 10
 *                                                                         *
11
 *   This program is free software; you can redistribute it and/or modify  *
12
 *   it under the terms of the GNU General Public License as published by  *
13
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 *   (at your option) any later version.                                   *
15
 *                                                                         *
16
 *   This program is distributed in the hope that it will be useful,       *
17
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
19
 *   GNU General Public License for more details.                          *
20
 *                                                                         *
21
 *   You should have received a copy of the GNU General Public License     *
22
 *   along with this program; if not, write to the                         *
23
 *   Free Software Foundation, Inc.,                                       *
18122 mrdocs 24
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
364 Franz 25
 ***************************************************************************/
26
 
27
#ifndef GTPARAGRAPHSTYLE_H
28
#define GTPARAGRAPHSTYLE_H
29
 
2969 craig 30
#include "scribusapi.h"
364 Franz 31
#include "gtstyle.h"
5184 avox 32
#include "sctextstruct.h"
364 Franz 33
 
34
enum Alignment {
35
        LEFT,
36
        CENTER,
37
        RIGHT,
38
        BLOCK,
39
        FORCED,
40
        AlignmentMAX
41
};
42
 
375 Franz 43
enum TabType {
44
        LEFT_T,
45
        RIGHT_T,
46
        FULL_STOP_T,
47
        COMMA_T,
48
        CENTER_T
49
};
50
 
2969 craig 51
class SCRIBUS_API gtParagraphStyle : public gtStyle
364 Franz 52
{
53
public:
23840 jghali 54
        gtParagraphStyle(const QString& name);
55
        gtParagraphStyle(const gtParagraphStyle& p);
56
        gtParagraphStyle(const gtStyle& s);
57
        ~gtParagraphStyle() {};
12895 jghali 58
 
59
        typedef enum
60
        {
61
                lineSpacingWasSet = 1,
62
                alignmentWasSet = 2,
63
                indentWasSet = 4,
64
                firstIndentWasSet = 8,
65
                spaceAboveWasSet  = 16,
66
                spaceBelowWasSet = 32,
67
                tabValueWasSet = 64,
68
                fillShadeWasSet = 128,
69
                dropCapWasSet = 256,
70
                dropCapHeightWasSet = 512,
71
                adjToBaselineWasSet = 1024,
72
                autoLineSpacingWasSet  = 2048,
18047 craig 73
                bulletWasSet = 4096,
74
                numWasSet = 8192
12895 jghali 75
        } wasSetFlags;
76
 
23890 jghali 77
        gtStyle& asGtStyle() { return dynamic_cast<gtStyle&>(*this); }
78
        const gtStyle& asGtStyle() const { return dynamic_cast<const gtStyle&>(*this); }
79
 
23840 jghali 80
        QString target() const override;
81
 
82
        int    getFlags() const;
83
        bool   isDefaultStyle() const;
10111 jghali 84
        void   setDefaultStyle(bool defStyle);
23840 jghali 85
        double getLineSpacing() const;
364 Franz 86
        void   setLineSpacing(double newLineSpacing);
23840 jghali 87
        bool   getAutoLineSpacing() const;
411 Franz 88
        void   setAutoLineSpacing(bool newALS);
23840 jghali 89
        int    getAlignment() const;
364 Franz 90
        void   setAlignment(Alignment newAlignment);
91
        void   setAlignment(int newAlignment);
23840 jghali 92
        double getIndent() const;
364 Franz 93
        void   setIndent(double newIndent);
23840 jghali 94
        double getFirstLineIndent() const;
364 Franz 95
        void   setFirstLineIndent(double newFirstLineIndent);
23840 jghali 96
        double getSpaceAbove() const;
364 Franz 97
        void   setSpaceAbove(double newSpaceAbove);
23840 jghali 98
        double getSpaceBelow() const;
364 Franz 99
        void   setSpaceBelow(double newSpaceBelow);
23840 jghali 100
        const QList<ParagraphStyle::TabRecord>& getTabValues() const;
375 Franz 101
        void   setTabValue(double newTabValue, TabType ttype = LEFT_T);
23840 jghali 102
        bool   hasDropCap() const;
364 Franz 103
        void   setDropCap(bool newDropCap);
104
        void   setDropCap(int newHeight);
23840 jghali 105
        int    getDropCapHeight() const;
364 Franz 106
        void   setDropCapHeight(int newHeight);
23840 jghali 107
        bool   isAdjToBaseline() const;
364 Franz 108
        void   setAdjToBaseline(bool newAdjToBaseline);
109
        void   getStyle(gtStyle* style);
23840 jghali 110
        bool hasBullet() const;
22635 craig 111
        void setBullet(bool newBullet, const QString& str);
23840 jghali 112
        QString getBullet() const;
113
        bool hasNum() const;
23991 craig 114
        void setNum(bool newNum, int format=0, int level=0, int start = 1, const QString& prefix = QString(), const QString& suffix = QString());
23840 jghali 115
        int getNumLevel() const;
116
        int getNumFormat() const;
117
        int getNumStart() const;
118
        QString getNumPrefix() const;
119
        QString getNumSuffix() const;
120
 
121
protected:
122
        int    flags { 0 };
123
        bool   defaultStyle { false };
124
        double lineSpacing { 15 };
125
        int    alignment { LEFT };
126
        double indent { 0.0 };
127
        double firstLineIndent { 0.0 };
128
        double spaceAbove { 0.0 };
129
        double spaceBelow { 0.0 };
130
        QList<ParagraphStyle::TabRecord> tabValues;
131
        bool dropCap { false };
132
        int  dropCapHeight { 2 };
133
        bool m_bullet { false }; ///< Is style using bullet?
134
        QString m_bulletStr { QChar(0x2022) }; ///< String used as bullet
135
        bool m_numeration { false }; ///< Is style using numeration?
136
        int m_numLevel { 0 }; ///< Level in hierarchical numbering
137
        int m_numFormat { 0 }; ///< 1_2_3, i_ii_ii, a_b_c
138
        int m_numStart { 1 }; ///< Numeration starts at number
139
        QString m_numPrefix; ///< Numeration prefix of style
140
        QString m_numSuffix; ///< Numeration sufffix of style
141
        bool adjToBaseline { false };
142
        bool autoLineSpacing { false };
143
        bool isVisible { true };
144
 
145
private:
146
        void init();
364 Franz 147
};
148
 
149
#endif // GTPARAGRAPHSTYLE_H