Commit 5d6311f0 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Fix distributed-alignment export to ODF. [part of #726035]

2014-03-12  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* openoffice-read.c (odf_style_set_align_h): repeat_content and
	gnm_halign take precedence
	* openoffice-write.c (odf_write_style_cell_properties): write LO's
	version of DISTRIBUTED
parent 0f33c9e2
......@@ -6,6 +6,7 @@ Andreas:
* Import invisible alignment characters in number formats from ODF.
[part of #725852]
* Fix fill-alignment export/import to and from ODF. [part of #726035]
* Fix distributed-alignment export to ODF. [part of #726035]
Morten:
* Support volatile functions. [#305798]
......
2014-03-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* openoffice-read.c (odf_style_set_align_h): repeat_content and
gnm_halign take precedence
* openoffice-write.c (odf_write_style_cell_properties): write LO's
version of DISTRIBUTED
2014-03-11 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* openoffice-read.c (oo_style_end): set alignment once
(odf_style_set_align_h): use repeat_content even if the
source is not set to 'fix'
(oo_style_prop_cell): don't set teh alignment here
(oo_style_prop_cell): don't set the alignment here
* openoffice-write.c (odf_write_cell): write a string-value
if repeat-content will be set to true
......
......@@ -6162,9 +6162,12 @@ odf_style_set_align_h (GnmStyle *style, gboolean h_align_is_valid, gboolean repe
if (repeat_content)
alignment = GNM_HALIGN_FILL;
else if (h_align_is_valid)
alignment = ((text_align < 0) ? ((gnm_halign > -1) ? gnm_halign : GNM_HALIGN_LEFT)
: text_align);
else if (h_align_is_valid) {
if (gnm_halign > -1)
alignment = gnm_halign;
else
alignment = ((text_align < 0) ? GNM_HALIGN_LEFT : text_align);
}
gnm_style_set_align_h (style, alignment);
}
......
......@@ -103,6 +103,7 @@
#define OOO "ooo:"
#define TABLEOOO "tableooo:"
#define XML "xml:"
#define CSS "css3t:"
#define GNMSTYLE "gnm:" /* We use this for attributes and elements not supported by ODF */
typedef struct {
......@@ -199,6 +200,7 @@ static struct {
{ "xmlns:xsd", "http://www.w3.org/2001/XMLSchema" },
{ "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" },
{ "xmlns:gnm", "http://www.gnumeric.org/odf-extension/1.0"},
{ "xmlns:css3t", "http://www.w3.org/TR/css3-text/"},
};
/*****************************************************************************/
......@@ -1311,6 +1313,7 @@ odf_write_style_cell_properties (GnmOOExport *state, GnmStyle const *style)
GnmHAlign align = gnm_style_get_align_h (style);
char const *source = NULL;
switch (align) {
case GNM_HALIGN_DISTRIBUTED:
case GNM_HALIGN_LEFT:
case GNM_HALIGN_RIGHT:
case GNM_HALIGN_CENTER:
......@@ -1321,7 +1324,6 @@ odf_write_style_cell_properties (GnmOOExport *state, GnmStyle const *style)
rep_content = TRUE;
case GNM_HALIGN_GENERAL:
case GNM_HALIGN_CENTER_ACROSS_SELECTION:
case GNM_HALIGN_DISTRIBUTED:
default:
/* Note that since source is value-type, alignment should be ignored */
/*(but isn't by OOo) */
......@@ -1366,11 +1368,14 @@ odf_write_style_paragraph_properties (GnmOOExport *state, GnmStyle const *style)
case GNM_HALIGN_JUSTIFY:
alignment = "justify";
break;
case GNM_HALIGN_DISTRIBUTED:
alignment = "justify";
gnum_specs = TRUE;
break;
case GNM_HALIGN_FILL:
break;
case GNM_HALIGN_GENERAL:
case GNM_HALIGN_CENTER_ACROSS_SELECTION:
case GNM_HALIGN_DISTRIBUTED:
default:
/* Note that since source is value-type, alignment should be ignored */
/*(but isn't by OOo) */
......@@ -1382,6 +1387,8 @@ odf_write_style_paragraph_properties (GnmOOExport *state, GnmStyle const *style)
gsf_xml_out_add_cstr (state->xml, FOSTYLE "text-align", alignment);
if (gnum_specs && state->with_extension)
gsf_xml_out_add_int (state->xml, GNMSTYLE "GnmHAlign", align);
if (align == GNM_HALIGN_DISTRIBUTED)
gsf_xml_out_add_cstr (state->xml, CSS "text-justify", "distribute");
}
/* Text Indent */
......
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