Source: /app/hbasic/hbasic/src/report_document.h


Annotated List
Files
Globals
Hierarchy
Index
/* **************************************************************************
 File: report_document.h
 ----------------------------------------------------------------------------
	copyright            : (C) 2001 HBasic project (Marcus Engels)
 ***************************************************************************/

/* **************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

/* ----------------------------------------------------------------------- */
/* Classlist: List of classes that will be defined in this source file.    */
/* ----------------------------------------------------------------------- */
/* CReportPart : one part of a report description (header, footer ...) */
/* CReportGroupDesc : description of report grouping.  */
/* CReportDocument : Document description for one database report. */

/* ----------------------------------------------------------------------- */
/* Changelog: Description of important changes within this file.           */
/*            Please report with date, maintainer and change description.  */
/* ----------------------------------------------------------------------- */

#ifndef REPORTDOC_H
#define REPORTDOC_H

#include 
#include 
#include "../hbdata/hbobject.h"
#include "defines.h"
#include "structs.h"

class QFile;
class MemoryBlock;
class MemoryRBlock;
class CReportDocument;

/* Type of next field to be inserted into the report. */

#define TREP_SELECT 1
#define TREP_FIELD 2
#define TREP_LINE 3
#define TREP_FRAME 4
#define TREP_IMAGE 5

typedef struct _REP_OUTPUT_SIZE REP_OUTPUT_SIZE;

struct _REP_OUTPUT_SIZE
{
	int page_number;

	int left_pix_margin;
	int top_pix_margin;

	int page_pix_width;
	int page_pix_height;

	double x_inch_to_pix;
	double y_inch_to_pix;
};

/* ########################################################################## */
/**
 * @short Partial description of report structure. Report parts will
 *
 * CReportPart : Partial description of report structure. Report parts will
 *    be allocated to describe all properties of a report header or footer,
 *    page header or footer or othe rreport parts.
 */

class CReportPart : public HBObject, public QObject
{
public:
	CReportPart( char *name );
	~CReportPart( void );
	void freeElementList( void );
	void saveToFile( QFile *f, CReportDocument *doc_ptr );
	void loadFromFile( QFile *f, CReportDocument *doc_ptr, FILE_TAG_HEADER *start_block );
	void storeProperty( QString *name, QVariant *value );
	void changeOffsets( long start_offset, long diff );
	void compilePartFields( CReportDocument *parent );

public:
	/* Ypos of this part in editor window. */
	int pix_start_ypos;

	/* TRUE if part is currently selected */
	short selected;

	void *start_code;
};

/* ######################################################################### */
/**
 * @short Desrcription for fields that appear with a group header or footer. 
 *
 * CReportGroupDesc : If a report should also be grouped by some database field
 *  this class will be used to handle the data that is needed to describe
 *  the group.
 */

class CReportGroupDesc : public HBObject, public QObject 
{
public:
	CReportGroupDesc( char *name );

	QString field_name;   /* group field */
	short sort_order;     /* 0=none ?? 1=ascending 2=descending 3=Group by. */
	CReportPart *group_header;
	CReportPart *group_footer;

	/* Store last value used at runtime. */
	/* This will be used to find datasets for which we have to */
	/* display group header/footer */

	QVariant last_value;
};

/* ############################################################################# */
/**
 * @short Handles the data that is needed to describe a report.
 *
 * class CReportDocument : Since the data structure that describe the 
 * contents of a database report are more complex than a simple structure
 * they will be managed with this document class.
 */

class CReportDocument : public HBObject, public QObject
{
public:               /* methods */
	CReportDocument( QString report_name );
	~CReportDocument( void );

public:               /* variables */
	/* Type of grid 0=none 1=lines 2=dots */
	short grid_type;
	short display_ruler;

	/* 0 = table / 1 = query */
	short base_type;
	QString *base_name;

	/* Page size in inch */
	double page_width_inch;
	double page_height_inch;

	/* Ruler format type */
	short ruler_type;

	CReportPart *report_header;
	CReportPart *page_header;
	CReportPart *report_body;
	CReportPart *page_footer;
	CReportPart *report_footer;

	/* Source code describing how to retrieve the contents of the fields */
	MemoryRBlock *source_code;

	/* Insert/Change data stored in code_ptr in source_code starting at field_offset */
	/* If field_offset is -1 allocate new block for code segment and return it's offset. */
	long insertSourceCode( MemoryRBlock *code_ptr, long field_offset );
	void compileReportFields( void );
	void saveReport( QFile *f );
	void loadFromFile( QFile *f );
};

#endif


Generated by: root on linux on Sun Jul 13 18:06:35 2003, using kdoc 2.0a54.