Scribus
Open source desktop publishing at your fingertips
gtwriter.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 GTWRITER_H
28 #define GTWRITER_H
29 
30 #include "scribusapi.h"
31 #include "gtaction.h"
32 
33 class PageItem;
34 
35 /*
36  gtWriter handles the writing to the scribus text frame.
37 */
38 class SCRIBUS_API gtWriter
39 {
40 public:
41 // gtWriter(bool append);
42  gtWriter(bool append, PageItem *pageitem);
43  ~gtWriter();
44  gtFrameStyle* getDefaultStyle();
45  void setFrameStyle(gtFrameStyle *fStyle);
46  void setParagraphStyle(gtParagraphStyle *pStyle);
47  void setCharacterStyle(gtStyle *cStyle);
48  void unsetFrameStyle();
49  void unsetParagraphStyle();
50  void unsetCharacterStyle();
51  double getPreferredLineSpacing(int fontSize);
52  double getPreferredLineSpacing(double fontSize);
53  void append(const QString& text); // Use the styles set beforehand
54  void append(const QString& text, gtStyle *style); // Use the style provided as a parameter
55  void append(const QString& text, gtStyle *style, bool updatePStyle);
56  void appendUnstyled(const QString& text); // Do not apply any formatting
57  double getFrameWidth();
58  QString getFrameName();
59  bool getUpdateParagraphStyles();
60  void setUpdateParagraphStyles(bool newUPS);
61  bool getOverridePStyleFont();
62  void setOverridePStyleFont(bool newOPSF);
63  bool inNote;
64  bool inNoteBody;
65 
66 private:
67  gtAction *action;
68  gtFrameStyle* defaultStyle;
69  gtStyle* currentStyle;
70 
71 /*
72  Frame style is the default style for text. Styles will be used in order so
73  that if no character style is found then it will try to use paragraph
74  style if no paragraph style is found frame style will be used. Last set
75  frame style will be left to the default style for the text frame.
76 */
77  gtFrameStyle* frameStyle;
78  gtStyle* paragraphStyle;
79  gtStyle* characterStyle;
80  bool errorSet;
81  void setDefaultStyle();
82 };
83 
84 #endif // WRITER_H
Definition: gtwriter.h:38
Definition: gtstyle.h:34
Definition: gtparagraphstyle.h:51
Definition: pageitem.h:92
Definition: gtaction.h:56
Definition: gtframestyle.h:33