summaryrefslogtreecommitdiffstats
path: root/external/liborcus/0001-xls-xml-Import-hidden-row-and-column-flags.patch
blob: 15a554a79cffa80669f60521109d7d76208277ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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