Back to index

scribus-ng  1.3.4.dfsg+svn20071115
gtwriter.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008  *   Copyright (C) 2004 by Riku Leino                                      *
00009  *   tsoots@gmail.com                                                      *
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This program is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00019  *   GNU General Public License for more details.                          *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU General Public License     *
00022  *   along with this program; if not, write to the                         *
00023  *   Free Software Foundation, Inc.,                                       *
00024  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00025  ***************************************************************************/
00026 
00027 #ifndef GTWRITER_H
00028 #define GTWRITER_H
00029 
00030 #include "scribusapi.h"
00031 #include "gtaction.h"
00032 #include "gtfont.h"
00033 #include "gtframestyle.h"
00034 #include "gtparagraphstyle.h"
00035 #include "gtstyle.h"
00036 
00037 class PageItem;
00038 
00039 /*
00040        gtWriter handles the writing to the scribus text frame.
00041 */
00042 class SCRIBUS_API gtWriter 
00043 {
00044 public:
00045 //     gtWriter(bool append);
00046        gtWriter(bool append, PageItem *pageitem);
00047        ~gtWriter();
00048        gtFrameStyle* getDefaultStyle();
00049        void setFrameStyle(gtFrameStyle *fStyle);
00050        void setParagraphStyle(gtParagraphStyle *pStyle);
00051        void setCharacterStyle(gtStyle *cStyle);
00052        void unsetFrameStyle();
00053        void unsetParagraphStyle();
00054        void unsetCharacterStyle();
00055        double getPreferredLineSpacing(int fontSize);
00056        double getPreferredLineSpacing(double fontSize);
00057        void append(const QString& text); // Use the styles set beforehand
00058        void append(const QString& text, gtStyle *style); // Use the style provided as a parameter
00059        void append(const QString& text, gtStyle *style, bool updatePStyle);
00060        double getFrameWidth();
00061        QString getFrameName();
00062        bool getUpdateParagraphStyles();
00063        void setUpdateParagraphStyles(bool newUPS);
00064        bool getOverridePStyleFont();
00065        void setOverridePStyleFont(bool newOPSF);
00066 private:
00067        gtAction *action;
00068        gtFrameStyle* defaultStyle;
00069        gtStyle* currentStyle;
00070 
00071 /* 
00072    Frame style is the default style for text. Styles will be used in order so
00073    that if no character style is found then it will try to use paragraph
00074    style if no paragraph style is found frame style will be used. Last set 
00075    frame style will be left to the default style for the text frame.
00076 */
00077        gtFrameStyle* frameStyle;
00078        gtStyle* paragraphStyle;
00079        gtStyle* characterStyle;
00080        bool errorSet;
00081        bool shouldAppend;
00082        void setDefaultStyle();
00083 };
00084 
00085 #endif // WRITER_H