diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /filters/kspread/applixspread | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'filters/kspread/applixspread')
-rw-r--r-- | filters/kspread/applixspread/Makefile.am | 17 | ||||
-rw-r--r-- | filters/kspread/applixspread/applixspreadimport.cc | 1326 | ||||
-rw-r--r-- | filters/kspread/applixspread/applixspreadimport.h | 79 | ||||
-rw-r--r-- | filters/kspread/applixspread/kspread_applixspread_import.desktop | 68 | ||||
-rw-r--r-- | filters/kspread/applixspread/status.html | 755 |
5 files changed, 2245 insertions, 0 deletions
diff --git a/filters/kspread/applixspread/Makefile.am b/filters/kspread/applixspread/Makefile.am new file mode 100644 index 00000000..944bdd1b --- /dev/null +++ b/filters/kspread/applixspread/Makefile.am @@ -0,0 +1,17 @@ +####### General stuff + +INCLUDES= -I$(srcdir) $(KOFFICE_INCLUDES) $(all_includes) + +####### Files + +kde_module_LTLIBRARIES = libapplixspreadimport.la + +libapplixspreadimport_la_SOURCES = applixspreadimport.cc +libapplixspreadimport_la_LIBADD = $(KOFFICE_LIBS) +libapplixspreadimport_la_LDFLAGS = -module $(KDE_PLUGIN) +noinst_HEADERS = applixspreadimport.h + +METASOURCES = AUTO + +service_DATA = kspread_applixspread_import.desktop +servicedir = $(kde_servicesdir) diff --git a/filters/kspread/applixspread/applixspreadimport.cc b/filters/kspread/applixspread/applixspreadimport.cc new file mode 100644 index 00000000..57baedeb --- /dev/null +++ b/filters/kspread/applixspread/applixspreadimport.cc @@ -0,0 +1,1326 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Enno Bartels <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include <config.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <qmessagebox.h> +#include <qstringlist.h> +#include <qregexp.h> +#include <qptrlist.h> +#include <applixspreadimport.h> +#include <kdebug.h> +#include <math.h> +#include <KoFilterChain.h> +#include <kgenericfactory.h> + +typedef KGenericFactory<APPLIXSPREADImport, KoFilter> APPLIXSPREADImportFactory; +K_EXPORT_COMPONENT_FACTORY( libapplixspreadimport, APPLIXSPREADImportFactory( "kofficefilters" ) ) + + +APPLIXSPREADImport::APPLIXSPREADImport ( QObject */*parent*/, const char* /*name*/, const QStringList& ) + : KoFilter() +{ +} + +QString APPLIXSPREADImport::nextLine( QTextStream & stream ) +{ + QString s = stream.readLine(); + m_instep += s.length(); + if (m_instep > m_stepsize) + { + m_instep = 0; + m_progress += 2; + emit sigProgress( m_progress ); + } + return s; +} + +KoFilter::ConversionStatus APPLIXSPREADImport::convert( const QCString& from, const QCString& to ) +{ + + if (to != "application/x-kspread" || from != "application/x-applixspread") + return KoFilter::NotImplemented; + + QFile in (m_chain->inputFile()); + if (!in.open(IO_ReadOnly)) + { + kdError(30502) << "Unable to open input file!" << endl; + in.close(); + return KoFilter::FileNotFound; + } + + QString str; + QPtrList<t_mycolor> mcol; + + str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; + str += "<!DOCTYPE spreadsheet>\n"; + str += "<spreadsheet mime=\"application/x-kspread\" editor=\"KSpread\" >\n"; + str += " <paper format=\"A4\" orientation=\"Portrait\" >\n"; + str += " <borders right=\"20\" left=\"20\" bottom=\"20\" top=\"20\" />\n"; + str += " <head/>\n"; + str += " <foot/>\n"; + str += " </paper>\n"; + str += " <locale positivePrefixCurrencySymbol=\"True\" negativeMonetarySignPosition=\"1\" negativePrefixCurrencySymbol=\"True\" fracDigits=\"2\" thousandsSeparator=\" \" dateFormat=\"%A, %e. %B %Y\" timeFormat=\"%H:%M:%S\" monetaryDecimalSymbol=\",\" weekStartsMonday=\"True\" currencySymbol=\"DM\" negativeSign=\"-\" positiveSign=\"\" positiveMonetarySignPosition=\"1\" decimalSymbol=\",\" monetaryThousandsSeparator=\" \" dateFormatShort=\"%d.%m.%Y\" />\n"; + str += " <map markerColumn=\"1\" activeTable=\"Table1\" markerRow=\"1\" >\n"; +// str += " <table columnnumber=\"0\" borders=\"0\" hide=\"0\" hidezero=\"0\" firstletterupper=\"0\" grid=\"1\" formular=\"0\" lcmode=\"0\" name=\"Tabelle1\" >\n"; + + + // QTextStream + QTextStream stream (&in); + m_stepsize = in.size()/50; + m_instep = 0; + m_progress = 0; + int pos; + char ccol; + int irow, icol; + QString tabctr ; // Tab control + QString mystr, typestr, cellnostr, tabnostr; + QStringList typefacetab; + + // QStringList rclist; + t_rc my_rc; + + + + /************************************************************************** + * Read header * + **************************************************************************/ + if (! readHeader (stream)) return KoFilter::StupidError; + + + while (!stream.atEnd ()) + { + // Read one line + mystr = nextLine( stream ); + + kdDebug()<<"INPUT : "<<mystr<<endl; + + + /********************************************************************** + * Looking for the colormap * + **********************************************************************/ + if (mystr.startsWith ("COLORMAP") ) + { + readColormap (stream, mcol); + } + + /********************************************************************** + * Looking for the typeface table * + **********************************************************************/ + else if (mystr.startsWith ("TYPEFACE TABLE") ) + { + readTypefaceTable (stream, typefacetab); + } + + /********************************************************************** + * Looking for some View-Informations * + **********************************************************************/ + else if (mystr.startsWith ("View Start, Name:") ) + { + readView (stream, mystr, my_rc); + } + + + /********************************************************************** + * Detect ( at the first place of the Linie * + **********************************************************************/ + else if (mystr[0] == '(') + { + int fg=-1; // fg = foregound + + // Delete '(' + mystr.remove (0, 1); + + int alllenght; + QString mystrn; + + // Remember lenght of the string + alllenght = mystr.length (); + if (alllenght >= 80-1) + { + kdDebug()<< " Line >= 80 chars \n"; + int ok = true; + do + { + pos = in.at (); + mystrn = nextLine( stream ); + if (mystrn[0] == ' ') + { + mystrn.remove (0, 1); + mystr += mystrn; + } + else + { + in.at (pos); + ok = false; + } + } + while (ok == true); + + } + + + // Search for ')' + pos = mystr.find (')'); + typestr = mystr.left (pos); + + + // Delete typeformat infos incl. Space + mystr.remove (0, pos+1); + // alllenght = alllenght - pos - 1; + + // Search for ':' + pos = mystr.find (':'); + + // Copy cellnumber informations + cellnostr = mystr.left (pos); + + // Delete cellnumber informations + mystr.remove (0, pos+1); + // alllenght = alllenght - pos - 1; + + + // Split Table and Cell Number + pos = cellnostr.find ('!'); + + // Copy tabnumber informations + tabnostr = cellnostr.left (pos); + + // Delete cellnumber informations + cellnostr.remove (0, pos+1); + + int len = cellnostr.length (); + char tmp[300], tmp1[300]; + int leni; + + + + pos = cellnostr.find (QRegExp ("[0-9]")); + kdDebug()<<" findpos :"<<pos<<endl; + + + + QString rowstr; + bool ok; + int bla; + rowstr = cellnostr.mid (pos, cellnostr.length()-pos); + irow = rowstr.toInt(&ok); + + kdDebug()<<" findpos :"<< rowstr<<" "<<irow<<endl; + sscanf (cellnostr.latin1(), "%299s%d",tmp, &bla); + sprintf (tmp1, "%d", irow); + leni = strlen (tmp1); + QString cellcolstr; + cellcolstr = cellnostr; + cellcolstr.remove (cellcolstr.length()-leni, leni); + + kdDebug()<<" Info: length :"<<len<<" cellnostr :"<<cellnostr<<" tmp :"<<tmp<<" irow :"<<irow<<" cellcolstr :"<<cellcolstr<<endl; + + // Transformat ascii column to int column + icol = translateColumnNumber (cellcolstr); + + + // sscanf (cellnostr.latin1(), "%c%d",&ccol, &irow); + + // Transformat ascii column to int column + // icol = ccol - 64; + + // Remove first whitespace + mystr.remove (0, 1); + tabnostr.remove (0, 1); + + + // Replace part for this characters: <, >, & + mystr.replace (QRegExp ("&"), "&"); + mystr.replace (QRegExp ("<"), "<"); + mystr.replace (QRegExp (">"), ">"); + + + // Replace part for Applix Characters + int foundSpecialCharakter; + QChar newchar; + + do + { + // initialize + foundSpecialCharakter = false; + + pos = mystr.find ("^"); + + // is there a special character ? + if (pos > -1 ) + { + // i have found a special character ! + foundSpecialCharakter = true; + + // translate the applix special character + newchar = specCharfind (mystr[pos+1], mystr[pos+2]); + + // replace the character + mystr.replace (pos, 3, newchar); + } + + } + while (foundSpecialCharakter == true); + + + // examine the typestring + // splitt typestring in 3 parts by an | + QString typeFormStr; + QString typeCharStr; + QString typeCellStr; + + int pos1 = typestr.find ("|"); + int pos2 = typestr.findRev ("|"); + + + typeFormStr = typestr.left (pos1); + + typeCharStr = typestr.mid (pos1+1, pos2 - pos1 - 1); + + typeCellStr = typestr.right (typestr.length() - pos2 - 1); + + // Is it a new table + if (tabctr != tabnostr) + { + // is it not the first table + if (!(tabctr.isNull())) str += " </table>\n"; + + str += " <table columnnumber=\"0\" borders=\"0\" hide=\"0\" hidezero=\"0\" firstletterupper=\"0\" grid=\"1\" formular=\"0\" lcmode=\"0\" name=\""; + str += tabnostr; + str += "\" >\n"; + + tabctr = tabnostr; + + // Searching for the rowcol part and adding to the hole string + pos = my_rc.tabname.findIndex (tabnostr); + if (pos > -1) str += my_rc.rc[pos]; + } + + kdDebug()<<" Data : Text :"<<mystr<<" tab :"<<tabnostr<<" "<< cellnostr <<" " <<ccol<<" " << irow<<" "<< typeFormStr<<" " <<typeCharStr<<" " <<typeCellStr<<endl; + + + /******************************************************************** + * examine charakter format String, splitt it up in basic parts * + ********************************************************************/ + QStringList typeCharList; + int bold=0, italic=0, underline=0, nn=0, fontsize=12, fontnr=-1; + + typeCharList = QStringList::split (',', typeCharStr); + + for (QStringList::Iterator it = typeCharList.begin(); + it != typeCharList.end(); ++it ) + { + // Output + kdDebug()<<" Char ("<<nn<<" ) >"<<*it<<"< "<<endl; + nn++; + + if ((*it) == "B") + { + kdDebug()<<" bold\n"; + bold = 1; + } + else if ((*it) == "I") + { + + kdDebug()<<" = italic\n"; + italic = 1; + } + else if ((*it) == "U") + { + kdDebug()<<" = underline\n"; + underline = 1; + } + else if ((*it).startsWith("FG") ) + { + sscanf ((*it).latin1(), "FG%d", &fg); + kdDebug()<<" = Colornr "<< fg<<endl; + } + else if ((*it).startsWith("TF") ) + { + sscanf ((*it).latin1(), "TF%d", &fontnr); + kdDebug()<<" = Font :"<<fontnr<<" "<<typefacetab[fontnr]<<endl; + } + else if ((*it).startsWith("P") ) + { + sscanf ((*it).latin1(), "P%d", &fontsize); + kdDebug()<<" = Fontsize "<<fontsize<<endl; + } + else + { + + kdDebug()<<" = ???\n"; + } + } + kdDebug()<<""<<endl; + + + + /******************************************************************** + * examine pos format String, splitt it up in basic parts * + ********************************************************************/ + QStringList typeFormList; + int align = 0, valign=0; + + typeFormList = QStringList::split (',', typeFormStr); + nn=0; + for (QStringList::Iterator it = typeFormList.begin(); it != typeFormList.end(); ++it ) + { + // Output + //kdDebug()<< " Type (%2d) >%s< ", + // nn, (*it).latin1() ); + nn++; + // Grep horizontal alignment + if ( (*it) == "1") + { + kdDebug()<< " = left align\n"; + align = 1; // left + } + else if ( (*it) == "2") + { + kdDebug()<< " = right align\n"; + align = 3; // right + } + else if ( (*it) == "3") + { + kdDebug()<< " = center align\n"; + align = 2; // center + } + + // Grep verticale alignment + else if ( (*it) == "VT") + { + kdDebug()<<" = top valign\n"; + valign = 1; // top + } + else if ( (*it) == "VC") + { + kdDebug()<<" = center valign\n"; + valign = 0; // center - default (2) + } + else if ( (*it) == "VB") + { + kdDebug()<<" = bottom valign\n"; + valign = 3; // bottom + } + else + { + kdDebug()<<" = ???\n"; + } + } + + + /******************************************************************** + * examine cell format String, splitt it up in basic parts * + ********************************************************************/ + QStringList typeCellList; + int topPenWidth=0, bottomPenWidth=0, leftPenWidth = 0, rightPenWidth = 0, fg_bg=-1; + int topPenStyle=0, bottomPenStyle=0, leftPenStyle = 0, rightPenStyle = 0; + int brushstyle=0, brushcolor=1; + int topbrushstyle=0, topbrushcolor=1, topfg_bg=1; + int leftbrushstyle=0, leftbrushcolor=1, leftfg_bg=1; + int rightbrushstyle=0, rightbrushcolor=1, rightfg_bg=1; + int bottombrushstyle=0, bottombrushcolor=1, bottomfg_bg=1; + + typeCellList = QStringList::split (',', typeCellStr); + nn=0; + for ( QStringList::Iterator it = typeCellList.begin(); it != typeCellList.end(); ++it ) + { + // Output + printf (" Cell (%2d) >%s< ", + nn, (*it).latin1() ); + nn++; + + if ((*it)[0] == 'T') + { + kdDebug()<<" = top \n"; + transPenFormat ((*it), &topPenWidth, &topPenStyle); + + if ((*it).length() > 2) + { + (*it).remove (0, 2); + filterSHFGBG ((*it), &topbrushstyle, &topbrushcolor, &topfg_bg); + } + + } + + else if ( (*it)[0] == 'B') + { + kdDebug()<<" = bottom \n"; + transPenFormat ((*it), &bottomPenWidth, &bottomPenStyle); + + if ((*it).length() > 2) + { + (*it).remove (0, 2); + filterSHFGBG ((*it), &bottombrushstyle, &bottombrushcolor, &bottomfg_bg); + } + } + + else if ( (*it)[0] == 'L') + { + kdDebug()<<" = left \n"; + transPenFormat ((*it), &leftPenWidth, &leftPenStyle); + + if ((*it).length() > 2) + { + (*it).remove (0, 2); + filterSHFGBG ((*it), &leftbrushstyle, &leftbrushcolor, &leftfg_bg); + } + } + + else if ( (*it)[0] == 'R') + { + kdDebug()<<" = right \n"; + transPenFormat ((*it), &rightPenWidth, &rightPenStyle); + + if ((*it).length() > 2) + { + (*it).remove (0, 2); + filterSHFGBG ((*it), &rightbrushstyle, &rightbrushcolor, &rightfg_bg); + } + } + + else if ( ((*it).startsWith ("SH")) || ((*it).startsWith ("FG")) || + ((*it).startsWith ("BG")) ) + { + kdDebug()<<" = \n"; + filterSHFGBG ((*it), &brushstyle, &fg_bg, &brushcolor); + } + + else + { + kdDebug()<<" = ???\n"; + } + + } + + + + + + QString col; + + // create kspread fileformat output + str += " <cell row=\"" + QString::number (irow) + "\""; + str += " column=\"" + QString::number (icol) + "\">\n"; + if (bold == 1 || italic == 1 || underline == 1 || + align != 0 || valign != 0 || + topPenStyle != 0 || bottomPenStyle != 0 || + leftPenStyle != 0 || rightPenStyle != 0 || fg !=-1 || fg_bg != -1 || + fontsize != 12 || brushstyle != 0 || fontnr != -1) + { + str += " <format"; + if (brushstyle != 0) + { + str += " brushstyle=\"" + QString::number(brushstyle) + "\" "; + str += " brushcolor=\""; + str += writeColor (mcol.at(brushcolor)); + str += "\""; + } + + if (align != 0) str += " align=\"" + QString::number(align) + "\" "; + if (valign != 0) str += " alignY=\"" + QString::number(valign) + "\" "; + if (fg_bg != -1) + { + str += " bgcolor=\""; + str += writeColor (mcol.at(fg_bg)); + str += "\" "; + } + str += ">\n"; + + // Font color + if (fg != -1) + { + str += " <pen width=\"0\" style=\"1\" color=\""; + str += writeColor (mcol.at(fg)); + str += "\" />\n"; + } + + // Left border + if (leftPenWidth > 0) + { + str += " <left-border>\n"; + col = writeColor (mcol.at(leftfg_bg)); + writePen (str, leftPenWidth, leftPenStyle, col); + str += " </left-border>\n"; + } + + // Right border + if (rightPenWidth > 0) + { + str += " <right-border>\n"; + col = writeColor (mcol.at(rightfg_bg)); + writePen (str, rightPenWidth, rightPenStyle, col); + str += " </right-border>\n"; + } + + // Bottom border + if (bottomPenWidth > 0) + { + str += " <bottom-border>\n"; + col = writeColor (mcol.at(bottomfg_bg)); + writePen (str, bottomPenWidth, bottomPenStyle, col); + str += " </bottom-border>\n"; + } + + // Top border + if (topPenWidth > 0) + { + str += " <top-border>\n"; + col = writeColor (mcol.at(topfg_bg)); + writePen (str, topPenWidth, topPenStyle, col); + str += " </top-border>\n"; + } + + // Font (size and family) + if ((fontsize != 12) || (fontnr != -1)) + { + str += " <font "; + // Fontsize + if (fontsize != 12) + { + str += "size=\""; + str += QString::number (fontsize); + str += "\" "; + } + // Fontfamily + if (fontnr != -1) + { + str += "family=\""; + str += typefacetab[fontnr].latin1(); + str += "\" "; + } + str += "weight=\"0\""; + + if (italic == 1) str += " italic=\"yes\""; + if (bold == 1) str += " bold=\"yes\""; + if (underline == 1) str += " underline=\"yes\""; + + str +=" />\n"; + } + str += " </format>\n"; + } + str += " <text>" + mystr + "</text>\n"; + str += " </cell>\n"; + } + + } + emit sigProgress(100); + + str += " </table>\n"; + str += " </map>\n"; + str += "</spreadsheet>\n"; +// str += "</DOC>\n"; + + kdDebug ()<<"Text "<< str<<endl; + + KoStoreDevice* out=m_chain->storageFile( "root", KoStore::Write ); + + if (!out) + { + kdError(38000/*30502*/) << "Unable to open output file!" << endl; + in.close (); + return KoFilter::StorageCreationError; + } + + QCString cstring = str.utf8(); + out->writeBlock ( cstring, cstring.length() ); + + in.close (); + return KoFilter::OK; +} + + + + +/****************************************************************************** + * function: specCharfind * + ******************************************************************************/ +QChar +APPLIXSPREADImport::specCharfind (QChar a, QChar b) +{ + QChar chr; + + if ( (a == 'n') && (b == 'p') ) chr = '�'; + + + else if ( (a == 'n') && (b == 'c') ) chr = '�'; + else if ( (a == 'p') && (b == 'c') ) chr = '�'; + + else if ( (a == 'n') && (b == 'd') ) chr = '�'; + else if ( (a == 'p') && (b == 'd') ) chr = '�'; + + else if ( (a == 'n') && (b == 'e') ) chr = '�'; + else if ( (a == 'p') && (b == 'e') ) chr = '�'; + + else if ( (a == 'n') && (b == 'f') ) chr = '�'; + else if ( (a == 'p') && (b == 'f') ) chr = '�'; + + else if ( (a == 'p') && (b == 'g') ) chr = '�'; + else if ( (a == 'n') && (b == 'g') ) chr = '�'; + + + + else if ( (a == 'n') && (b == 'j') ) chr = '�'; + else if ( (a == 'p') && (b == 'j') ) chr = '�'; + + else if ( (a == 'n') && (b == 'k') ) chr = '�'; + else if ( (a == 'p') && (b == 'k') ) chr = '�'; + + else if ( (a == 'n') && (b == 'l') ) chr = '�'; + else if ( (a == 'p') && (b == 'l') ) chr = '�'; + + else if ( (a == 'p') && (b == 'm') ) chr = '�'; + else if ( (a == 'n') && (b == 'm') ) chr = '�'; + + + + else if ( (a == 'm') && (b == 'a') ) chr = '�'; + else if ( (a == 'o') && (b == 'a') ) chr = '�'; + + else if ( (a == 'm') && (b == 'b') ) chr = '�'; + else if ( (a == 'o') && (b == 'b') ) chr = '�'; + + else if ( (a == 'm') && (b == 'c') ) chr = '�'; + else if ( (a == 'o') && (b == 'c') ) chr = '�'; + + else if ( (a == 'm') && (b == 'd') ) chr = '�'; + else if ( (a == 'o') && (b == 'd') ) chr = '�'; + + else if ( (a == 'm') && (b == 'e') ) chr = '�'; + else if ( (a == 'o') && (b == 'e') ) chr = '�'; + + else if ( (a == 'm') && (b == 'f') ) chr = '�'; + else if ( (a == 'o') && (b == 'f') ) chr = '�'; + + else if ( (a == 'm') && (b == 'g') ) chr = '�'; + else if ( (a == 'o') && (b == 'g') ) chr = '�'; + + + + else if ( (a == 'm') && (b == 'i') ) chr = '�'; + else if ( (a == 'o') && (b == 'i') ) chr = '�'; + + else if ( (a == 'm') && (b == 'j') ) chr = '�'; + else if ( (a == 'o') && (b == 'j') ) chr = '�'; + + else if ( (a == 'm') && (b == 'k') ) chr = '�'; + else if ( (a == 'o') && (b == 'k') ) chr = '�'; + + else if ( (a == 'm') && (b == 'l') ) chr = '�'; + else if ( (a == 'o') && (b == 'l') ) chr = '�'; + + + + + + + else if ( (a == 'm') && (b == 'm') ) chr = '�'; + else if ( (a == 'o') && (b == 'm') ) chr = '�'; + + else if ( (a == 'm') && (b == 'n') ) chr = '�'; + else if ( (a == 'o') && (b == 'n') ) chr = '�'; + + else if ( (a == 'm') && (b == 'o') ) chr = '�'; + else if ( (a == 'o') && (b == 'o') ) chr = '�'; + + else if ( (a == 'm') && (b == 'p') ) chr = '�'; + else if ( (a == 'o') && (b == 'p') ) chr = '�'; + + + else if ( (a == 'n') && (b == 'b') ) chr = '�'; + else if ( (a == 'p') && (b == 'b') ) chr = '�'; + + + else if ( (a == 'k') && (b == 'c') ) chr = '�'; + else if ( (a == 'k') && (b == 'j') ) chr = '�'; + else if ( (a == 'l') && (b == 'f') ) chr = '�'; + else if ( (a == 'n') && (b == 'i') ) chr = '�'; + else if ( (a == 'p') && (b == 'i') ) chr = '�'; + + else if ( (a == 'l') && (b == 'j') ) chr = '�'; + else if ( (a == 'l') && (b == 'c') ) chr = '�'; + else if ( (a == 'l') && (b == 'd') ) chr = '�'; + + else if ( (a == 'l') && (b == 'm') ) chr = '�'; + else if ( (a == 'l') && (b == 'n') ) chr = '�'; + else if ( (a == 'l') && (b == 'o') ) chr = '�'; + + else if ( (a == 'l') && (b == 'a') ) chr = '�'; + + else if ( (a == 'k') && (b == 'o') ) chr = '�'; + else if ( (a == 'k') && (b == 'h') ) chr = '�'; + else if ( (a == 'k') && (b == 'd') ) chr = '�'; + + else if ( (a == 'p') && (b == 'a') ) chr = '�'; + else if ( (a == 'n') && (b == 'a') ) chr = '�'; + + else if ( (a == 'l') && (b == 'l') ) chr = '�'; + else if ( (a == 'k') && (b == 'l') ) chr = '�'; + + else if ( (a == 'l') && (b == 'k') ) chr = '�'; + + else if ( (a == 'l') && (b == 'h') ) chr = '�'; + + else if ( (a == 'k') && (b == 'b') ) chr = '�'; + + else if ( (a == 'k') && (b == 'e') ) chr = '�'; + + else if ( (a == 'l') && (b == 'b') ) chr = '�'; + + else if ( (a == 'l') && (b == 'p') ) chr = '�'; + + else if ( (a == 'k') && (b == 'f') ) chr = '�'; + + else if ( (a == 'p') && (b == 'o') ) chr = '�'; + else if ( (a == 'n') && (b == 'o') ) chr = '�'; + + else if ( (a == 'n') && (b == 'n') ) chr = '�'; + else if ( (a == 'p') && (b == 'n') ) chr = '�'; + else if ( (a == 'p') && (b == 'p') ) chr = '�'; + + else if ( (a == 'k') && (b == 'k') ) chr = '�'; + + else if ( (a == 'k') && (b == 'm') ) chr = '�'; + else if ( (a == 'p') && (b == 'h') ) chr = '�'; + + else if ( (a == 'k') && (b == 'g') ) chr = '|'; + + else if ( (a == 'l') && (b == 'e') ) chr = '\''; + + else if ( (a == 'k') && (b == 'i') ) chr = '�'; + + else if ( (a == 'k') && (b == 'n') ) chr = '�'; + + else if ( (a == 'k') && (b == 'p') ) chr = '�'; + + else if ( (a == 'l') && (b == 'g') ) chr = '�'; + + else if ( (a == 'l') && (b == 'i') ) chr = '�'; + + else if ( (a == 'm') && (b == 'h') ) chr = '�'; + else if ( (a == 'o') && (b == 'h') ) chr = '�'; + + else if ( (a == 'n') && (b == 'h') ) chr = '�'; + + else if ( (a == 'k') && (b == 'a') ) chr = '�'; + + else if ( (a == 'a') && (b == 'j') ) chr = '!'; + + else chr = '#'; + + return chr; +} + + + +/****************************************************************************** + * function: writePen * + ******************************************************************************/ +void +APPLIXSPREADImport::writePen (QString &str, int penwidth, int penstyle, QString framecolor) +{ + str += " <pen width=\""; + + // width of the pen + str += QString::number (penwidth); + str += "\" style=\""; + + // style of the pen + str += QString::number (penstyle); + str += "\" color=\""; + + // color of the pen + str += framecolor; + str += "\" />\n"; + +} + + + +/****************************************************************************** + * function: writeColor * + ******************************************************************************/ +QString +APPLIXSPREADImport::writeColor (t_mycolor *mc) +{ + char rgb[20]; + +// printf (" WriteColor: <%d>-<%d>-<%d> <%d>-<%d>-<%d>-<%d>\n", +// mc->r, mc->g, mc->b, +// mc->c, mc->m, mc->y, mc->k); + + sprintf (rgb, "#%02X%02X%02X", mc->r, mc->g, mc->b); + QString bla = rgb; + + + return bla; +} + + + + +/****************************************************************************** + * function: readTypefaceTable * + ******************************************************************************/ +void +APPLIXSPREADImport::readTypefaceTable (QTextStream &stream, QStringList &typefacetab) +{ + int tftabCounter=0, ok; + QString mystr; + + // Read the colormap + kdDebug()<<"Reading typeface table: \n"; + + ok = true; + do + { + mystr = nextLine( stream ); + if (mystr == "END TYPEFACE TABLE" ) ok = false; + else + { + //printf (" %2d: <%s>\n", tftabCounter, mystr.latin1()); + typefacetab.append(mystr); + tftabCounter++; + } + } + while (ok == true ); + + kdDebug()<<"... done \n"; +} + + + +/****************************************************************************** + * function: readColormap * + ******************************************************************************/ +void +APPLIXSPREADImport::readColormap (QTextStream &stream, QPtrList<t_mycolor> &mcol) +{ + int contcount, ok, pos; + + QString colstr, mystr; + kdDebug ()<<"Reading colormap: \n"; + + ok = true; + + do + { + + mystr = nextLine( stream ); + mystr.stripWhiteSpace (); + + if (mystr == "END COLORMAP") ok = false; + else + { + kdDebug()<<" -> "<< mystr<<endl; + + // Count the number of whitespaces + contcount = mystr.contains (' '); + kdDebug()<< "contcount: "<< contcount<<endl; + contcount -= 5; + + // Begin off interest + pos = mystr.find (" 0 "); + + // get colorname + colstr = mystr.left (pos); + mystr.remove (0, pos+1); + mystr.stripWhiteSpace (); + + t_mycolor *tmc = new t_mycolor; + + // get sub colors + pos = sscanf (mystr.latin1(), "0 %d %d %d %d 0", + &tmc->c, &tmc->m, &tmc->y, &tmc->k); + + printf (" - <%-20s> <%-15s> <%3d> <%3d> <%3d> <%3d> pos: %d\n", + mystr.latin1(), + colstr.latin1(), + tmc->c, tmc->m, tmc->y, tmc->k, pos); + + // Color transformation cmyk -> rgb + tmc->r = 255 - (tmc->c + tmc->k); + if (tmc->r < 0) tmc->r = 0; + + tmc->g = 255 - (tmc->m + tmc->k); + if (tmc->g < 0) tmc->g = 0; + + tmc->b = 255 - (tmc->y + tmc->k); + if (tmc->b < 0) tmc->b = 0; + + mcol.append (tmc); + } + + } + while (ok == true ); + + kdDebug()<< "... done "<< mcol.count()<<endl; + + + t_mycolor *emp; + for (emp=mcol.first(); emp != 0; emp=mcol.next() ) + { + printf (" c:%3d m:%3d y:%3d k:%3d r:%3d g:%3d b:%3d\n", + emp->c, emp->m, emp->y, emp->k, emp->r, emp->g, emp->b); + } +} + + + + +/****************************************************************************** + * function: readColormap * + ******************************************************************************/ +void +APPLIXSPREADImport::readView (QTextStream &stream, QString instr, t_rc &rc) +{ + QString rowcolstr; + QString mystr, tabname; + int ok; + + kdDebug()<<"Reading View\n"; + + tabname = instr; + + tabname.remove (0, 19); + tabname.remove (tabname.length()-2, 2); + kdDebug()<< " - Table name: "<< tabname<<endl; + + ok = true; + do + { + mystr = nextLine( stream ); + + kdDebug()<<" "<< mystr<<endl; + if (mystr.startsWith ("View End, Name:")) ok = false; + else + { + // COLUMN Widths + if (mystr.startsWith ("View Column Widths")) + { + kdDebug()<< " - Column Widths\n"; + mystr.remove (0, 20); + kdDebug()<< " "<<mystr<<endl; + + int colwidth, icolumn; + char ccolumn; + + // loop + QStringList ColumnList; + ColumnList = QStringList::split (' ', mystr); + + for ( QStringList::Iterator it = ColumnList.begin(); it != ColumnList.end(); ++it ) + { + + sscanf ((*it).latin1(), "%c:%d", &ccolumn, &colwidth); + int len = (*it).length (); + int pos = (*it).find (":"); + (*it).remove (pos, len-pos); + + printf( " >%s<- -<%c><%d> \n", (*it).latin1(), ccolumn, colwidth); + + // Transformat ascii column to int column + icolumn = translateColumnNumber (*it); + + //icolumn = ccolumn - 64; + // Translate the column width right from applix to kspread + icolumn = icolumn * 5; + + + rowcolstr += " <column width=\""; + rowcolstr += QString::number (colwidth); + rowcolstr += "\" column=\""; + rowcolstr += QString::number (icolumn); + rowcolstr += "\" >\n"; + rowcolstr += " <format/>\n"; + rowcolstr += " </column>\n"; + } + } + + // ROW Heights + else if (mystr.startsWith ("View Row Heights")) + { + kdDebug()<< " - Row Heights\n"; + mystr.remove (0, 17); + kdDebug()<<" "<< mystr<<endl; + + int irow, rowheight; + + // loop + QStringList RowList; + RowList = QStringList::split (' ', mystr); + + for ( QStringList::Iterator it = RowList.begin(); it != RowList.end(); ++it ) + { + sscanf ((*it).latin1(), " %d:%d", + &irow, &rowheight); + printf (" row: %2d height: %2d\n", irow, rowheight); + if (rowheight > 32768) rowheight -= 32768; + printf (" height: %2d\n", rowheight); + rowcolstr += " <row row=\""; + rowcolstr += QString::number (irow); + rowcolstr += "\" height=\""; + rowcolstr += QString::number (rowheight); + rowcolstr += "\" >\n"; + rowcolstr += " <format/>\n"; + rowcolstr += " </row>\n"; + } + + + } + } // else != END COLORMAP + } + while (ok == true ); + + // tabname append to my list + // tabname append to my list + rc.tabname.append (tabname); + rc.rc.append (rowcolstr); + + printf ("%s %s\n", tabname.latin1(), + rowcolstr.latin1()); + + printf ("...done \n\n"); +} + + + + + +/****************************************************************************** + * function: filterSHFGBG * + ******************************************************************************/ +void +APPLIXSPREADImport::filterSHFGBG (QString it, int *style, int *bgcolor, + int *fgcolor) +{ + QString tmpstr; + int pos; + int m2=0, m3=0; + + // filter SH = Brushstyle Background + pos = it.find ("SH"); + if (pos > -1) + { + tmpstr = it; + if (pos > 0) tmpstr.remove(0, pos); + pos = sscanf (tmpstr.latin1(), "SH%d", + style); + + printf ("style: %d(%d) ", + *style, pos); + } + + + // filter FG = FGCOLOR + pos = it.find ("FG"); + if (pos > -1) + { + tmpstr = it; + if (pos > 0) tmpstr.remove(0, pos); + pos = sscanf (tmpstr.latin1(), "FG%d", + fgcolor); + printf ("fg: %d(%d) ", + *fgcolor, pos); + m2=1; + } + + + // filter BG = BGCOLOR + pos = it.find ("BG"); + if (pos > -1) + { + tmpstr = it; + if (pos > 0) tmpstr.remove(0, pos); + pos = sscanf (tmpstr.latin1(), "BG%d", + bgcolor); + printf ("bgcolor: %d(%d) ", + *bgcolor, pos); + m3=1; + } + + + printf ("\n"); + + + // corrent the bgcolor to the fgcolor if the background is plain + if ((*style == 8) && (m2 == 1) && (m3 == 0)) + { + *bgcolor = *fgcolor; + } + + + // Translate brushstyle to kspread brushstyle + if (*style != 0) + { + if (*style == 1) *style = 0; + else if (*style == 2) *style = 7; + else if (*style == 3) *style = 0; + else if (*style == 4) *style = 4; + else if (*style == 5) *style = 3; + else if (*style == 6) *style = 2; + else if (*style == 7) *style = 0; + else if (*style == 8) *style = 0; + else if (*style == 9) *style = 10; + else if (*style == 10) *style = 9; + else if (*style == 11) *style = 11; + else if (*style == 12) *style = 12; + else if (*style == 13) *style = 13; + else if (*style == 14) *style = 14; + else if (*style == 15) *style = 0; + else if (*style == 16) *style = 0; + else if (*style == 17) *style = 0; + else if (*style == 18) *style = 0; + else if (*style == 19) *style = 0; + } +} + + + +/****************************************************************************** + * function: filterSHFGBG * + ******************************************************************************/ +void +APPLIXSPREADImport::transPenFormat (QString it, int *PenWidth, int *PenStyle) +{ + + if ( it[1] == '1' ) + { + *PenWidth = 1; + *PenStyle = 1; + } + + else if ( it[1] == '2' ) + { + *PenWidth = 2; + *PenStyle = 1; + } + + else if ( it[1] == '3' ) + { + *PenWidth = 3; + *PenStyle = 1; + } + + else if ( it[1] == '4' ) + { + *PenWidth = 1; + *PenStyle = 3; + } + + else if ( it[1] == '5' ) + { + *PenWidth = 5; + *PenStyle = 1; + } + + printf ("frame (w:%d - s:%d) \n", *PenWidth, *PenStyle); +} + + + + +/****************************************************************************** + * function: readHeader * + ******************************************************************************/ +int +APPLIXSPREADImport::readHeader (QTextStream &stream) +{ + QString mystr; + int vers[3] = { 0, 0, 0 }; + int rueck; + + + // Read Headline + mystr = nextLine (stream); + rueck = sscanf (mystr.latin1(), + "*BEGIN SPREADSHEETS VERSION=%d/%d ENCODING=%dBIT", + &vers[0], &vers[1], &vers[2]); + printf ("Versions info: %d %d %d\n", vers[0], vers[1], vers[2]); + + // Check the headline + if (rueck <= 0) + { + printf ("Header not correkt - May be it is not an applixspreadsheet file\n"); + printf ("Headerline: <%s>\n", mystr.latin1()); + + QMessageBox::critical (0L, "Applix spreadsheet header problem", + QString ("The Applix Spreadsheet header is not correct. " + "May be it is not an applix spreadsheet file! <BR>" + "This is the header line I did read:<BR><B>%1</B>").arg(mystr.latin1()), + "Okay"); + + + return false; + } + else + { + return true; + } +} + + + +/****************************************************************************** + * function: translateRowNumber * + ******************************************************************************/ +int +APPLIXSPREADImport::translateColumnNumber (QString colstr) +{ + int icol=0; + int p, x, len; + + + len = colstr.length (); + p = len-1; + x = 1; + + printf ("HI 0 len:%d\n", len ); + while ((p >= 0)) + { + printf ("HI 1 x:%d p:%d char:<%c>\n", x, p, colstr[p].latin1()); + // Upper chars + if ((colstr[p] >= 'A') && (colstr[p] <= 'Z')) + { + kdDebug ()<<" UPPER\n"; + icol = icol + ((int)pow ((double)x, 26) * (colstr[p].latin1() - 'A' + 1) ); + x++; + } + // lower chars + else if ((colstr[p] >= 'a') && (colstr[p] <= 'z')) + { + kdDebug()<<" lower\n"; + icol = icol + ((int)pow ((double)x, 26) * (colstr[p].latin1() - 'a' + 1) ); + x++; + } + p--; + kdDebug ()<< "HI 2\n"; + + } + + printf ("translateColumnNumber : <%s> -> %d\n", colstr.latin1(), icol); + return icol; +} + +#include <applixspreadimport.moc> diff --git a/filters/kspread/applixspread/applixspreadimport.h b/filters/kspread/applixspread/applixspreadimport.h new file mode 100644 index 00000000..31452e00 --- /dev/null +++ b/filters/kspread/applixspread/applixspreadimport.h @@ -0,0 +1,79 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Enno Bartels <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef APPLIXSPREADIMPORT_H +#define APPLIXSPREADIMPORT_H + +#include <qstring.h> +#include <qfile.h> +#include <qobject.h> +#include <qtextstream.h> +#include <qptrlist.h> + +#include <KoFilter.h> +#include <KoStore.h> + +typedef struct +{ + int r; + int g; + int b; + + int c; + int m; + int y; + int k; +} t_mycolor; + +typedef struct +{ + QStringList tabname; + QStringList rc; +} t_rc; + + +class APPLIXSPREADImport : public KoFilter { + + Q_OBJECT + +public: + APPLIXSPREADImport ( QObject *parent, const char* name, const QStringList& ); + virtual ~APPLIXSPREADImport() {} + + virtual KoFilter::ConversionStatus convert( const QCString& from, const QCString& to ); + +protected: + QString nextLine (QTextStream &); + QChar specCharfind (QChar , QChar ); + void writePen (QString &, int, int, QString); + QString writeColor (t_mycolor *); + void readTypefaceTable (QTextStream &, QStringList &); + void readColormap (QTextStream &, QPtrList<t_mycolor> &); + void readView (QTextStream &, QString, t_rc &); + void filterSHFGBG (QString, int *, int *, int *); + void transPenFormat (QString, int *, int *); + int readHeader (QTextStream &); + int translateColumnNumber (QString); + +private: + int m_stepsize; + int m_instep; + int m_progress; +}; +#endif // APPLIXSPREADIMPORT_H diff --git a/filters/kspread/applixspread/kspread_applixspread_import.desktop b/filters/kspread/applixspread/kspread_applixspread_import.desktop new file mode 100644 index 00000000..5d829d39 --- /dev/null +++ b/filters/kspread/applixspread/kspread_applixspread_import.desktop @@ -0,0 +1,68 @@ +[Desktop Entry] +Type=Service +Name=KSpread Applix Spreadsheet Import Filter +Name[af]=Kspread Applix Spreiblad In voer Filter +Name[az]=KSpread Applix Hesab Cədvəli Alma Süzgəci +Name[bg]=Филтър за импортиране от Applix Spreadsheet в KSpread +Name[br]=Sil enporzh al loger Applix evit KSpread +Name[ca]=Filtre d'importació per a fulls per a càlcul Applix per a KSpread +Name[cs]=KSpread Applix Spreadsheet importní filtr +Name[cy]=Hidlen Fewnforio Taenlen Applix KSpread +Name[da]=KSpread Applix regnearks-importfilter +Name[de]=KSpread Applix-Spreadsheet-Importfilter +Name[el]=Φίλτρο εισαγωγής λογιστικού φύλλου Applix του KSpread +Name[eo]=Appliks-tabelo-import-filtrilo por KSpread +Name[es]=Filtro de importación de KSpread para hoja de cálculo de Applix +Name[et]=KSpreadi Applix'i tabelite impordifilter +Name[eu]=KSpread-en Applix-en kalkulu-orriaren inportaziorako iragazkia +Name[fa]=پالایۀ واردات صفحه گستردۀ KSpread Applix +Name[fi]=KSpread Applix taulukkolaskenta -tuontisuodin +Name[fr]=Filtre d'importation Applix Spreadsheet de KSpread +Name[fy]=KSpread Applix Spreadsheet Ymportfilter +Name[gl]=Filtro de Importación de Applix Spreadsheet para KSpread +Name[he]=מסנן לייבוא גיליונות אלקטרוניים של Applix ל־KSpread +Name[hi]=के-स्प्रेड एप्लिक्स स्प्रेडशीट आयात छननी +Name[hr]=KSpread Applix Spreadsheet filtar uvoza +Name[hu]=KSpread Applix Spreadsheets importszűrő +Name[is]=KSpread Applix töflureiknis innflutningssía +Name[it]=Filtro di importazione Applix Spreadsheet per KSpread +Name[ja]=KSpread Applix スプレッドシート インポートフィルタ +Name[km]=តម្រងនាំចូលសៀវភៅបញ្ជី Applix សម្រាប់ KSpread +Name[lo]= ຕົວຕອງການນຳເຂົ້າຕາຕະລາງງານ Apllix ຂອງກະດາດຄຳນວນ K +Name[lt]=KWord Applix elektroninės lentelės importo filtras +Name[lv]=KSpread Applix elektroniskās tabulas importa filtrs +Name[ms]=Penapis Import KSpread Applix Spreadsheet +Name[mt]=Filtru għall-importazzjoni ta' Spreadsheet Applix ġo KSpread +Name[nb]=Applix-regnearkimportfilter for KSpread +Name[nds]="Applix-Tabellenutreken"-Importfilter för KSpread +Name[ne]=केडीई स्प्रिेड एप्लिक्स स्प्रिेडसिट आयात फिल्टर +Name[nl]=KSpread Applix Spreadsheet Importfilter +Name[nn]=Applix Spreadsheet-importfilter for KSpread +Name[pl]=Filtr importu formatu arkusza kalkulacyjnego Applix do KSpread +Name[pt]=Filtro de Importação de Applix Spreadsheet para o KSpread +Name[pt_BR]=Filtro de importação de Planilhas para o KSpread +Name[ro]=Filtru importare KSpread pentru Applix +Name[ru]=Фильтр импорта таблиц Applix Spreadsheet в KSpread +Name[se]=KSpread:a Applix Spreadsheet-sisafievrridansilli +Name[sk]=Applix Spreadsheet filter pre import pre KSpread +Name[sl]=Uvozni filter Applix Spreadsheet za KSpread +Name[sr]=KSpread-ов филтер за увоз Applix-ових прорачунских листова +Name[sr@Latn]=KSpread-ov filter za uvoz Applix-ovih proračunskih listova +Name[sv]=Kspread-importfilter för Applix-kalkylark +Name[ta]=KSpread Applix Spreadsheet இறக்குமதி வடிகட்டி +Name[tg]=Филтри Воридоти KSpread Applix Spreadsheet +Name[th]=ตัวกรองการนำเข้าตารางงาน Apllix ของกระดาษคำนวณ K +Name[tr]=KSpread Applix Hesap Tablosu Alma Filtresi +Name[uk]=Фільтр імпорту Applix Spreadsheet для KSpread +Name[uz]=KSpread Applix elektron jadval import filteri +Name[uz@cyrillic]=KSpread Applix электрон жадвал импорт филтери +Name[ven]=U phadaladza ha K Applix filithara ya u dzhenisa nga ngomu ya siatari lo phadalalho +Name[wa]=Passete tåvleu Applix d' intrêye po KSpread +Name[xh]=Isihluzi Sokurhweba se KSpread Applix Spreadsheet +Name[zh_CN]=KSpread Applix 电子表格导入过滤器 +Name[zh_TW]=KSpread Applix 電子表單匯入過濾程式 +X-KDE-Export=application/x-kspread +X-KDE-Import=application/x-applixspread +X-KDE-Weight=1 +X-KDE-Library=libapplixspreadimport +ServiceTypes=KOfficeFilter diff --git a/filters/kspread/applixspread/status.html b/filters/kspread/applixspread/status.html new file mode 100644 index 00000000..c944ef5c --- /dev/null +++ b/filters/kspread/applixspread/status.html @@ -0,0 +1,755 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>KOffice filters status: Applix Spreadsheet FILTER</title> +</head> +<body text="#000000" bgcolor="#FFFFFF" link="#000099" vlink="#666666" alink="#666666"> +<A NAME="START"> </A> + +<BR> +<center> + <h1> + KOffice filters status: <i>Applix Spreadsheet FILTER</i> + </h1> +</center> + +<hr NOSHADE SIZE=2 WIDTH="70%"> + +<font size="-1"><b> + <A HREF="#import">Import</A> | + <A HREF="#export">Export</A> +</b></font> + +<BR><BR><BR> +<center><a NAME="import"></a></center> + +<A HREF="#START"><font size="-1"><b>Up</b></font></A> +<center> +<table BORDER=0 CELLSPACING=0 BGCOLOR="#000000" WIDTH="100%"> + <tr> + <td> + <table BORDER=0 CELLPADDING=2 BGCOLOR="#FFFFFF" WIDTH="100%"> + + <tr BGCOLOR="#DDFFDD"> + <td COLSPAN="2"> + <center><b><i><font size="+1"> + <BR> + Import Applix Spreadsheet for kspread<BR> + <BR> + </font></i></b></center> + </td> + </tr> + + <tr BGCOLOR="#EEEEFF"> + <td VALIGN=TOP WIDTH="1%" NOWRAP><b><font size="+1">Last update</font></b></td> + <td>03 mar 2001</td> + </tr> + + <tr BGCOLOR="#CCCCFF"> + <td VALIGN=TOP><b><font size="+1">Features</font></b></td> + <td> + - can import simple and complex Applix Spreadsheet documents<br> + - tests the headline of the document<br> + - converts <, >, &, to &lt; &gt; &amp;<br> + - converts all applix special characters<br> + - converts fontsize, fontcolor, horizontal and vertical alignment, bold, italic, underline<br> + - eats long text strings (more than one row in inputfile)<br> + - converts different tables inside of one document<br> + - cellformat: background color, brushstyles, brushcolor<br> + - cellframe: linewidth, linetype, linecolor<br> + - row height and column width<br> + - converting the fontfamily (incl. reading the typeface table)<br> + - correct process bar value emiting (procent)<br> + - rows A-Z and greater Z (AA-ZZ) are right translate into integer values<br> + </td> + </tr> + + <tr BGCOLOR="#EEEEFF"> + <td VALIGN=TOP><b><font size="+1">Todo</font></b></td> + <td> + - cellframes: double lines are not supported in kspread till now. So they can't translated correct.<br> + - check the row height and column width - they are not right sometimes<br> + - grouped row and column formats<br> + - add endoffile checking with dialog in do-while loops<br> + - detect valueline (can only do textlines)<br> + - convert a formular, date or something else right with cell references<br> + - change the printf output to debug (xxxxx) output<br> + </td> + </tr> + + <tr BGCOLOR="#CCCCFF"> + <td VALIGN=TOP><b><font size="+1">History</font></b></td> + <td> + + + <table border="0" cellspacing="0"> + <tr valign=top> + <td align=right>17 mar 2001</td> + <td> : </td> + <td>The fontfamily in support (incl. bugfix)<BR> + Longnamed columns like AA are right supported now- for cell elements and column width elements<BR> + Corrected the row width values. They start with 32768!<BR> + Little code cleanup. Updated the fileformat description. + </td> + </tr> + <tr> + <td align=right>13 mar 2001</td> + <td> : </td> + <td>Added the progress bar value emiting (<A HREF="[email protected]">David Faure</A>)</td> + </tr> + <tr> + <td align=right>11 mar 2001</td> + <td> : </td> + <td>Added fileformat description.</td> + </tr> + <tr> + <td align=right>10 mar 2001</td> + <td> : </td> + <td>Checked in this version after discussion with David Faure. He told me that he just tried to begin with a applix spreadsheet import filter too.</td> + </tr> + <tr> + <td align=right>09 mar 2001</td> + <td> : </td> + <td>Read the row height and column width.</td> + </tr> + <tr> + <td align=right>03 mar 2001</td> + <td> : </td> + <td>Reads the typefont and the colortable, converts cmyk to rgb, added some style information (cell and string)</td> + </tr> + <tr> + <td align=right>24 feb 2001</td> + <td> : </td> + <td>Add <, >, & and applix character convertation</td> + </tr> + <tr> + <td align=right>11 feb 2001</td> + <td> : </td> + <td>Written a filter that only can filter simple applix files</td> + </tr> + </table> + + + </td> + </tr> + + <tr BGCOLOR="#EEEEFF"> + <td VALIGN=TOP><b><font size="+1">Authors </font></b></td> + <td><A HREF="mailto:[email protected]">Enno Bartels</A></td> + </tr> + + <tr BGCOLOR="#CCCCFF"> + <td VALIGN=TOP><b><font size="+1">Links</font></b></td> + <td><A HREF="http://home.nordwest.net/ebartels/applixinfo/as/index.html">Applixword example</A></td> + </tr> + + <tr BGCOLOR="#EEEEFF"> + <td VALIGN=TOP><b><font size="+1">Progress report </font></b></td> + <td><B><U><font size="+1">Fileformat:</font></U></B><BR> + <BR> + <B><U>Main Structure:</U></B><BR> + <spacer size="20">1. Header<BR> + <spacer size="20">2. Colortable<BR> + <spacer size="20">3. Fonttable<BR> + <spacer size="20">...<BR> + <spacer size="20">4. View<BR> + <spacer size="20">...<BR> + <spacer size="20">5. Headers and footers<BR> + <spacer size="20">6. Cellvalues<BR> + <spacer size="20">7. End<BR><BR><BR> + + + <B><U>1. Header:</U></B><BR> + <spacer size="10">The headerline looks like that:<BR> + <spacer size="20"><B><I>*BEGIN SPREADSHEETS VERSION=430/430 ENCODING=7BIT</I></B><BR><BR><BR> + + + <B><U>2. Colormap:</U></B><BR> + <spacer size="10">The colormap has 3 parts<BR> + <spacer size="10">2.1. Starting line<BR> + <spacer size="10">2.2. Value lines<BR> + <spacer size="10">2.3. Ending line<BR> + <BR> + + <spacer size="10"><U>2.1. Colormap start:</U><BR> + <spacer size="20">The colormap begins with this line<BR> + <spacer size="20"><B><I>COLORMAP</I></B><BR> + <BR> + + <spacer size="10"><U>2.2. Colormap value:</U><BR> + <spacer size="20">A color value line has the following parts (cmyk - colorsystem)<BR> + <spacer size="20"><B>Text 0 c m y k 0</B><BR> + <BR> + + <spacer size="20"> + <TABLE CELLPADDING="0" BORDER="0"> + <TR> + <TD>2.2.1.</TD> + <TD>Text</TD> + <TD>= Textstring</TD> + <TD>-</TD> + </TR> + <TR> + <TD>2.2.2.</TD> + <TD>0</TD> + <TD>= NULL</TD> + <TD>-</TD> + </TR> + <TR> + <TD>2.2.3.</TD> + <TD>c</TD> + <TD>= cyan</TD> + <TD>0-255</TD> + </TR> + <TR> + <TD>2.2.4.</TD> + <TD>m</TD> + <TD>= magenta</TD> + <TD>0-255</TD> + </TR> + <TR> + <TD>2.2.5.</TD> + <TD>y</TD> + <TD>= yellow</TD> + <TD>0-255</TD> + </TR> + <TR> + <TD>2.2.6.</TD> + <TD>k</TD> + <TD>= black (key)</TD> + <TD>0-255</TD> + </TR> + <TR> + <TD>2.2.7.</TD> + <TD>0</TD> + <TD>= NULL</TD> + <TD>-</TD> + </TR> + </TABLE> + <BR><BR> + + <spacer size="20">Color converting is very simple cmyk to rgb:<BR> + <spacer size="20">r = 255 - (c+k)<BR> + <spacer size="20">g = 255 - (m+k)<BR> + <spacer size="20">b = 255 - (y+k)<BR> + <spacer size="20">If the value of r, g or b if less then 0 you must set it to 0 .<BR> + <BR> + <spacer size="20">For examples inside koffice look a this files too<br> + <spacer size="20"><I>koffice/kimageshop/core/kis_color.cc and kis_color.h</I><BR> + <BR><BR> + + <spacer size="10"><U>2.3. Colormap end:</U><BR> + <spacer size="20">The colormap ends with this line:<BR> + <spacer size="20"><B><I>END COLORMAP</I></B> + <BR><BR> + + + <B><U>3. Fonttable:</U></B><BR> + <spacer size="10">The fonttable has 3 parts<BR> + <spacer size="10">3.1. Starting line<BR> + <spacer size="10">3.2. Value lines<BR> + <spacer size="10">3.3. Ending line<BR> + <BR> + + <spacer size="10"><U>3.1. Starting line</U><BR> + <spacer size="20">The fonttable begins with this line:<BR> + <spacer size="20"><B><I>TYPEFACE TABLE</I></B><BR> + <BR> + + <spacer size="10"><U>3.2. Value line</U><BR> + <spacer size="20">The fonttable value line looks like that:<BR> + <spacer size="20"><B>Helvetica</B><BR> + <BR> + + <spacer size="10"><U>3.3. Ending line</U><BR> + <spacer size="20">The colormap ends with this line ends with<BR> + <spacer size="20"><B><I>END TYPEFACE TABLE</I></B><BR> + <BR><BR> + + + <B><U>4. View:</U></B><BR> + <spacer size="10">Each table has its own view section and everyone has 3 parts<br> + <spacer size="10">4.1. Starting line<BR> + <spacer size="10">4.2. Value lines<BR> + <spacer size="10">4.3. Ending line<BR> + <spacer size="10">This is an example with the table name <B>A</B><BR> + <BR> + + <spacer size="10"><U>4.1. Starting line</U><BR> + <spacer size="20">The view of table <B>A</B> begins with this line:<BR> + <spacer size="20"><B><I>View Start, Name: ~A:~</I></B><br> + <BR> + + <spacer size="10"><U>4.2. Value lines</U><BR> + <spacer size="20">There are different value lines, but all of them start with <B>view</B><BR> + <spacer size="20">There are following important value lines:<BR> + + <spacer size="20">4.2.1. Column width <BR> + <spacer size="20">4.2.2. Row heights<BR> + <BR> + + <spacer size="20"><U>4.2.1. Column width</U><BR> + <spacer size="30">In the view of an table block is for example the width of a column:<br> + <spacer size="30"><B><I>View Column Widths: A:3 B:3 C:3 D:3 E:3 F:3 G:4 H:4</I></B><br> + <BR> + + <spacer size="20"><U>4.2.1. Row height</U><BR> + <spacer size="30">or the height of a row<br> + <spacer size="30"><B><I>View Row Heights: 3:18 4:24 8:32804 </I></B><br> + <spacer size="30">Attention: If the row value is greater then 32768 you have to calc rowHeight = rowHeight - 32768 to get the right value! + <br><br> + + <spacer size="10"><U>4.3. Ending line</U><BR> + <spacer size="20">The view of table <B>A</B> ends with this line:<BR> + <spacer size="20"><B><I>View End, Name: ~A:~</I></B><BR> + <br><br> + + + <B><U>5. Headers and footers:</U></B><BR> + <spacer size="10">The headers and footers section has 3 parts<BR> + <spacer size="10">5.1. Starting line<BR> + <spacer size="10">5.2. Value lines<BR> + <spacer size="10">5.3. Ending line<BR> + <BR> + + <spacer size="10"><U>5.1. Starting line</U><BR> + <spacer size="20">The headers and footers section begins with this line:<BR> + <spacer size="20"><B><I>Headers And Footers</I></B><BR> + <BR> + + <spacer size="10"><U>5.2. Value lines</U><BR> + <spacer size="20">-<BR> + <spacer size="20">-<BR> + <BR> + + <spacer size="10"><U>5.3. Ending line</U><BR> + <spacer size="20">The headers and footers section end with<BR> + <spacer size="20"><B><I>Headers And Footers End</I></B><BR> + <BR><BR> + + + + <B><U>6. Cellvalue:</U></B><BR> + <spacer size="10">This is a cellvalue line<BR> + <spacer size="10"><B><I>('DN|B,I,U,TF1,P18|T4) A!D11: Hello everybody</I></B><BR> <BR> + <spacer size="10">a cellvalue line has 3 parts:<BR> + <spacer size="10">6.1. Formatpart<BR> + <spacer size="10">6.2. Location part<BR> + <spacer size="10">6.3. Text String, formular, value, link, etc.<BR> + <BR> + + + <spacer size="10"><U>6.1. Formatpart:</U><BR> + <spacer size="20">The format part looks like that:<BR> + <spacer size="20"><B>('DN|B,I,U,TF1,P18|T4)</B><BR> + <spacer size="20">There are 3 formatsubparts divided by <B>|</B>:<BR> + <spacer size="20"><B>(Part1|Part2|Part3)</B><BR> + <spacer size="20">5.1.1. Part 1 - Alignment format<BR> + <spacer size="20">5.1.2. Part 2 - Text format<BR> + <spacer size="20">5.1.3. Part 3 - Cell format<BR> + <BR> + + + <spacer size="20"><U>6.1.1. Part 1 - Alignment format</U><BR> + <spacer size="30">This is the alignment format for vertical, horizontal alignment<BR> + <spacer size="30"> + <TABLE CELLPADDING="0" BORDER="0"> + <TR> + <TD>6.1.1.1 </TD> + <TD><B>1</B></TD> + <TD>horizontal alignment</TD> + <TD>left</TD> + </TR> + <TR> + <TD>6.1.1.2 </TD> + <TD><B>2</B></TD> + <TD>horizontal alignment</TD> + <TD>right</TD> + </TR> + <TR> + <TD>6.1.1.3 </TD> + <TD><B>3</B></TD> + <TD>horizontal alignment</TD> + <TD>center</TD> + </TR> + <TR> + <TD>6.1.1.4 </TD> + <TD><B>VT</B></TD> + <TD>vertical alignment</TD> + <TD>top</TD> + </TR> + <TR> + <TD>6.1.1.5 </TD> + <TD><B>VC</B></TD> + <TD>vertical alignment</TD> + <TD>center</TD> + </TR> + <TR> + <TD>6.1.1.5 </TD> + <TD><B>VB</B></TD> + <TD>vertical alignment</TD> + <TD>bottom</TD> + </TR> + <TR> + <TD>6.1.1.6 </TD> + <TD><B>DN</B></TD> + <TD>??</TD> + <TD>??</TD> + </TR> + </TABLE> + <BR> + + + <spacer size="20"><U>6.1.2. Part 2 - Text format</U><BR> + <spacer size="30">This is the alignment format for the text<BR> + <spacer size="30"> + <TABLE CELLPADDING="0" BORDER="0"> + <TR> + <TD>6.1.2.1. </TD> + <TD><B>B</B></TD> + <TD>bold</TD> + <TD>-</TD> + </TR> + <TR> + <TD>6.1.2.2. </TD> + <TD><B>I</B></TD> + <TD>italic</TD> + <TD>-</TD> + </TR> + <TR> + <TD>6.1.2.3. </TD> + <TD><B>U</B></TD> + <TD>underline</TD> + <TD>-</TD> + </TR> + <TR> + <TD>6.1.2.4. </TD> + <TD><B>TFx</B></TD> + <TD>fontfamily</TD> + <TD>x is the number in the fonttable.</TD> + </TR> + <TR> + <TD>6.1.2.5. </TD> + <TD><B>Px</B></TD> + <TD>fontsize</TD> + <TD>x is the fontsize.</TD> + </TR> + </TABLE> + <BR> + + + + <spacer size="20"><U>6.1.3. Part 3 - Cell format</U><BR> + <spacer size="30">This is the alignment format for the text<BR> + <spacer size="30"> + <TABLE CELLPADDING="0" BORDER="0"> + <TR> + <TD>6.1.3.1. </TD> + <TD><B>Txy</B></TD> + <TD>Frame at the top</TD> + </TR> + <TR> + <TD>6.1.3.2. </TD> + <TD><B>Bxy</B></TD> + <TD>Frame at the bottom</TD> + </TR> + <TR> + <TD>6.1.3.3. </TD> + <TD><B>Lxy</B></TD> + <TD>Frame at the left side</TD> + </TR> + <TR> + <TD>6.1.3.4. </TD> + <TD><B>Rxy</B></TD> + <TD>Frame at the right side</TD> + </TR> + </TABLE> + <BR> + + <spacer size="30">x = number describes the penwidth and penstyle of the frame line<BR> + <spacer size="30"> + <TABLE CELLPADDING="0" BORDER="1"> + <TR> + <TD ALIGN=CENTER colspan=2>applix</TD> + <TD ALIGN=CENTER> </TD> + <TD ALIGN=CENTER colspan=2> kspread</TD> + </TR> + <TR> + <TD ALIGN=CENTER>number x</TD> + <TD ALIGN=CENTER>info</TD> + <TD ALIGN=CENTER> </TD> + <TD ALIGN=CENTER>penwidth</TD> + <TD ALIGN=CENTER>penstyle</TD> + </TR> + <TR> + <TD>1</TD> + <TD>-</TD> + <TD> = </TD> + <TD>1</TD> + <TD>1</TD> + </TR> + <TR> + <TD>2</TD> + <TD>-</TD> + <TD> = </TD> + <TD>2</TD> + <TD>1</TD> + </TR> + <TR> + <TD>3</TD> + <TD>-</TD> + <TD> = </TD> + <TD>3</TD> + <TD>1</TD> + </TR> + <TR> + <TD>4</TD> + <TD>dashed</TD> + <TD> = </TD> + <TD>1</TD> + <TD>3</TD> + </TR> + <TR> + <TD>5</TD> + <TD>double line</TD> + <TD> = </TD> + <TD>5</TD> + <TD>1</TD> + </TR> + </TABLE> + <BR> + + + <spacer size="30">y = examples <B>FG7</B> <B>SH11FG18</B> <B>SH11FG18BG4</B><BR> + <spacer size="30">it has max 3 Parts:<BR> + <spacer size="30">6.1.3.4.1. Foreground color.<BR> + <spacer size="30">6.1.3.4.2. Background shade type.<BR> + <spacer size="30">6.1.3.4.3. Background color.<BR> + <BR> + + <spacer size="30"><U>6.1.3.4.1. Foreground color:</U><BR> + <spacer size="40">FGx = Foreground color. - x is the number in the colortable<BR> + <BR> + + <spacer size="30"><U>6.1.3.4.2. Background shade type:</U><BR> + <spacer size="40">SHx = Background shade type. x is the shadetypenumber<BR> + <spacer size="40">Not all can be translate !<BR> + <BR> + <spacer size="40"> + <TABLE CELLPADDING="0" BORDER="1"> + <TR> + <TD ALIGN=CENTER>applix</TD> + <TD ALIGN=CENTER> </TD> + <TD ALIGN=CENTER>kspread</TD> + </TR> + <TR> + <TD ALIGN=CENTER>shadetype number </TD> + <TD ALIGN=CENTER> </TD> + <TD ALIGN=CENTER>shadetype number</TD> + </TR> + <TR> + <TD>1</TD> + <TD>=</TD> + <TD>0</TD> + </TR> + <TR> + <TD>2</TD> + <TD>=</TD> + <TD>7</TD> + </TR> + <TR> + <TD>3</TD> + <TD>=</TD> + <TD>0</TD> + </TR> + <TR> + <TD>4</TD> + <TD>=</TD> + <TD>4</TD> + </TR> + <TR> + <TD>5</TD> + <TD>=</TD> + <TD>3</TD> + </TR> + <TR> + <TD>6</TD> + <TD>=</TD> + <TD>2</TD> + </TR> + <TR> + <TD>7</TD> + <TD>=</TD> + <TD>0</TD> + </TR> + <TR> + <TD>8</TD> + <TD>=</TD> + <TD>0</TD> + </TR> + <TR> + <TD>9</TD> + <TD>=</TD> + <TD>10</TD> + </TR> + <TR> + <TD>10</TD> + <TD>=</TD> + <TD>9</TD> + </TR> + <TR> + <TD>11</TD> + <TD>=</TD> + <TD>11</TD> + </TR> + <TR> + <TD>12</TD> + <TD>=</TD> + <TD>12</TD> + </TR> + <TR> + <TD>13</TD> + <TD>=</TD> + <TD>13</TD> + </TR> + <TR> + <TD>14</TD> + <TD>=</TD> + <TD>14</TD> + </TR> + <TR> + <TD>15</TD> + <TD>=</TD> + <TD>0</TD> + </TR> + <TR> + <TD>16</TD> + <TD>=</TD> + <TD>0</TD> + </TR> + <TR> + <TD>17</TD> + <TD>=</TD> + <TD>0</TD> + </TR> + <TR> + <TD>18</TD> + <TD>=</TD> + <TD>0</TD> + </TR> + <TR> + <TD>19</TD> + <TD>=</TD> + <TD>0</TD> + </TR> + </TABLE> + <BR> + + <spacer size="30"><U>6.1.3.4.3. Background color:</U> <BR> + <spacer size="40">BGx = Background color. x is the number in the colortable<BR> + <BR><BR> + + + <spacer size="10"><U>6.2. Location part:</U> <BR> + <spacer size="20">The location part looks like that:<BR> + <spacer size="20"><B>A!D11:</B><BR> + <spacer size="20">A = table <BR> + <spacer size="20">D11 = cellnumber<BR> + <spacer size="30">D = columnnumber<BR> + <spacer size="30">11 = rownumber<BR> + <spacer size="30">:=textstring, ;=formular, .=value<BR> + <BR> + + <spacer size="10"><U>6.3. Text String etc:</U><BR> + <spacer size="20">The text string part looks like that:<BR> + <spacer size="20"><B>Hello everybody</B><BR> + <BR> + + + + + + + <B><U>7. End</U></B><BR> + The end looks like that:<BR> + <B><I></I>*END SPREADSHEETS</B><BR> + <BR><BR> + + + </td> + </tr> + </table> + </td> + </tr> +</table> +</center> +<A HREF="#START"><font size="-1"><b>Up</b></font></A> + +<br><br><br> + +<hr NOSHADE SIZE=1> +<br><br><br> + + +<center> + <a NAME="export"></a> +</center> + +<A HREF="#START"><font size="-1"><b>Up</b></font></A> +<center> +<table BORDER=0 CELLSPACING=0 BGCOLOR="#000000" WIDTH="100%"> + <tr> + <td> + <table BORDER=0 CELLPADDING=2 BGCOLOR="#FFFFFF" WIDTH="100%"> + <tr BGCOLOR="#FFDDDD"> + <td COLSPAN="2"> + <center><b><i><font size="+1"> + <BR>Export kspread to Applix Spreadsheet<BR><BR> + </font></i></b></center> + </td> + </tr> + + <tr BGCOLOR="#EEEEFF"> + <td VALIGN=TOP WIDTH="1%" NOWRAP><b><font size="+1">Last update</font></b></td> + <td>-</td> + </tr> + + <tr BGCOLOR="#CCCCFF"> + <td VALIGN=TOP><b><font size="+1">Features</font></b></td> + <td>None</td> + </tr> + + <tr BGCOLOR="#EEEEFF"> + <td VALIGN=TOP><b><font size="+1">Todo</font></b></td> + <td>Everything</td> + </tr> + + <tr BGCOLOR="#CCCCFF"> + <td VALIGN=TOP><b><font size="+1">History</font></b></td> + <td>-</td> + </tr> + + <tr BGCOLOR="#EEEEFF"> + <td VALIGN=TOP><b><font size="+1">Authors</font></b></td> + <td><!a href="mailto:[email protected]">-</a></td> + </tr> + + <tr BGCOLOR="#CCCCFF"> + <td VALIGN=TOP><b><font size="+1">Links</font></b></td> + <td><!a href="http://www.koffice.org">-</a></td> + </tr> + + <tr BGCOLOR="#EEEEFF"> + <td VALIGN=TOP><b><font size="+1">Progress report </font></b></td> + <td>---</td> + </tr> + </table> + </td> + </tr> +</table> +</center> +<A HREF="#START"><font size="-1"><b>Up</b></font></A> + +</body> +</html> |