100 lines
2.2 KiB
C++
Executable File
100 lines
2.2 KiB
C++
Executable File
#ifndef __FORM_H
|
|
#define __FORM_H
|
|
|
|
#ifndef __PRINTER_H
|
|
#include <printer.h>
|
|
#endif
|
|
|
|
#ifndef __SCANNER_H
|
|
#include <scanner.h>
|
|
#endif
|
|
|
|
#ifndef __RELATION_H
|
|
class TRelation;
|
|
class TCursor;
|
|
#endif
|
|
|
|
enum pagetype { odd_page, even_page, first_page, last_page };
|
|
|
|
class TForm;
|
|
class TForm_item;
|
|
|
|
class TPrint_section : public TArray
|
|
{
|
|
word _height; // Altezza della sezione
|
|
|
|
TForm* _form; // Form cui appartiene alla sezione
|
|
TArray _item; // Lista dei campi da stampare
|
|
|
|
protected:
|
|
virtual void print_on(ostream& out) const;
|
|
TForm_item* parse_item(const TString& key);
|
|
TForm_item* parse_item(TScanner& scanner);
|
|
|
|
public:
|
|
TPrintrow& row(int num);
|
|
TForm* form() const { return _form; }
|
|
|
|
TForm_item& field(int n) const { return (TForm_item&)_item[n]; }
|
|
word fields() const { return _item.items(); }
|
|
word height() const { return _height; }
|
|
|
|
void reset();
|
|
bool update();
|
|
bool parse(TScanner& scanner);
|
|
|
|
bool edit();
|
|
|
|
TPrint_section(TForm* parent);
|
|
virtual ~TPrint_section() {}
|
|
};
|
|
|
|
|
|
class TForm : public TObject
|
|
{
|
|
TFilename _name; // Profile name
|
|
|
|
TRelation* _relation; // Can be NULL
|
|
TCursor* _cursor; // Can be NULL
|
|
|
|
TArray _head; // Headers
|
|
TArray _body; // Bodies
|
|
TArray _foot; // Footers
|
|
|
|
bool _lastpage;
|
|
|
|
TPrint_section& page2pos(const TArray& a, word p) const;
|
|
|
|
static void header_handler(TPrinter& p);
|
|
static void footer_handler(TPrinter& p);
|
|
|
|
protected:
|
|
TPrint_section& section(char s, pagetype t); // H = Header, B = Body, F = Footer
|
|
|
|
void print_section(ostream& out, const TArray& s, const char* name) const;
|
|
virtual void print_on(ostream& out) const;
|
|
|
|
bool parse_use(TScanner&);
|
|
bool parse_join(TScanner&);
|
|
|
|
word page(const TPrinter& p) const;
|
|
|
|
virtual long records() const;
|
|
virtual word set_header(word p, bool u);
|
|
virtual word set_body(word p, bool u);
|
|
virtual word set_footer(word p, bool u);
|
|
|
|
public:
|
|
bool print(long from = 0L, long to = -1L);
|
|
|
|
TRelation* relation() const { return _relation; }
|
|
TCursor* cursor() const { return _cursor; }
|
|
|
|
bool edit(char section, pagetype t);
|
|
|
|
TForm(const char* form);
|
|
~TForm();
|
|
};
|
|
|
|
#endif
|