#ifndef __PAGEPRNT_H #define __PAGEPRNT_H #ifndef __ASSOC_H #include #endif #ifndef __WINDOW_H #include #endif class TReport_font : public TObject { enum { DEFAULT_FONT_SIZE = 10 }; TString _name; int _size, _cpi; bool _bold, _italic, _underline; TArray _physical; public: const TString& name() const { return _name; } int size() const { return _size; } XVT_FNTID get_xvt_font(WINDOW win, int size) const; TReport_font(); virtual ~TReport_font() { } }; class TReport_section : public TArray { const TReport_section* _father; char _type; // Head,Body,Tail int _level; // 0,1,2,... TReport_font* _font; public: char type() const { return _type; } int level() const { return _level; } void description(TString& str) const; const TReport_font& font() const; TReport_section(const TReport_section* f, char t, int l); virtual ~TReport_section(); }; class TReport_field : public TObject { TReport_section* _section; char _type; // Text, String, Numeric, Date, Line, Rectangle, Image short _x, _y; // Coordinate in centesimi short _width, _height; // Dimensioni in centesimi COLOR _fgcolor, _bgcolor; short _border; char _halign, _valign; TString _picture, _field; TReport_font* _font; bool _selected; protected: void copy(const TReport_field& rf); public: virtual TObject* dup() const { return new TReport_field(*this); } TReport_field& operator=(const TReport_field& rf) { copy(rf); return *this; } TReport_section& section() { return *_section; } void set_section(TReport_section* sec) { _section = sec; } char type() const { return _type; } const TReport_font& font() const; const TString& picture() const { return _picture; } void set_picture(const char* str) { _picture = str; } const TString& field() const { return _field; } void set_field(const char* str) { _field = str; } void set_type(char t) { _type = t; } void set_pos(short x, short y); void set_size(short w, short h); void get_rect(RCT& rct) const; void set_fore_color(COLOR c) { _fgcolor = c; } COLOR fore_color() const { return _fgcolor; } void set_back_color(COLOR c) { _bgcolor = c; } COLOR back_color() const { return _bgcolor; } void set_border(short b) { _border = b; } short border() const { return _border; } void set_horizontal_alignment(char a) { _halign = a; } char horizontal_alignment() const { return _halign; } void set_vertical_alignment(char a) { _valign = a; } char vertical_alignment() const { return _valign; } void select(bool ok = true) { _selected = ok; } bool selected() const { return _selected; } void offset(const TPoint& pt); TReport_field(TReport_section* sec); TReport_field(const TReport_field& rf) { copy(rf); } }; class TReport : public TObject { TAssoc_array _sections; int _cpi, _lpi; protected: void build_section_key(char type, int level, TString& key) const; public: TReport_section* find_section(char type, int level) const; TReport_section& section(char type, int level); TReport_section& background_section(char type) { return section(type, 0); } int cpi() const { return _cpi; } int lpi() const { return _lpi; } TReport(); }; class TPage_printer : public TWindow { protected: long _pw, _ph, _phr, _pvr; // Printer width, height, horizontal and vertical resolution word _copies; word _pagefrom; word _pageto; bool _aborted; public: virtual int pages() const pure; virtual bool print_page(int p) pure; virtual const char* form_name() const; virtual const char* font_name() const; virtual int font_size() const; virtual bool ask_pages(); virtual bool print(); TPage_printer(); virtual ~TPage_printer(); }; #endif