[gnumeric] Improve ODF roundtrip of conditional formats. [part of #726201]



commit e352d2145c6f68fe82fc17036f8c45fcb959bdf2
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Wed Mar 12 21:58:35 2014 -0600

    Improve ODF roundtrip of conditional formats. [part of #726201]
    
    2014-03-12  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-write.c (odf_write_style_cell_properties): write
        repeat-content only when it is defined
        * openoffice-read.c (odf_style_set_align_h): don't set the slignment
        if it isn't defined

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    7 +++++++
 plugins/openoffice/openoffice-read.c  |   10 +++-------
 plugins/openoffice/openoffice-write.c |    9 +++++----
 4 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/NEWS b/NEWS
index f6f4c7d..d1aff2f 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Andreas:
        * Fix fill-alignment export/import to and from ODF. [part of #726035]
        * Fix distributed-alignment export to ODF. [part of #726035]
        * Fix ODF roundtrip of "center accross selection". [#726010]
+       * Improve ODF roundtrip of conditional formats. [part of #726201]
 
 Morten:
        * Support volatile functions.  [#305798]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 3c19aa3..61d4347 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,12 @@
 2014-03-12  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-write.c (odf_write_style_cell_properties): write
+       repeat-content only when it is defined
+       * openoffice-read.c (odf_style_set_align_h): don't set the slignment
+       if it isn't defined
+
+2014-03-12  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-write.c (odf_write_style_cell_properties):
        GNM_HALIGN_CENTER_ACROSS_SELECTION should be source="fix"
        (odf_write_style_paragraph_properties): use "center" for
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 038e6bf..c63e605 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -6158,18 +6158,14 @@ static void
 odf_style_set_align_h (GnmStyle *style, gboolean h_align_is_valid, gboolean repeat_content,
                       int text_align, int gnm_halign)
 {
-       int alignment = GNM_HALIGN_GENERAL;
-
        if (repeat_content)
-               alignment = GNM_HALIGN_FILL;
+               gnm_style_set_align_h (style, GNM_HALIGN_FILL);
        else if (h_align_is_valid) {
                if (gnm_halign > -1)
-                       alignment = gnm_halign;
+                       gnm_style_set_align_h (style, gnm_halign);
                else
-                       alignment = ((text_align < 0) ? GNM_HALIGN_LEFT : text_align);
+                       gnm_style_set_align_h (style, (text_align < 0) ? GNM_HALIGN_LEFT : text_align);
        }
-
-       gnm_style_set_align_h (style, alignment);
 }
 
 static void
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index f96945f..e17ec33 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -1183,7 +1183,7 @@ odf_get_gnm_border_format (GnmBorder   *border)
 static void
 odf_write_style_cell_properties (GnmOOExport *state, GnmStyle const *style)
 {
-       gboolean test1, test2, rep_content = FALSE;
+       gboolean test1, test2;
 
        gsf_xml_out_start_element (state->xml, STYLE "table-cell-properties");
 /* Background Color */
@@ -1312,6 +1312,8 @@ odf_write_style_cell_properties (GnmOOExport *state, GnmStyle const *style)
        if (gnm_style_is_element_set (style, MSTYLE_ALIGN_H)) {
                GnmHAlign align = gnm_style_get_align_h (style);
                char const *source = NULL;
+               gboolean rep_content = FALSE;
+
                switch (align) {
                case GNM_HALIGN_DISTRIBUTED:
                case GNM_HALIGN_LEFT:
@@ -1331,11 +1333,10 @@ odf_write_style_cell_properties (GnmOOExport *state, GnmStyle const *style)
                        break;
                }
                gsf_xml_out_add_cstr (state->xml, STYLE "text-align-source", source);
+               /* Repeat Content */
+               odf_add_bool (state->xml,  STYLE "repeat-content", rep_content);
        }
 
-/* Repeat Content */
-       odf_add_bool (state->xml,  STYLE "repeat-content", rep_content);
-
        gsf_xml_out_end_element (state->xml); /* </style:table-cell-properties */
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]