00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021
00022 #ifdef HAVE_UNISTD_H
00023 #include <unistd.h>
00024 #endif
00025
00026 #include <qmessagebox.h>
00027 #include <qptrlist.h>
00028 #include <applixwordimport.h>
00029 #include <applixwordimport.moc>
00030 #include <kdebug.h>
00031 #include <KoFilterChain.h>
00032 #include <kgenericfactory.h>
00033
00034 typedef KGenericFactory<APPLIXWORDImport, KoFilter> APPLIXWORDImportFactory;
00035 K_EXPORT_COMPONENT_FACTORY( libapplixwordimport, APPLIXWORDImportFactory( "kofficefilters" ) )
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 APPLIXWORDImport::APPLIXWORDImport (KoFilter *, const char *, const QStringList& ) :
00047 KoFilter()
00048 {
00049 }
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 QString
00060 APPLIXWORDImport::nextLine (QTextStream & stream)
00061 {
00062 QString s;
00063
00064
00065 s = stream.readLine();
00066
00067 m_instep += s.length();
00068 if (m_instep > m_stepsize)
00069 {
00070 m_instep = 0;
00071 m_progress += 2;
00072 emit sigProgress (m_progress) ;
00073 }
00074
00075 return s;
00076 }
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 KoFilter::ConversionStatus APPLIXWORDImport::convert( const QCString& from, const QCString& to )
00089 {
00090
00091 if (to!="application/x-kword" || from!="application/x-applixword")
00092 return KoFilter::NotImplemented;
00093
00094 QFile in(m_chain->inputFile());
00095 if (!in.open (IO_ReadOnly))
00096 {
00097 kdError(30517) << "Unable to open input file!" << endl;
00098 in.close();
00099 return KoFilter::FileNotFound;
00100 }
00101
00102
00103 QString str;
00104
00105 str += "<?xml version=\"1.0\"?>\n";
00106 str += "<DOC author=\"Reginald Stadlbauer and Torben Weis\" email=\"reggie@kde.org and weis@kde.org\" editor=\"KWord\" mime=\"application/x-kword\">\n";
00107 str += " <PAPER format=\"1\" ptWidth=\"595\" ptHeight=\"841\" mmWidth =\"210\" mmHeight=\"297\" inchWidth =\"8.26772\" inchHeight=\"11.6929\" orientation=\"0\" columns=\"1\" ptColumnspc=\"2\" mmColumnspc=\"1\" inchColumnspc=\"0.0393701\" hType=\"0\" fType=\"0\" ptHeadBody=\"9\" ptFootBody=\"9\" mmHeadBody=\"3.5\" mmFootBody=\"3.5\" inchHeadBody=\"0.137795\" inchFootBody=\"0.137795\">\n";
00108 str += " <PAPERBORDERS mmLeft=\"10\" mmTop=\"15\" mmRight=\"10\" mmBottom=\"15\" ptLeft=\"28\" ptTop=\"42\" ptRight=\"28\" ptBottom=\"42\" inchLeft=\"0.393701\" inchTop=\"0.590551\" inchRight=\"0.393701\" inchBottom=\"0.590551\"/>\n";
00109 str += " </PAPER>\n";
00110 str += " <ATTRIBUTES processing=\"0\" standardpage=\"1\" hasHeader=\"0\" hasFooter=\"0\" />\n";
00111 str += " <FRAMESETS>\n";
00112 str += " <FRAMESET frameType=\"1\" autoCreateNewFrame=\"1\" frameInfo=\"0\" removeable=\"0\">\n";
00113 str += " <FRAME left=\"28\" top=\"42\" right=\"566\" bottom=\"798\" runaround=\"1\" runaGapPT=\"2\" runaGapMM=\"1\" runaGapINCH=\"0.0393701\" lWidth=\"1\" lRed=\"255\" lGreen=\"255\" lBlue=\"255\" lStyle=\"0\" rWidth=\"1\" rRed=\"255\" rGreen=\"255\" rBlue=\"255\" rStyle=\"0\" tWidth=\"1\" tRed=\"255\" tGreen=\"255\" tBlue=\"255\" tStyle=\"0\" bWidth=\"1\" bRed=\"255\" bGreen=\"255\" bBlue=\"255\" bStyle=\"0\" bkRed=\"255\" bkGreen=\"255\" bkBlue=\"255\" bleftpt=\"0\" bleftmm=\"0\" bleftinch=\"0\" brightpt=\"0\" brightmm=\"0\" brightinch=\"0\" btoppt=\"0\" btopmm=\"0\" btopinch=\"0\" bbottompt=\"0\" bbottommm=\"0\" bbottominch=\"0\"/>\n";
00114
00115
00116 QTextStream stream (&in);
00117
00118 m_stepsize = in.size()/50;
00119 m_instep = 0;
00120 m_progress = 0;
00121
00122 int rueck;
00123 int pos, ok;
00124 char stylename[100];
00125 QString mystr, textstr;
00126 QPtrList<t_mycolor> mcol;
00127 QStringList mcoltxt;
00128
00129
00130
00131
00132 if (! readHeader (stream, in)) return KoFilter::StupidError;
00133
00134
00135 while (!stream.atEnd())
00136 {
00137
00138 mystr = readTagLine (stream, in);
00139 ok = true;
00140
00141
00142
00143
00144 if (mystr == "<start_styles>")
00145 {
00146 printf ("Start styles\n");
00147 t_mycolor *col = new t_mycolor;
00148 QString coltxt ;
00149 int zaehler = 0;
00150 do
00151 {
00152 mystr = readTagLine (stream, in);
00153 if (mystr == "<end_styles>")
00154 {
00155 ok = false;
00156 kdDebug(30517)<<"End styles\n\n";
00157 }
00158 else
00159 {
00160 if (mystr.startsWith ("<color "))
00161 {
00162 mystr.remove (0, 8);
00163 pos = mystr.find ("\"");
00164 coltxt = mystr.left (pos);
00165 mystr.remove (0,pos+1);
00166 rueck = sscanf ((const char *) mystr.latin1() ,
00167 ":%d:%d:%d:%d>",
00168 &col->c, &col->m, &col->y, &col->k);
00169 kdDebug(30517)<<" Color " << zaehler<<" : "<<col->c << " " << col->m<< " "<< col->y<<" "<< col->k<<" "<<coltxt<<" "<<endl;
00170 zaehler ++;
00171
00172
00173 col->r = 255 - (col->c + col->k);
00174 if (col->r < 0) col->r = 0;
00175
00176 col->g = 255 - (col->m + col->k);
00177 if (col->g < 0) col->g = 0;
00178
00179 col->b = 255 - (col->y + col->k);
00180 if (col->b < 0) col->b = 0;
00181
00182 mcol.append (col);
00183 mcoltxt.append (coltxt);
00184 }
00185 }
00186 }
00187 while (ok == true);
00188 delete col;
00189 }
00190
00191
00192
00193 else if (mystr == "<start_data Applix>")
00194 {
00195 kdDebug(30517)<<"\nEmbedded Applix object starts:\n";
00196 do
00197 {
00198 mystr = readTagLine (stream, in);
00199 if (mystr == "<end_data>") ok = false;
00200 else
00201 {
00202 kdDebug(30517)<<" "<<mystr<<endl;
00203 }
00204 }
00205 while (ok == true);
00206 kdDebug(30517)<<"Embedded Applix object ends\n\n";
00207
00208 }
00209
00210
00211
00212 else if (mystr.startsWith ("<start_hdrftr "))
00213 {
00214 kdDebug(30517)<<"\nHeader/Footer starts:\n";
00215 do
00216 {
00217 mystr = readTagLine (stream, in);
00218 if (mystr == "<end_hdrftr>") ok = false;
00219 else
00220 {
00221 kdDebug(30517)<<" "<<mystr<<endl;
00222 }
00223 }
00224 while (ok == true);
00225 kdDebug(30517)<<"\nHeader/Footer ends\n";
00226 }
00227
00228
00229
00230 else if (mystr.startsWith ("<P "))
00231 {
00232 sscanf ( (const char *) mystr.latin1(), "<P \"%99s\"", stylename);
00233 mystr.remove (0, 5+strlen(stylename));
00234 kdDebug(30517)<<" Para Name: "<< stylename<<endl;
00235 kdDebug(30517)<<" Rest: "<<mystr<<endl;
00236 }
00237
00238
00239
00240 else if (mystr.startsWith ("<T "))
00241 {
00242 QString colname;
00243
00244
00245 mystr.remove (0, 4);
00246
00247
00248 mystr.remove (mystr.length()-1, 1);
00249
00250
00251 ok = true;
00252 int y=0;
00253 do
00254 {
00255 pos = mystr.find ("\"", y);
00256 kdDebug(30517)<<"POS:"<<pos<<" length:"<< mystr.length()<<" y:"<<y <<endl;
00257
00258 kdDebug(30517)<<"< "<<mystr<<" >\n";
00259 if( (pos-1 > -1) && (mystr[pos-1] == '\\'))
00260 {
00261 kdDebug(30517)<<" No string end - but Gänsefüsschen\n";
00262 y=pos+1;
00263 }
00264 else
00265 {
00266 kdDebug(30517)<<" String end //\n";
00267 ok = false;
00268 }
00269 }
00270 while (ok == true);
00271
00272 textstr = mystr.left (pos);
00273 mystr.remove (0, pos+1);
00274 mystr.stripWhiteSpace();
00275 kdDebug(30517) <<"Text:<" <<textstr <<" > "<< pos<<" Rest:<"<< mystr<<"> \n";
00276
00277
00278 QStringList typeList;
00279 typeList = QStringList::split (' ', mystr);
00280
00281 int fontsize=12, bold=0, italic=0, underline=0, colpos=-1;
00282 QString fontname;
00283 int nn=0;
00284 for (QStringList::Iterator it = typeList.begin(); it != typeList.end(); ++it )
00285 {
00286 kdDebug(30517) <<" No: "<< nn<< " > "<< (*it)<< "< = \n";
00287
00288
00289 if ((*it) == "bold")
00290 {
00291 bold = 1;
00292 kdDebug(30517)<<"bold\n";
00293 }
00294 else if ((*it) == "no-bold")
00295 {
00296 bold = 0;
00297 kdDebug(30517)<<"no bold\n";
00298 }
00299 else if ((*it) == "italic")
00300 {
00301 italic = 1;
00302 kdDebug(30517)<<"italic\n";
00303 }
00304 else if ((*it) == "no-italic")
00305 {
00306 italic = 0;
00307 kdDebug(30517) <<"no italic\n";
00308 }
00309 else if ((*it) == "underline")
00310 {
00311 underline = 1;
00312 kdDebug(30517)<<"underline\n";
00313 }
00314 else if ((*it) == "no-underline")
00315 {
00316 underline = 0;
00317 kdDebug(30517) <<"no underline\n";
00318 }
00319 else if ((*it).startsWith ("size"))
00320 {
00321 (*it).remove (0, 5);
00322 sscanf ( (const char *) (*it).latin1(), "%d", &fontsize);
00323 kdDebug(30517)<<"fontsize: "<< fontsize<<endl;
00324 }
00325 else if ((*it).startsWith ("face"))
00326 {
00327 (*it).remove (0, 6);
00328 (*it).remove ((*it).length()-1, 1);
00329 fontname = *it;
00330 kdDebug(30517)<<"fontname: "<<fontname<<endl;
00331 }
00332 else if ((*it).startsWith ("color:"))
00333 {
00334 (*it).remove (0, 7);
00335 (*it).remove ((*it).length()-1, 1);
00336 colname = *it;
00337 colpos = mcoltxt.findIndex (colname);
00338 kdDebug(30517) <<" Color: "<< colname<<" "<< colpos <<" \n";
00339 }
00340 else
00341 {
00342 kdDebug(30517)<<" "<< (*it)<<endl;
00343 }
00344
00345
00346 }
00347 kdDebug(30517) <<"\n";
00348
00349
00350 replaceSpecial (textstr);
00351
00352
00353
00354 str += " <PARAGRAPH>\n";
00355 str += " <TEXT>";
00356 str += textstr;
00357 str += "</TEXT>\n";
00358
00359 if (bold == 1 || underline == 1 || italic == 1 || fontsize != 12 ||
00360 colpos != -1 || !fontname.isEmpty())
00361 {
00362 str += " <LAYOUT>\n";
00363 str += " <FORMAT>\n";
00364 if (!fontname.isEmpty())
00365 {
00366 str += " <FONT name=\"";
00367 str += fontname;
00368 str += "\" />\n";
00369 }
00370
00371 if (fontsize != 1)
00372 {
00373 str += " <SIZE value=\"";
00374 str += QString::number (fontsize);
00375 str += "\" />\n";
00376 }
00377
00378 if (italic == 1)
00379 {
00380 str += " <ITALIC value=\"1\" />\n";
00381 }
00382
00383 if (bold == 1)
00384 {
00385 str += " <WEIGHT value=\"75\" />\n";
00386 }
00387
00388 if (underline == 1)
00389 {
00390 str += " <UNDERLINE value=\"1\" />\n";
00391 }
00392
00393 if (colpos != -1)
00394 {
00395 t_mycolor *mc = new t_mycolor;
00396 mc = mcol.at(colpos);
00397 str += " <COLOR red=\"";
00398
00399 str += QString::number (mc->r);
00400 str += "\" green=\"";
00401 str += QString::number (mc->g);
00402 str += "\" blue=\"";
00403 str += QString::number (mc->b);
00404 str += "\" />\n";
00405 delete mc;
00406 }
00407
00408 str += " </FORMAT>\n";
00409 str += " </LAYOUT>\n";
00410 }
00411 str += " </PARAGRAPH>\n";
00412 }
00413
00414 }
00415 emit sigProgress(100);
00416
00417 str += " </FRAMESET>\n";
00418 str += " </FRAMESETS>\n";
00419 str += "</DOC>\n";
00420 kdDebug(30517)<<"Text "<< str <<endl;
00421
00422 KoStoreDevice* out = m_chain->storageFile( "root", KoStore::Write );
00423 if (!out)
00424 {
00425 kdError(30517) << "Unable to open output file!" << endl;
00426 in.close ();
00427 return KoFilter::StorageCreationError;
00428 }
00429
00430 QCString cstring = str.utf8 ();
00431
00432 out->writeBlock ((const char*) cstring, cstring.length());
00433
00434 in.close ();
00435 return KoFilter::OK;
00436 }
00437
00438
00439
00440
00441
00442 QChar
00443 APPLIXWORDImport::specCharfind (QChar a, QChar b)
00444 {
00445 QChar chr;
00446
00447 if ( (a == 'n') && (b == 'p') ) chr = 'ß';
00448
00449
00450 else if ( (a == 'n') && (b == 'c') ) chr = 'Ò';
00451 else if ( (a == 'p') && (b == 'c') ) chr = 'ò';
00452
00453 else if ( (a == 'n') && (b == 'd') ) chr = 'Ó';
00454 else if ( (a == 'p') && (b == 'd') ) chr = 'ó';
00455
00456 else if ( (a == 'n') && (b == 'e') ) chr = 'Ô';
00457 else if ( (a == 'p') && (b == 'e') ) chr = 'ô';
00458
00459 else if ( (a == 'n') && (b == 'f') ) chr = 'Õ';
00460 else if ( (a == 'p') && (b == 'f') ) chr = 'õ';
00461
00462 else if ( (a == 'p') && (b == 'g') ) chr = 'ö';
00463 else if ( (a == 'n') && (b == 'g') ) chr = 'Ö';
00464
00465
00466
00467 else if ( (a == 'n') && (b == 'j') ) chr = 'Ù';
00468 else if ( (a == 'p') && (b == 'j') ) chr = 'ù';
00469
00470 else if ( (a == 'n') && (b == 'k') ) chr = 'Ú';
00471 else if ( (a == 'p') && (b == 'k') ) chr = 'ú';
00472
00473 else if ( (a == 'n') && (b == 'l') ) chr = 'Û';
00474 else if ( (a == 'p') && (b == 'l') ) chr = 'û';
00475
00476 else if ( (a == 'p') && (b == 'm') ) chr = 'ü';
00477 else if ( (a == 'n') && (b == 'm') ) chr = 'Ü';
00478
00479
00480
00481 else if ( (a == 'm') && (b == 'a') ) chr = 'À';
00482 else if ( (a == 'o') && (b == 'a') ) chr = 'à';
00483
00484 else if ( (a == 'm') && (b == 'b') ) chr = 'Á';
00485 else if ( (a == 'o') && (b == 'b') ) chr = 'á';
00486
00487 else if ( (a == 'm') && (b == 'c') ) chr = 'Â';
00488 else if ( (a == 'o') && (b == 'c') ) chr = 'â';
00489
00490 else if ( (a == 'm') && (b == 'd') ) chr = 'Ã';
00491 else if ( (a == 'o') && (b == 'd') ) chr = 'ã';
00492
00493 else if ( (a == 'm') && (b == 'e') ) chr = 'Ä';
00494 else if ( (a == 'o') && (b == 'e') ) chr = 'ä';
00495
00496 else if ( (a == 'm') && (b == 'f') ) chr = 'Å';
00497 else if ( (a == 'o') && (b == 'f') ) chr = 'å';
00498
00499 else if ( (a == 'm') && (b == 'g') ) chr = 'Æ';
00500 else if ( (a == 'o') && (b == 'g') ) chr = 'æ';
00501
00502
00503
00504 else if ( (a == 'm') && (b == 'i') ) chr = 'È';
00505 else if ( (a == 'o') && (b == 'i') ) chr = 'è';
00506
00507 else if ( (a == 'm') && (b == 'j') ) chr = 'É';
00508 else if ( (a == 'o') && (b == 'j') ) chr = 'é';
00509
00510 else if ( (a == 'm') && (b == 'k') ) chr = 'Ê';
00511 else if ( (a == 'o') && (b == 'k') ) chr = 'ê';
00512
00513 else if ( (a == 'm') && (b == 'l') ) chr = 'Ë';
00514 else if ( (a == 'o') && (b == 'l') ) chr = 'ë';
00515
00516
00517
00518
00519
00520
00521 else if ( (a == 'm') && (b == 'm') ) chr = 'Ì';
00522 else if ( (a == 'o') && (b == 'm') ) chr = 'ì';
00523
00524 else if ( (a == 'm') && (b == 'n') ) chr = 'Í';
00525 else if ( (a == 'o') && (b == 'n') ) chr = 'í';
00526
00527 else if ( (a == 'm') && (b == 'o') ) chr = 'Î';
00528 else if ( (a == 'o') && (b == 'o') ) chr = 'î';
00529
00530 else if ( (a == 'm') && (b == 'p') ) chr = 'Ï';
00531 else if ( (a == 'o') && (b == 'p') ) chr = 'ï';
00532
00533
00534 else if ( (a == 'n') && (b == 'b') ) chr = 'Ñ';
00535 else if ( (a == 'p') && (b == 'b') ) chr = 'ñ';
00536
00537
00538 else if ( (a == 'k') && (b == 'c') ) chr = '¢';
00539 else if ( (a == 'k') && (b == 'j') ) chr = '©';
00540 else if ( (a == 'l') && (b == 'f') ) chr = 'µ';
00541 else if ( (a == 'n') && (b == 'i') ) chr = 'Ø';
00542 else if ( (a == 'p') && (b == 'i') ) chr = 'ø';
00543
00544 else if ( (a == 'l') && (b == 'j') ) chr = '¹';
00545 else if ( (a == 'l') && (b == 'c') ) chr = '²';
00546 else if ( (a == 'l') && (b == 'd') ) chr = '³';
00547
00548 else if ( (a == 'l') && (b == 'm') ) chr = '¼';
00549 else if ( (a == 'l') && (b == 'n') ) chr = '½';
00550 else if ( (a == 'l') && (b == 'o') ) chr = '¾';
00551
00552 else if ( (a == 'l') && (b == 'a') ) chr = '°';
00553
00554 else if ( (a == 'k') && (b == 'o') ) chr = '®';
00555 else if ( (a == 'k') && (b == 'h') ) chr = '§';
00556 else if ( (a == 'k') && (b == 'd') ) chr = '£';
00557
00558 else if ( (a == 'p') && (b == 'a') ) chr = 'ð';
00559 else if ( (a == 'n') && (b == 'a') ) chr = 'Ð';
00560
00561 else if ( (a == 'l') && (b == 'l') ) chr = '»';
00562 else if ( (a == 'k') && (b == 'l') ) chr = '«';
00563
00564 else if ( (a == 'l') && (b == 'k') ) chr = 'º';
00565
00566 else if ( (a == 'l') && (b == 'h') ) chr = '·';
00567
00568 else if ( (a == 'k') && (b == 'b') ) chr = '¡';
00569
00570 else if ( (a == 'k') && (b == 'e') ) chr = '¤';
00571
00572 else if ( (a == 'l') && (b == 'b') ) chr = '±';
00573
00574 else if ( (a == 'l') && (b == 'p') ) chr = '¿';
00575
00576 else if ( (a == 'k') && (b == 'f') ) chr = '¥';
00577
00578 else if ( (a == 'p') && (b == 'o') ) chr = 'þ';
00579 else if ( (a == 'n') && (b == 'o') ) chr = 'Þ';
00580
00581 else if ( (a == 'n') && (b == 'n') ) chr = 'Ý';
00582 else if ( (a == 'p') && (b == 'n') ) chr = 'ý';
00583 else if ( (a == 'p') && (b == 'p') ) chr = 'ÿ';
00584
00585 else if ( (a == 'k') && (b == 'k') ) chr = 'ª';
00586
00587 else if ( (a == 'k') && (b == 'm') ) chr = '¬';
00588 else if ( (a == 'p') && (b == 'h') ) chr = '÷';
00589
00590 else if ( (a == 'k') && (b == 'g') ) chr = '|';
00591
00592 else if ( (a == 'l') && (b == 'e') ) chr = '\'';
00593
00594 else if ( (a == 'k') && (b == 'i') ) chr = '¨';
00595
00596 else if ( (a == 'k') && (b == 'n') ) chr = '';
00597
00598 else if ( (a == 'k') && (b == 'p') ) chr = '¯';
00599
00600 else if ( (a == 'l') && (b == 'g') ) chr = '¶';
00601
00602 else if ( (a == 'l') && (b == 'i') ) chr = '¸';
00603
00604 else if ( (a == 'm') && (b == 'h') ) chr = 'Ç';
00605 else if ( (a == 'o') && (b == 'h') ) chr = 'ç';
00606
00607 else if ( (a == 'n') && (b == 'h') ) chr = '×';
00608
00609 else if ( (a == 'k') && (b == 'a') ) chr = ' ';
00610
00611 else if ( (a == 'a') && (b == 'j') ) chr = '!';
00612
00613 else chr = '#';
00614
00615 return chr;
00616 }
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628 QString
00629 APPLIXWORDImport::readTagLine (QTextStream &stream, QFile &in)
00630 {
00631 QString mystrn, mystr;
00632 int ok, pos;
00633
00634
00635 mystr = nextLine (stream);
00636
00637
00638 mystr.stripWhiteSpace();
00639
00640
00641 if ((mystr.length() == 80) && (mystr[mystr.length()-1] == '\\') )
00642 {
00643 ok = true;
00644 do
00645 {
00646
00647 pos = in.at ();
00648
00649
00650 mystrn = nextLine (stream);
00651
00652
00653 if (mystrn[0] == ' ')
00654 {
00655
00656 mystrn.remove (0, 1);
00657
00658
00659 mystr.remove (mystr.length()-1, 1);
00660
00661
00662 mystr += mystrn;
00663 }
00664 else
00665 {
00666
00667 in.at (pos);
00668 ok = false;
00669 }
00670 }
00671 while (ok == true);
00672 }
00673
00674 return mystr;
00675 }
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688 void
00689 APPLIXWORDImport::replaceSpecial (QString &textstr)
00690 {
00691 int ok, pos;
00692
00693
00694 textstr.replace ('&', "&");
00695 textstr.replace ('<', "<");
00696 textstr.replace ('>', ">");
00697
00698
00699
00700 ok = true;
00701 pos = 0;
00702 do
00703 {
00704
00705 pos = textstr.find ('\"', pos);
00706
00707
00708 if ((pos > -1) && (textstr[pos-1] == '\\'))
00709 {
00710 textstr.replace (pos-1, 2,"\"");
00711 }
00712 else
00713 {
00714 ok = false;
00715 }
00716 }
00717 while (ok == true);
00718
00719
00720
00721
00722 int foundSpecialCharakter;
00723 QChar newchar;
00724
00725 do
00726 {
00727
00728 foundSpecialCharakter = false;
00729
00730 pos = textstr.find ("^");
00731
00732
00733 if (pos > -1 )
00734 {
00735
00736 foundSpecialCharakter = true;
00737
00738
00739 newchar = specCharfind (textstr[pos+1], textstr[pos+2]);
00740
00741
00742 textstr.replace (pos, 3, newchar);
00743 }
00744 }
00745 while (foundSpecialCharakter == true);
00746 }
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758 int
00759 APPLIXWORDImport::readHeader (QTextStream &stream, QFile &in)
00760 {
00761 QString mystr;
00762 int rueck;
00763 int vers[3] = { 0, 0, 0 };
00764
00765
00766 mystr = readTagLine (stream, in);
00767
00768
00769 rueck = sscanf ((const char *) mystr.latin1() ,
00770 "*BEGIN WORDS VERSION=%d/%d ENCODING=%dBIT",
00771 &vers[0], &vers[1], &vers[2]);
00772 printf ("Versions info: %d %d %d\n", vers[0], vers[1], vers[2]);
00773
00774
00775 if (rueck <= 0)
00776 {
00777 printf ("Header not correkt - May be it is not an applixword file\n");
00778 printf ("Headerline: <%s>\n", (const char *) mystr.latin1());
00779
00780 QMessageBox::critical (0L, "Applixword header problem",
00781 QString ("The Applixword header is not correct. "
00782 "May be it is not an applixword file! <BR>"
00783 "This is the header line I did read:<BR><B>%1</B>").arg(mystr.latin1()),
00784 "Okay");
00785
00786
00787 return false;
00788 }
00789 else return true;
00790 }