Back to index

scribus-ng  1.3.4.dfsg+svn20071115
gtaction.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 GTACTION_H
00028 #define GTACTION_H
00029 
00030 #include <qcolor.h>
00031 #include <qtextcodec.h>
00032 #include <qvaluelist.h>
00033 #include <qmap.h>
00034 #include <qstring.h>
00035 class PageItem;
00036 class PrefsManager;
00037 class ScFace;
00038 #include "scribusapi.h"
00039 #include "gtfont.h"
00040 #include "gtframestyle.h"
00041 #include "gtparagraphstyle.h"
00042 #include "gtstyle.h"
00043 
00044 class ScribusDoc;
00045 class ScribusMainWindow;
00046 
00047 typedef QMap<QString, QString> FontFamilyMap;
00048 
00049 class SCRIBUS_API gtAction
00050 {
00051 private:
00052        ScribusMainWindow* m_ScMW;
00053        PageItem *textFrame;
00054        PageItem *it;
00055        int lastParagraphStyle;
00056        bool inPara;
00057        bool isFirstWrite;
00058        bool doAppend;
00059        bool lastCharWasLineChange;
00060        bool updateParagraphStyles;
00061        /* If paragraph style is used should the font style of the gtpstyle be used 
00062           or should writer respect the font set in the real paragraph style
00063        */
00064        bool overridePStyleFont;
00065        QString currentFrameStyle;
00066        FontFamilyMap families;
00067        int findParagraphStyle(const QString& name);
00068        int findParagraphStyle(gtParagraphStyle* pstyle);
00069        int applyParagraphStyle(gtParagraphStyle* pstyle);
00070        ScFace validateFont(gtFont* font);
00071        QString findFontName(gtFont* font);
00072        void updateParagraphStyle(int pstyleIndex, gtParagraphStyle* pstyle);
00073        QString parseColor(const QString &s);
00074        QColor parseColorN(const QString &rgbColor);
00075        void finalize();
00076        PrefsManager *prefsManager;
00077 public:
00078 //     gtAction(bool append);
00079        gtAction(bool append, PageItem *pageitem);
00080        ~gtAction();
00081        void setTextFrame(PageItem* frame);
00082        void setProgressInfo();
00083        void setProgressInfoDone();
00084        void setInfo(QString infoText);
00085        double getLineSpacing(int fontSize);
00086        void clearFrame();
00087        void getFrameFont(gtFont *font);
00088        void getFrameStyle(gtFrameStyle *fstyle);
00089        void write(const QString& text, gtStyle *style);
00090        void applyFrameStyle(gtFrameStyle* fstyle);
00091        void createParagraphStyle(gtParagraphStyle* pstyle);
00092        void updateParagraphStyle(const QString& pstyleName, gtParagraphStyle* pstyle);
00093        void removeParagraphStyle(const QString& name);
00094        void removeParagraphStyle(int index);
00095        double getFrameWidth();
00096        QString getFrameName();
00097        bool getUpdateParagraphStyles();
00098        void setUpdateParagraphStyles(bool newUPS);
00099        bool getOverridePStyleFont();
00100        void setOverridePStyleFont(bool newOPSF);
00101 };
00102 
00103 #endif