2004-05-07 10:25:51 +00:00
|
|
|
#ifndef __REPRINT_H
|
|
|
|
#define __REPRINT_H
|
|
|
|
|
|
|
|
#ifndef __REPORT_H
|
|
|
|
#include <report.h>
|
|
|
|
#endif
|
|
|
|
|
2006-07-11 13:10:51 +00:00
|
|
|
enum {BOOKDPI = 720};
|
|
|
|
|
2004-05-27 10:55:07 +00:00
|
|
|
class TBook : public TObject
|
2004-05-07 10:25:51 +00:00
|
|
|
{
|
2004-05-27 10:55:07 +00:00
|
|
|
size_t _page, _pages;
|
2004-05-07 10:25:51 +00:00
|
|
|
|
2006-09-22 13:30:53 +00:00
|
|
|
TFilename _file, _pdf_file; // Nomi dei file di output
|
|
|
|
|
|
|
|
ofstream* _out; // File di output
|
|
|
|
TPointer_array _index; // Indice delle pagine
|
2007-04-02 08:25:53 +00:00
|
|
|
bool _is_temporary; // Flag di file di output temporaneo
|
2004-05-27 10:55:07 +00:00
|
|
|
|
|
|
|
DRAW_CTOOLS _tools;
|
|
|
|
TReport_font _font;
|
|
|
|
TRectangle _rect;
|
|
|
|
char _horizontal_alignment, _vertical_alignment;
|
2010-04-13 14:30:29 +00:00
|
|
|
int _shade_angle;
|
|
|
|
|
2004-05-27 16:00:36 +00:00
|
|
|
TReport_image_cache _images;
|
2004-05-07 10:25:51 +00:00
|
|
|
|
2008-03-20 17:11:59 +00:00
|
|
|
size_t _pagefrom, _pageto;
|
|
|
|
TPoint _max_frame;
|
|
|
|
word _copies;
|
2009-11-02 14:51:09 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void define_frame(const TRectangle& rect); // Salva su file un <frame> a 720 DPI
|
|
|
|
|
2004-05-07 10:25:51 +00:00
|
|
|
protected:
|
2004-05-27 10:55:07 +00:00
|
|
|
PRINT_RCD* _rcd;
|
2005-09-23 15:57:29 +00:00
|
|
|
TWindow* _printwin;
|
2009-11-02 14:51:09 +00:00
|
|
|
TSize _page_size; // Dimensioni stampabili a 720 DPI
|
2004-05-27 10:55:07 +00:00
|
|
|
bool _page_is_open;
|
2004-05-07 10:25:51 +00:00
|
|
|
|
2009-11-02 14:51:09 +00:00
|
|
|
virtual void define_frame(const TReport_rct& rect);
|
|
|
|
|
2004-05-27 10:55:07 +00:00
|
|
|
virtual bool init();
|
2009-11-02 14:51:09 +00:00
|
|
|
TPoint log2dev(const TReport_pnt& ptlog) const;
|
|
|
|
TRectangle log2dev(const TReport_rct& rctlog) const;
|
|
|
|
PNT log2pix(const TReport_pnt& ptlog) const;
|
2009-07-15 15:10:28 +00:00
|
|
|
short book2pix(int thickness) const;
|
2007-03-30 13:51:17 +00:00
|
|
|
void print_doc(TWindow& win, const TFilename& name);
|
|
|
|
void close_output();
|
|
|
|
|
|
|
|
void split_file(int colonne);
|
|
|
|
void join_file(int pps);
|
|
|
|
bool split_file_if_needed();
|
2006-07-11 13:10:51 +00:00
|
|
|
bool is_pdf() const { return _pdf_file.full(); }
|
2006-04-13 17:56:02 +00:00
|
|
|
|
2004-05-27 10:55:07 +00:00
|
|
|
public:
|
2004-05-07 10:25:51 +00:00
|
|
|
virtual bool open_page();
|
|
|
|
virtual bool close_page();
|
2004-05-27 10:55:07 +00:00
|
|
|
virtual bool main_loop();
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
virtual const TFilename & file() const { return _file;}
|
|
|
|
virtual void set_pen(COLOR color, int width = 0, PEN_STYLE style = P_SOLID);
|
2010-04-13 14:30:29 +00:00
|
|
|
virtual void set_brush(COLOR color, PAT_STYLE pattern = PAT_SOLID, int shade_angle = 0);
|
2004-07-21 10:52:09 +00:00
|
|
|
virtual void set_font(const TReport_font& font);
|
|
|
|
virtual void set_text_color(COLOR fore, COLOR back = COLOR_WHITE, bool opaque = false);
|
|
|
|
virtual void set_text_align(char halign ='L', char valign = 'T');
|
2009-11-02 14:51:09 +00:00
|
|
|
virtual void draw_rectangle(const TReport_rct& rect);
|
|
|
|
virtual void draw_round_rectangle(const TReport_rct& rect, int radius);
|
|
|
|
virtual void draw_ellipse(const TReport_rct& rect);
|
|
|
|
virtual void draw_line(const TReport_rct& rect);
|
|
|
|
virtual void draw_image(const TReport_rct& rect, const char* filename);
|
|
|
|
virtual void draw_text(const TReport_rct& rect, const char* text, const char* owner);
|
|
|
|
virtual void draw_text(const TReport_rct& rect, const TString_array& text, const char* owner);
|
|
|
|
virtual void draw_link(const TReport_rct& rect, const char* text, const char* link);
|
|
|
|
virtual void draw_book_pages(const TReport_rct& r);
|
2004-07-29 12:49:43 +00:00
|
|
|
virtual void set_clip(long top, long bottom);
|
2009-11-02 14:51:09 +00:00
|
|
|
virtual int compute_text_frame(const TString& txt, const TReport_font& font, TReport_rct& rect, TString_array& para) const;
|
2006-04-13 17:56:02 +00:00
|
|
|
virtual void add_doc(const TString& name);
|
2007-09-17 15:33:04 +00:00
|
|
|
virtual bool can_split(int pages) const;
|
|
|
|
virtual bool can_merge(int pages) const;
|
2006-04-13 17:56:02 +00:00
|
|
|
|
2009-11-02 14:51:09 +00:00
|
|
|
TSize page_size() const;
|
|
|
|
TSize page_res() const;
|
2004-05-27 10:55:07 +00:00
|
|
|
size_t page() const { return _page; }
|
|
|
|
size_t pages() const { return _pages; }
|
2008-03-20 17:11:59 +00:00
|
|
|
|
2004-06-03 08:13:02 +00:00
|
|
|
virtual int lpi() const { return 6; }
|
|
|
|
virtual int cpi() const { return 10; }
|
2004-06-15 14:55:33 +00:00
|
|
|
virtual int logical_page_width() const { return page_size().x * cpi() / page_res().x * 100; }
|
|
|
|
virtual int logical_page_height() const { return page_size().y * lpi() / page_res().y * 100; }
|
2004-05-27 10:55:07 +00:00
|
|
|
|
|
|
|
virtual bool print_page(TWindow& win, size_t page);
|
2007-04-02 08:25:53 +00:00
|
|
|
// virtual void print_doc(TWindow& win, const TFilename& name);
|
2004-06-03 08:13:02 +00:00
|
|
|
virtual bool on_link(const TReport_link&) { return false; }
|
2004-05-07 10:25:51 +00:00
|
|
|
|
2009-03-06 16:25:35 +00:00
|
|
|
virtual bool print(size_t pagefrom = 0, size_t pageto = 0, word copies = 0);
|
2009-03-19 15:50:04 +00:00
|
|
|
virtual bool archive(const char* repname, bool signature);
|
2004-05-27 10:55:07 +00:00
|
|
|
virtual bool preview();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
2009-07-15 15:10:28 +00:00
|
|
|
virtual bool export_excel(TFilename& fname, bool signature);
|
2009-03-19 15:50:04 +00:00
|
|
|
virtual bool export_pdf(TFilename& fname, bool signature);
|
|
|
|
virtual bool export_text(TFilename& fname, bool signature);
|
|
|
|
virtual bool send_mail(TFilename& fname, bool signature);
|
2006-12-29 14:16:28 +00:00
|
|
|
virtual bool esporta();
|
2004-05-27 10:55:07 +00:00
|
|
|
bool print_or_preview(); // Calls one of the above
|
2004-05-07 10:25:51 +00:00
|
|
|
|
2004-05-27 10:55:07 +00:00
|
|
|
TBook(const char* name);
|
|
|
|
virtual ~TBook();
|
2004-05-07 10:25:51 +00:00
|
|
|
};
|
|
|
|
|
2004-05-27 10:55:07 +00:00
|
|
|
class TReport_book : public TBook
|
2004-05-07 10:25:51 +00:00
|
|
|
{
|
2004-05-27 10:55:07 +00:00
|
|
|
TReport* _report;
|
2004-05-07 10:25:51 +00:00
|
|
|
long _logical_page_height, _logical_page_width;
|
|
|
|
long _logical_foot_pos;
|
|
|
|
bool _is_last_page, _page_break_allowed;
|
2009-11-02 14:51:09 +00:00
|
|
|
TReport_size _delta;
|
2004-06-11 14:12:12 +00:00
|
|
|
size_t _rep_page;
|
2004-05-07 10:25:51 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool open_page();
|
|
|
|
virtual bool close_page();
|
2007-03-06 16:37:44 +00:00
|
|
|
virtual void add_doc(const TString& name);
|
2007-09-17 15:33:04 +00:00
|
|
|
virtual bool can_split(int pages) const;
|
|
|
|
virtual bool can_merge(int pages) const;
|
2004-05-27 10:55:07 +00:00
|
|
|
|
2009-11-02 14:51:09 +00:00
|
|
|
virtual void define_frame(const TReport_rct& r);
|
2004-06-03 08:13:02 +00:00
|
|
|
virtual bool on_link(const TReport_link& lnk);
|
2004-05-27 10:55:07 +00:00
|
|
|
|
|
|
|
bool init(TReport& rep);
|
2005-03-03 15:42:04 +00:00
|
|
|
void reprint_group_headers(const TReport_section& rs);
|
2004-05-07 10:25:51 +00:00
|
|
|
long print_section(TReport_section& rs);
|
|
|
|
long print_section(char type, int level);
|
2005-02-17 18:13:12 +00:00
|
|
|
void print_subsections(int father);
|
2004-05-07 10:25:51 +00:00
|
|
|
|
|
|
|
public:
|
2004-06-04 11:28:14 +00:00
|
|
|
bool add(TReport& report, bool progind = true);
|
2004-05-27 10:55:07 +00:00
|
|
|
|
2004-06-03 08:13:02 +00:00
|
|
|
virtual int lpi() const;
|
|
|
|
virtual int cpi() const;
|
2004-06-15 14:55:33 +00:00
|
|
|
virtual int logical_page_width() const { return _logical_page_width; }
|
|
|
|
virtual int logical_page_height() const { return _logical_page_height; }
|
2009-03-06 12:11:03 +00:00
|
|
|
virtual bool print(size_t pagefrom = 0, size_t pageto = 0, word copies = 0);
|
2009-03-19 15:50:04 +00:00
|
|
|
virtual bool archive(const char* repname, bool signature);
|
2004-06-04 11:28:14 +00:00
|
|
|
TReport_book(const char* name = NULL);
|
2004-05-07 10:25:51 +00:00
|
|
|
};
|
|
|
|
|
2004-06-15 14:55:33 +00:00
|
|
|
bool advanced_set_draw_tools(TWindow& win, PAT_STYLE pat, int border, COLOR fore, COLOR back);
|
2004-07-27 14:20:01 +00:00
|
|
|
void advanced_draw_rect(TWindow& win, const RCT& r, PAT_STYLE pat, int border, COLOR fore, COLOR back, int radius, int shade);
|
2009-03-06 12:11:03 +00:00
|
|
|
void advanced_draw_text_line(WINDOW win, const char* text, const RCT& r, char halign, char valign);
|
|
|
|
void advanced_draw_paragraph(WINDOW win, const TString_array& text, const RCT& r,
|
2009-11-02 14:51:09 +00:00
|
|
|
char halign, char valign, int default_10row_height);
|
2004-05-07 10:25:51 +00:00
|
|
|
|
2008-04-04 16:04:15 +00:00
|
|
|
#endif
|