]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlSendto.C
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlSendto.C
index 7eb8376e22b202b0089806bf6ddc7b33df5535da..75f76fdc46d3daa6bf7c892b95a9c7c21bcfca60 100644 (file)
@@ -1,23 +1,21 @@
 /**
  * \file ControlSendto.C
- * Copyright 2002 The LyX Team.
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming, a.leeming@.ac.uk
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "ControlSendto.h"
 #include "ViewBase.h"
-#include "frontends/LyXView.h"
-#include "BufferView.h"
 #include "buffer.h"
 #include "converter.h"
+#include "format.h"
 #include "exporter.h"
 #include "gettext.h"
 #include "lyxrc.h"
@@ -26,6 +24,8 @@
 #include "support/lstrings.h"
 #include "support/systemcall.h"
 
+using namespace lyx::support;
+
 using std::vector;
 
 
@@ -43,13 +43,13 @@ vector<Format const *> const ControlSendto::allFormats() const
        exports.push_back("lyx");
        exports.push_back("text");
 
-       if (lv_.buffer()->isLatex())
+       if (buffer()->isLatex())
                exports.push_back("latex");
-       if (lv_.buffer()->isLinuxDoc())
+       if (buffer()->isLinuxDoc())
                exports.push_back("linuxdoc");
-       if (lv_.buffer()->isDocBook())
+       if (buffer()->isDocBook())
                exports.push_back("docbook");
-       if (lv_.buffer()->isLiterate())
+       if (buffer()->isLiterate())
                exports.push_back("literate");
 
        // Loop over these native formats and ascertain what formats we
@@ -98,13 +98,13 @@ void ControlSendto::setFormat(Format const * fmt)
 
 void ControlSendto::setCommand(string const & cmd)
 {
-       command_ = strip(frontStrip(cmd));
+       command_ = trim(cmd);
 }
 
 
 void ControlSendto::apply()
 {
-       if (!lv_.view()->available())
+       if (!bufferIsAvailable())
                return;
 
        view().apply();
@@ -117,15 +117,15 @@ void ControlSendto::apply()
 
        // Output to filename
        if (format_->name() == "lyx") {
-               filename = ChangeExtension(lv_.buffer()->getLatexName(false),
+               filename = ChangeExtension(buffer()->getLatexName(false),
                                           format_->extension());
-               if (!lv_.buffer()->tmppath.empty())
-                       filename = AddName(lv_.buffer()->tmppath, filename);
+               if (!buffer()->tmppath.empty())
+                       filename = AddName(buffer()->tmppath, filename);
 
-               lv_.buffer()->writeFile(filename, true);
+               buffer()->writeFile(filename);
 
        } else {
-               Exporter::Export(lv_.buffer(), format_->name(), true, filename);
+               Exporter::Export(buffer(), format_->name(), true, filename);
        }
 
        // Substitute $$FName for filename