0270efe4ef
Files correlati : Ricompilazione Demo : [ ] Commento :corretti 46 errori di riporto! git-svn-id: svn://10.65.10.50/trunk@15154 c028cbd2-c16b-5b4b-a496-9718f37d4682
141 lines
5.0 KiB
C++
Executable File
141 lines
5.0 KiB
C++
Executable File
#ifndef __REPRINT_H
|
|
#define __REPRINT_H
|
|
|
|
#ifndef __REPORT_H
|
|
#include <report.h>
|
|
#endif
|
|
|
|
enum {BOOKDPI = 720};
|
|
|
|
class TBook : public TObject
|
|
{
|
|
size_t _page, _pages;
|
|
|
|
TFilename _file, _pdf_file; // Nomi dei file di output
|
|
|
|
ofstream* _out; // File di output
|
|
TPointer_array _index; // Indice delle pagine
|
|
bool _is_temporary; // Flag di file di output temporaneo
|
|
|
|
DRAW_CTOOLS _tools;
|
|
TReport_font _font;
|
|
TRectangle _rect;
|
|
char _horizontal_alignment, _vertical_alignment;
|
|
TReport_image_cache _images;
|
|
|
|
size_t _pagefrom, _pageto, _copies;
|
|
TPoint _max_frame; // Massimo rettangolo scritto sul file di output
|
|
|
|
protected:
|
|
PRINT_RCD* _rcd;
|
|
TWindow* _printwin;
|
|
long _ph, _pw, _pvr, _phr;
|
|
bool _page_is_open;
|
|
|
|
virtual void define_frame(const TRectangle& rect);
|
|
virtual bool init();
|
|
TPoint log2dev(const TPoint& ptlog) const;
|
|
PNT log2pix(const TPoint& ptlog) const;
|
|
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();
|
|
bool is_pdf() const { return _pdf_file.full(); }
|
|
|
|
public:
|
|
virtual bool open_page();
|
|
virtual bool close_page();
|
|
virtual bool main_loop();
|
|
|
|
virtual const TFilename & file() const { return _file;}
|
|
virtual void set_pen(COLOR color, int width = 0, PEN_STYLE style = P_SOLID);
|
|
virtual void set_brush(COLOR color, PAT_STYLE pattern = PAT_SOLID);
|
|
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');
|
|
virtual void draw_rectangle(const TRectangle& rect);
|
|
virtual void draw_round_rectangle(const TRectangle& rect, int radius);
|
|
virtual void draw_ellipse(const TRectangle& rect);
|
|
virtual void draw_line(const TRectangle& rect);
|
|
virtual void draw_image(const TRectangle& rect, const char* filename);
|
|
virtual void draw_text(const TRectangle& rect, const char* text);
|
|
virtual void draw_text(const TRectangle& rect, const TString_array& text);
|
|
virtual void draw_link(const TRectangle& rect, const char* text, const char* link);
|
|
virtual void draw_book_pages(const TRectangle& r);
|
|
virtual void set_clip(long top, long bottom);
|
|
virtual int compute_text_frame(const TString& txt, const TReport_font& font, TRectangle& rect, TString_array& para) const;
|
|
virtual void add_doc(const TString& name);
|
|
|
|
TPoint page_size() const;
|
|
TPoint page_res() const;
|
|
size_t page() const { return _page; }
|
|
size_t pages() const { return _pages; }
|
|
virtual int lpi() const { return 6; }
|
|
virtual int cpi() const { return 10; }
|
|
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; }
|
|
|
|
virtual bool print_page(TWindow& win, size_t page);
|
|
// virtual void print_doc(TWindow& win, const TFilename& name);
|
|
virtual bool on_link(const TReport_link&) { return false; }
|
|
|
|
virtual bool print(size_t pagefrom = 0, size_t pageto = 0, size_t copies = 0);
|
|
virtual bool archive(const char* repname = NULL);
|
|
virtual bool preview();
|
|
|
|
virtual bool export_pdf(const TFilename& fname);
|
|
virtual bool export_text(const TFilename& fname);
|
|
virtual bool send_mail(const TFilename& fname);
|
|
virtual bool esporta();
|
|
bool print_or_preview(); // Calls one of the above
|
|
|
|
TBook(const char* name);
|
|
virtual ~TBook();
|
|
};
|
|
|
|
class TReport_book : public TBook
|
|
{
|
|
TReport* _report;
|
|
long _logical_page_height, _logical_page_width;
|
|
long _logical_foot_pos;
|
|
bool _is_last_page, _page_break_allowed;
|
|
TPoint _delta;
|
|
size_t _rep_page;
|
|
|
|
protected:
|
|
virtual bool open_page();
|
|
virtual bool close_page();
|
|
virtual void add_doc(const TString& name);
|
|
|
|
virtual void define_frame(const TRectangle& r);
|
|
virtual bool on_link(const TReport_link& lnk);
|
|
|
|
bool init(TReport& rep);
|
|
void reprint_group_headers(const TReport_section& rs);
|
|
long print_section(TReport_section& rs);
|
|
long print_section(char type, int level);
|
|
void print_subsections(int father);
|
|
|
|
public:
|
|
bool add(TReport& report, bool progind = true);
|
|
|
|
virtual int lpi() const;
|
|
virtual int cpi() const;
|
|
virtual int logical_page_width() const { return _logical_page_width; }
|
|
virtual int logical_page_height() const { return _logical_page_height; }
|
|
|
|
virtual bool print(size_t pagefrom = 0, size_t pageto = 0, size_t copies = 0);
|
|
virtual bool archive(const char* repname = NULL);
|
|
|
|
TReport_book(const char* name = NULL);
|
|
};
|
|
|
|
bool advanced_set_draw_tools(TWindow& win, PAT_STYLE pat, int border, COLOR fore, COLOR back);
|
|
void advanced_draw_rect(TWindow& win, const RCT& r, PAT_STYLE pat, int border, COLOR fore, COLOR back, int radius, int shade);
|
|
void advanced_draw_text_line(TWindow& win, const char* text, const RCT& r, char halign, char valign);
|
|
void advanced_draw_paragraph(TWindow& win, const TString_array& text, const RCT& r,
|
|
char halign, char valign, int default_row_height);
|
|
|
|
#endif |