Subversion Repositories Scribus

Rev

Rev 18084 | Rev 20606 | Go to most recent revision | 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 GTACTION_H
28
#define GTACTION_H
29
 
10223 cbradney 30
#include <QColor>
31
#include <QTextCodec>
32
#include <QMap>
33
#include <QString>
34
 
13805 jghali 35
#include "scribusapi.h"
36
 
838 cbradney 37
class PageItem;
2834 cbradney 38
class PrefsManager;
5980 avox 39
class ScFace;
12895 jghali 40
class CharStyle;
41
class ParagraphStyle;
5781 cbradney 42
class ScribusDoc;
43
class ScribusMainWindow;
18084 jghali 44
class StoryText;
45
class TextNote;
46
 
17641 craig 47
class UndoManager;
5781 cbradney 48
 
13805 jghali 49
class gtStyle;
50
class gtParagraphStyle;
51
class gtFont;
52
class gtFrameStyle;
53
 
411 Franz 54
typedef QMap<QString, QString> FontFamilyMap;
55
 
2969 craig 56
class SCRIBUS_API gtAction
364 Franz 57
{
58
private:
17641 craig 59
        UndoManager* undoManager;
5781 cbradney 60
        ScribusMainWindow* m_ScMW;
364 Franz 61
        PageItem *textFrame;
62
        PageItem *it;
63
        int lastParagraphStyle;
411 Franz 64
        bool inPara;
418 Franz 65
        bool isFirstWrite;
66
        bool doAppend;
364 Franz 67
        bool lastCharWasLineChange;
411 Franz 68
        bool updateParagraphStyles;
418 Franz 69
        /* If paragraph style is used should the font style of the gtpstyle be used
70
           or should writer respect the font set in the real paragraph style
71
        */
72
        bool overridePStyleFont;
364 Franz 73
        QString currentFrameStyle;
411 Franz 74
        FontFamilyMap families;
12895 jghali 75
 
411 Franz 76
        int findParagraphStyle(const QString& name);
364 Franz 77
        int findParagraphStyle(gtParagraphStyle* pstyle);
78
        int applyParagraphStyle(gtParagraphStyle* pstyle);
12895 jghali 79
 
80
        ScFace  validateFont(gtFont* font);
387 Franz 81
        QString findFontName(gtFont* font);
12895 jghali 82
        void    updateParagraphStyle(int pstyleIndex, gtParagraphStyle* pstyle);
833 tsoots 83
        QString parseColor(const QString &s);
12895 jghali 84
        QColor  parseColorN(const QString &rgbColor);
364 Franz 85
        void finalize();
2834 cbradney 86
        PrefsManager *prefsManager;
18084 jghali 87
        StoryText* noteStory;
88
        TextNote* note;
364 Franz 89
public:
5781 cbradney 90
//      gtAction(bool append);
1702 cbradney 91
        gtAction(bool append, PageItem *pageitem);
364 Franz 92
        ~gtAction();
93
        void setTextFrame(PageItem* frame);
94
        void setProgressInfo();
95
        void setProgressInfoDone();
96
        void setInfo(QString infoText);
411 Franz 97
        double getLineSpacing(int fontSize);
364 Franz 98
        void clearFrame();
99
        void getFrameFont(gtFont *font);
100
        void getFrameStyle(gtFrameStyle *fstyle);
18084 jghali 101
        void write(const QString& text, gtStyle *style, bool isNote);
102
        void writeUnstyled(const QString& text, bool isNote);
411 Franz 103
        void applyFrameStyle(gtFrameStyle* fstyle);
364 Franz 104
        void createParagraphStyle(gtParagraphStyle* pstyle);
12895 jghali 105
        void setCharStyleAttributes(gtFont *font, CharStyle& style);
106
        void setParaStyleAttributes(gtParagraphStyle *gtstyle, ParagraphStyle& style);
411 Franz 107
        void updateParagraphStyle(const QString& pstyleName, gtParagraphStyle* pstyle);
108
        void removeParagraphStyle(const QString& name);
109
        void removeParagraphStyle(int index);
375 Franz 110
        double getFrameWidth();
111
        QString getFrameName();
411 Franz 112
        bool getUpdateParagraphStyles();
113
        void setUpdateParagraphStyles(bool newUPS);
418 Franz 114
        bool getOverridePStyleFont();
115
        void setOverridePStyleFont(bool newOPSF);
364 Franz 116
};
117
 
118
#endif