~ubuntu-branches/ubuntu/trusty/scribus-ng/trusty

« back to all changes in this revision

Viewing changes to scribus/serializer.h

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-15 15:57:12 UTC
  • mfrom: (4.2.10 sid)
  • Revision ID: package-import@ubuntu.com-20120215155712-biimoc8o875jht80
Tags: 1.4.0.dfsg+r17300-1
* Prepare a dummy transitional package to converge on the 1.4.0 release.
* debian/NEWS: update the news.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
                          serializer.h  -  description
9
 
                             -------------------
10
 
    begin                : Sat May 5 2001
11
 
    copyright            : (C) 2001 by Franz Schmid
12
 
    email                : Franz.Schmid@altmuehlnet.de
13
 
 ***************************************************************************/
14
 
 
15
 
/***************************************************************************
16
 
 *                                                                         *
17
 
 *   This program is free software; you can redistribute it and/or modify  *
18
 
 *   it under the terms of the GNU General Public License as published by  *
19
 
 *   the Free Software Foundation; either version 2 of the License, or     *
20
 
 *   (at your option) any later version.                                   *
21
 
 *                                                                         *
22
 
 ***************************************************************************/
23
 
 
24
 
#ifndef SERIALIZER_H
25
 
#define SERIALIZER_H
26
 
 
27
 
#include <QString>
28
 
#include <QFile>
29
 
#include <QByteArray>
30
 
#include "scribusapi.h"
31
 
#include "selection.h"
32
 
#include "desaxe/saxio.h"
33
 
#include "desaxe/digester.h"
34
 
 
35
 
/**
36
 
  * This class reads/writes Scribus datastructures from/to SAX streams 
37
 
  * (was done by ScribusXML before). It also serves as a testbed for the new
38
 
  * Scribus 1.4 file format
39
 
  *
40
 
  * Currently it also holds to old methods which are used to read/write text 
41
 
  * from/to a file.
42
 
  *
43
 
  * @author Andreas Vox
44
 
  */
45
 
 
46
 
class ScribusDoc;
47
 
class ColorList;
48
 
 
49
 
class SCRIBUS_API Serializer : public desaxe::Digester {
50
 
public: 
51
 
 
52
 
        /** Construct a Serializer object which can be used to (de)serialize Scribus
53
 
                elements. Since it has Digester as a superclass, a Serializer object can
54
 
            also be used where a SaxHandler is required as argument, eg. the saxx() method.
55
 
         */
56
 
        Serializer(ScribusDoc& doc);
57
 
        /**
58
 
          Writes all objects in selection to handler as a fragment. Needed styles and colors
59
 
          are included.
60
 
        */
61
 
        static void serializeObjects(const Selection& objects, SaxHandler& handler);
62
 
        /**
63
 
          Reads objects from the given QString which must represent a fragment, imports them
64
 
          into the document and returns a (nonGUI) selection to it.
65
 
        */
66
 
        Selection deserializeObjects(const QByteArray & xml);
67
 
        /**
68
 
          Reads objects from the given QFile which must represent a fragment, imports them
69
 
          into the document and returns a (nonGUI) selection to it.
70
 
         */
71
 
        Selection deserializeObjects(const QFile & xml);
72
 
 
73
 
        Selection cloneObjects(const Selection& objects);
74
 
        
75
 
        /** Legacy method to read plain text for a textframe */
76
 
        static bool readWithEncoding(const QString& filename, const QString& encoding, 
77
 
                                                                 QString & txt);
78
 
        /** Legacy method to write plain text from a textframe */
79
 
        static bool writeWithEncoding(const QString& filename, const QString& encoding, 
80
 
                                                                  const QString& txt);
81
 
 
82
 
private:
83
 
        ScribusDoc& m_Doc;
84
 
        ColorList backUpColors;
85
 
        Selection importCollection();
86
 
        void updateGradientColors(const ColorList& colors);
87
 
};
88
 
 
89
 
#endif