33
32
#include <kgenericfactory.h>
35
34
typedef KGenericFactory<APPLIXWORDImport, KoFilter> APPLIXWORDImportFactory;
36
K_EXPORT_COMPONENT_FACTORY( libapplixwordimport, APPLIXWORDImportFactory( "applixwordfilter" ) )
35
K_EXPORT_COMPONENT_FACTORY( libapplixwordimport, APPLIXWORDImportFactory( "kofficefilters" ) )
39
38
/******************************************************************************
95
94
QFile in(m_chain->inputFile());
96
95
if (!in.open (IO_ReadOnly))
98
kdError(30502) << "Unable to open input file!" << endl;
97
kdError(30517) << "Unable to open input file!" << endl;
100
99
return KoFilter::FileNotFound;
147
146
printf ("Start styles\n");
148
147
t_mycolor *col = new t_mycolor; // delete is in place
149
int zaehler = 0; // Note: "zaehler" means "counter" in English
153
152
mystr = readTagLine (stream, in);
154
153
if (mystr == "<end_styles>")
157
kdDebug()<<"End styles\n\n";
156
kdDebug(30517)<<"End styles\n\n";
167
166
rueck = sscanf ((const char *) mystr.latin1() ,
169
168
&col->c, &col->m, &col->y, &col->k);
170
kdDebug()<<" Color " << zaehler<<" : "<<col->c << " " << col->m<< " "<< col->y<<" "<< col->k<<" "<<coltxt<<" "<<endl;
169
kdDebug(30517)<<" Color " << zaehler<<" : "<<col->c << " " << col->m<< " "<< col->y<<" "<< col->k<<" "<<coltxt<<" "<<endl;
173
172
// Color transformation cmyk -> rgb
193
192
***********************************************************************/
194
193
else if (mystr == "<start_data Applix>")
196
kdDebug()<<"\nEmbedded Applix object starts:\n";
195
kdDebug(30517)<<"\nEmbedded Applix object starts:\n";
199
198
mystr = readTagLine (stream, in);
200
199
if (mystr == "<end_data>") ok = false;
203
kdDebug()<<" "<<mystr<<endl;
202
kdDebug(30517)<<" "<<mystr<<endl;
206
205
while (ok == true);
207
kdDebug()<<"Embedded Applix object ends\n\n";
206
kdDebug(30517)<<"Embedded Applix object ends\n\n";
210
209
/**********************************************************************
212
211
**********************************************************************/
213
212
else if (mystr.startsWith ("<start_hdrftr "))
215
kdDebug()<<"\nHeader/Footer starts:\n";
214
kdDebug(30517)<<"\nHeader/Footer starts:\n";
218
217
mystr = readTagLine (stream, in);
219
218
if (mystr == "<end_hdrftr>") ok = false;
222
kdDebug()<<" "<<mystr<<endl;
221
kdDebug(30517)<<" "<<mystr<<endl;
225
224
while (ok == true);
226
kdDebug()<<"\nHeader/Footer ends\n";
225
kdDebug(30517)<<"\nHeader/Footer ends\n";
228
227
/**********************************************************************
229
228
* found a paragraph string *
233
232
sscanf ( (const char *) mystr.latin1(), "<P \"%99s\"", stylename);
234
233
mystr.remove (0, 5+strlen(stylename));
235
kdDebug()<<" Para Name: "<< stylename<<endl;
236
kdDebug()<<" Rest: "<<mystr<<endl;
234
kdDebug(30517)<<" Para Name: "<< stylename<<endl;
235
kdDebug(30517)<<" Rest: "<<mystr<<endl;
238
237
/**********************************************************************
239
238
* found a textstring *
256
255
pos = mystr.find ("\"", y);
257
kdDebug()<<"POS:"<<pos<<" length:"<< mystr.length()<<" y:"<<y <<endl;
256
kdDebug(30517)<<"POS:"<<pos<<" length:"<< mystr.length()<<" y:"<<y <<endl;
259
kdDebug()<<"< "<<mystr<<" >\n";
258
kdDebug(30517)<<"< "<<mystr<<" >\n";
260
259
if( (pos-1 > -1) && (mystr[pos-1] == '\\'))
262
kdDebug()<<" No string end - but G�nsef�sschen\n";
261
kdDebug(30517)<<" No string end - but G�nsef�sschen\n";
267
kdDebug()<<" String end //\n";
266
kdDebug(30517)<<" String end //\n";
285
284
for (QStringList::Iterator it = typeList.begin(); it != typeList.end(); ++it )
287
kdDebug() <<" No: "<< nn<< " > "<< (*it)<< "< = \n";
286
kdDebug(30517) <<" No: "<< nn<< " > "<< (*it)<< "< = \n";
289
288
// Looking for bold
290
289
if ((*it) == "bold")
292
kdDebug(30517)<<"bold\n";
295
294
else if ((*it) == "no-bold")
298
kdDebug()<<"no bold\n";
297
kdDebug(30517)<<"no bold\n";
300
299
else if ((*it) == "italic")
303
kdDebug()<<"italic\n";
302
kdDebug(30517)<<"italic\n";
305
304
else if ((*it) == "no-italic")
308
kdDebug() <<"no italic\n";
307
kdDebug(30517) <<"no italic\n";
310
309
else if ((*it) == "underline")
313
kdDebug()<<"underline\n";
312
kdDebug(30517)<<"underline\n";
315
314
else if ((*it) == "no-underline")
318
kdDebug() <<"no underline\n";
317
kdDebug(30517) <<"no underline\n";
320
319
else if ((*it).startsWith ("size"))
322
321
(*it).remove (0, 5);
323
322
sscanf ( (const char *) (*it).latin1(), "%d", &fontsize);
324
kdDebug()<<"fontsize: "<< fontsize<<endl;
323
kdDebug(30517)<<"fontsize: "<< fontsize<<endl;
326
325
else if ((*it).startsWith ("face"))
328
327
(*it).remove (0, 6);
329
328
(*it).remove ((*it).length()-1, 1);
331
kdDebug()<<"fontname: "<<fontname<<endl;
330
kdDebug(30517)<<"fontname: "<<fontname<<endl;
333
332
else if ((*it).startsWith ("color:"))
336
335
(*it).remove ((*it).length()-1, 1);
338
337
colpos = mcoltxt.findIndex (colname);
339
kdDebug() <<" Color: "<< colname<<" "<< colpos <<" \n";
338
kdDebug(30517) <<" Color: "<< colname<<" "<< colpos <<" \n";
343
kdDebug()<<" "<< (*it)<<endl;
342
kdDebug(30517)<<" "<< (*it)<<endl;
347
kdDebug(30517) <<"\n";
350
349
// Replaces Part for & <>, applixwear special characters and qouts
351
350
replaceSpecial (textstr);
418
417
str += " </FRAMESET>\n";
419
418
str += " </FRAMESETS>\n";
420
419
str += "</DOC>\n";
421
kdDebug()<<"Text "<<str.utf8()<<endl;
420
kdDebug(30517)<<"Text "<< str <<endl;
423
422
KoStoreDevice* out = m_chain->storageFile( "root", KoStore::Write );
426
kdError(30502) << "Unable to open output file!" << endl;
425
kdError(30517) << "Unable to open output file!" << endl;
428
427
return KoFilter::StorageCreationError;
694
693
// 1. Replace Part for this characters: <, >, &
695
textstr.replace (QRegExp ("&"), "&");
696
textstr.replace (QRegExp ("<"), "<");
697
textstr.replace (QRegExp (">"), ">");
694
textstr.replace ('&', "&");
695
textstr.replace ('<', "<");
696
textstr.replace ('>', ">");
700
699
// 2. Replace part for this characters: applixwear qoutes