gnumeric r16523 - in trunk: . plugins/qpro



Author: mortenw
Date: Sun Apr 27 22:18:20 2008
New Revision: 16523
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16523&view=rev

Log:
2008-04-27  Morten Welinder  <terra gnome org>

	* qpro-read.c (qpro_get_record): 907 records are big too.  Fixes
	#530183.
	(qpro_read_sheet): Do aliggment for text cells.



Modified:
   trunk/NEWS
   trunk/plugins/qpro/ChangeLog
   trunk/plugins/qpro/qpro-read.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Sun Apr 27 22:18:20 2008
@@ -72,7 +72,8 @@
 	* Fix problems editing times.  [#527392]
 	* Implement IFERROR.  [#445591]
 	* Implement F9 for evaluating a selected subexpression.
-	* Fix problem loading wb1 files.  [#530183]
+	* Fix problem loading Quattro Pro files.  [#530183]
+	* Fix right/center text for Quattro Pro files.
 
 Nick Lamb:
 	* Honour detachable-toolbar preference.  [#321867]

Modified: trunk/plugins/qpro/qpro-read.c
==============================================================================
--- trunk/plugins/qpro/qpro-read.c	(original)
+++ trunk/plugins/qpro/qpro-read.c	Sun Apr 27 22:18:20 2008
@@ -18,6 +18,13 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
  * USA
+ *
+ * Docs for the format used to be at
+ *
+ *   www.corel.com/partners_developers/ds/CO32SDK/docs/qp7/Qpf3recd.htm
+ *   www.corel.com/partners_developers/ds/CO32SDK/docs/qp7/Qpf2intr.htm
+ *
+ * Try Wayback!
  */
 #include <gnumeric-config.h>
 #include <glib/gi18n-lib.h>
@@ -34,6 +41,7 @@
 #include <cell.h>
 #include <value.h>
 #include <expr.h>
+#include <mstyle.h>
 #include <sheet-style.h>
 #include <style-color.h>
 #include <parse-util.h>
@@ -746,8 +754,32 @@
 			if (validate (QPRO_LABEL_CELL, -1)) {
 				int col = data[0];
 				int row = GSF_LE_GET_GUINT16 (data + 2);
-				sheet_style_set_pos (sheet, col, row,
-					qpro_get_style (state, data + 4));
+				GnmHAlign align = HALIGN_GENERAL;
+				GnmStyle *as = qpro_get_style (state, data + 4);
+				GnmHAlign asa = gnm_style_is_element_set (as, MSTYLE_ALIGN_H)
+					? gnm_style_get_align_h (as)
+					: HALIGN_GENERAL;
+				if (asa == HALIGN_GENERAL)
+					asa = HALIGN_LEFT;
+
+				sheet_style_set_pos (sheet, col, row, as);
+				switch (data[6]) {
+				case '\'': align = HALIGN_LEFT; break;
+				case '^':  align = HALIGN_CENTER; break;
+				case '"':  align = HALIGN_RIGHT; break;
+				case '\\': break; /* Repeat */
+				case '|':  break; /* Page break */
+				case 0:    break; /* Nothing */
+				default:
+					g_printerr ("Ignoring unknown alignment\n");
+				}
+				if (align != HALIGN_GENERAL && align != asa) {
+					GnmStyle *s = gnm_style_new ();
+					gnm_style_set_align_h (s, align);
+					sheet_style_apply_pos (sheet, col, row,
+							       s);
+				}
+
 				gnm_cell_assign_value (sheet_cell_fetch (sheet, col, row),
 						   qpro_new_string (state, data + 7));
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]