[gnumeric] xls: clarify listbox type.



commit 4b11410951710d65e680faf0483f1d991cbba989
Author: Morten Welinder <terra gnome org>
Date:   Tue Dec 22 15:49:39 2015 -0500

    xls: clarify listbox type.
    
    0 is user-combo; 3 is auto filter; 6 would be validation drop down.

 plugins/excel/ms-excel-write.c |    2 +-
 plugins/excel/ms-obj.c         |   20 ++++++++++++--------
 plugins/excel/ms-obj.h         |    4 ++--
 3 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 2271bae..cca996c 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -4276,7 +4276,7 @@ excel_write_autofilter_objs (ExcelWriteSheet *esheet)
                        ms_objv8_write_common (bp,
                                esheet->cur_obj, MSOT_COMBO, 0x2101);
                        ms_objv8_write_scrollbar_old (bp);
-                       ms_objv8_write_listbox (bp, cond != NULL); /* acts as an end */
+                       ms_objv8_write_listbox (bp, 3, cond != NULL); /* acts as an end */
                } else {
                        data = ms_biff_put_len_next (bp, BIFF_OBJ, sizeof std_obj_v7);
                        memcpy (data, std_obj_v7, sizeof std_obj_v7);
diff --git a/plugins/excel/ms-obj.c b/plugins/excel/ms-obj.c
index 1885a26..e87ccb3 100644
--- a/plugins/excel/ms-obj.c
+++ b/plugins/excel/ms-obj.c
@@ -1131,7 +1131,7 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *c, MSObj *obj)
                        break;
 
                case GR_COMMON_OBJ_DATA : {
-                       guint16 const options =GSF_LE_GET_GUINT16 (data+8);
+                       guint16 const options = GSF_LE_GET_GUINT16 (data+8);
 
                        /* Multiple objects in 1 record ?? */
                        XL_CHECK_CONDITION_VAL (obj->excel_type == -1, TRUE);
@@ -1139,9 +1139,7 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *c, MSObj *obj)
                        obj->excel_type = GSF_LE_GET_GUINT16(data+4);
                        obj->id = GSF_LE_GET_GUINT16(data+6);
 
-                       /* Undocumented.  It appears that combos for filters are marked
-                        * with flag 0x100
-                        */
+                       // "P" flag in FtCmo.
                        obj->auto_combo =
                                (obj->excel_type == 0x14) && (options & 0x100);
 
@@ -1375,18 +1373,24 @@ ms_objv8_write_scrollbar_old (BiffPut *bp)
 }
 
 void
-ms_objv8_write_listbox (BiffPut *bp, gboolean filtered)
+ms_objv8_write_listbox (BiffPut *bp, guint8 lct, gboolean filtered)
 {
        static guint8 const data[] = {
-               0x13, 0,
+               0x13, 0, // GR_LISTBOX_DATA
                0xee, 0x1f,     /* totally contradicts docs, see above */
-               0, 0, 0, 0, 1, 0, 1, 3, 0, 0, 2, 0,
-               8, 0, 0x57, 0, 0, 0, 0, 0
+               0, 0, // Formula?
+               3, 0, // # lines
+               0, 0, // Nothing selected
+               1,    // Flags (fUseCB)
+               6,    // lct
+               0, 0, // iEdit
+               2, 0, 8, 0, 0x40, 0, 0, 0, 0, 0 // LbsDropData
        };
        guint8 buf[sizeof data];
        memcpy (buf, data, sizeof data);
        if (filtered)
                GSF_LE_SET_GUINT16 (buf + 14, 0xa);
+       GSF_LE_SET_GUINT8 (buf + 11, lct);
        ms_biff_put_var_write (bp, buf, sizeof data);
 }
 
diff --git a/plugins/excel/ms-obj.h b/plugins/excel/ms-obj.h
index a9e38b4..529fd88 100644
--- a/plugins/excel/ms-obj.h
+++ b/plugins/excel/ms-obj.h
@@ -169,7 +169,7 @@ struct _MSObj {
 
        /* a kludge for now until the indicator and the box have distinct objects */
        GnmCellPos       comment_pos;
-       gboolean         auto_combo;
+       gboolean         auto_combo;  /* Filter, Validation, ... */
        gboolean         is_linked;
        MSObjAttrBag    *attrs;
 };
@@ -182,7 +182,7 @@ char  *ms_read_TXO   (BiffQuery *q, MSContainer *c, PangoAttrList **markup);
 
 void ms_objv8_write_common     (BiffPut *bp, int id, int type, guint16 flags);
 void ms_objv8_write_scrollbar_old (BiffPut *bp);
-void ms_objv8_write_listbox    (BiffPut *bp, gboolean filtered);
+void ms_objv8_write_listbox    (BiffPut *bp, guint8 lct, gboolean filtered);
 
 void ms_objv8_write_note       (BiffPut *bp);
 


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