[gnumeric] Use the pagesetup setting to determine the landscape option in LaTeX export [#702169]



commit 3b4c208f9606ef91e1c2a7af41a78d0acc0708a1
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Jun 13 12:39:25 2013 -0600

    Use the pagesetup setting to determine the landscape option in LaTeX export [#702169]
    
    2013-06-13  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * latex.c (latex2e_write_file_header): set the landscape option
        depending on the current pagesetup setting.

 NEWS                   |    2 ++
 plugins/html/ChangeLog |    5 +++++
 plugins/html/latex.c   |   25 +++++++++++++++++++++----
 src/print-info.c       |    5 +----
 4 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/NEWS b/NEWS
index deb7370..3a57b6a 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,8 @@ Andreas:
          sheet preferences. [Debian #699054]
        * Write/read pagesetup settings to/from xlsx. [#701834]
        * Fix in-cell-combos attached to merged cells. [#702146]
+       * Use the pagesetup setting to determine the landscape option in LaTeX
+         export [#702169]
 
 Darrell Tangman:
        * Update documentation for Edit and Insert menus. [#700596]
diff --git a/plugins/html/ChangeLog b/plugins/html/ChangeLog
index 1a89d9f..bdf8fe2 100644
--- a/plugins/html/ChangeLog
+++ b/plugins/html/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-13  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * latex.c (latex2e_write_file_header): set the landscape option
+       depending on the current pagesetup setting.
+
 2013-04-28  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * latex.c (latex2e_find_this_vline): renamed from latex2e_find_vline
diff --git a/plugins/html/latex.c b/plugins/html/latex.c
index f0d3e78..e733df2 100644
--- a/plugins/html/latex.c
+++ b/plugins/html/latex.c
@@ -56,6 +56,7 @@
 #include <parse-util.h>
 #include <rendered-value.h>
 #include <cellspan.h>
+#include <print-info.h>
 
 #include <locale.h>
 #include <gsf/gsf-output.h>
@@ -476,6 +477,13 @@ latex2e_write_font_encodings (GsfOutput *output, Sheet *sheet, GnmRange const *r
 static void
 latex2e_write_file_header(GsfOutput *output, Sheet *sheet, GnmRange const *range)
 {
+       gboolean is_landscape = FALSE, use_utf8;
+       GtkPageOrientation orient = print_info_get_paper_orientation (sheet->print_info);
+
+       is_landscape = (orient == GTK_PAGE_ORIENTATION_LANDSCAPE ||
+                       orient == GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE);
+       use_utf8 = gnm_conf_get_plugin_latex_use_utf8 ();
+
        gsf_output_puts (output,
 "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"
 "%%                                                                  %%\n"
@@ -496,7 +504,7 @@ latex2e_write_file_header(GsfOutput *output, Sheet *sheet, GnmRange const *range
 "%%  rendered correctly:                                             %%\n"
 );
 
-       if (gnm_conf_get_plugin_latex_use_utf8 ())
+       if (use_utf8)
                gsf_output_puts (output,
 "%%    \\usepackage{ucs}                                              %%\n"
 "%%    \\usepackage[utf8x]{inputenc}                                  %%\n"
@@ -540,15 +548,24 @@ latex2e_write_file_header(GsfOutput *output, Sheet *sheet, GnmRange const *range
 "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"
 "%%                                                                  %%\n"
 "%%  This is the PREAMBLE. Change these values to get the right      %%\n"
-"%%  paper size and other niceties. Uncomment the landscape option   %%\n"
-"%%  to the documentclass defintion for standalone documents.        %%\n"
+"%%  paper size and other niceties.                                  %%\n"
 "%%                                                                  %%\n"
 "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"
 "\n"
+               );
+       if (is_landscape)
+               gsf_output_puts (output,
+"      \\documentclass[12pt%\n"
+"                        ,landscape%\n"
+"                    ]{report}\n"
+                                );
+       else
+               gsf_output_puts (output,
 "      \\documentclass[12pt%\n"
 "                        %,landscape%\n"
 "                    ]{report}\n"
-               );
+                                );
+
 
 
        if (gnm_conf_get_plugin_latex_use_utf8 ()) {
diff --git a/src/print-info.c b/src/print-info.c
index 32749ba..6d05876 100644
--- a/src/print-info.c
+++ b/src/print-info.c
@@ -1364,10 +1364,7 @@ print_info_get_page_setup (PrintInformation *pi)
        g_return_val_if_fail (pi != NULL, NULL);
        print_info_load_defaults (pi);
 
-       if (pi->page_setup)
-               return pi->page_setup;
-       else
-               return NULL;
+       return pi->page_setup;
 }
 
 /**


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