summaryrefslogtreecommitdiffstats
path: root/kbarcode/label.h
blob: 698b86118347768ed817d44ed9f649fda60e5c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/***************************************************************************
                          label.h  -  description
                             -------------------
    begin                : Mon Apr 29 2002
    copyright            : (C) 2002 by Dominik Seichter
    email                : domseichter@web.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef LABEL_H
#define LABEL_H

#include <qfont.h>
#include <qpicture.h>
#include "labelutils.h"
#include "xmlutils.h"
#include "definition.h"
#include "tokenprovider.h"

class BarCode;
class Barkode;
class QDomDocument;
class QIODevice;
class QString;
class QPainter;
class QPaintDevice;
class QTextStream;
class KPrinter;
/** Creates a QPicture from the XML KBarcode file. If a SQL connections is available
  * the data from the SQL tables will be used, too.
  */
class Label : private LabelUtils, private XMLUtils, public TokenProvider {
    public:
        Label( Definition* _def, QIODevice* device, QString labelname, QPaintDevice* _printer, QString customer_id, QString _article_no, QString _group = "" );
        Label( Definition* _def, QIODevice* device, QString labelname, QPaintDevice* _printer );
        ~Label();

        void epcl( QTextStream* stream );
        void ipl( QTextStream* stream );
        void zpl( QTextStream* stream );

        void draw( QPainter* painter,int x, int y );
        
        int getId() const;  
        static void getXLabel( double x, double y, double width, double height, QPainter* painter, int mode, QString value = "" );

        //void setPrinter( KPrinter* p ) { m_printer = p; }

	/** reimplemented from TokenProvider
	 *  returns wether this label has to be regenerated everytime
	 */
	bool update();

    private:
        void load( QIODevice* device );
        void setBarcodeValue( Barkode* barcode );
        void InitBarcodes();
        bool drawThisItem( const DocumentItem* item );

    protected:
        DocumentItemList m_list;
        
        Definition* d;
        QPaintDevice* m_printer;

        bool m_sequence;
};

#endif