/**
* \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"
#include "support/lstrings.h"
#include "support/systemcall.h"
+using namespace lyx::support;
+
using std::vector;
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
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();
// 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