Source: /app/hbasic/hbasic/gui_db_access/report_editor.h
|
|
|
|
/* **************************************************************************
File: report_editor.h
Desc: Report editor widget
----------------------------------------------------------------------------
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. */
/* ----------------------------------------------------------------------- */
/**
* class ReportEditor : Edit database reports.
*/
/* ----------------------------------------------------------------------- */
/* Changelog: Description of important changes within this file. */
/* Please report with date, maintainer and change description. */
/* ----------------------------------------------------------------------- */
#ifndef REPORT_EDIT_H
#define REPORT_EDIT_H
class QLabel;
class QScrollView;
class ReportDesigner;
class RWidgetSelection;
class HBReportElmt;
class HBProperty;
#include
#include
#include
// #include
#include
#include "rsizehandle.h"
#include "../src/structs.h"
#include "report_document.h"
#define SREP_SELECT 1
#define SREP_LABEL 2
#define SREP_FIELD 3
#define MTYPE_MOVE_NONE 0
#define MTYPE_MOVE_RBORDER 1
#define MTYPE_MOVE_BOTTOM 2
/**
* @short Database report editor widget.
*
* class CReportEditorWidget : This class handles the main editing functions
* for the database report editor.
*/
class CRulerWidget : public QWidget
{
Q_OBJECT
public:
CRulerWidget( QWidget *parent, CReportDocument *doc_ptr, short new_ruler_type );
/* Set position of scrollbars as offset for ruler. */
void setHScrollPos( short new_xpos );
void setVScrollPos( short new_ypos );
void drawLeftRuler( void );
private:
/* Draw contents of rulers. */
void drawTopRuler( void );
void paintEvent( QPaintEvent *evt );
void drawPartRuler( QPainter *p, short *pix_ypos, CReportPart *part_ptr );
short ruler_type; // 0=top 1=bottom
short text_line_height;
CReportDocument *doc_ptr;
short hscroll_pos;
short vscroll_pos;
};
/* ################################################################## */
class CReportEditor : public QWidget
{
Q_OBJECT
public:
CReportEditor( ReportDesigner *parent, CReportDocument *doc_ptr );
CRulerWidget *left_ruler_wgt;
void setNewScale( double );
private:
CReportDocument *report_document;
CReportEditorWidget *display_wgt;
CRulerWidget *top_ruler_wgt;
void resizeEvent( QResizeEvent *evt );
public slots:
void slotShowRuler( void );
private slots:
void slotNewContentsPos( int xpos, int ypos );
};
/* ################################################################## */
class CReportEditorWidget : public QScrollView
{
Q_OBJECT
public:
CReportEditorWidget( CReportEditor *parent, ReportDesigner *designer_parent, CReportDocument *doc_ptr );
enum RectType { Insert, Rubber };
public: /* methods */
QPoint grid() const;
QLabel *sizePreview() const;
void checkPreviewGeometry( QRect &r );
void updateChildSelections( QWidget *w );
void emitUpdateProperties( QWidget *w );
void setScaleFactor( double change_factor );
void resizeReportFields( CReportPart *rep_part_ptr, double resize_factor );
private: /* variables */
CReportDocument *document_ptr;
CReportEditor *parent_editor;
/* size of the report editor widget. */
int report_width;
int report_height;
/* height of one text line */
short text_line_height;
int mouse_moving;
int mouse_changed;
int mouse_move_start_ypos;
CReportPart *mouse_move_part;
bool widgetPressed;
bool drawRubber;
bool checkedSelectionsForMove;
bool propShowBlocked;
QWidget *insertParent;
ReportDesigner *parent_designer;
QList selections;
QPtrDict repUsedSelections;
QWidget *propertyWidget;
HBReportElmt *propertyElement;
CReportPart *propertyPart;
QLabel *sizePreviewLabel;
QPtrDict insertedWidgets;
bool oldRectValid;
QRect currRect;
QPoint rectAnchor;
QPainter *unclippedPainter;
QPoint sizePreviewPos;
QPixmap *sizePreviewPixmap;
QRect widgetGeom;
QPoint oldPressPos, origPressPos;
QObject *connectReceiver;
QMap moving;
private: /* methods */
void drawReportFields( QPainter *p, char *header_text,
CReportPart *field_list, short *current_ypos, int *current_sep_height );
void createReportItems( void );
void setElmtProperty( CReportPart *rep_part_ptr,
HBReportElmt *rep_elmt_ptr, HBProperty *property_ptr );
void addReportFields( CReportPart *rep_part_ptr );
void unselectReportParts( void );
bool checkYWidgetBorder( CReportPart *part_ptr, int ypos, int *check_ypos);
void changeBorder( int xpos, int ypos );
void checkWidgetBorder( int xpos, int ypos );
CReportPart *getPartByYpos( QMouseEvent *evt, short *is_header );
QWidget *createItem( CReportPart *rep_part_ptr, int xpos, int ypos );
void rightMousePressEvent( QMouseEvent *evt );
bool eventFilter( QObject *obj, QEvent *evt );
void drawContents(QPainter* p, int cx, int cy, int cw, int ch);
short getReportHeight( void );
short checkHeaderClicked( CReportPart *rep_part_ptr, short current_ypos );
short checkFieldClicked( CReportPart *rep_part_ptr, short xpos, short current_ypos );
void handleMousePress( QMouseEvent *e, QWidget *w, CReportPart *rep_part_ptr );
void handleMouseMove( QMouseEvent *e, QWidget *w, CReportPart *rep_part_ptr );
void handleMouseRelease( QMouseEvent *e, QWidget *w, CReportPart *rep_part_ptr );
QWidget *checkFieldObject( CReportPart *part_desc_ptr, QObject *obj );
QWidget *getMouseWidget( QObject *o, CReportPart **rep_part_ptr );
void updateProperty( char *name, QVariant value );
void selectWidget( QWidget *w, bool select = TRUE );
void changePartYpos( CReportPart *part_ptr, int ydiff );
void updateSelection( QWidget *w );
void raiseSelection( QWidget *w );
void clearSelection( bool changePropertyDisplay );
void repaintSelection( QWidget *w );
bool allowMove( QWidget *w );
void continueRectDraw( const QPoint &p, const QPoint &global, QWidget *, RectType t );
void endRectDraw();
void endUnclippedPainter();
void setPropertyShowingBlocked( bool b );
void moveSelectedWidgets( CReportPart *rep_part_ptr, int dx, int dy );
void checkSelectionsForMove( QWidget *w );
bool isWidgetSelected( QWidget *w );
bool isPropertyShowingBlocked() const;
void startRectDraw( const QPoint &p, const QPoint &global, QWidget *, RectType t );
void raiseChildSelections( QWidget *w );
void beginUnclippedPainter( bool doNot );
bool isMainContainer( QWidget *w );
void selectWidgets();
QPoint gridPoint( const QPoint &p );
void drawSizePreview( const QPoint &pos, const QString& text );
private slots:
void slotEditGroups( void );
void slotChangeReportHeader( void );
void slotChangePageHeader( void );
void slotChangePageFooter( void );
void slotChangeReportFooter( void );
void slotShowGrid( void );
};
#endif
Generated by: root on linux on Sun Jul 13 18:06:35 2003, using kdoc 2.0a54. |