Source: /app/hbasic/hbasic/hbdata/hbsheet.h
|
|
|
|
/* **************************************************************************
File: sheet_cell_data.h
Desc: Data handler for sheets
----------------------------------------------------------------------------
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 CSheetEditor: Editor widget for calc sheets.
*/
/* ----------------------------------------------------------------------- */
/* Changelog: Description of important changes within this file. */
/* Please report with date, maintainer and change description. */
/* ----------------------------------------------------------------------- */
#ifndef SHEET_DATA_H
#define SHEET_DATA_H
class CSourceEditData;
class HBProperty;
#include
#include "hbsublist.h"
/* Header orientation */
#define HEAD_VERTICAL 0
#define HEAD_HORIZONTAL 1
/* Header for description of one calc sheet cell/entry/item */
/* Cell properties will be stored in property list that will be created at runtime */
/* in sublists of parent QObject structure. */
class HBSheetCell : public QObject, public HBObject
{
public:
HBSheetCell( char *name );
short entry_type;
short calc_state;
long source_code_start; /* Start offset of sourcecode in sheet data */
long source_code_length; /* length of content description in byte. */
void *runtime_code; /* Address of appropriate code after compile */
QVariant *value;
short row_number;
short column_number;
/* Save value text as internal description */
void saveValue( char *new_text );
/* Get value of cell as text */
/* unparse_expr = TRUE if expressions should be displayed as text */
/* Otherwise it's value will be returned. The value will normalle */
/* be displayed in the table and the unparsed expression in the */
/* edit line at the top. */
QString *getValueText( short unparse_expr );
/* Methods to save changed value in cell description of value */
void createTextDesc( char *cptr, HBSheet *sheet_ptr );
void createNumberDesc( char *cptr, HBSheet *sheet_ptr );
void createExpressionDesc( char *cptr, HBSheet *sheet_ptr );
void replaceCellValue( char *new_text, HBSheet *sheet_ptr );
void correctFieldOffsets( CSourceEditData *byte_data, char *store_adr_ptr, long change_offset );
/* Get contents of fiels as text */
QString getCellValue( CSourceEditData *data_ptr, short in_sheet );
};
class HBSheetCellHeader : public QObject, public HBObject
{
public:
HBSheetCellHeader( short orientation, char *name );
short position;
/* Width or height of column or row */
short pix_size;
/* Start position of header in widget */
short pix_start;
};
class HBSheet : public QObject, public HBObject
{
public:
HBSheet( char *name );
/* Property default values or properties that should be applied to the whole sheet. */
// HBSubList properties;
CSourceEditData *cell_contents;
// TODO: add HBSheetRange list
/* Pointer to sheet editor if available */
CSheetEditor *sheet_edit_ptr;
HBSheetCellHeader *findHeader( short orientation, short position, short create_it );
HBSheetCellHeader *findHeaderAt( short orientation, short pix_findpos,
short create_it, short *find_pos, short *find_pix_pos, short *pos_ok );
HBSheetCellHeader *findHeaderAtMousepos( short orientation, short pix_findpos,
short *find_pos, short *find_pix_pos );
HBSheetCell *findCell( short row, short column, short create_it );
void saveSheetToFile( QFile *f );
void loadSheetFromFile( QFile *f, FILE_TAG_HEADER *start_block );
void correctFieldOffsets( char *store_adr_ptr, long change_offset );
void insertRow( short find_row );
void insertColumn( short find_col );
void deleteRow( short find_row );
void deleteColumn( short find_column );
private:
void findCellEntry( HBSubList *head_list, short find_pos, HBSheetCell *cell_ptr );
};
#endif
Generated by: root on linux on Sun Jul 13 18:06:35 2003, using kdoc 2.0a54. |