Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

pdbim.h

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef PDBIM_H
00008 #define PDBIM_H
00009 
00010 #include "pluginapi.h"
00011 
00012 class gtWriter;
00013 class gtParagraphStyle;
00014 class QString;
00015 class QStringList;
00016 
00017 extern "C" PLUGIN_API void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer);
00018 
00019 extern "C" PLUGIN_API QString FileFormatName();
00020 
00021 extern "C" PLUGIN_API QStringList FileExtensions();
00022 
00023 
00024 
00025 
00027 typedef unsigned int UT_uint32;
00028 typedef unsigned short UT_uint16;
00029 
00032 typedef unsigned char Byte;
00033 typedef UT_uint16 Word;
00034 typedef UT_uint32 DWord;
00035 
00037 #define RECORD_SIZE_MAX 4096
00038 #define BUFFER_SIZE 4096
00039 #define COUNT_BITS 3
00040 #define DISP_BITS 11
00041 #define DOC_CREATOR "REAd"
00042 #define DOC_TYPE "TEXt"
00043 
00044 #define dmDBNameLength 32
00045 
00057 typedef struct
00058 {
00059     char    name[ dmDBNameLength ];
00060     Word    attributes;
00061     Word    version;
00062     DWord   create_time;
00063     DWord   modify_time;
00064     DWord   backup_time;
00065     DWord   modificationNumber;
00066     DWord   appInfoID;
00067     DWord   sortInfoID;
00068     char    type[4];
00069     char    creator[4];
00070     DWord   id_seed;
00071     DWord   nextRecordList;
00072     Word    numRecords;
00073 } pdb_header;
00074 
00078 #define PDB_HEADER_SIZE 78
00079 #define PDB_RECORD_HEADER_SIZE 8
00080 
00083 typedef struct {
00084     Word    version; /* 1 = plain text, 2 = compressed */
00085     Word    reserved1;
00086     DWord   doc_size; /* in bytes, when uncompressed */
00087     Word    numRecords; /* text rec's only; = pdb_header.numRecords-1 */
00088     Word    rec_size; /* usually RECORD_SIZE_MAX */
00089     DWord   reserved2;
00090 } doc_record0;
00091 
00093 typedef struct {
00094     Byte buf[BUFFER_SIZE];
00095     UT_uint32   len;
00096     UT_uint32   position;
00097 } buffer;
00098 
00099 #define GET_Word(f,n)   { fread( &n, 2, 1, f ); n = swap_Word ( n ); }
00100 #define GET_DWord(f,n)  { fread( &n, 4, 1, f ); n = swap_DWord( n ); }
00101 
00114 class PdbIm
00115 {
00116 public:
00121     PdbIm(const QString& fname, const QString& enc, gtWriter *w);
00122     ~PdbIm(){};
00125     void write();
00126 private:
00128     buffer *m_buf;
00130     QString data;
00132     QString encoding;
00134     gtWriter *writer;
00136     bool m_littlendian;
00138     bool bCompressed;
00139     
00142     void loadFile(QString fname);
00145     void selectSwap();
00149     Word swap_Word(Word r);
00153     DWord swap_DWord(DWord r);
00156     void uncompress(buffer *m_buf);
00157 };
00158 
00159 #endif
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.