[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    patch to fix bug #28049
From:       Ariya Hidayat <ariya () tf ! itb ! ac ! id>
Date:       2002-08-26 13:44:28
[Download RAW message or body]

The following patch fixes bug #28049 (MS Excel filter doesn't translate sheet 
name). I only tested it on some Cyrillic Excel files but should work well.

Please review.

PS: Thanks to Vadim for the XLS files.

["sheetname.patch" (text/x-diff)]

Index: worker.cc
===================================================================
RCS file: /home/kde/koffice/filters/olefilters/excel97/worker.cc,v
retrieving revision 1.11
diff -u -3 -p -r1.11 worker.cc
--- worker.cc	2002/06/16 18:45:30	1.11
+++ worker.cc	2002/08/26 14:41:10
@@ -192,7 +192,8 @@ bool Worker::op_boundsheet(Q_UINT32, QDa
 {
 	Q_UINT32 lbPlyPos;
 	Q_UINT16 grbit;
-	Q_UINT16 cch;
+	Q_UINT8 cch;
+	Q_UINT8 flag;
 	Q_UINT8 tmp8;
 	QDomElement *e;
 
@@ -203,16 +204,34 @@ bool Worker::op_boundsheet(Q_UINT32, QDa
 			cch = tmp8;
 			break;
 		case BIFF_8:
-			body >> lbPlyPos >> grbit >> cch;
+			body >> lbPlyPos >> grbit >> cch >> flag;
 			break;
 		default:
 			return false;
 	}
 
-	char *name = new char[cch];
-	body.readRawBytes(name, cch);
-	QString s = QString::fromLatin1(name, cch);
-	delete []name;
+        QString s; // name of sheet/macro/chart
+
+        if( flag & 1 )
+        {
+                // Unicode
+                for( int i=0; i<cch; i++ )
+                {
+                        Q_UINT16 ch;
+                        body >> ch;
+                        s.append( QChar( ch ) );
+                }
+        }
+        else
+        {
+                // Latin1
+                for( int i=0; i<cch; i++ )
+                {
+                        Q_UINT8 ch;
+                        body >> ch;
+                        s.append( (char)ch );
+                }
+        }
 
 	if((grbit & 0x0f) == 0)
 	{

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic