Subversion Repositories Scribus

Rev

Rev 12285 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 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
*/
3 paul 7
/***************************************************************************
8
                        scribusXml.h the document xml library for scribus
9
                             -------------------
10
    begin                : Sam Jul 14 10:00:00 CEST 2001
168 Franz 11
    copyright            : (C) 2001 by Christian T�p
3 paul 12
    email                : christian.toepp@mr-ct@gmx.de
13
 ***************************************************************************/
14
 
10259 jghali 15
#ifndef _SCRIBUSXML_H
16
#define _SCRIBUSXML_H
3 paul 17
 
10223 cbradney 18
#include <QDomDocument>
19
#include <QDomElement>
9803 fschmid 20
#include <QList>
9953 cbradney 21
#include <QProgressBar>
3 paul 22
 
3252 craig 23
#include "scfonts.h"
10223 cbradney 24
#include "scribusapi.h"
5642 cbradney 25
#include "scribusstructs.h"
4130 cbradney 26
#include "selection.h"
12340 pierre 27
// #include "styles/styleset.h"
3252 craig 28
 
12053 cbradney 29
#include <QXmlStreamAttributes>
30
#include <QXmlStreamReader>
31
#include <QXmlStreamWriter>
10601 mrdocs 32
class PageItem;
2834 cbradney 33
class PrefsManager;
3252 craig 34
class ScribusView;
35
class SCFonts;
36
class ScribusDoc;
12039 jghali 37
class ScPattern;
38
class ScXmlStreamWriter;
1087 cbradney 39
 
10434 cbradney 40
class SCRIBUS_API ScriXmlDoc
3 paul 41
{
10434 cbradney 42
 
3 paul 43
public:
2834 cbradney 44
        ScriXmlDoc();
3 paul 45
        ~ScriXmlDoc() {};
4650 subik 46
        /*!
47
        \author Frederic Dubuy <effediwhy@gmail.com>, Petr Vanek
48
        \date august 17th 2004, 10/03/2004
49
        \brief Preliminary Scribus file validator. totally rewritten when fixing crash bug #1092. It's much simpler now.
12071 subik 50
        \param file filename of file to test
4650 subik 51
        \retval bool true = Scribus format file, false : not Scribus
52
        */
10407 jghali 53
        bool    ReadElemHeader(QString file, bool isFile, double *x, double *y, double *w, double *h);
54
        bool    ReadElem(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, ScribusView *view);
4130 cbradney 55
        QString WriteElem(ScribusDoc *doc, ScribusView *view, Selection *selection);
10407 jghali 56
 
1065 cbradney 57
        ColorList Farben;
5980 avox 58
        StyleSet<ParagraphStyle> docParagraphStyles;
9803 fschmid 59
        QList<Linked> LFrames;
118 Franz 60
        QStringList MNames;
332 Franz 61
        QMap<QString,QString> DoFonts;
1166 fschmid 62
        QMap<QString,QString> ReplacedFonts;
332 Franz 63
        QMap<uint,QString> DoVorl;
9803 fschmid 64
        QList<ScFace> dummyScFaces;
332 Franz 65
        uint VorlC;
1468 fschmid 66
        bool newReplacement;
3 paul 67
 
2834 cbradney 68
protected:
69
        PrefsManager* prefsManager;
10334 jghali 70
 
12039 jghali 71
        bool    attrHasValue(const QXmlStreamAttributes& attrs, const char* attName);
10870 jghali 72
        bool    attrAsBool(const QXmlStreamAttributes& attrs, const char* attName, bool defVal = false);
12053 cbradney 73
        int     attrAsInt (const QXmlStreamAttributes& attrs, const char* attName, int  defVal = 0);
10870 jghali 74
        double  attrAsDbl (const QXmlStreamAttributes& attrs, const char* attName, double defVal = 0.0);
75
        QString attrAsString (const QXmlStreamAttributes& attrs, const char* attName, const QString& defVal);
10407 jghali 76
 
77
        void GetItemProps(const QXmlStreamAttributes& attrs, struct CopyPasteBuffer *OB, const QString& baseDir, bool newVersion);
12039 jghali 78
        void GetItemText (const QXmlStreamAttributes& attrs, StoryText& story, ScribusDoc *doc, LastStyles* last, bool VorLFound, bool impo);
79
        void GetStyle(QXmlStreamReader& reader, ParagraphStyle &vg, StyleSet<ParagraphStyle>* tempStyles, ScribusDoc* doc, bool fl);
10407 jghali 80
 
12039 jghali 81
        void ReadPattern(QXmlStreamReader& reader, ScribusDoc* doc, ScribusView *view, const QString& fileName, int& GrMax, bool styleFound, bool newVersion);
82
        void ReadCStyle (QXmlStreamReader& reader, CharStyle& style, ScribusDoc* doc);
83
        void ReadPStyle (QXmlStreamReader& reader, ParagraphStyle &style, ScribusDoc* doc);
84
 
85
        void SetItemProps(ScXmlStreamWriter& writer, ScribusDoc *doc, PageItem* item, const QString& baseDir, bool newFormat);
86
        void WriteObject (ScXmlStreamWriter& writer, ScribusDoc *doc, PageItem *item, const QString& baseDir, QMap<int, int> &UsedMapped2Saved);
87
        void WriteITEXTs (ScXmlStreamWriter& writer, ScribusDoc *doc, PageItem *item);
88
        void WriteLegacyCStyle (ScXmlStreamWriter& writer, const CharStyle& style);
89
        void WriteCStyle (ScXmlStreamWriter& writer, const CharStyle& style);
90
        void WritePStyle (ScXmlStreamWriter& writer, const ParagraphStyle& style, const QString& nodeName);
91
 
5642 cbradney 92
        QString AskForFont(SCFonts &avail, QString fStr, ScribusDoc *doc);
3 paul 93
};
94
 
95
#endif // _SCRIBUS_CONFIG_
4130 cbradney 96
 
10334 jghali 97
 
98
 
99