Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scribus13format.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 #ifndef SCRIBUS13FORMAT_H
00008 #define SCRIBUS13FORMAT_H
00009 
00010 #include "pluginapi.h"
00011 #include "loadsaveplugin.h"
00012 #include "scfonts.h"
00013 #include "scribusstructs.h"
00014 #include "styles/styleset.h"
00015 
00016 #include <qdom.h>
00017 #include <qmap.h>
00018 #include <qstring.h>
00019 #include <qvaluelist.h>
00020 
00021 class PLUGIN_API Scribus13Format : public LoadSavePlugin
00022 {
00023        Q_OBJECT
00024 
00025        public:
00026               // Standard plugin implementation
00027               Scribus13Format();
00028               virtual ~Scribus13Format();
00029               virtual const QString fullTrName() const;
00030               virtual const AboutData* getAboutData() const;
00031               virtual void deleteAboutData(const AboutData* about) const;
00032               virtual void languageChange();
00033               //Not the same as readSLA. This one only reads max 4k of the file for speed.
00034               virtual bool fileSupported(QIODevice* file, const QString & fileName=QString::null) const;
00035 
00036               virtual bool loadFile(const QString & fileName, const FileFormat & fmt, int flags, int index = 0);
00037               virtual bool saveFile(const QString & fileName, const FileFormat & fmt);
00038               virtual void addToMainWindowMenu(ScribusMainWindow *) {};
00039 
00040               // Special features - .sla page extraction support
00041               virtual bool loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName=QString::null);
00042               virtual bool readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles);
00043               virtual bool readLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty);
00044               virtual bool readColors(const QString& fileName, ColorList & colors);
00045               virtual bool readPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames);
00046               virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces);
00047 
00048        private:
00049               void registerFormats();
00050               //Scribus Doc vars, not plugin vars
00051               void GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo=false, bool VorLFound=false);
00052               void readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, ScribusDoc *doc);
00053               PageItem* PasteItem(QDomElement *obj, ScribusDoc *doc);
00054               void GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> *tempParagraphStyles, ScribusDoc* doc, bool fl);
00055               QString readSLA(const QString & fileName);
00056               QString AskForFont(QString fStr, ScribusDoc *doc);
00057               void WritePages(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, bool master);
00058               void WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master);
00059               void SetItemProps(QDomElement *ob, PageItem* item, bool newFormat);
00060               const ScFace& findFont(ScribusDoc *doc, const QString& fontname);
00061               
00062               QMap<int, int> itemRemap;
00063               QMap<int, int> itemNext;
00064               int  itemCount;
00065               bool newReplacement;
00066               QMap<QString,QString> ReplacedFonts;
00067               QMap<uint,QString> DoVorl;
00068               uint VorlC;
00069 };
00070 
00071 extern "C" PLUGIN_API int scribus13format_getPluginAPIVersion();
00072 extern "C" PLUGIN_API ScPlugin* scribus13format_getPlugin();
00073 extern "C" PLUGIN_API void scribus13format_freePlugin(ScPlugin* plugin);
00074 
00075 #endif