From b124158c34249d41ed671315bc3c57ba7f0c0daf Mon Sep 17 00:00:00 2001
From: Michael Schmitt
Date: Wed, 23 Aug 2006 10:57:45 +0000
Subject: [PATCH] drop linuxdoc support (part 3)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14818 a592a061-630c-0410-9148-cb99ea01b6c8
---
src/buffer.C | 84 +--------
src/buffer_funcs.C | 4 +-
src/exporter.C | 5 -
src/frontends/controllers/ControlSendto.C | 2 -
src/frontends/controllers/ControlViewSource.C | 3 -
src/frontends/controllers/Kernel.C | 2 -
src/frontends/controllers/Kernel.h | 1 -
src/frontends/gtk/GRef.C | 4 +-
src/frontends/qt3/QRef.C | 3 +-
src/frontends/qt4/QRef.C | 3 +-
src/layout.h | 2 -
src/lyxtextclass.C | 2 -
src/mathed/formulamacro.C | 7 -
src/mathed/formulamacro.h | 3 -
src/mathed/math_hullinset.C | 7 -
src/mathed/math_hullinset.h | 3 -
src/mathed/ref_inset.C | 8 -
src/mathed/ref_inset.h | 2 -
src/output_linuxdoc.C | 172 ------------------
src/output_linuxdoc.h | 30 ---
20 files changed, 7 insertions(+), 340 deletions(-)
delete mode 100644 src/output_linuxdoc.C
delete mode 100644 src/output_linuxdoc.h
diff --git a/src/buffer.C b/src/buffer.C
index 21240a0bea..a2dfa7c020 100644
--- a/src/buffer.C
+++ b/src/buffer.C
@@ -41,7 +41,6 @@
#include "output.h"
#include "output_docbook.h"
#include "output_latex.h"
-#include "output_linuxdoc.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
@@ -957,12 +956,6 @@ bool Buffer::isLatex() const
}
-bool Buffer::isLinuxDoc() const
-{
- return params().getLyXTextClass().outputType() == LINUXDOC;
-}
-
-
bool Buffer::isLiterate() const
{
return params().getLyXTextClass().outputType() == LITERATE;
@@ -979,76 +972,7 @@ bool Buffer::isSGML() const
{
LyXTextClass const & tclass = params().getLyXTextClass();
- return tclass.outputType() == LINUXDOC ||
- tclass.outputType() == DOCBOOK;
-}
-
-
-void Buffer::makeLinuxDocFile(string const & fname,
- OutputParams const & runparams,
- bool const body_only)
-{
- lyxerr[Debug::LATEX] << "makeLinuxDocFile..." << endl;
-
- ofstream ofs;
- if (!openFileWrite(ofs, fname))
- return;
-
- writeLinuxDocSource(ofs, fname, runparams, body_only);
-
- ofs.close();
- if (ofs.fail())
- lyxerr << "File '" << fname << "' was not closed properly." << endl;
-}
-
-
-void Buffer::writeLinuxDocSource(ostream &os, string const & fname,
- OutputParams const & runparams,
- bool const body_only)
-{
- LaTeXFeatures features(*this, params(), runparams);
- validate(features);
-
- texrow().reset();
-
- LyXTextClass const & tclass = params().getLyXTextClass();
-
- string const & top_element = tclass.latexname();
-
- if (!body_only) {
- os << tclass.class_header();
-
- string preamble = params().preamble;
- string const name = runparams.nice ? changeExtension(pimpl_->filename, ".sgml")
- : fname;
- preamble += features.getIncludedFiles(name);
- preamble += features.getLyXSGMLEntities();
-
- if (!preamble.empty()) {
- os << " [ " << preamble << " ]";
- }
- os << ">\n\n";
-
- if (params().options.empty())
- sgml::openTag(os, top_element);
- else {
- string top = top_element;
- top += ' ';
- top += params().options;
- sgml::openTag(os, top);
- }
- }
-
- os << "\n";
-
- linuxdocParagraphs(*this, paragraphs(), os, runparams);
-
- if (!body_only) {
- os << "\n\n";
- sgml::closeTag(os, top_element);
- }
+ return tclass.outputType() == DOCBOOK;
}
@@ -1678,8 +1602,6 @@ void Buffer::getSourceCode(ostream & os, lyx::pit_type par_begin, lyx::pit_type
os << "% Preview source code\n\n";
if (isLatex())
writeLaTeXSource(os, filePath(), runparams, true, true);
- else if (isLinuxDoc())
- writeLinuxDocSource(os, fileName(), runparams, false);
else
writeDocBookSource(os, fileName(), runparams, false);
} else {
@@ -1693,9 +1615,7 @@ void Buffer::getSourceCode(ostream & os, lyx::pit_type par_begin, lyx::pit_type
if (isLatex()) {
texrow().reset();
latexParagraphs(*this, paragraphs(), os, texrow(), runparams);
- } else if (isLinuxDoc())
- linuxdocParagraphs(*this, paragraphs(), os, runparams);
- else // DocBook
+ } else // DocBook
docbookParagraphs(paragraphs(), *this, os, runparams);
}
}
diff --git a/src/buffer_funcs.C b/src/buffer_funcs.C
index ae975e1b5e..22544c76dc 100644
--- a/src/buffer_funcs.C
+++ b/src/buffer_funcs.C
@@ -240,9 +240,7 @@ void bufferErrors(Buffer const & buf, TeXErrors const & terr,
string const bufferFormat(Buffer const & buffer)
{
- if (buffer.isLinuxDoc())
- return "linuxdoc";
- else if (buffer.isDocBook())
+ if (buffer.isDocBook())
return "docbook";
else if (buffer.isLiterate())
return "literate";
diff --git a/src/exporter.C b/src/exporter.C
index 63d9aefaee..39ff619440 100644
--- a/src/exporter.C
+++ b/src/exporter.C
@@ -191,11 +191,6 @@ bool Exporter::Export(Buffer * buffer, string const & format,
// no backend
else if (backend_format == "lyx")
buffer->writeFile(filename);
- // Linuxdoc backend
- else if (buffer->isLinuxDoc()) {
- runparams.nice = !put_in_tempdir;
- buffer->makeLinuxDocFile(filename, runparams);
- }
// Docbook backend
else if (buffer->isDocBook()) {
runparams.nice = !put_in_tempdir;
diff --git a/src/frontends/controllers/ControlSendto.C b/src/frontends/controllers/ControlSendto.C
index b083bf3681..0f979c6999 100644
--- a/src/frontends/controllers/ControlSendto.C
+++ b/src/frontends/controllers/ControlSendto.C
@@ -65,8 +65,6 @@ vector const ControlSendto::allFormats() const
if (buffer.isLatex())
exports.push_back("latex");
- else if (buffer.isLinuxDoc())
- exports.push_back("linuxdoc");
else if (buffer.isDocBook())
exports.push_back("docbook");
else if (buffer.isLiterate())
diff --git a/src/frontends/controllers/ControlViewSource.C b/src/frontends/controllers/ControlViewSource.C
index a74eb95488..c2b834c891 100644
--- a/src/frontends/controllers/ControlViewSource.C
+++ b/src/frontends/controllers/ControlViewSource.C
@@ -73,9 +73,6 @@ string const ControlViewSource::title() const
case Kernel::LATEX:
source_type = "LaTeX";
break;
- case Kernel::LINUXDOC:
- source_type = "LinuxDoc";
- break;
case Kernel::DOCBOOK:
source_type = "DocBook";
break;
diff --git a/src/frontends/controllers/Kernel.C b/src/frontends/controllers/Kernel.C
index 6a103467cf..17c417f8a9 100644
--- a/src/frontends/controllers/Kernel.C
+++ b/src/frontends/controllers/Kernel.C
@@ -75,8 +75,6 @@ Kernel::DocType Kernel::docType() const
return LATEX;
if (buffer().isLiterate())
return LITERATE;
- if (buffer().isLinuxDoc())
- return LINUXDOC;
return DOCBOOK;
}
diff --git a/src/frontends/controllers/Kernel.h b/src/frontends/controllers/Kernel.h
index 5bca1151b0..891a653fc2 100644
--- a/src/frontends/controllers/Kernel.h
+++ b/src/frontends/controllers/Kernel.h
@@ -71,7 +71,6 @@ public:
enum DocType {
LATEX,
LITERATE,
- LINUXDOC,
DOCBOOK
};
/// The type of the current buffer.
diff --git a/src/frontends/gtk/GRef.C b/src/frontends/gtk/GRef.C
index 7ef931bc54..a354f1ed93 100644
--- a/src/frontends/gtk/GRef.C
+++ b/src/frontends/gtk/GRef.C
@@ -177,8 +177,8 @@ void GRef::update()
nameentry_->set_sensitive(true);
}
- // Format is irrelevant to LinuxDoc/DocBook.
- if (doctype == Kernel::LINUXDOC || doctype == Kernel::DOCBOOK) {
+ // Format is irrelevant to DocBook.
+ if (doctype == Kernel::DOCBOOK) {
formatcombo_->set_active(0);
formatcombo_->set_sensitive(false);
diff --git a/src/frontends/qt3/QRef.C b/src/frontends/qt3/QRef.C
index 7a53587669..0b33f3b72c 100644
--- a/src/frontends/qt3/QRef.C
+++ b/src/frontends/qt3/QRef.C
@@ -127,8 +127,7 @@ bool QRef::nameAllowed()
bool QRef::typeAllowed()
{
Kernel::DocType const doc_type = kernel().docType();
- return doc_type != Kernel::LINUXDOC &&
- doc_type != Kernel::DOCBOOK;
+ return doc_type != Kernel::DOCBOOK;
}
diff --git a/src/frontends/qt4/QRef.C b/src/frontends/qt4/QRef.C
index db5f2ef3e9..11984b30c4 100644
--- a/src/frontends/qt4/QRef.C
+++ b/src/frontends/qt4/QRef.C
@@ -128,8 +128,7 @@ bool QRef::nameAllowed()
bool QRef::typeAllowed()
{
Kernel::DocType const doc_type = kernel().docType();
- return doc_type != Kernel::LINUXDOC &&
- doc_type != Kernel::DOCBOOK;
+ return doc_type != Kernel::DOCBOOK;
}
diff --git a/src/layout.h b/src/layout.h
index a83965daf2..1d06c324df 100644
--- a/src/layout.h
+++ b/src/layout.h
@@ -18,8 +18,6 @@ enum OutputType {
///
LATEX = 1,
///
- LINUXDOC,
- ///
DOCBOOK,
///
LITERATE
diff --git a/src/lyxtextclass.C b/src/lyxtextclass.C
index 95d6212f0a..040cad9649 100644
--- a/src/lyxtextclass.C
+++ b/src/lyxtextclass.C
@@ -516,7 +516,6 @@ void LyXTextClass::readOutputType(LyXLex & lexrc)
keyword_item outputTypeTags[] = {
{ "docbook", DOCBOOK },
{ "latex", LATEX },
- { "linuxdoc", LINUXDOC },
{ "literate", LITERATE }
};
@@ -528,7 +527,6 @@ void LyXTextClass::readOutputType(LyXLex & lexrc)
lexrc.printError("Unknown output type `$$Token'");
return;
case LATEX:
- case LINUXDOC:
case DOCBOOK:
case LITERATE:
outputType_ = static_cast(le);
diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C
index 092ccb976e..e4e69d4a79 100644
--- a/src/mathed/formulamacro.C
+++ b/src/mathed/formulamacro.C
@@ -94,13 +94,6 @@ int InsetFormulaMacro::plaintext(Buffer const &, ostream & os,
}
-int InsetFormulaMacro::linuxdoc(Buffer const & buf, ostream & os,
- OutputParams const & runparams) const
-{
- return plaintext(buf, os, runparams);
-}
-
-
int InsetFormulaMacro::docbook(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
diff --git a/src/mathed/formulamacro.h b/src/mathed/formulamacro.h
index f55fdbffba..a6831ce1ae 100644
--- a/src/mathed/formulamacro.h
+++ b/src/mathed/formulamacro.h
@@ -47,9 +47,6 @@ public:
int latex(Buffer const &, std::ostream & os,
OutputParams const &) const;
///
- int linuxdoc(Buffer const &, std::ostream & os,
- OutputParams const &) const;
- ///
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;
diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C
index ab754bfada..a1beb23c24 100644
--- a/src/mathed/math_hullinset.C
+++ b/src/mathed/math_hullinset.C
@@ -1427,13 +1427,6 @@ int MathHullInset::plaintext(Buffer const &, ostream & os,
}
-int MathHullInset::linuxdoc(Buffer const & buf, ostream & os,
- OutputParams const & runparams) const
-{
- return docbook(buf, os, runparams);
-}
-
-
int MathHullInset::docbook(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
diff --git a/src/mathed/math_hullinset.h b/src/mathed/math_hullinset.h
index 79c42dca9c..dfc7969292 100644
--- a/src/mathed/math_hullinset.h
+++ b/src/mathed/math_hullinset.h
@@ -103,9 +103,6 @@ public:
int plaintext(Buffer const &, std::ostream &,
OutputParams const &) const;
///
- int linuxdoc(Buffer const &, std::ostream &,
- OutputParams const &) const;
- ///
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;
/// the string that is passed to the TOC
diff --git a/src/mathed/ref_inset.C b/src/mathed/ref_inset.C
index 5a419886d9..62ebc47f64 100644
--- a/src/mathed/ref_inset.C
+++ b/src/mathed/ref_inset.C
@@ -157,14 +157,6 @@ int RefInset::plaintext(std::ostream & os, OutputParams const &) const
}
-int RefInset::linuxdoc(std::ostream & os, OutputParams const &) const
-{
- os << "[";
- return 0;
-}
-
-
int RefInset::docbook(Buffer const & buf, std::ostream & os, OutputParams const & runparams) const
{
if (cell(1).empty()) {
diff --git a/src/mathed/ref_inset.h b/src/mathed/ref_inset.h
index cf5298ef1a..80e6aa3d40 100644
--- a/src/mathed/ref_inset.h
+++ b/src/mathed/ref_inset.h
@@ -36,8 +36,6 @@ public:
/// plain ascii output
int plaintext(std::ostream & os, OutputParams const &) const;
- /// linuxdoc output
- int linuxdoc(std::ostream & os, OutputParams const &) const;
/// docbook output
int docbook(Buffer const & buf, std::ostream & os, OutputParams const &) const;
diff --git a/src/output_linuxdoc.C b/src/output_linuxdoc.C
deleted file mode 100644
index 459c23b324..0000000000
--- a/src/output_linuxdoc.C
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * \file output_linuxdoc.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- * \author José Matos
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include
-
-#include "output_linuxdoc.h"
-
-#include "buffer.h"
-#include "bufferparams.h"
-#include "outputparams.h"
-#include "paragraph.h"
-#include "paragraph_funcs.h"
-#include "ParagraphList.h"
-#include "ParagraphParameters.h"
-#include "sgml.h"
-
-#include
-
-using std::ostream;
-using std::stack;
-using std::vector;
-using std::string;
-
-void linuxdocParagraphs(Buffer const & buf,
- ParagraphList const & paragraphs,
- ostream & os,
- OutputParams const & runparams)
-{
-
- Paragraph::depth_type depth = 0; // paragraph depth
- string item_name;
- vector environment_stack(5);
-
- ParagraphList::const_iterator pit = paragraphs.begin();
- ParagraphList::const_iterator pend = paragraphs.end();
-
- BOOST_ASSERT(runparams.par_begin <= runparams.par_end);
- // if only part of the paragraphs will be outputed
- if (runparams.par_begin != runparams.par_end) {
- pit = boost::next(paragraphs.begin(), runparams.par_begin);
- pend = boost::next(paragraphs.begin(), runparams.par_end);
- // runparams will be passed to nested paragraphs, so
- // we have to reset the range parameters.
- const_cast(runparams).par_begin = 0;
- const_cast(runparams).par_end = 0;
- }
-
- for (; pit != pend; ++pit) {
- LyXLayout_ptr const & style = pit->layout();
- // treat as a special case for compatibility with old code
- if (!pit->empty() && pit->isInset(0)) {
- InsetBase const * inset = pit->getInset(0);
- if (inset->lyxCode() == InsetBase::TOC_CODE) {
- string const temp = "toc";
- sgml::openTag(os, temp);
- continue;
- }
- }
-
- // environment tag closing
- for (; depth > pit->params().depth(); --depth) {
- sgml::closeTag(os, environment_stack[depth]);
- environment_stack[depth].erase();
- }
-
- // write opening SGML tags
- switch (style->latextype) {
- case LATEX_PARAGRAPH:
- if (depth == pit->params().depth()
- && !environment_stack[depth].empty()) {
- sgml::closeTag(os, environment_stack[depth]);
- environment_stack[depth].erase();
- if (depth)
- --depth;
- else
- os << "]
";
- }
- sgml::openTag(os, style->latexname());
- break;
-
- case LATEX_COMMAND:
-#if 0
- if (depth != 0)
- error(ErrorItem(_("Error:"), _("Wrong depth for LatexType Command.\n"), pit->id(), 0, pit->size()));
-#endif
-
- if (!environment_stack[depth].empty()) {
- sgml::closeTag(os, environment_stack[depth]);
- os << "";
- }
-
- environment_stack[depth].erase();
- sgml::openTag(os, style->latexname());
- break;
-
- case LATEX_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT:
- case LATEX_BIB_ENVIRONMENT: {
- string const & latexname = style->latexname();
-
- if (depth == pit->params().depth()
- && environment_stack[depth] != latexname) {
- sgml::closeTag(os, environment_stack[depth]);
- environment_stack[depth].erase();
- }
- if (depth < pit->params().depth()) {
- depth = pit->params().depth();
- environment_stack[depth].erase();
- }
- if (environment_stack[depth] != latexname) {
- if (depth == 0) {
- sgml::openTag(os, "p");
- }
- sgml::openTag(os, latexname);
-
- if (environment_stack.size() == depth + 1)
- environment_stack.push_back("!-- --");
- environment_stack[depth] = latexname;
- }
-
- if (style->latexparam() == "CDATA")
- os << "latextype == LATEX_ENVIRONMENT) break;
-
- if (style->labeltype == LABEL_MANUAL)
- item_name = "tag";
- else
- item_name = "item";
-
- sgml::openTag(os, item_name);
- }
- break;
-
- default:
- sgml::openTag(os, style->latexname());
- break;
- }
-
- pit->simpleLinuxDocOnePar(buf, os,
- outerFont(std::distance(paragraphs.begin(), pit), paragraphs),
- runparams, depth);
-
- os << "\n";
- // write closing SGML tags
- switch (style->latextype) {
- case LATEX_COMMAND:
- break;
- case LATEX_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT:
- case LATEX_BIB_ENVIRONMENT:
- if (style->latexparam() == "CDATA")
- os << "]]>";
- break;
- default:
- sgml::closeTag(os, style->latexname());
- break;
- }
- }
-
- // Close open tags
- for (int i = depth; i >= 0; --i)
- sgml::closeTag(os, environment_stack[i]);
-}
diff --git a/src/output_linuxdoc.h b/src/output_linuxdoc.h
deleted file mode 100644
index 625bf47926..0000000000
--- a/src/output_linuxdoc.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// -*- C++ -*-
-/**
- * \file output_linuxdoc.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- * \author José Matos
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef OUTPUT_LINUXDOC_H
-#define OUTPUT_LINUXDOC_H
-
-#include "ParagraphList_fwd.h"
-
-#include
-
-class Buffer;
-class OutputParams;
-
-///
-void linuxdocParagraphs(Buffer const & buf,
- ParagraphList const & paragraphs,
- std::ostream & os,
- OutputParams const & runparams);
-
-
-#endif