Commit fa991013 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Save and restore print file name. [#649713]

2011-05-09  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* gnumeric.xsd: add xs:element name="print-to-uri"
	* src/print-info.h (print_info_set_printtofile_uri): new
	* src/print-info.c (print_info_set_printtofile_uri): new
	(print_info_set_printtofile_from_settings): use above
	* src/xml-sax-read.c (xml_sax_print_to_uri): new
	* src/xml-sax-write.c (xml_write_print_info): write print-to-uri
parent 31422d8f
2011-05-09 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* gnumeric.xsd: add xs:element name="print-to-uri"
* src/print-info.h (print_info_set_printtofile_uri): new
* src/print-info.c (print_info_set_printtofile_uri): new
(print_info_set_printtofile_from_settings): use above
* src/xml-sax-read.c (xml_sax_print_to_uri): new
* src/xml-sax-write.c (xml_write_print_info): write print-to-uri
2011-05-09 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/print-info.h (_PrintInformation): new field printtofile_uri
......
......@@ -12,7 +12,7 @@ Andreas:
* Fix pdf docs. [#649591]
* Handle MS Works formula import. [#649406]
* Restore Gnumeric print range. [#649714]
* Set print file name. [#649711]
* Set default, save and restore print file name. [#649711][#649713]
Morten:
* Fix problems with localized function docs.
......
......@@ -329,7 +329,7 @@
<xs:attribute name="value" type="xs:boolean" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="print-to-uri" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="vPageBreaks" type="gnm:PageBreaks" minOccurs="0" maxOccurs="1"/><!-- between rows -->
<xs:element name="hPageBreaks" type="gnm:PageBreaks" minOccurs="0" maxOccurs="1"/><!-- between cols -->
</xs:choice>
......
......@@ -1506,6 +1506,13 @@ gnm_page_breaks_clean (GnmPageBreaks *breaks)
}
}
void
print_info_set_printtofile_uri (PrintInformation *pi,
gchar const *uri)
{
g_free (pi->printtofile_uri);
pi->printtofile_uri = g_strdup (uri);
}
void
print_info_set_printtofile_from_settings (PrintInformation *pi,
......@@ -1515,11 +1522,10 @@ print_info_set_printtofile_from_settings (PrintInformation *pi,
char const *uri = gtk_print_settings_get
(settings,
GTK_PRINT_SETTINGS_OUTPUT_URI);
g_free (pi->printtofile_uri);
if (strcmp (uri, default_uri) == 0)
pi->printtofile_uri = NULL;
print_info_set_printtofile_uri (pi, NULL);
else
pi->printtofile_uri = g_strdup (uri);
print_info_set_printtofile_uri (pi, uri);
}
char const *
......
......@@ -172,6 +172,8 @@ void print_info_set_edge_to_above_footer (PrintInformation *pi,
double e_f);
void print_info_set_edge_to_below_header (PrintInformation *pi,
double e_h);
void print_info_set_printtofile_uri (PrintInformation *pi,
gchar const *uri);
void print_info_set_printtofile_from_settings
(PrintInformation *pi,
GtkPrintSettings *settings,
......
......@@ -2722,6 +2722,17 @@ xml_sax_paper (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
print_info_set_paper (state->sheet->print_info, xin->content->str);
}
static void
xml_sax_print_to_uri (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
{
XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
xml_sax_must_have_sheet (state);
print_info_set_printtofile_uri (state->sheet->print_info,
xin->content->str);
}
static void
handle_delayed_names (XMLSaxParseState *state)
{
......@@ -2875,6 +2886,7 @@ GSF_XML_IN_NODE_FULL (START, WB, GNM, "Workbook", GSF_XML_NO_CONTENT, TRUE, TRUE
GSF_XML_IN_NODE_FULL (SHEET_PRINTINFO, PRINT_HEADER, GNM, "Header", GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_print_hf, NULL, 1),
GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_ORDER, GNM, "order", GSF_XML_CONTENT, NULL, &xml_sax_print_order),
GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_PAPER, GNM, "paper", GSF_XML_CONTENT, NULL, &xml_sax_paper),
GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_TO_URI, GNM, "print-to-uri",GSF_XML_CONTENT, NULL, &xml_sax_print_to_uri),
GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_ORIENT, GNM, "orientation", GSF_XML_CONTENT, NULL, &xml_sax_orientation),
GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_ONLY_STYLE, GNM, "even_if_only_styles", GSF_XML_CONTENT, &xml_sax_even_if_only_styles, NULL),
......
/* vim: set sw=8: */
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* xml-sax-write.c : export .gnumeric and the clipboard subset using a the sax
......@@ -305,6 +305,7 @@ static void
xml_write_print_info (GnmOutputXML *state, PrintInformation *pi)
{
char *paper_name;
char const *uri;
double header;
double footer;
double left;
......@@ -398,8 +399,14 @@ xml_write_print_info (GnmOutputXML *state, PrintInformation *pi)
paper_name = print_info_get_paper (pi);
if (paper_name)
gsf_xml_out_simple_element (state->output, GNM "paper", paper_name);
gsf_xml_out_simple_element (state->output, GNM "paper",
paper_name);
g_free (paper_name);
uri = print_info_get_printtofile_uri (pi);
if (uri)
gsf_xml_out_simple_element (state->output, GNM "print-to-uri",
uri);
if (NULL != pi->page_breaks.v)
xml_write_breaks (state, pi->page_breaks.v);
......
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