3e25e35ae6
Files correlati : ba8 Ricompilazione Demo : [ ] Commento : Riassunto 0001600: Dopo la stampa di un report in orizz ritorna in visual con il foglio in vert. Faccio l'anteprima di un report creato con orientamento foglio orrizzontale fisso, dopo aver stampato ritorna in visualizzazione con l'orientamento del foglio impostato sulla stampante (normalmente in verticale) git-svn-id: svn://10.65.10.50/trunk@20331 c028cbd2-c16b-5b4b-a496-9718f37d4682
155 lines
5.5 KiB
C++
Executable File
155 lines
5.5 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;
|
|
int _shade_angle;
|
|
|
|
TReport_image_cache _images;
|
|
|
|
size_t _pagefrom, _pageto;
|
|
TPoint _max_frame;
|
|
word _copies;
|
|
|
|
private:
|
|
void define_frame(const TRectangle& rect); // Salva su file un <frame> a 720 DPI
|
|
|
|
protected:
|
|
PRINT_RCD* _rcd;
|
|
TWindow* _printwin;
|
|
TSize _page_size; // Dimensioni stampabili a 720 DPI
|
|
bool _page_is_open;
|
|
|
|
virtual void define_frame(const TReport_rct& rect);
|
|
|
|
virtual bool init();
|
|
TPoint log2dev(const TReport_pnt& ptlog) const;
|
|
TRectangle log2dev(const TReport_rct& rctlog) const;
|
|
PNT log2pix(const TReport_pnt& ptlog) const;
|
|
short book2pix(int thickness) 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, int shade_angle = 0);
|
|
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 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);
|
|
virtual void set_clip(long top, long bottom);
|
|
virtual int compute_text_frame(const TString& txt, const TReport_font& font, TReport_rct& rect, TString_array& para) const;
|
|
virtual void add_doc(const TString& name);
|
|
virtual bool can_split(int pages) const;
|
|
virtual bool can_merge(int pages) const;
|
|
|
|
TSize page_size() const;
|
|
TSize 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, word copies = 0);
|
|
virtual bool archive(const char* repname, bool signature);
|
|
virtual bool preview();
|
|
|
|
virtual bool export_excel(TFilename& fname, bool signature);
|
|
virtual bool export_pdf(TFilename& fname, bool signature);
|
|
virtual bool export_text(TFilename& fname, bool signature);
|
|
virtual bool send_mail(TFilename& fname, bool signature);
|
|
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;
|
|
TReport_size _delta;
|
|
size_t _rep_page;
|
|
|
|
protected:
|
|
virtual bool open_page();
|
|
virtual bool close_page();
|
|
virtual void add_doc(const TString& name);
|
|
virtual bool can_split(int pages) const;
|
|
virtual bool can_merge(int pages) const;
|
|
|
|
virtual void define_frame(const TReport_rct& 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, word copies = 0);
|
|
virtual bool archive(const char* repname, bool signature);
|
|
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(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,
|
|
char halign, char valign, int default_10row_height);
|
|
|
|
#endif
|