summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-sheet/Excel.cpp
Unidiff
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,3 +1,32 @@
1/*
2 =. This file is part of the Opie Project
3 .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
4 .>+-=
5 _;:, .> :=|. This program is free software; you can
6.> <`_, > . <= redistribute it and/or modify it under
7:`=1 )Y*s>-.-- : the terms of the GNU General Public
8.="- .-=="i, .._ License as published by the Free Software
9 - . .-<_> .<> Foundation; either version 2 of the License,
10 ._= =} : or (at your option) any later version.
11 .%`+i> _;_.
12 .i_,=:_. -<s. This program is distributed in the hope that
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
14 : .. .:, . . . without even the implied warranty of
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.= = ; Library General Public License for more
18++= -. .` .: details.
19 : = ...= . :.=-
20 -. .:....=;==+<; You should have received a copy of the GNU
21 -_. . . )=. = Library General Public License along with
22 -- :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
1 28
29#include "Excel.h"
2 30
31/* STD */
3#include <stdio.h> 32#include <stdio.h>
@@ -8,3 +37,2 @@
8#include <strings.h> 37#include <strings.h>
9#include "Excel.h"
10 38
@@ -65,3 +93,4 @@ int ExcelBook::Integer4Byte(int b1,int b2,int b3,int b4)
65 93
66int ExcelBook::Integer2ByteFile(FILE *f) { 94int ExcelBook::Integer2ByteFile(FILE *f)
95{
67 int i1, i2; 96 int i1, i2;
@@ -104,3 +133,4 @@ double ExcelBook::Double4Byte(int b1, int b2, int b3, int b4)
104 return value; 133 return value;
105 }else 134 }
135 else
106 { 136 {
@@ -134,6 +164,9 @@ void ExcelBook::DetectEndian(void)
134 end = (*a != 0x11); 164 end = (*a != 0x11);
135 if (end == 1) { 165 if (end == 1)
166 {
136 endian = BIG_ENDIAN; 167 endian = BIG_ENDIAN;
137 printf("BIGENDIAN!\r\n"); 168 printf("BIGENDIAN!\r\n");
138 } else { 169 }
170 else
171 {
139 endian = LITTLE_ENDIAN; 172 endian = LITTLE_ENDIAN;
@@ -150,3 +183,4 @@ double ExcelBook::Double8Byte(int b1, int b2, int b3, int b4, int b5, int b6, in
150 for (i = 0; i < 8; i++) ieee[i] = 0; 183 for (i = 0; i < 8; i++) ieee[i] = 0;
151 if (endian == BIG_ENDIAN) { 184 if (endian == BIG_ENDIAN)
185 {
152 ieee[0] = ((int)b8) & 0xff;ieee[1] = ((int)b7) & 0xff; 186 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
155 ieee[6] = ((int)b2) & 0xff;ieee[7] = ((int)b1) & 0xff; 189 ieee[6] = ((int)b2) & 0xff;ieee[7] = ((int)b1) & 0xff;
156 } else { 190 }
191 else
192 {
157 ieee[0] = ((int)b1) & 0xff;ieee[1] = ((int)b2) & 0xff; 193 ieee[0] = ((int)b1) & 0xff;ieee[1] = ((int)b2) & 0xff;
@@ -395,3 +431,4 @@ int ExcelBook::SheetHandleRecord(ExcelSheet* sheet, ExcelBREC* record)
395 sheet->cols = Integer2Byte(data[6], data[7]); 431 sheet->cols = Integer2Byte(data[6], data[7]);
396 } else 432 }
433 else
397 { 434 {
@@ -604,3 +641,4 @@ void ExcelBook::HandleBoundSheet(ExcelBREC* rec)
604 name=GetASCII(data,pos,length); 641 name=GetASCII(data,pos,length);
605 }else 642 }
643 else
606 { 644 {
@@ -810,3 +848,4 @@ QString* ExcelBook::CellDataString(ExcelSheet* sh, int row, int col)
810 strftime(str,1024,dateformat.ascii(),tmptr); 848 strftime(str,1024,dateformat.ascii(),tmptr);
811 } else 849 }
850 else
812 { 851 {
@@ -814,3 +853,4 @@ QString* ExcelBook::CellDataString(ExcelSheet* sh, int row, int col)
814 }; 853 };
815 } else 854 }
855 else
816 if (XFRecords[c->xfindex]->type == NUMBERFORMAT) 856 if (XFRecords[c->xfindex]->type == NUMBERFORMAT)
@@ -823,3 +863,4 @@ QString* ExcelBook::CellDataString(ExcelSheet* sh, int row, int col)
823 sprintf(str,"%.*f",precision,c->valued); 863 sprintf(str,"%.*f",precision,c->valued);
824 }else 864 }
865 else
825 { 866 {
@@ -1004,3 +1045,4 @@ void ExcelBook::HandleFormula(ExcelSheet* sheet, ExcelBREC* record)
1004 // string 1045 // string
1005 } else 1046 }
1047 else
1006 if (data[6] == 1 && data[12] == -1 && data[13] == -1) 1048 if (data[6] == 1 && data[12] == -1 && data[13] == -1)
@@ -1008,3 +1050,4 @@ void ExcelBook::HandleFormula(ExcelSheet* sheet, ExcelBREC* record)
1008 // boolean 1050 // boolean
1009 } else 1051 }
1052 else
1010 if ( data[6] == 2 && data[12] == -1 && data[13] == -1) 1053 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
1125 operands.prepend(new QString(s1)); 1168 operands.prepend(new QString(s1));
1126 }else 1169 }
1170 else
1127 { 1171 {
@@ -1144,3 +1188,4 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i
1144 w4=Integer2Byte(data[idx],data[idx+1]) & 0x00FF;idx=idx+2;//col2 1188 w4=Integer2Byte(data[idx],data[idx+1]) & 0x00FF;idx=idx+2;//col2
1145 }else 1189 }
1190 else
1146 { 1191 {
@@ -1163,3 +1208,4 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i
1163 w2=Integer2Byte(data[idx],data[idx+1]) & 0x00FF;idx=idx+2;//col 1208 w2=Integer2Byte(data[idx],data[idx+1]) & 0x00FF;idx=idx+2;//col
1164 }else 1209 }
1210 else
1165 { 1211 {
@@ -1334,3 +1380,4 @@ QString ExcelBook::GetFormula(int row, int col, ExcelSheet* sheet, char* data, i
1334 w1=Integer2Byte(data[idx],data[idx+1]);idx=idx+2; 1380 w1=Integer2Byte(data[idx],data[idx+1]);idx=idx+2;
1335 }else 1381 }
1382 else
1336 { 1383 {