/* xls2xml: Converts from Microsoft Excel files to XML. Copyright 1999 Roberto Arturo Tena Sanchez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Roberto Arturo Tena Sanchez */ #include #include #include #include #include #include /* WINDOW1 - Window Information */ int p3D (void) { char number[6]; /* max number 65535 */ U16 flags; xmlNodePtr window_state; xmlNodePtr metrics; xmlNodePtr display; U16 top; U16 first; assert_return (xls2xml, parameters->record.opcode == 0x3D, 19); assert_return (xls2xml, parameters->xml_tree_shortcuts.tabs_state != NULL, 19); assert_return (xls2xml, parameters->xml_tree_shortcuts.defaults != NULL, 19); if (parameters->xml_tree_shortcuts.window_state != NULL) { verbose ("Warning: Double WINDOW1, first wins"); return 0; } test (parameters->record.size >= 18, 15); window_state = xmlNewChild (parameters->xml_tree_shortcuts.defaults, NULL, (unsigned char *)"windowstate", NULL); test (window_state != NULL, 10); parameters->xml_tree_shortcuts.window_state = window_state; /* Metrics */ metrics = xmlNewChild (window_state, NULL, (unsigned char *)"metrics", NULL); test (metrics != NULL, 10); sprintf (number, "%d", fil_sreadU16 (parameters->record.info)); test (xmlNewChild (metrics, NULL, (unsigned char *)"xpos", (unsigned char *)number) != NULL, 10); sprintf (number, "%d", fil_sreadU16 (parameters->record.info+2)); test (xmlNewChild (metrics, NULL, (unsigned char *)"ypos", (unsigned char *)number) != NULL, 10); sprintf (number, "%d", fil_sreadU16 (parameters->record.info+4)); test (xmlNewChild (metrics, NULL, (unsigned char *)"width", (unsigned char *)number) != NULL, 10); sprintf (number, "%d", fil_sreadU16 (parameters->record.info+6)); test (xmlNewChild (metrics, NULL, (unsigned char *)"height", (unsigned char *)number) != NULL, 10); /* Display */ display = xmlNewChild (window_state, NULL, (unsigned char *)"display", NULL); test (metrics != NULL, 10); flags = fil_sreadU16 (parameters->record.info+8); test (xmlNewChild (display, NULL, (unsigned char *)"hidden", flags & 0x01 ? (unsigned char *)"yes" : (unsigned char *)"no") != NULL, 10); test (xmlNewChild (display, NULL, (unsigned char *)"iconic", flags & 0x02 ? (unsigned char *)"yes" : (unsigned char *)"no") != NULL, 10); test (xmlNewChild (display, NULL, (unsigned char *)"horizscrollbar", flags & 0x08 ? (unsigned char *)"yes" : (unsigned char *)"no") != NULL, 10); test (xmlNewChild (display, NULL, (unsigned char *)"vertscrollbar", flags & 0x10 ? (unsigned char *)"yes" : (unsigned char *)"no") != NULL, 10); test (xmlNewChild (display, NULL, (unsigned char *)"tabs", flags & 0x20 ? (unsigned char *)"yes" : (unsigned char *)"no") != NULL, 10); /* tabs */ top = fil_sreadU16 (parameters->record.info+10); first = fil_sreadU16 (parameters->record.info+12); sprintf (number, "%d", top); test (xmlNewChild (parameters->xml_tree_shortcuts.tabs_state, NULL, (unsigned char *)"top", (unsigned char *)number) != NULL, 10); sprintf (number, "%d", first); test (xmlNewChild (parameters->xml_tree_shortcuts.tabs_state, NULL, (unsigned char *)"first", (unsigned char *)number) != NULL, 10); sprintf (number, "%d", fil_sreadU16 (parameters->record.info+14)); test (xmlNewChild (parameters->xml_tree_shortcuts.tabs_state, NULL, (unsigned char *)"howmanyselected", (unsigned char *)number) != NULL, 10); sprintf (number, "%d", fil_sreadU16 (parameters->record.info+16)); test (xmlNewChild (parameters->xml_tree_shortcuts.tabs_state, NULL, (unsigned char *)"widthratiovshorizscrollbar", (unsigned char *)number) != NULL, 10); return 0; }