summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-24 16:42:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-24 16:42:44 +0000
commitc5b713f6527a71038819795ca61e9eb04a35465e (patch)
tree97e58f9dc5bb87a8c1bc3af66133caf6ef284127
parentReleasing progress-linux version 0.13.2-1~dschinn1. (diff)
downloadliborcus-c5b713f6527a71038819795ca61e9eb04a35465e.zip
liborcus-c5b713f6527a71038819795ca61e9eb04a35465e.tar.xz
Merging upstream version 0.13.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--ChangeLog48
-rwxr-xr-xconfigure22
-rw-r--r--configure.ac2
-rw-r--r--src/liborcus/gnumeric_sheet_context.cpp4
-rw-r--r--src/liborcus/odf_styles_context.cpp3
-rw-r--r--src/liborcus/odf_styles_context_test.cpp9
-rw-r--r--src/liborcus/xls_xml_context.cpp30
-rw-r--r--src/liborcus/xls_xml_context.hpp1
-rw-r--r--src/liborcus/xlsx_context.cpp35
-rw-r--r--src/liborcus/xlsx_context.hpp2
10 files changed, 134 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 385308d..276fb53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,55 @@
-2018-01-26 Kohei Yoshida <kohei.yoshida@gmail.com> [dadc490ce903a9ccd9688f25af5e848b78bf8f23]
+2018-02-14 Kohei Yoshida <kohei.yoshida@gmail.com> [7ca73a7c83504a30a1d24444a27f57a86451100f]
+
+ Up the version to 0.13.3.
+
+
+2018-02-13 Kohei Yoshida <kohei.yoshida@gmail.com> [66bbbd42f5d135b7e7dd57eaa7fdf6fd69c664df]
+
+ xls-xml: Import hidden row and column flags.
+
+ (cherry picked from commit 95420c1a1e8c082bb5953b2a49f0d56eef0e5f7e)
+
+2018-02-08 Kohei Yoshida <kohei.yoshida@gmail.com> [0798d81a4c771b69b4b8eade396c88ffb5416b04]
+
+ xlsx: Remove carriage returns from multi-line strings.
+
+ Let's try to consistently only use linefeed characters for multi-
+ line strings.
+
+ (cherry picked from commit 0412bd269983825e5019a8a12267b54f51117aba)
+
+2018-02-08 Kohei Yoshida <kohei.yoshida@gmail.com> [0a4e8c44fc8229818191c6b9b46e4de079d0ca3b]
+
+ xls-xml: Pick up border colors.
+
+ (cherry picked from commit e065d26dabafea465ec49e7d79775e62014ac0db)
+
+2018-02-07 Kohei Yoshida <kohei.yoshida@gmail.com> [9662fce62ce77f87a4a8ba61f4507ec08e705b57]
+
+ xlsx: Let's not forget to apply color for diagonal borders too.
+
+ (cherry picked from commit c392ea15000b331bb6580b09c1045fd14b449b46)
+
+2018-01-31 Kohei Yoshida <kohei.yoshida@gmail.com> [473526e1ca3a7117e2daf977e1b82a0a3977fc84]
+
+ We are supposed to use the foreground color for solid fill.
+
+ (cherry picked from commit f821995022df8dd1e580dd22cf131584b2b1ac4f)
+
+2018-01-31 Kohei Yoshida <kohei.yoshida@gmail.com> [98d2b3377da71b713a37f9004acff3c02c22ce2b]
+
+ Alpha value of 0 means fully transparent. I'm sure 255 was intended.
+
+ (cherry picked from commit f7953a814d6a43205791b6cc01c528ef5d4b1ce3)
+
+2018-01-26 Kohei Yoshida <kohei.yoshida@gmail.com> [5aba1df254cf4e052ad013d4b8ac886e274b74fa]
Revert "fix automake warning"
This reverts commit e4e1e3eb41755a4520a22b904a638da0770836f1.
+ This fixes the breakage on 'make distcheck'.
+
2018-01-26 Kohei Yoshida <kohei.yoshida@gmail.com> [d26cfd097e33f2ab05182bc63a54599667d1fc34]
Up the version to 0.13.2.
diff --git a/configure b/configure
index 9beb2fc..35aaf41 100755
--- a/configure
+++ b/configure
@@ -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.2.
+# Generated by GNU Autoconf 2.69 for liborcus 0.13.3.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='liborcus'
PACKAGE_TARNAME='liborcus'
-PACKAGE_VERSION='0.13.2'
-PACKAGE_STRING='liborcus 0.13.2'
+PACKAGE_VERSION='0.13.3'
+PACKAGE_STRING='liborcus 0.13.3'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1420,7 +1420,7 @@ if test "$ac_init_help" = "long"; then
# 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.2 to adapt to many kinds of systems.
+\`configure' configures liborcus 0.13.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1491,7 +1491,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of liborcus 0.13.2:";;
+ short | recursive ) echo "Configuration of liborcus 0.13.3:";;
esac
cat <<\_ACEOF
@@ -1642,7 +1642,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-liborcus configure 0.13.2
+liborcus configure 0.13.3
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2291,7 +2291,7 @@ cat >config.log <<_ACEOF
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.2, which was
+It was created by liborcus $as_me 0.13.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3158,7 +3158,7 @@ fi
# Define the identity of the package.
PACKAGE='liborcus'
- VERSION='0.13.2'
+ VERSION='0.13.3'
cat >>confdefs.h <<_ACEOF
@@ -17532,7 +17532,7 @@ IXION_REQUIRED_API_VERSION=0.13
ORCUS_API_VERSION=0.13
ORCUS_MAJOR_VERSION=0
ORCUS_MINOR_VERSION=13
-ORCUS_MICRO_VERSION=2
+ORCUS_MICRO_VERSION=3
@@ -21423,7 +21423,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# 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.2, which was
+This file was extended by liborcus $as_me 0.13.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21489,7 +21489,7 @@ _ACEOF
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.2
+liborcus config.status 0.13.3
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 112ddab..e3b4f83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,7 +8,7 @@ AC_PREREQ([2.65])
# ===================
m4_define([orcus_major_version], [0])
m4_define([orcus_minor_version], [13])
-m4_define([orcus_micro_version], [2])
+m4_define([orcus_micro_version], [3])
m4_define([orcus_version], [orcus_major_version.orcus_minor_version.orcus_micro_version])
# ===============
diff --git a/src/liborcus/gnumeric_sheet_context.cpp b/src/liborcus/gnumeric_sheet_context.cpp
index 8659cc3..6bd1471 100644
--- a/src/liborcus/gnumeric_sheet_context.cpp
+++ b/src/liborcus/gnumeric_sheet_context.cpp
@@ -132,7 +132,7 @@ public:
{
spreadsheet::color_elem_t red, green, blue;
gnumeric_helper::parse_RGB_color_attribute(red, green, blue, attr.value);
- m_styles.set_fill_fg_color(0, red, green, blue);
+ m_styles.set_fill_fg_color(255, red, green, blue);
m_fill = true;
@@ -145,7 +145,7 @@ public:
{
spreadsheet::color_elem_t red, green, blue;
gnumeric_helper::parse_RGB_color_attribute(red, green, blue, attr.value);
- m_styles.set_fill_bg_color(0, red, green, blue);
+ m_styles.set_fill_bg_color(255, red, green, blue);
m_fill = true;
}
diff --git a/src/liborcus/odf_styles_context.cpp b/src/liborcus/odf_styles_context.cpp
index d988f7d..e5f1cc6 100644
--- a/src/liborcus/odf_styles_context.cpp
+++ b/src/liborcus/odf_styles_context.cpp
@@ -739,7 +739,8 @@ void styles_context::start_element(xmlns_id_t ns, xml_token_t name, const std::v
{
spreadsheet::color_elem_t red, green, blue;
func.get_background_color(red, green, blue);
- mp_styles->set_fill_bg_color(0, red, green, blue);
+ mp_styles->set_fill_pattern_type(ORCUS_ASCII("solid"));
+ mp_styles->set_fill_fg_color(255, red, green, blue);
}
size_t fill_id = mp_styles->commit_fill();
diff --git a/src/liborcus/odf_styles_context_test.cpp b/src/liborcus/odf_styles_context_test.cpp
index 4c7eab5..7255a54 100644
--- a/src/liborcus/odf_styles_context_test.cpp
+++ b/src/liborcus/odf_styles_context_test.cpp
@@ -48,10 +48,11 @@ void test_odf_fill(orcus::spreadsheet::import_styles &styles)
std::cerr << std::hex << (int)fill;
const orcus::spreadsheet::fill_t* cell_fill = styles.get_fill(fill);
assert(cell_fill);
- std::cerr << std::hex << (int)cell_fill->bg_color.red;
- assert(cell_fill->bg_color.red == 0xfe);
- assert(cell_fill->bg_color.green == 0xff);
- assert(cell_fill->bg_color.blue == 0xcc);
+ std::cerr << std::hex << (int)cell_fill->fg_color.red;
+ assert(cell_fill->fg_color.red == 0xfe);
+ assert(cell_fill->fg_color.green == 0xff);
+ assert(cell_fill->fg_color.blue == 0xcc);
+ assert(cell_fill->pattern_type == "solid");
}
void test_odf_border(orcus::spreadsheet::import_styles &styles)
diff --git a/src/liborcus/xls_xml_context.cpp b/src/liborcus/xls_xml_context.cpp
index 790dfed..04b863a 100644
--- a/src/liborcus/xls_xml_context.cpp
+++ b/src/liborcus/xls_xml_context.cpp
@@ -1069,6 +1069,7 @@ void xls_xml_context::start_element_border(const xml_token_pair_t& parent, const
spreadsheet::border_direction_t dir = spreadsheet::border_direction_t::unknown;
spreadsheet::border_style_t style = spreadsheet::border_style_t::unknown;
+ spreadsheet::color_rgb_t color;
long weight = 0;
for (const xml_token_attr_t& attr : attrs)
@@ -1093,6 +1094,11 @@ void xls_xml_context::start_element_border(const xml_token_pair_t& parent, const
weight = to_long(attr.value);
break;
}
+ case XML_Color:
+ {
+ color = spreadsheet::to_color_rgb(attr.value.data(), attr.value.size());
+ break;
+ }
default:
;
}
@@ -1105,6 +1111,7 @@ void xls_xml_context::start_element_border(const xml_token_pair_t& parent, const
border_style_type& bs = m_current_style->borders.back();
bs.dir = dir;
bs.style = style;
+ bs.color = color;
switch (bs.style)
{
@@ -1215,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)
@@ -1237,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:
;
}
@@ -1244,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;
}
@@ -1256,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)
@@ -1274,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:
;
}
@@ -1286,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()
@@ -1525,7 +1548,10 @@ void xls_xml_context::commit_styles()
styles->set_border_count(style->borders.size());
for (const border_style_type& b : style->borders)
+ {
styles->set_border_style(b.dir, b.style);
+ styles->set_border_color(b.dir, 255, b.color.red, b.color.green, b.color.blue);
+ }
size_t border_id = styles->commit_border();
styles->set_xf_border(border_id);
diff --git a/src/liborcus/xls_xml_context.hpp b/src/liborcus/xls_xml_context.hpp
index 47cd01c..93dceca 100644
--- a/src/liborcus/xls_xml_context.hpp
+++ b/src/liborcus/xls_xml_context.hpp
@@ -107,6 +107,7 @@ class xls_xml_context : public xml_context_base
{
spreadsheet::border_direction_t dir = spreadsheet::border_direction_t::unknown;
spreadsheet::border_style_t style = spreadsheet::border_style_t::unknown;
+ spreadsheet::color_rgb_t color;
};
struct font_style_type
diff --git a/src/liborcus/xlsx_context.cpp b/src/liborcus/xlsx_context.cpp
index 337673d..f873a6b 100644
--- a/src/liborcus/xlsx_context.cpp
+++ b/src/liborcus/xlsx_context.cpp
@@ -240,6 +240,40 @@ void xlsx_shared_strings_context::characters(const pstring& str, bool transient)
if (cur_token.first == NS_ooxml_xlsx && cur_token.second == XML_t)
{
m_cur_str = str;
+
+ // In case the string contains carriage returns (CRs), remove them.
+ m_cell_buffer.reset();
+ const char* p = m_cur_str.data();
+ const char* p_end = p + m_cur_str.size();
+ const char* p0 = nullptr;
+
+ for (; p != p_end; ++p)
+ {
+ if (!p0)
+ p0 = p;
+
+ if (*p == 0x0D)
+ {
+ // Append the segment up to this CR, and skip the CR.
+ m_cell_buffer.append(p0, std::distance(p0, p));
+ p0 = nullptr;
+ }
+ }
+
+ if (!m_cell_buffer.empty())
+ {
+ // This string contains at least one CR.
+
+ if (p0)
+ // Append the tail end.
+ m_cell_buffer.append(p0, std::distance(p0, p));
+
+ m_cur_str = m_pool.intern(
+ m_cell_buffer.get(), m_cell_buffer.size()).first;
+
+ transient = false;
+ }
+
if (transient)
m_cur_str = m_pool.intern(m_cur_str).first;
}
@@ -612,6 +646,7 @@ void xlsx_styles_context::start_element(xmlns_id_t ns, xml_token_t name, const x
case XML_bottom:
case XML_left:
case XML_right:
+ case XML_diagonal:
// This color is for a border.
start_border_color(attrs);
break;
diff --git a/src/liborcus/xlsx_context.hpp b/src/liborcus/xlsx_context.hpp
index 4063696..cf3303b 100644
--- a/src/liborcus/xlsx_context.hpp
+++ b/src/liborcus/xlsx_context.hpp
@@ -10,6 +10,7 @@
#include "orcus/spreadsheet/types.hpp"
#include "orcus/string_pool.hpp"
+#include "orcus/cell_buffer.hpp"
#include "xml_context_base.hpp"
#include "xlsx_types.hpp"
@@ -42,6 +43,7 @@ public:
private:
spreadsheet::iface::import_shared_strings* mp_strings;
string_pool m_pool;
+ cell_buffer m_cell_buffer;
pstring m_cur_str;
bool m_in_segments;
};