Hello community,
here is the log from the commit of package liborcus for openSUSE:Factory checked in at 2018-02-03 15:36:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/liborcus (Old)
and /work/SRC/openSUSE:Factory/.liborcus.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "liborcus"
Sat Feb 3 15:36:28 2018 rev:23 rq:571125 version:0.13.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/liborcus/liborcus.changes 2018-01-09 14:50:44.278708570 +0100
+++ /work/SRC/openSUSE:Factory/.liborcus.new/liborcus.changes 2018-02-03 15:36:29.634210179 +0100
@@ -1,0 +2,7 @@
+Tue Jan 30 14:57:03 UTC 2018 - tchvatal@suse.com
+
+- Version update to 0.13.2:
+ * Various small fixes
+ * Improvements in Excel 2003 XML import iflter
+
+-------------------------------------------------------------------
Old:
----
liborcus-0.13.1.tar.xz
New:
----
liborcus-0.13.2.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ liborcus.spec ++++++
--- /var/tmp/diff_new_pack.hLbh4a/_old 2018-02-03 15:36:30.522168703 +0100
+++ /var/tmp/diff_new_pack.hLbh4a/_new 2018-02-03 15:36:30.526168516 +0100
@@ -18,7 +18,7 @@
%define libname liborcus-0_13-0
Name: liborcus
-Version: 0.13.1
+Version: 0.13.2
Release: 0
Summary: Spreadsheet file processing library
License: MPL-2.0
++++++ liborcus-0.13.1.tar.xz -> liborcus-0.13.2.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/ChangeLog new/liborcus-0.13.2/ChangeLog
--- old/liborcus-0.13.1/ChangeLog 2017-11-16 01:56:52.000000000 +0100
+++ new/liborcus-0.13.2/ChangeLog 2018-01-27 03:08:17.000000000 +0100
@@ -1,3 +1,88 @@
+2018-01-26 Kohei Yoshida [dadc490ce903a9ccd9688f25af5e848b78bf8f23]
+
+ Revert "fix automake warning"
+
+ This reverts commit e4e1e3eb41755a4520a22b904a638da0770836f1.
+
+2018-01-26 Kohei Yoshida [d26cfd097e33f2ab05182bc63a54599667d1fc34]
+
+ Up the version to 0.13.2.
+
+
+2018-01-25 Kohei Yoshida [cc8bb3cc0318a639b300a49984fa98644655a14e]
+
+ xls-xml: import cell borders.
+
+ We'll just map these cell borders to xlsx's cell border styles.
+
+ (cherry picked from commit 83f7fb42f5280f1732dfb135e3aa41adc29f29b2)
+
+2018-01-24 Kohei Yoshida [bd048dcf365b0b16fe5d188915ea30f2040d8828]
+
+ xlsx: pick up diagonal borders.
+
+ (cherry picked from commit 6f4ff977fb912f389cb5f066c136f758e8431f78)
+
+2018-01-23 Kohei Yoshida [e0b65787e3bb1b264002a183790265cdadde7312]
+
+ xlsx: fix exception being thrown when diagonal element is encountered.
+
+ (cherry picked from commit b5d3809c70ef7531e2891d8ac0b04873a4573480)
+
+2018-01-23 David Tardon [679a6229d4838f0a162c5c9938d5bc1c1cfbaa9b]
+
+ fix build failure in Rawhide
+
+ (cherry picked from commit 658e77a9fc43853cb25a9511e01772dd1bef3c36)
+
+2018-01-23 David Tardon [e4e1e3eb41755a4520a22b904a638da0770836f1]
+
+ fix automake warning
+
+ (cherry picked from commit 719ab1789710a32c034f85b826025c71808a5eb5)
+
+2018-01-13 Kohei Yoshida [491ba8e21c639842fa82d93950062ef638e87103]
+
+ xls-xml: pick up text alignment properties.
+
+ (cherry picked from commit caece95470f4ba5cf4aaca513f493d6a94b4dfa7)
+
+2018-01-10 Kohei Yoshida [804eec72736d51aae15d5a1a823f6f3332c1118e]
+
+ xlsx: pick up justified and distributed alignment types as well.
+
+ (cherry picked from commit a138b970085b2ff1f43888d39f1e891f46c7e2b1)
+
+2018-01-04 Kohei Yoshida [19a2294a2d89adf0a83363452c7d4c6546ada118]
+
+ xls-xml: alpha value must be 255 for being fully opaque.
+
+ (cherry picked from commit 62e49b9297c4c3417524d960bd0cd3e4fa4f9885)
+
+2018-01-04 Kohei Yoshida [68089a402044c7e5e127f9fbaeccda0af56d1808]
+
+ xls-xml: pick up solid fill colors.
+
+ (cherry picked from commit f3c8707042914b1c771dd643983d773f9fcf217b)
+
+2017-12-30 Kohei Yoshida [1dac2d68e5993d1e3f64a6f047e761db4074f36f]
+
+ Pick up row height properties.
+
+ (cherry picked from commit 0b9323fc39e4f4cc0f7b063f55fd8443feedf21c)
+
+2017-12-30 Kohei Yoshida [76438dea4b8315041a988aac0b0aabd45205675d]
+
+ Pick up column width properties.
+
+ (cherry picked from commit 057d65f7db30f58fca880aa2952d9536e5d2a5ac)
+
+2017-11-27 Caolán McNamara [25f6ad315418ba5beab70e7fd53c7cde6b519998]
+
+ Silence an assert.
+
+ (cherry picked from commit 0a5014ae282f7a3bd2dae0cf6425d7b61d06b034)
+
2017-11-15 Kohei Yoshida [8d9fa37666f313871b90382b4a6c495f199d22d7]
Update the changelog.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/configure new/liborcus-0.13.2/configure
--- old/liborcus-0.13.1/configure 2017-11-16 01:51:42.000000000 +0100
+++ new/liborcus-0.13.2/configure 2018-01-27 03:07:29.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for liborcus 0.13.1.
+# Generated by GNU Autoconf 2.69 for liborcus 0.13.2.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@
# Identity of this package.
PACKAGE_NAME='liborcus'
PACKAGE_TARNAME='liborcus'
-PACKAGE_VERSION='0.13.1'
-PACKAGE_STRING='liborcus 0.13.1'
+PACKAGE_VERSION='0.13.2'
+PACKAGE_STRING='liborcus 0.13.2'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1420,7 +1420,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures liborcus 0.13.1 to adapt to many kinds of systems.
+\`configure' configures liborcus 0.13.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1491,7 +1491,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of liborcus 0.13.1:";;
+ short | recursive ) echo "Configuration of liborcus 0.13.2:";;
esac
cat <<\_ACEOF
@@ -1642,7 +1642,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-liborcus configure 0.13.1
+liborcus configure 0.13.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2291,7 +2291,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by liborcus $as_me 0.13.1, which was
+It was created by liborcus $as_me 0.13.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3158,7 +3158,7 @@
# Define the identity of the package.
PACKAGE='liborcus'
- VERSION='0.13.1'
+ VERSION='0.13.2'
cat >>confdefs.h <<_ACEOF
@@ -17532,7 +17532,7 @@
ORCUS_API_VERSION=0.13
ORCUS_MAJOR_VERSION=0
ORCUS_MINOR_VERSION=13
-ORCUS_MICRO_VERSION=1
+ORCUS_MICRO_VERSION=2
@@ -21423,7 +21423,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by liborcus $as_me 0.13.1, which was
+This file was extended by liborcus $as_me 0.13.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21489,7 +21489,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-liborcus config.status 0.13.1
+liborcus config.status 0.13.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/configure.ac new/liborcus-0.13.2/configure.ac
--- old/liborcus-0.13.1/configure.ac 2017-11-16 01:38:45.000000000 +0100
+++ new/liborcus-0.13.2/configure.ac 2018-01-27 03:07:20.000000000 +0100
@@ -8,7 +8,7 @@
# ===================
m4_define([orcus_major_version], [0])
m4_define([orcus_minor_version], [13])
-m4_define([orcus_micro_version], [1])
+m4_define([orcus_micro_version], [2])
m4_define([orcus_version], [orcus_major_version.orcus_minor_version.orcus_micro_version])
# ===============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/src/liborcus/measurement.cpp new/liborcus-0.13.2/src/liborcus/measurement.cpp
--- old/liborcus-0.13.1/src/liborcus/measurement.cpp 2017-11-16 01:38:32.000000000 +0100
+++ new/liborcus-0.13.2/src/liborcus/measurement.cpp 2017-12-30 22:16:45.000000000 +0100
@@ -148,6 +148,9 @@
case length_unit_t::inch:
// twips to inches : 1 twip = 1/1440 inches
return value / 1440.0;
+ case length_unit_t::point:
+ // 1 twip = 1/1440 inches = 72/1440 points = 1/20 points
+ return value / 20.0;
default:
;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/src/liborcus/xls_xml_context.cpp new/liborcus-0.13.2/src/liborcus/xls_xml_context.cpp
--- old/liborcus-0.13.1/src/liborcus/xls_xml_context.cpp 2017-11-16 01:38:32.000000000 +0100
+++ new/liborcus-0.13.2/src/liborcus/xls_xml_context.cpp 2018-01-26 03:52:07.000000000 +0100
@@ -12,6 +12,8 @@
#include "orcus/spreadsheet/import_interface_view.hpp"
#include "orcus/measurement.hpp"
+#include
+
#include <iostream>
using namespace std;
@@ -399,37 +401,97 @@
pstring get_name() const { return m_name; }
};
-class row_attr_parser : public unary_function
+namespace border_dir {
+
+typedef mdds::sorted_string_mapspreadsheet::border_direction_t map_type;
+
+// Keys must be sorted.
+const std::vector entries =
{
- long m_row_index;
-public:
- row_attr_parser() : m_row_index(-1) {}
+ { ORCUS_ASCII("Bottom"), spreadsheet::border_direction_t::bottom },
+ { ORCUS_ASCII("DiagonalLeft"), spreadsheet::border_direction_t::diagonal_tl_br },
+ { ORCUS_ASCII("DiagonalRight"), spreadsheet::border_direction_t::diagonal_bl_tr },
+ { ORCUS_ASCII("Left"), spreadsheet::border_direction_t::left },
+ { ORCUS_ASCII("Right"), spreadsheet::border_direction_t::right },
+ { ORCUS_ASCII("Top"), spreadsheet::border_direction_t::top },
+};
- void operator() (const xml_token_attr_t& attr)
- {
- if (attr.value.empty())
- return;
+const map_type& get()
+{
+ static map_type mt(entries.data(), entries.size(), spreadsheet::border_direction_t::unknown);
+ return mt;
+}
- if (attr.ns == NS_xls_xml_ss)
- {
- switch (attr.name)
- {
- case XML_Index:
- {
- const char* p = attr.value.get();
- const char* p_end = p + attr.value.size();
- m_row_index = to_long(p, p_end);
- }
- break;
- default:
- ;
- }
- }
- }
+}
+
+namespace border_style {
+
+typedef mdds::sorted_string_mapspreadsheet::border_style_t map_type;
- long get_row_index() const { return m_row_index; }
+// Keys must be sorted.
+const std::vector entries =
+{
+ { ORCUS_ASCII("Continuous"), spreadsheet::border_style_t::solid },
+ { ORCUS_ASCII("Dash"), spreadsheet::border_style_t::dashed },
+ { ORCUS_ASCII("DashDot"), spreadsheet::border_style_t::dash_dot },
+ { ORCUS_ASCII("DashDotDot"), spreadsheet::border_style_t::dash_dot_dot },
+ { ORCUS_ASCII("Dot"), spreadsheet::border_style_t::dotted },
+ { ORCUS_ASCII("Double"), spreadsheet::border_style_t::double_border },
+ { ORCUS_ASCII("SlantDashDot"), spreadsheet::border_style_t::slant_dash_dot },
};
+const map_type& get()
+{
+ static map_type mt(entries.data(), entries.size(), spreadsheet::border_style_t::unknown);
+ return mt;
+}
+
+}
+
+namespace hor_align {
+
+typedef mdds::sorted_string_mapspreadsheet::hor_alignment_t map_type;
+
+// Keys must be sorted.
+const std::vector entries =
+{
+ { ORCUS_ASCII("Center"), spreadsheet::hor_alignment_t::center },
+ { ORCUS_ASCII("Distributed"), spreadsheet::hor_alignment_t::distributed },
+ { ORCUS_ASCII("Justify"), spreadsheet::hor_alignment_t::justified },
+ { ORCUS_ASCII("Left"), spreadsheet::hor_alignment_t::left },
+ { ORCUS_ASCII("Right"), spreadsheet::hor_alignment_t::right },
+};
+
+const map_type& get()
+{
+ static map_type mt(entries.data(), entries.size(), spreadsheet::hor_alignment_t::unknown);
+ return mt;
+}
+
+}
+
+namespace ver_align {
+
+typedef mdds::sorted_string_mapspreadsheet::ver_alignment_t map_type;
+
+// Keys must be sorted.
+const std::vector entries =
+{
+ { ORCUS_ASCII("Bottom"), spreadsheet::ver_alignment_t::bottom },
+ { ORCUS_ASCII("Center"), spreadsheet::ver_alignment_t::middle },
+ { ORCUS_ASCII("Distributed"), spreadsheet::ver_alignment_t::distributed },
+ { ORCUS_ASCII("Justify"), spreadsheet::ver_alignment_t::justified },
+ { ORCUS_ASCII("Top"), spreadsheet::ver_alignment_t::top },
+};
+
+const map_type& get()
+{
+ static map_type mt(entries.data(), entries.size(), spreadsheet::ver_alignment_t::unknown);
+ return mt;
+}
+
+}
+
}
xls_xml_context::named_exp::named_exp(const pstring& _name, const pstring& _expression, spreadsheet::sheet_t _scope) :
@@ -501,6 +563,7 @@
mp_sheet_props(nullptr),
m_cur_sheet(-1),
m_cur_row(0), m_cur_col(0),
+ m_cur_prop_col(0),
m_cur_merge_down(0), m_cur_merge_across(0),
m_cc_data(session_cxt, tokens, factory)
{
@@ -583,20 +646,14 @@
xml_element_expected(parent, NS_xls_xml_ss, XML_Worksheet);
break;
case XML_Row:
- {
- xml_element_expected(parent, NS_xls_xml_ss, XML_Table);
- m_cur_col = 0;
- long row_index = for_each(attrs.begin(), attrs.end(), row_attr_parser()).get_row_index();
- if (row_index > 0)
- {
- // 1-based row index. Convert it to a 0-based one.
- m_cur_row = row_index - 1;
- }
+ start_element_row(parent, attrs);
break;
- }
case XML_Cell:
start_element_cell(parent, attrs);
break;
+ case XML_Column:
+ start_element_column(parent, attrs);
+ break;
case XML_Names:
{
xml_elem_stack_t expected_parents;
@@ -681,6 +738,12 @@
break;
}
+ case XML_Borders:
+ start_element_borders(parent, attrs);
+ break;
+ case XML_Border:
+ start_element_border(parent, attrs);
+ break;
case XML_Font:
{
xml_element_expected(parent, NS_xls_xml_ss, XML_Style);
@@ -714,6 +777,69 @@
}
break;
}
+ case XML_Interior:
+ {
+ xml_element_expected(parent, NS_xls_xml_ss, XML_Style);
+
+ for (const xml_token_attr_t& attr : attrs)
+ {
+ if (attr.ns != NS_xls_xml_ss)
+ continue;
+
+ switch (attr.name)
+ {
+ case XML_Color:
+ {
+ m_current_style->fill.color =
+ spreadsheet::to_color_rgb(attr.value.data(), attr.value.size());
+ break;
+ }
+ case XML_Pattern:
+ {
+ // TODO : support fill types other than 'solid'.
+ m_current_style->fill.solid = (attr.value == "Solid");
+ break;
+ }
+ default:
+ ;
+ }
+ }
+ break;
+ }
+ case XML_Alignment:
+ {
+ xml_element_expected(parent, NS_xls_xml_ss, XML_Style);
+
+ for (const xml_token_attr_t& attr : attrs)
+ {
+ if (attr.ns != NS_xls_xml_ss)
+ continue;
+
+ switch (attr.name)
+ {
+ case XML_Horizontal:
+ {
+ m_current_style->text_alignment.hor =
+ hor_align::get().find(attr.value.data(), attr.value.size());
+ break;
+ }
+ case XML_Vertical:
+ {
+ m_current_style->text_alignment.ver =
+ ver_align::get().find(attr.value.data(), attr.value.size());
+ break;
+ }
+ case XML_Indent:
+ {
+ m_current_style->text_alignment.indent = to_long(attr.value);
+ break;
+ }
+ default:
+ ;
+ }
+ }
+ break;
+ }
default:
warn_unhandled();
}
@@ -799,12 +925,21 @@
{
switch (name)
{
+ case XML_Borders:
+ end_element_borders();
+ break;
+ case XML_Border:
+ end_element_border();
+ break;
case XML_Row:
- ++m_cur_row;
+ end_element_row();
break;
case XML_Cell:
end_element_cell();
break;
+ case XML_Column:
+ end_element_column();
+ break;
case XML_Workbook:
end_element_workbook();
break;
@@ -922,6 +1057,95 @@
}
}
+void xls_xml_context::start_element_borders(const xml_token_pair_t& parent, const xml_attrs_t& attrs)
+{
+ xml_element_expected(parent, NS_xls_xml_ss, XML_Style);
+ m_current_style->borders.clear();
+}
+
+void xls_xml_context::start_element_border(const xml_token_pair_t& parent, const xml_attrs_t& attrs)
+{
+ xml_element_expected(parent, NS_xls_xml_ss, XML_Borders);
+
+ spreadsheet::border_direction_t dir = spreadsheet::border_direction_t::unknown;
+ spreadsheet::border_style_t style = spreadsheet::border_style_t::unknown;
+ long weight = 0;
+
+ for (const xml_token_attr_t& attr : attrs)
+ {
+ if (attr.ns != NS_xls_xml_ss)
+ continue;
+
+ switch (attr.name)
+ {
+ case XML_Position:
+ {
+ dir = border_dir::get().find(attr.value.data(), attr.value.size());
+ break;
+ }
+ case XML_LineStyle:
+ {
+ style = border_style::get().find(attr.value.data(), attr.value.size());
+ break;
+ }
+ case XML_Weight:
+ {
+ weight = to_long(attr.value);
+ break;
+ }
+ default:
+ ;
+ }
+ }
+
+ if (dir == spreadsheet::border_direction_t::unknown || style == spreadsheet::border_style_t::unknown)
+ return;
+
+ m_current_style->borders.emplace_back();
+ border_style_type& bs = m_current_style->borders.back();
+ bs.dir = dir;
+ bs.style = style;
+
+ switch (bs.style)
+ {
+ case spreadsheet::border_style_t::solid:
+ {
+ switch (weight)
+ {
+ case 0:
+ bs.style = spreadsheet::border_style_t::hair;
+ break;
+ case 1:
+ bs.style = spreadsheet::border_style_t::thin;
+ break;
+ case 2:
+ bs.style = spreadsheet::border_style_t::medium;
+ break;
+ case 3:
+ bs.style = spreadsheet::border_style_t::thick;
+ break;
+ default:
+ ;
+ }
+ break;
+ }
+ case spreadsheet::border_style_t::dashed:
+ if (weight > 1)
+ bs.style = spreadsheet::border_style_t::medium_dashed;
+ break;
+ case spreadsheet::border_style_t::dash_dot:
+ if (weight > 1)
+ bs.style = spreadsheet::border_style_t::medium_dash_dot;
+ break;
+ case spreadsheet::border_style_t::dash_dot_dot:
+ if (weight > 1)
+ bs.style = spreadsheet::border_style_t::medium_dash_dot_dot;
+ break;
+ default:
+ ;
+ }
+}
+
void xls_xml_context::start_element_cell(const xml_token_pair_t& parent, const xml_attrs_t& attrs)
{
xml_element_expected(parent, NS_xls_xml_ss, XML_Row);
@@ -981,6 +1205,99 @@
}
}
+void xls_xml_context::start_element_column(const xml_token_pair_t& parent, const xml_attrs_t& attrs)
+{
+ xml_element_expected(parent, NS_xls_xml_ss, XML_Table);
+
+ if (!mp_sheet_props)
+ return;
+
+ spreadsheet::col_t col_index = m_cur_prop_col;
+ spreadsheet::col_t span = 0;
+ double width = 0.0;
+
+ std::for_each(attrs.begin(), attrs.end(),
+ [&](const xml_token_attr_t& attr)
+ {
+ if (attr.value.empty())
+ return;
+
+ if (attr.ns != NS_xls_xml_ss)
+ return;
+
+ switch (attr.name)
+ {
+ case XML_Index:
+ // Convert from 1-based to 0-based.
+ col_index = to_long(attr.value) - 1;
+ break;
+ case XML_Width:
+ width = to_double(attr.value);
+ break;
+ case XML_Span:
+ span = to_long(attr.value);
+ break;
+ default:
+ ;
+ }
+ }
+ );
+
+ 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);
+
+ m_cur_prop_col = col_index;
+}
+
+void xls_xml_context::start_element_row(const xml_token_pair_t& parent, const xml_attrs_t& attrs)
+{
+ xml_element_expected(parent, NS_xls_xml_ss, XML_Table);
+ m_cur_col = 0;
+ spreadsheet::row_t row_index = -1;
+ bool has_height = false;
+ double height = 0.0;
+
+ for (const xml_token_attr_t& attr : attrs)
+ {
+ if (attr.value.empty())
+ return;
+
+ if (attr.ns == NS_xls_xml_ss)
+ {
+ switch (attr.name)
+ {
+ case XML_Index:
+ row_index = to_long(attr.value);
+ break;
+ case XML_Height:
+ has_height = true;
+ height = to_double(attr.value);
+ break;
+ default:
+ ;
+ }
+ }
+ }
+
+ if (row_index > 0)
+ {
+ // 1-based row index. Convert it to a 0-based one.
+ 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);
+}
+
+void xls_xml_context::end_element_borders()
+{
+}
+
+void xls_xml_context::end_element_border()
+{
+}
+
void xls_xml_context::end_element_cell()
{
if (mp_sheet_props && (m_cur_merge_across > 0 || m_cur_merge_down > 0))
@@ -1009,6 +1326,15 @@
m_cur_col += m_cur_merge_across;
}
+void xls_xml_context::end_element_column()
+{
+}
+
+void xls_xml_context::end_element_row()
+{
+ ++m_cur_row;
+}
+
void xls_xml_context::end_element_workbook()
{
spreadsheet::iface::import_named_expression* ne_global = mp_factory->get_named_expression();
@@ -1172,7 +1498,7 @@
{
styles->set_font_bold(style->font.bold);
styles->set_font_italic(style->font.italic);
- styles->set_font_color(0,
+ styles->set_font_color(255,
style->font.color.red,
style->font.color.green,
style->font.color.blue);
@@ -1181,6 +1507,40 @@
styles->set_xf_font(font_id);
+ if (style->fill.solid)
+ {
+ // TODO : add support for fill types other than 'solid'.
+ styles->set_fill_pattern_type(ORCUS_ASCII("solid"));
+ styles->set_fill_fg_color(255,
+ style->fill.color.red,
+ style->fill.color.green,
+ style->fill.color.blue);
+
+ size_t fill_id = styles->commit_fill();
+ styles->set_xf_fill(fill_id);
+ }
+
+ if (!style->borders.empty())
+ {
+ styles->set_border_count(style->borders.size());
+
+ for (const border_style_type& b : style->borders)
+ styles->set_border_style(b.dir, b.style);
+
+ size_t border_id = styles->commit_border();
+ styles->set_xf_border(border_id);
+ }
+
+ bool apply_alignment =
+ style->text_alignment.hor != spreadsheet::hor_alignment_t::unknown ||
+ style->text_alignment.ver != spreadsheet::ver_alignment_t::unknown;
+
+ styles->set_xf_apply_alignment(apply_alignment);
+ styles->set_xf_horizontal_alignment(style->text_alignment.hor);
+ styles->set_xf_vertical_alignment(style->text_alignment.ver);
+
+ // TODO : handle text indent level.
+
size_t xf_id = styles->commit_cell_xf();
m_style_map.insert({style->id, xf_id});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/src/liborcus/xls_xml_context.hpp new/liborcus-0.13.2/src/liborcus/xls_xml_context.hpp
--- old/liborcus-0.13.1/src/liborcus/xls_xml_context.hpp 2017-11-16 01:38:32.000000000 +0100
+++ new/liborcus-0.13.2/src/liborcus/xls_xml_context.hpp 2018-01-26 03:52:07.000000000 +0100
@@ -103,6 +103,12 @@
class xls_xml_context : public xml_context_base
{
+ struct border_style_type
+ {
+ spreadsheet::border_direction_t dir = spreadsheet::border_direction_t::unknown;
+ spreadsheet::border_style_t style = spreadsheet::border_style_t::unknown;
+ };
+
struct font_style_type
{
bool bold = false;
@@ -111,12 +117,32 @@
spreadsheet::color_rgb_t color;
};
+ /**
+ * TODO: we only support solid fill for now. More fill types to be added
+ * later.
+ */
+ struct fill_style_type
+ {
+ bool solid = false;
+ spreadsheet::color_rgb_t color;
+ };
+
+ struct text_alignment_type
+ {
+ spreadsheet::hor_alignment_t hor = spreadsheet::hor_alignment_t::unknown;
+ spreadsheet::ver_alignment_t ver = spreadsheet::ver_alignment_t::unknown;
+ int8_t indent = 0;
+ };
+
struct style_type
{
pstring id;
pstring name;
font_style_type font;
+ fill_style_type fill;
+ text_alignment_type text_alignment;
+ std::vector borders;
};
struct named_exp
@@ -173,8 +199,17 @@
virtual void characters(const pstring& str, bool transient);
private:
+ void start_element_borders(const xml_token_pair_t& parent, const xml_attrs_t& attrs);
+ void start_element_border(const xml_token_pair_t& parent, const xml_attrs_t& attrs);
void start_element_cell(const xml_token_pair_t& parent, const xml_attrs_t& attrs);
+ void start_element_column(const xml_token_pair_t& parent, const xml_attrs_t& attrs);
+ void start_element_row(const xml_token_pair_t& parent, const xml_attrs_t& attrs);
+
+ void end_element_borders();
+ void end_element_border();
void end_element_cell();
+ void end_element_column();
+ void end_element_row();
void end_element_workbook();
void end_element_styles();
@@ -195,6 +230,7 @@
spreadsheet::sheet_t m_cur_sheet;
spreadsheet::row_t m_cur_row;
spreadsheet::col_t m_cur_col;
+ spreadsheet::col_t m_cur_prop_col; /// current column position for column properties.
spreadsheet::row_t m_cur_merge_down;
spreadsheet::col_t m_cur_merge_across;
pstring m_cur_cell_formula;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/src/liborcus/xlsx_context.cpp new/liborcus-0.13.2/src/liborcus/xlsx_context.cpp
--- old/liborcus-0.13.1/src/liborcus/xlsx_context.cpp 2017-11-16 01:38:32.000000000 +0100
+++ new/liborcus-0.13.2/src/liborcus/xlsx_context.cpp 2018-01-25 02:48:48.000000000 +0100
@@ -471,6 +471,10 @@
m_hor_align = spreadsheet::hor_alignment_t::right;
else if (attr.value == "left")
m_hor_align = spreadsheet::hor_alignment_t::left;
+ else if (attr.value == "justify")
+ m_hor_align = spreadsheet::hor_alignment_t::justified;
+ else if (attr.value == "distributed")
+ m_hor_align = spreadsheet::hor_alignment_t::distributed;
}
break;
case XML_vertical:
@@ -481,6 +485,10 @@
m_ver_align = spreadsheet::ver_alignment_t::middle;
else if (attr.value == "bottom")
m_ver_align = spreadsheet::ver_alignment_t::bottom;
+ else if (attr.value == "justify")
+ m_ver_align = spreadsheet::ver_alignment_t::justified;
+ else if (attr.value == "distributed")
+ m_ver_align = spreadsheet::ver_alignment_t::distributed;
}
break;
default:
@@ -504,6 +512,7 @@
xlsx_styles_context::xlsx_styles_context(session_context& session_cxt, const tokens& tokens, spreadsheet::iface::import_styles* styles) :
xml_context_base(session_cxt, tokens),
mp_styles(styles),
+ m_diagonal_up(false), m_diagonal_down(false),
m_cur_border_dir(spreadsheet::border_direction_t::unknown),
m_cell_style_xf(false) {}
@@ -591,6 +600,7 @@
allowed.push_back(xml_token_pair_t(NS_ooxml_xlsx, XML_bottom));
allowed.push_back(xml_token_pair_t(NS_ooxml_xlsx, XML_left));
allowed.push_back(xml_token_pair_t(NS_ooxml_xlsx, XML_right));
+ allowed.push_back(xml_token_pair_t(NS_ooxml_xlsx, XML_diagonal));
allowed.push_back(xml_token_pair_t(NS_ooxml_xlsx, XML_mruColors));
xml_element_expected(parent, allowed);
@@ -679,12 +689,9 @@
break;
case XML_border:
{
- xml_elem_stack_t expected_elements;
- expected_elements.push_back(xml_token_pair_t(NS_ooxml_xlsx, XML_borders));
- expected_elements.push_back(xml_token_pair_t(NS_ooxml_xlsx, XML_dxf));
- xml_element_expected(parent, expected_elements);
+ start_element_border(parent, attrs);
+ break;
}
- break;
case XML_top:
{
xml_element_expected(parent, NS_ooxml_xlsx, XML_border);
@@ -719,12 +726,9 @@
break;
case XML_diagonal:
{
- xml_element_expected(parent, NS_ooxml_xlsx, XML_border);
- m_cur_border_dir = spreadsheet::border_direction_t::diagonal;
- border_attr_parser func(spreadsheet::border_direction_t::diagonal, *mp_styles);
- for_each(attrs.begin(), attrs.end(), func);
+ start_element_diagonal(parent, attrs);
+ break;
}
- break;
case XML_cellStyleXfs:
{
xml_element_expected(parent, NS_ooxml_xlsx, XML_styleSheet);
@@ -871,6 +875,68 @@
// not used in the styles.xml part.
}
+void xlsx_styles_context::start_element_border(const xml_token_pair_t& parent, const xml_attrs_t& attrs)
+{
+ xml_elem_stack_t expected_elements;
+ expected_elements.push_back(xml_token_pair_t(NS_ooxml_xlsx, XML_borders));
+ expected_elements.push_back(xml_token_pair_t(NS_ooxml_xlsx, XML_dxf));
+ xml_element_expected(parent, expected_elements);
+
+ bool diagonal_up = false;
+ bool diagonal_down = false;
+
+ std::for_each(attrs.begin(), attrs.end(),
+ [&diagonal_up,&diagonal_down](const xml_token_attr_t& attr)
+ {
+ if (attr.ns != NS_ooxml_xlsx)
+ return;
+
+ switch (attr.name)
+ {
+ case XML_diagonalDown:
+ // top-left to bottom-right.
+ diagonal_down = to_long(attr.value) != 0;
+ break;
+ case XML_diagonalUp:
+ // bottom-left to top-right.
+ diagonal_up = to_long(attr.value) != 0;
+ break;
+ default:
+ ;
+ }
+ }
+ );
+
+ m_diagonal_up = diagonal_up;
+ m_diagonal_down = diagonal_down;
+}
+
+void xlsx_styles_context::start_element_diagonal(const xml_token_pair_t& parent, const xml_attrs_t& attrs)
+{
+ xml_element_expected(parent, NS_ooxml_xlsx, XML_border);
+
+ m_cur_border_dir = spreadsheet::border_direction_t::unknown;
+
+ if (m_diagonal_up)
+ {
+ m_cur_border_dir = m_diagonal_down ?
+ spreadsheet::border_direction_t::diagonal :
+ spreadsheet::border_direction_t::diagonal_bl_tr;
+ }
+ else
+ {
+ m_cur_border_dir = m_diagonal_down ?
+ spreadsheet::border_direction_t::diagonal_tl_br :
+ spreadsheet::border_direction_t::unknown;
+ }
+
+ if (m_cur_border_dir == spreadsheet::border_direction_t::unknown)
+ return;
+
+ border_attr_parser func(m_cur_border_dir, *mp_styles);
+ for_each(attrs.begin(), attrs.end(), func);
+}
+
void xlsx_styles_context::start_border_color(const xml_attrs_t& attrs)
{
color_attr_parser func;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/src/liborcus/xlsx_context.hpp new/liborcus-0.13.2/src/liborcus/xlsx_context.hpp
--- old/liborcus-0.13.1/src/liborcus/xlsx_context.hpp 2017-11-16 01:38:32.000000000 +0100
+++ new/liborcus-0.13.2/src/liborcus/xlsx_context.hpp 2018-01-25 02:48:47.000000000 +0100
@@ -65,12 +65,16 @@
virtual void characters(const pstring& str, bool transient);
private:
+ void start_element_border(const xml_token_pair_t& parent, const xml_attrs_t& attrs);
+ void start_element_diagonal(const xml_token_pair_t& parent, const xml_attrs_t& attrs);
void start_border_color(const xml_attrs_t& attrs);
void start_font_color(const xml_attrs_t& attrs);
private:
spreadsheet::iface::import_styles* mp_styles;
string_pool m_pool;
+ bool m_diagonal_up;
+ bool m_diagonal_down;
spreadsheet::border_direction_t m_cur_border_dir;
bool m_cell_style_xf;
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/src/parser/sax_parser_base.cpp new/liborcus-0.13.2/src/parser/sax_parser_base.cpp
--- old/liborcus-0.13.1/src/parser/sax_parser_base.cpp 2017-11-16 01:38:32.000000000 +0100
+++ new/liborcus-0.13.2/src/parser/sax_parser_base.cpp 2017-11-28 01:34:32.000000000 +0100
@@ -296,7 +296,7 @@
str = pstring(buf.get(), buf.size());
// Skip the closing quote.
- assert(cur_char() == '"');
+ assert(!has_char() || cur_char() == '"');
next();
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/src/python/Makefile.am new/liborcus-0.13.2/src/python/Makefile.am
--- old/liborcus-0.13.1/src/python/Makefile.am 2017-11-16 01:38:32.000000000 +0100
+++ new/liborcus-0.13.2/src/python/Makefile.am 2018-01-23 23:42:28.000000000 +0100
@@ -29,7 +29,8 @@
sheet_rows.cpp
_orcus_la_LIBADD += \
- ../spreadsheet/liborcus-spreadsheet-model-@ORCUS_API_VERSION@.la
+ ../spreadsheet/liborcus-spreadsheet-model-@ORCUS_API_VERSION@.la \
+ $(LIBIXION_LIBS)
endif # BUILD_SPREADSHEET_MODEL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.13.1/src/python/Makefile.in new/liborcus-0.13.2/src/python/Makefile.in
--- old/liborcus-0.13.1/src/python/Makefile.in 2017-11-16 01:51:41.000000000 +0100
+++ new/liborcus-0.13.2/src/python/Makefile.in 2018-01-27 03:07:31.000000000 +0100
@@ -98,7 +98,8 @@
@BUILD_PYTHON_TRUE@@BUILD_SPREADSHEET_MODEL_TRUE@ sheet_rows.cpp
@BUILD_PYTHON_TRUE@@BUILD_SPREADSHEET_MODEL_TRUE@am__append_2 = \
-@BUILD_PYTHON_TRUE@@BUILD_SPREADSHEET_MODEL_TRUE@ ../spreadsheet/liborcus-spreadsheet-model-@ORCUS_API_VERSION@.la
+@BUILD_PYTHON_TRUE@@BUILD_SPREADSHEET_MODEL_TRUE@ ../spreadsheet/liborcus-spreadsheet-model-@ORCUS_API_VERSION@.la \
+@BUILD_PYTHON_TRUE@@BUILD_SPREADSHEET_MODEL_TRUE@ $(LIBIXION_LIBS)
@BUILD_PYTHON_TRUE@@WITH_PYTHON_XLSX_TRUE@am__append_3 = ../../test/python/xlsx.py
subdir = src/python
@@ -145,9 +146,11 @@
am__installdirs = "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(orcusdir)"
LTLIBRARIES = $(pyexec_LTLIBRARIES)
am__DEPENDENCIES_1 =
+@BUILD_PYTHON_TRUE@@BUILD_SPREADSHEET_MODEL_TRUE@am__DEPENDENCIES_2 = ../spreadsheet/liborcus-spreadsheet-model-@ORCUS_API_VERSION@.la \
+@BUILD_PYTHON_TRUE@@BUILD_SPREADSHEET_MODEL_TRUE@ $(am__DEPENDENCIES_1)
@BUILD_PYTHON_TRUE@_orcus_la_DEPENDENCIES = ../liborcus/liborcus-@ORCUS_API_VERSION@.la \
@BUILD_PYTHON_TRUE@ ../parser/liborcus-parser-@ORCUS_API_VERSION@.la \
-@BUILD_PYTHON_TRUE@ $(am__DEPENDENCIES_1) $(am__append_2)
+@BUILD_PYTHON_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am___orcus_la_SOURCES_DIST = python.cpp root.hpp root.cpp xlsx.hpp \
xlsx.cpp document.hpp document.cpp sheet.hpp sheet.cpp \
sheet_rows.hpp sheet_rows.cpp