Diffstat (limited to 'noncore/apps/opie-sheet/Excel.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-sheet/Excel.cpp | 83 |
1 files changed, 65 insertions, 18 deletions
diff --git a/noncore/apps/opie-sheet/Excel.cpp b/noncore/apps/opie-sheet/Excel.cpp index fc49d56..57aef20 100644 --- a/noncore/apps/opie-sheet/Excel.cpp +++ b/noncore/apps/opie-sheet/Excel.cpp @@ -1,3 +1,32 @@ +/* + =. This file is part of the Opie Project + .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ +#include "Excel.h" +/* STD */ #include <stdio.h> @@ -8,3 +37,2 @@ #include <strings.h> -#include "Excel.h" @@ -65,3 +93,4 @@ int ExcelBook::Integer4Byte(int b1,int b2,int b3,int b4) -int ExcelBook::Integer2ByteFile(FILE *f) { +int ExcelBook::Integer2ByteFile(FILE *f) +{ int i1, i2; @@ -104,3 +133,4 @@ double ExcelBook::Double4Byte(int b1, int b2, int b3, int b4) return value; - }else + } + else { @@ -134,6 +164,9 @@ void ExcelBook::DetectEndian(void) end = (*a != 0x11); - if (end == 1) { + if (end == 1) + { endian = BIG_ENDIAN; printf("BIGENDIAN!\r\n"); - } else { + } + else + { endian = LITTLE_ENDIAN; @@ -150,3 +183,4 @@ double ExcelBook::Double8Byte(int b1, int b2, int b3, int b4, int b5, int b6, in for (i = 0; i < 8; i++) ieee[i] = 0; - if (endian == BIG_ENDIAN) { + if (endian == BIG_ENDIAN) + { ieee[0] = ((int)b8) & 0xff;ieee[1] = ((int)b7) & 0xff; @@ -155,3 +189,5 @@ double ExcelBook::Double8Byte(int b1, int b2, int b3, int b4, int b5, int b6, in ieee[6] = ((int)b2) & 0xff;ieee[7] = ((int)b1) & 0xff; - } else { + } + else + { ieee[0] = ((int)b1) & 0xff;ieee[1] = ((int)b2) & 0xff; @@ -395,3 +431,4 @@ int ExcelBook::SheetHandleRecord(ExcelSheet* sheet, ExcelBREC* record) sheet->cols = Integer2Byte(data[6], data[7]); - } else + } + else { @@ -604,3 +641,4 @@ void ExcelBook::HandleBoundSheet(ExcelBREC* rec) name=GetASCII(data,pos,length); - }else + } + else { @@ -810,3 +848,4 @@ QString* ExcelBook::CellDataString(ExcelSheet* sh, int row, int col) strftime(str,1024,dateformat.ascii(),tmptr); - } else + } + else { @@ -814,3 +853,4 @@ QString* ExcelBook::CellDataString(ExcelSheet* sh, int row, int col) }; - } else + } + else if (XFRecords[c->xfindex]->type == NUMBERFORMAT) @@ -823,3 +863,4 @@ QString* ExcelBook::CellDataString(ExcelSheet* sh, int row, int col) sprintf(str,"%.*f",precision,c->valued); - }else + } + else { @@ -1004,3 +1045,4 @@ void ExcelBook::HandleFormula(ExcelSheet* sheet, ExcelBREC* record) // string - } else + } + else if (data[6] == 1 && data[12] == -1 && data[13] == -1) @@ -1008,3 +1050,4 @@ void ExcelBook::HandleFormula(ExcelSheet* sheet, ExcelBREC* record) // boolean - } else + } + else if ( data[6] == 2 && data[12] == -1 && data[13] == -1) @@ -1125,3 +1168,4 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i operands.prepend(new QString(s1)); - }else + } + else { @@ -1144,3 +1188,4 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i w4=Integer2Byte(data[idx],data[idx+1]) & 0x00FF;idx=idx+2;//col2 - }else + } + else { @@ -1163,3 +1208,4 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i w2=Integer2Byte(data[idx],data[idx+1]) & 0x00FF;idx=idx+2;//col - }else + } + else { @@ -1334,3 +1380,4 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i w1=Integer2Byte(data[idx],data[idx+1]);idx=idx+2; - }else + } + else { |