26#include <tqtextcodec.h>
28#include <tqfileinfo.h>
29#include <tqtextstream.h>
31#include <KWEFBaseWorker.h>
32#include <KWEFKWordLeader.h>
37bool WPFiveWorker::doOpenFile(
const TQString& filenameOut,
const TQString& )
39 filename = filenameOut;
40 outfile.setName( filename );
41 if( !outfile.open( IO_WriteOnly ) )
44 output.setDevice( &outfile );
45 output.setByteOrder (TQDataStream::LittleEndian);
49bool WPFiveWorker::doCloseFile(
void)
52 TQ_UINT32 total_filesize = outfile.at();
58 if( !outfile.open( IO_ReadWrite ) )
60 output.setDevice( &outfile );
61 output.setByteOrder (TQDataStream::LittleEndian);
67 output << total_filesize;
71 output << document_area_ptr;
77bool WPFiveWorker::doOpenDocument(
void)
83 TQ_UINT8 magic[] = { 0xff, 0x57, 0x50, 0x43 };
84 for(
int i=0; i<4; i++ ) output << magic[i];
87 TQ_UINT8 docptr[] = { 0x0E, 0x02, 0x00, 0x00 } ;
88 for(
int i=0; i<4; i++ ) output << docptr[i];
91 TQ_UINT8 product_type = 1;
92 output << product_type;
95 TQ_UINT8 file_type = 10;
99 TQ_UINT16 version = 0x0100;
103 TQ_UINT16 encrypt = 0;
107 TQ_UINT16 index_header_ptr = 0x200;
108 output << index_header_ptr;
111 TQ_UINT32 extheader = 5;
115 TQ_UINT32 filesize = 0;
120 for(
int i=0; i<488; i++ ) output << dummy;
123 TQ_UINT8 index_header[] = { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
125 for(
int i=0; i<14; i++ ) output << index_header[i];
128 document_area_ptr = output.device()->at();
133bool WPFiveWorker::doCloseDocument(
void)
140static TQCString WPFiveEscape(
const TQString& text )
144 for(
unsigned int i=0; i < text.length(); i++ )
146 int c = text[i].unicode();
147 if( c < 32 ) result +=
'.';
148 else if ( c == 32 ) result += 0x20 ;
149 else if ( c < 128 ) result += text[i].latin1();
157bool WPFiveWorker::doFullParagraph(
const TQString& paraText,
158 const LayoutData& ,
const ValueListFormatData& paraFormatDataList)
160 ValueListFormatData::ConstIterator it;
161 for( it = paraFormatDataList.begin(); it!=paraFormatDataList.end(); ++it )
163 const FormatData& formatData = *it;
166 if( formatData.id == 1 )
170 if( formatData.text.weight >= 75 ) attr = 12;
171 if( formatData.text.italic ) attr = 8;
179 if( formatData.text.verticalAlignment == 1 ) attr = 6;
180 if( formatData.text.verticalAlignment == 2 ) attr = 5;
181 if( formatData.text.
strikeout ) attr = 13;
187 if( attr > 0 ) output << (TQ_UINT8)0xc3 << attr << (TQ_UINT8)0xc3;
190 TQColor fgColor = formatData.text.fgColor;
191 if( fgColor.isValid() )
193 TQ_UINT8 wp_color[] = { 0xd1, 0, 10, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0xd1 };
194 wp_color[7] = (TQ_UINT8) fgColor.red();
195 wp_color[8] = (TQ_UINT8) fgColor.green();
196 wp_color[9] = (TQ_UINT8) fgColor.blue();
197 output.writeRawBytes( (
const char*)wp_color, 14 );
201 TQCString out = WPFiveEscape( paraText.mid( formatData.pos, formatData.len ) );
202 output.writeRawBytes( (
const char*)out, out.length() );
205 if( attr > 0 ) output << (TQ_UINT8)0xc4 << attr << (TQ_UINT8)0xc4;
210 output << (TQ_UINT8) 0x0a;
bool underline
Any underline? (If true, we do not know if simple or double or what else).
bool strikeout
true if strikeout
TQString underlineValue
"value" of the underline: single, double, bold-single...