MagicSmoke  $VERSION$
odtrender.h
Go to the documentation of this file.
1 //
2 // C++ Interface: odtrender
3 //
4 // Description:
5 //
6 //
7 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2011
8 //
9 // Copyright: See README/COPYING.GPL files that come with this distribution
10 //
11 //
12 
13 #ifndef MAGICSMOKE_ODTRENDER_H
14 #define MAGICSMOKE_ODTRENDER_H
15 
16 #include <QObject>
17 #include <QString>
18 
19 #include "templates.h"
20 #include "commonexport.h"
21 
23 class QFile;
24 
25 MAGICSMOKE_COMMON_EXPORT extern const QString OdfTemplateNS;
26 MAGICSMOKE_COMMON_EXPORT extern const QString OdfTemplatePrefix;
27 
30 {
31  public:
33  MOdtRenderer(MTemplate file);
35  virtual ~MOdtRenderer();
36 
38  virtual void renderToFile(QString file);
39 
41  virtual void renderToFile(QFile& file,bool preventOpen=false);
42 
44  virtual void renderToPrinter();
45 
47  virtual QString renderToPdf();
48 
51  static QByteArray convertV1toV2(const QByteArray&);
52 
54  enum class FileFormat{
56  None,
58  Version2,
60  ConvertedV1,
61  };
63  FileFormat fileFormat()const;
64 
65  protected:
66  friend class MOdtRendererPrivate;
67  friend class MOdfEngine;
69  virtual QVariant getVariable(QString varname)=0;
70 
72  virtual int getLoopIterations(QString loopname)=0;
73 
75  virtual void setLoopIteration(QString loopname, int interation)=0;
76  private:
78 };
79 
82 {
83  Q_OBJECT
84  public:
89 
90  signals:
92  void getVariable(QString varname,QVariant&value);
93 
95  void getLoopIterations(QString loopname,int&iterations);
96 
97  void setLoopIteration(QString loopname, int interation);
98 
99  protected:
100  QVariant getVariable(QString varname);
101  int getLoopIterations(QString loopname);
102 };
103 
104 #endif
#define MAGICSMOKE_COMMON_EXPORT
Definition: commonexport.h:7
Definition: odtrender.cpp:63
this class wraps a single template
Definition: templates.h:25
MAGICSMOKE_COMMON_EXPORT const QString OdfTemplateNS
virtual int getLoopIterations(QString loopname)=0
implement this to return the amount of iterations for a defined loop; should return 0 if the loop doe...
Definition: odtrender.cpp:33
abstract base class for all ODT rendering classes
Definition: odtrender.h:29
generic class that implements MOdtRenderer by calling signals; the signals must be connected using a ...
Definition: odtrender.h:81
FileFormat
format of the file represented by this renderer
Definition: odtrender.h:54
virtual QVariant getVariable(QString varname)=0
implement this to return the value of a variable during rendering; should return empty string if the ...
virtual void setLoopIteration(QString loopname, int interation)=0
implement this to populate the variables used in a specific iteration of the loop ...
MAGICSMOKE_COMMON_EXPORT const QString OdfTemplatePrefix