summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-sheet/Excel.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-sheet/Excel.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/Excel.cpp83
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,4 +1,33 @@
+/*
+ =. 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>
#include <stdlib.h>
@@ -7,5 +36,4 @@
#include <sys/types.h>
#include <strings.h>
-#include "Excel.h"
static xfrecord formatter[] = {
@@ -64,5 +92,6 @@ int ExcelBook::Integer4Byte(int b1,int b2,int b3,int b4)
};
-int ExcelBook::Integer2ByteFile(FILE *f) {
+int ExcelBook::Integer2ByteFile(FILE *f)
+{
int i1, i2;
i1 = fgetc(f);
@@ -103,5 +132,6 @@ double ExcelBook::Double4Byte(int b1, int b2, int b3, int b4)
};
return value;
- }else
+ }
+ else
{
@@ -133,8 +163,11 @@ void ExcelBook::DetectEndian(void)
unsigned char* a = (unsigned char*) &i;
end = (*a != 0x11);
- if (end == 1) {
+ if (end == 1)
+ {
endian = BIG_ENDIAN;
printf("BIGENDIAN!\r\n");
- } else {
+ }
+ else
+ {
endian = LITTLE_ENDIAN;
printf("LITTLEENDIAN!\r\n");
@@ -149,10 +182,13 @@ double ExcelBook::Double8Byte(int b1, int b2, int b3, int b4, int b5, int b6, in
ieee = (unsigned char *)&d;
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;
ieee[2] = ((int)b6) & 0xff;ieee[3] = ((int)b5) & 0xff;
ieee[4] = ((int)b4) & 0xff;ieee[5] = ((int)b3) & 0xff;
ieee[6] = ((int)b2) & 0xff;ieee[7] = ((int)b1) & 0xff;
- } else {
+ }
+ else
+ {
ieee[0] = ((int)b1) & 0xff;ieee[1] = ((int)b2) & 0xff;
ieee[2] = ((int)b3) & 0xff;ieee[3] = ((int)b4) & 0xff;
@@ -394,5 +430,6 @@ int ExcelBook::SheetHandleRecord(ExcelSheet* sheet, ExcelBREC* record)
sheet->rows = Integer2Byte(data[2], data[3]);
sheet->cols = Integer2Byte(data[6], data[7]);
- } else
+ }
+ else
{
sheet->rows = Integer4Byte(data[4], data[5], data[6], data[7]);
@@ -603,5 +640,6 @@ void ExcelBook::HandleBoundSheet(ExcelBREC* rec)
//ascii
name=GetASCII(data,pos,length);
- }else
+ }
+ else
{
name=GetUnicode(data,pos,length);
@@ -809,9 +847,11 @@ QString* ExcelBook::CellDataString(ExcelSheet* sh, int row, int col)
{
strftime(str,1024,dateformat.ascii(),tmptr);
- } else
+ }
+ else
{
strftime(str,1024,format.ascii(),tmptr);
};
- } else
+ }
+ else
if (XFRecords[c->xfindex]->type == NUMBERFORMAT)
{
@@ -822,5 +862,6 @@ QString* ExcelBook::CellDataString(ExcelSheet* sh, int row, int col)
precision = CellGetPrecision(c->valued);
sprintf(str,"%.*f",precision,c->valued);
- }else
+ }
+ else
{
precision = CellGetPrecision(c->valued);
@@ -1003,9 +1044,11 @@ void ExcelBook::HandleFormula(ExcelSheet* sheet, ExcelBREC* record)
{
// string
- } else
+ }
+ else
if (data[6] == 1 && data[12] == -1 && data[13] == -1)
{
// boolean
- } else
+ }
+ else
if ( data[6] == 2 && data[12] == -1 && data[13] == -1)
{
@@ -1124,5 +1167,6 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i
s1=QString("""")+s1+QString("""");
operands.prepend(new QString(s1));
- }else
+ }
+ else
{
w1=data[idx];idx++;
@@ -1143,5 +1187,6 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i
w3=Integer2Byte(data[idx],data[idx+1]) & 0x00FF;idx=idx+2;//col1
w4=Integer2Byte(data[idx],data[idx+1]) & 0x00FF;idx=idx+2;//col2
- }else
+ }
+ else
{
w1=Integer2Byte(data[idx],data[idx+1]) & 0x3FFF;idx=idx+2;//row1
@@ -1162,5 +1207,6 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i
w1=Integer2Byte(data[idx],data[idx+1]);idx=idx+2;//row
w2=Integer2Byte(data[idx],data[idx+1]) & 0x00FF;idx=idx+2;//col
- }else
+ }
+ else
{
w1=Integer2Byte(data[idx],data[idx+1]) & 0x3FFF;idx=idx+2;//row
@@ -1333,5 +1379,6 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i
w2=(int)data[idx];idx++;
w1=Integer2Byte(data[idx],data[idx+1]);idx=idx+2;
- }else
+ }
+ else
{
w1=Integer2Byte(data[idx],data[idx+1]);idx=idx+2;