Commit 2569ccd8 authored by Morten Welinder's avatar Morten Welinder

xlsx: make window size roundtrip.

parent a28fba9f
......@@ -34,6 +34,7 @@ Morten:
* Fix xls import of headers and footers. [Part of #724516]
* Fix xlsx export of row heights.
* Fix xlsx export of rotated styles.
* Make window geometry round-trip through xlsx.
--------------------------------------------------------------------------
Gnumeric 1.12.11
......
......@@ -3236,6 +3236,29 @@ xlsx_CT_CalcPr (GsfXMLIn *xin, xmlChar const **attrs)
;
}
static void
xlsx_CT_workbookView (GsfXMLIn *xin, xmlChar const **attrs)
{
XLSXReadState *state = (XLSXReadState *)xin->user_state;
int active_tab = -1;
int width = -1, height = -1;
const int scale = 10; /* Guess */
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
if (attr_int (xin, attrs, "activeTab", &active_tab))
;
else if (attr_int (xin, attrs, "windowHeight", &height))
;
else if (attr_int (xin, attrs, "windowWidth", &width))
;
}
if (width > scale / 2 && height > scale / 2)
wb_view_preferred_size (state->wb_view,
(width + scale / 2) / scale,
(height + scale / 2) / scale);
}
static void
xlsx_sheet_begin (GsfXMLIn *xin, xmlChar const **attrs)
{
......@@ -3801,7 +3824,7 @@ GSF_XML_IN_NODE_FULL (START, WORKBOOK, XL_NS_SS, "workbook", GSF_XML_NO_CONTENT,
GSF_XML_IN_NODE (WORKBOOK, CALC_PROPS, XL_NS_SS, "calcPr", GSF_XML_NO_CONTENT, &xlsx_CT_CalcPr, NULL),
GSF_XML_IN_NODE (WORKBOOK, VIEWS, XL_NS_SS, "bookViews", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (VIEWS, VIEW, XL_NS_SS, "workbookView", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (VIEWS, VIEW, XL_NS_SS, "workbookView", GSF_XML_NO_CONTENT, &xlsx_CT_workbookView, NULL),
GSF_XML_IN_NODE (WORKBOOK, CUSTOMWVIEWS, XL_NS_SS, "customWorkbookViews", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (CUSTOMWVIEWS, CUSTOMWVIEW , XL_NS_SS, "customWorkbookView", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (CUSTOMWVIEW, EXTLST, XL_NS_SS, "extLst", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd */
......
......@@ -2545,9 +2545,14 @@ xlsx_write_workbook (XLSXWriteState *state, GsfOutfile *root_part)
gsf_xml_out_start_element (xml, "bookViews");
WORKBOOK_FOREACH_VIEW (state->base.wb, view, {
int scale = 10; /* Guess */
gsf_xml_out_start_element (xml, "workbookView");
gsf_xml_out_add_int (xml, "activeTab",
view->current_sheet->index_in_wb);
if (view->preferred_width > 0)
gsf_xml_out_add_int (xml, "windowWidth", view->preferred_width * scale);
if (view->preferred_height > 0)
gsf_xml_out_add_int (xml, "windowHeight", view->preferred_height * scale);
gsf_xml_out_end_element (xml);
});
gsf_xml_out_end_element (xml);
......
......@@ -39,5 +39,4 @@ my $xls_greek_filter = "$PERL -p -C7 -e '1 while (s{\\b(ValueType=\"60\">Greek[
&test_roundtrip ($file,
'format' => 'Gnumeric_Excel:xlsx',
'ext' => "xlsx",
'resize' => '1048576x16384',
'ignore_failure' => 1);
'resize' => '1048576x16384');
......@@ -37,5 +37,4 @@ my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:
&test_roundtrip ($file,
'format' => 'Gnumeric_Excel:xlsx',
'ext' => "xlsx",
'resize' => '1048576x16384',
'ignore_failure' => 1);
'resize' => '1048576x16384');
......@@ -37,5 +37,4 @@ my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:
&test_roundtrip ($file,
'format' => 'Gnumeric_Excel:xlsx',
'ext' => "xlsx",
'resize' => '1048576x16384',
'ignore_failure' => 1);
'resize' => '1048576x16384');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment