office-gobmx/external/liborcus/0001-xls-xml-Import-hidden-row-and-column-flags.patch
Kohei Yoshida 9dbc3ffec0 Pick up hidden row and column flags when importing via orcus.
Change-Id: Idf2530935eb93339602ac5f6a5d0547aa56b453a
Reviewed-on: https://gerrit.libreoffice.org/49695
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
2018-02-14 05:48:47 +01:00

81 lines
2.9 KiB
Diff

From 66bbbd42f5d135b7e7dd57eaa7fdf6fd69c664df Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@gmail.com>
Date: Tue, 13 Feb 2018 22:15:49 -0500
Subject: [PATCH] xls-xml: Import hidden row and column flags.
(cherry picked from commit 95420c1a1e8c082bb5953b2a49f0d56eef0e5f7e)
---
src/liborcus/xls_xml_context.cpp | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/liborcus/xls_xml_context.cpp b/src/liborcus/xls_xml_context.cpp
index 917ff86..04b863a 100644
--- a/src/liborcus/xls_xml_context.cpp
+++ b/src/liborcus/xls_xml_context.cpp
@@ -1222,6 +1222,7 @@ void xls_xml_context::start_element_column(const xml_token_pair_t& parent, const
spreadsheet::col_t col_index = m_cur_prop_col;
spreadsheet::col_t span = 0;
double width = 0.0;
+ bool hidden = false;
std::for_each(attrs.begin(), attrs.end(),
[&](const xml_token_attr_t& attr)
@@ -1244,6 +1245,8 @@ void xls_xml_context::start_element_column(const xml_token_pair_t& parent, const
case XML_Span:
span = to_long(attr.value);
break;
+ case XML_Hidden:
+ hidden = to_long(attr.value) != 0;
default:
;
}
@@ -1251,8 +1254,11 @@ void xls_xml_context::start_element_column(const xml_token_pair_t& parent, const
);
for (; span >= 0; --span, ++col_index)
+ {
// Column widths are stored as points.
mp_sheet_props->set_column_width(col_index, width, orcus::length_unit_t::point);
+ mp_sheet_props->set_column_hidden(col_index, hidden);
+ }
m_cur_prop_col = col_index;
}
@@ -1263,6 +1269,7 @@ void xls_xml_context::start_element_row(const xml_token_pair_t& parent, const xm
m_cur_col = 0;
spreadsheet::row_t row_index = -1;
bool has_height = false;
+ bool hidden = false;
double height = 0.0;
for (const xml_token_attr_t& attr : attrs)
@@ -1281,6 +1288,9 @@ void xls_xml_context::start_element_row(const xml_token_pair_t& parent, const xm
has_height = true;
height = to_double(attr.value);
break;
+ case XML_Hidden:
+ hidden = to_long(attr.value) != 0;
+ break;
default:
;
}
@@ -1293,8 +1303,14 @@ void xls_xml_context::start_element_row(const xml_token_pair_t& parent, const xm
m_cur_row = row_index - 1;
}
- if (mp_sheet_props && has_height)
- mp_sheet_props->set_row_height(m_cur_row, height, length_unit_t::point);
+ if (mp_sheet_props)
+ {
+ if (has_height)
+ mp_sheet_props->set_row_height(m_cur_row, height, length_unit_t::point);
+
+ if (hidden)
+ mp_sheet_props->set_row_hidden(m_cur_row, true);
+ }
}
void xls_xml_context::end_element_borders()
--
2.7.4