Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / extension / internal / latex-text-renderer.cpp
index d944de71ad22bdde1aa0c59e63ac7b039a3d0899..fd99afe31b71f2fedd8c9dd503d97e277ce4d44d 100644 (file)
@@ -1,5 +1,3 @@
-#define EXTENSION_INTERNAL_LATEX_TEXT_RENDERER_CPP
-
 /** \file
  * Rendering LaTeX file (pdf/eps/ps+latex output)
  *
@@ -9,6 +7,8 @@
  * Authors:
  *   Johan Engelen <goejendaagh@zonnet.nl>
  *   Miklos Erdelyi <erdelyim@gmail.com>
+ *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2006-2010 Authors
  *
@@ -51,14 +51,14 @@ namespace Internal {
 
 /**
  * This method is called by the PDF, EPS and PS output extensions.
- * @param filename This should be the filename without extension to which the tex code should be written. Output goes to <filename>.tex.
+ * @param filename This should be the filename without '_tex' extension to which the tex code should be written. Output goes to <filename>_tex, note the underscore instead of period.
  */
 bool
 latex_render_document_text_to_file( SPDocument *doc, gchar const *filename,
                                     const gchar * const exportId, bool exportDrawing, bool exportCanvas,
                                     bool pdflatex)
 {
-    doc->ensure_up_to_date();
+    doc->ensureUpToDate();
 
     SPItem *base = NULL;
 
@@ -70,7 +70,7 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename,
     }
     else {
         // we want to export the entire document from root
-        base = SP_ITEM(sp_document_root(doc));
+        base = SP_ITEM(doc->getRoot());
         pageBoundingBox = !exportDrawing;
     }
 
@@ -132,7 +132,7 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) {
 
         _filename = g_path_get_basename(filename);
 
-        gchar *filename_ext = g_strdup_printf("%s.tex", filename);
+        gchar *filename_ext = g_strdup_printf("%s_tex", filename);
         Inkscape::IO::dump_fopen_call(filename_ext, "K");
         FILE *osf = Inkscape::IO::fopen_utf8name(filename_ext, "w+");
         if (!osf) {
@@ -176,12 +176,12 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) {
 
 static char const preamble[] =
 "%% To include the image in your LaTeX document, write\n"
-"%%   \\input{<filename>.tex}\n"
+"%%   \\input{<filename>.pdf_tex}\n"
 "%%  instead of\n"
 "%%   \\includegraphics{<filename>.pdf}\n"
 "%% To scale the image, write\n"
-"%%   \\def{\\svgwidth}{<desired width>}\n"
-"%%   \\input{<filename>.tex}\n"
+"%%   \\def\\svgwidth{<desired width>}\n"
+"%%   \\input{<filename>.pdf_tex}\n"
 "%%  instead of\n"
 "%%   \\includegraphics[width=<desired width>]{<filename>.pdf}\n"
 "%%\n"
@@ -190,7 +190,7 @@ static char const preamble[] =
 "%% installed) using\n"
 "%%   \\usepackage{import}\n"
 "%% in the preamble, and then including the image with\n"
-"%%   \\import{<path to file>}{<filename>.tex}\n"
+"%%   \\import{<path to file>}{<filename>.pdf_tex}\n"
 "%% Alternatively, one can specify\n"
 "%%   \\graphicspath{{<path to file>/}}\n"
 "%% \n"
@@ -490,8 +490,9 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *
 {
 // The boundingbox calculation here should be exactly the same as the one by CairoRenderer::setupDocument !
 
-    if (!base)
-        base = SP_ITEM(sp_document_root(doc));
+    if (!base) {
+        base = SP_ITEM(doc->getRoot());
+    }
 
     Geom::OptRect d;
     if (pageBoundingBox) {
@@ -578,4 +579,4 @@ LaTeXTextRenderer::pop_transform()
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :