Source: sqlguipart/export_formate.h


Annotated List
Files
Globals
Hierarchy
Index
/* **************************************************************************
                          export_formate.h  -  description
                             -------------------
    begin                : Sun Nov 18 2001
    copyright            : (C) 2001 by mb
    email                : marcus@beranek.de
 ***************************************************************************/

/* **************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef EXPORT_FORMATE_H
#define EXPORT_FORMATE_H

// Define some formats we may use to export data...
#define EXCEL      1
#define TEXT       2
#define CSV        3
#define HTML       4
#define XML        5
#define POSTSCRIPT 6
#define TEX        7

// include files for QT
#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 
#include 

#include 
#include 

#include 

/** This is a generic export-class. It provides access to the various export-formats,
which are defined in the classes ExportObj_TEXT, ExportObj_CSV, etc. The use is allways the same:
create an export-object, set filname and format, add data and at least create the file.

Everything which is specific for the export is done by the classes ExportObj_TEXT, ExportObj_CSV, etc.


*/
class ExportObj : public QObject
{
  Q_OBJECT
  public:
  /** Constructor for the fileclass of the export


  */
  ExportObj(QWidget *parent, const char *name);
	
	/** Sets the format of the export.
			x may have the following values:
			
			1 - for excel (not implemented now)
			2 - for txt   (separated with tabs)
			3 - for csv   (separated with semicolon)
			4 - for html  (as a table)
			5 - for xml   (remember: we don't have any DTD now)
			6 - for ps    (not implemented now)
			7 - for tex   (not implemented now)
			
You may also use EXCEL, TEXT, CSV, HTML, XML, PS and TEX instead of the numbers. */ void setFormat(int x); /** Sets the filename, which is going to be written. */ void setFilename(const QString * filename); void setTablename(const QString * tbname); /** Adds a cell of the data, we want to export.
			row - the row, where the data is located
			col - the column, where the data is located
			data - a QString, representing the data
			dtype - an integervalue, representing the datatype.
			
Remember, there's no definition for the datatypes now! I suggest using: 0 for strings (256 character), 1 - 5 for int (8, 16, 32 ,64, 128bit), 6 - 10 for floats. But I have to think about this again, also need more information about what datatypes in mysql (and other dbs) are supported. */ void addData(int row, int col, QString* data, QString* dtype=NULL); /** finish will start the actual export. This will create the file (given by setFilename and setFormat) and put all data (given with addData). */ void finish(); void setRowOffset( int r ); void setColumnOffset( int c ); private slots: void doExport(); private: int exportformat; int cells; QString* exportFilename; QString* exportTablename; cell_t * zellExport; cell_t * last; char * datastring; char * dtypestring; int rowOffset; int columnOffset; }; #endif // EXPORT_FORMATE_H

Generated by: marcus on voyager on Mon Sep 16 15:31:33 2002, using kdoc 2.0a53.