Cambiato metodo add_to degli importi git-svn-id: svn://10.65.10.50/trunk@1491 c028cbd2-c16b-5b4b-a496-9718f37d4682
172 lines
4.7 KiB
C++
Executable File
172 lines
4.7 KiB
C++
Executable File
#ifndef __FORM_H
|
|
#define __FORM_H
|
|
|
|
#ifndef __STRINGS_H
|
|
#include <strings.h>
|
|
#endif
|
|
|
|
#ifndef __PRINTER_H
|
|
class TPrinter;
|
|
class TPrintrow;
|
|
#endif
|
|
|
|
#ifndef __SCANNER_H
|
|
class TScanner;
|
|
#endif
|
|
|
|
#ifndef __MASK_H
|
|
class TMask;
|
|
#endif
|
|
|
|
#ifndef __ISAM_H
|
|
class TRectype;
|
|
#endif
|
|
|
|
#ifndef __RELATION_H
|
|
class TRelation;
|
|
class TRelation_description;
|
|
class TCursor;
|
|
#endif
|
|
|
|
enum pagetype { odd_page, even_page, first_page, last_page };
|
|
|
|
class TForm;
|
|
class TForm_item;
|
|
|
|
|
|
class TPrint_section : public TArray
|
|
{
|
|
static TMask* _msk;
|
|
|
|
word _height; // Altezza della sezione
|
|
int _x, _y; // Offset di stampa
|
|
bool _dirty; // Flag di modifica parametri
|
|
|
|
TForm* _form; // Form cui appartiene alla sezione
|
|
pagetype _page_type; // Tipo della pagina
|
|
bool _subsection; // e' una sottosezione
|
|
|
|
TArray _item; // Lista dei campi da stampare
|
|
int _repeat_count; // n. ripetizioni eseguite
|
|
|
|
const TPrint_section& copy(const TPrint_section& ps);
|
|
|
|
protected:
|
|
virtual void print_on(ostream& out) const;
|
|
virtual 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]; }
|
|
TForm_item& find_field(short id) const;
|
|
|
|
word fields() const { return _item.items(); }
|
|
word height() const { return _height; }
|
|
int offset_x() const { return _x; }
|
|
int offset_y() const { return _y; }
|
|
void offset(int& x, int& y) const;
|
|
void set_repeat_count(int x) { _repeat_count = x; }
|
|
|
|
virtual bool ok() const { return height() > 0 || fields() > 0; }
|
|
|
|
void reset();
|
|
virtual bool update();
|
|
bool parse(TScanner& scanner);
|
|
|
|
bool read_from(const TRectype& rec);
|
|
void print_on(TRectype& rec);
|
|
|
|
bool edit(const char* title);
|
|
pagetype page_type() const { return _page_type; }
|
|
|
|
bool dirty() const { return _dirty; }
|
|
void set_dirty(bool d = TRUE) { _dirty = d; }
|
|
|
|
const TPrint_section& operator=(const TPrint_section& ps) { return copy(ps); }
|
|
TPrint_section(TForm* parent, pagetype pt, bool subsection = FALSE);
|
|
TPrint_section(const TPrint_section& ps) { copy(ps); }
|
|
virtual ~TPrint_section();
|
|
};
|
|
|
|
|
|
class TForm : public TObject
|
|
{
|
|
friend class TForm_editor;
|
|
|
|
TString16 _name; // Profile name
|
|
long _code; // Profile code
|
|
|
|
TRelation* _relation; // Can be NULL
|
|
TCursor* _cursor; // Can be NULL
|
|
TRelation_description* _rel_desc; // Can be NULL
|
|
|
|
TArray _head; // Headers
|
|
TArray _body; // Bodies
|
|
TArray _foot; // Footers
|
|
TArray _back; // Graphic backgrounds
|
|
|
|
bool _lastpage; // I am about to print the last page?
|
|
|
|
bool _isnew; // new form
|
|
bool _isbase; // base form (.frm file)
|
|
int _editlevel; // Edit permission
|
|
TString _desc; // form description
|
|
|
|
TPrint_section* exist(char s, pagetype t, bool create = FALSE); // Can be NULL
|
|
|
|
static void header_handler(TPrinter& p);
|
|
static void footer_handler(TPrinter& p);
|
|
|
|
protected:
|
|
// H = Header, B = Body, F = Footer, R = Relation
|
|
TPrint_section& section(char s = 'B', word page = 1);
|
|
word height(); // Height of first page
|
|
|
|
void print_section(ostream& out, char s) const;
|
|
virtual void print_on(ostream& out) const;
|
|
|
|
bool parse_use(TScanner&);
|
|
bool parse_join(TScanner&);
|
|
|
|
bool parse_description(TScanner&);
|
|
void print_description(ostream& out) const;
|
|
|
|
bool read_profile();
|
|
bool write_profile();
|
|
|
|
word page(const TPrinter& p) const;
|
|
|
|
virtual long records() const;
|
|
virtual word set_background(word p, bool u);
|
|
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);
|
|
|
|
const TString& name() const { return _name; }
|
|
long code() const { return _code; }
|
|
|
|
bool edit_level() const { return _editlevel; }
|
|
void set_description(const char* s) { _desc = s; }
|
|
|
|
TRelation* relation() const { return _relation; }
|
|
TRelation_description& rel_desc() const;
|
|
|
|
TCursor* cursor() const { return _cursor; }
|
|
virtual const char* validate(const char* cur, TToken_string& val);
|
|
|
|
TForm_item& find_field(char sec, pagetype pag, short id) const;
|
|
|
|
// if code == NULL it's a base form
|
|
// otherwise it's integrated by a file definition
|
|
TForm(const char* form, long code = 0L, int editlevel = 0, const char* desc = "");
|
|
virtual ~TForm();
|
|
};
|
|
|
|
#endif
|