1 /***************************************************************************
2             Template for Kraft Documents - Grantlee and ctemplate
3                              -------------------
4     begin                : March 2020
5     copyright            : (C) 2020 by Klaas Freitag
6     email                : kraft@freisturz.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef DOCUMENTTEMPLATE_H
19 #define DOCUMENTTEMPLATE_H
20 
21 #include <kcontacts/addressee.h>
22 
23 #include "archdoc.h"
24 
25 class DocumentTemplate
26 {
27 public:
28     DocumentTemplate( const QString& tmplFile );
~DocumentTemplate()29     virtual ~DocumentTemplate(){ };
30 
31     virtual const QString expand(ArchDoc *archDoc,
32                                  const KContacts::Addressee &myContact,
33                                  const KContacts::Addressee &customerContact) = 0;
34 
error()35     QString error() const { return _errorStr; }
36 
37 protected:
38     QString _tmplFile;
39     QString _errorStr;
40 };
41 
42 // ==================================================================================
43 
44 class CTemplateDocumentTemplate : public DocumentTemplate
45 {
46 public:
47     CTemplateDocumentTemplate(const QString& tmplFile);
48 
49     const QString expand(ArchDoc *archDoc,
50                          const KContacts::Addressee &myContact,
51                          const KContacts::Addressee &customerContact) override;
52 };
53 
54 // ==================================================================================
55 
56 class GrantleeDocumentTemplate : public DocumentTemplate
57 {
58 public:
59     GrantleeDocumentTemplate(const QString& tmplFile);
60 
61     const QString expand(ArchDoc *archDoc,
62                          const KContacts::Addressee &myContact,
63                          const KContacts::Addressee &customerContact) override;
64 };
65 
66 #endif // DOCUMENTTEMPLATE_H
67