Scribus
Open source desktop publishing at your fingertips
gtaction.h
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 */
7 /***************************************************************************
8  * Copyright (C) 2004 by Riku Leino *
9  * tsoots@gmail.com *
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., *
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
25  ***************************************************************************/
26 
27 #ifndef GTACTION_H
28 #define GTACTION_H
29 
30 #include <QColor>
31 #include <QTextCodec>
32 #include <QMap>
33 #include <QString>
34 
35 #include "scribusapi.h"
36 
37 class PageItem;
38 class PrefsManager;
39 class ScFace;
40 class CharStyle;
41 class ParagraphStyle;
42 class ScribusDoc;
43 class ScribusMainWindow;
44 class StoryText;
45 class TextNote;
46 
47 class UndoManager;
48 
49 class gtStyle;
50 class gtParagraphStyle;
51 class gtFont;
52 class gtFrameStyle;
53 
54 typedef QMap<QString, QString> FontFamilyMap;
55 
56 class SCRIBUS_API gtAction
57 {
58 private:
59  UndoManager* undoManager;
60  ScribusMainWindow* m_ScMW;
61  PageItem *textFrame;
62  PageItem *it;
63  int lastParagraphStyle;
64  bool inPara;
65  bool isFirstWrite;
66  bool doAppend;
67  bool lastCharWasLineChange;
68  bool updateParagraphStyles;
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;
73  QString currentFrameStyle;
74  FontFamilyMap families;
75 
76  int findParagraphStyle(const QString& name);
77  int findParagraphStyle(gtParagraphStyle* pstyle);
78  int applyParagraphStyle(gtParagraphStyle* pstyle);
79 
80  ScFace validateFont(gtFont* font);
81  QString findFontName(gtFont* font);
82  void updateParagraphStyle(int pstyleIndex, gtParagraphStyle* pstyle);
83  QString parseColor(const QString &s);
84  QColor parseColorN(const QString &rgbColor);
85  void finalize();
86  PrefsManager *prefsManager;
87  StoryText* noteStory;
88  TextNote* note;
89 public:
90 // gtAction(bool append);
91  gtAction(bool append, PageItem *pageitem);
92  ~gtAction();
93  void setTextFrame(PageItem* frame);
94  void setProgressInfo();
95  void setProgressInfoDone();
96  void setInfo(QString infoText);
97  double getLineSpacing(int fontSize);
98  void clearFrame();
99  void getFrameFont(gtFont *font);
100  void getFrameStyle(gtFrameStyle *fstyle);
101  void write(const QString& text, gtStyle *style, bool isNote);
102  void writeUnstyled(const QString& text, bool isNote);
103  void applyFrameStyle(gtFrameStyle* fstyle);
104  void createParagraphStyle(gtParagraphStyle* pstyle);
105  void setCharStyleAttributes(gtFont *font, CharStyle& style);
106  void setParaStyleAttributes(gtParagraphStyle *gtstyle, ParagraphStyle& style);
107  void updateParagraphStyle(const QString& pstyleName, gtParagraphStyle* pstyle);
108  void removeParagraphStyle(const QString& name);
109  void removeParagraphStyle(int index);
110  double getFrameWidth();
111  QString getFrameName();
112  bool getUpdateParagraphStyles();
113  void setUpdateParagraphStyles(bool newUPS);
114  bool getOverridePStyleFont();
115  void setOverridePStyleFont(bool newOPSF);
116 };
117 
118 #endif
Definition: storytext.h:71
Definition: charstyle.h:78
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
Definition: gtfont.h:91
Definition: paragraphstyle.h:27
Definition: gtstyle.h:34
the Document Class
Definition: scribusdoc.h:90
Base Class ScFace : This is a total rewrite of the old Foi class.
Definition: scface.h:73
Definition: gtparagraphstyle.h:51
Definition: pageitem.h:92
UndoManager handles the undo stack.
Definition: undomanager.h:81
Definition: gtaction.h:56
Manage Scribus preferences here, and here alone Start to move the preferences out of scribus...
Definition: prefsmanager.h:43
Definition: gtframestyle.h:33
Definition: notesstyles.h:91