X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsettoc.C;h=c959ee47c5aeaa0a96825bb6b2b57897dc78ca88;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=e93003c44318bc8e5d18f221572dcb4c0129d265;hpb=27de1486ca34aaad446adb798d71a77d6f6304da;p=lyx.git diff --git a/src/insets/insettoc.C b/src/insets/insettoc.C index e93003c443..c959ee47c5 100644 --- a/src/insets/insettoc.C +++ b/src/insets/insettoc.C @@ -1,32 +1,79 @@ -#include +/** + * \file insettoc.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Lars Gullik Bjønnes + * + * Full author contact details are available in file CREDITS. + */ -#ifdef __GNUG__ -#pragma implementation -#endif +#include #include "insettoc.h" + #include "buffer.h" -#include "bufferlist.h" -#include "commandtags.h" -#include "lyxfunc.h" -#include "LyXView.h" +#include "dispatchresult.h" +#include "funcrequest.h" +#include "gettext.h" +#include "metricsinfo.h" +#include "TocBackend.h" + +#include "support/std_ostream.h" + + +namespace lyx { + +using std::string; +using std::ostream; + + +InsetTOC::InsetTOC(InsetCommandParams const & p) + : InsetCommand(p, "toc") +{} + + +std::auto_ptr InsetTOC::doClone() const +{ + return std::auto_ptr(new InsetTOC(*this)); +} -extern BufferView *current_view; -void InsetTOC::Edit(int, int) +docstring const InsetTOC::getScreenLabel(Buffer const &) const { - current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_TOCVIEW); + if (getCmdName() == "tableofcontents") + return _("Table of Contents"); + return _("Unknown toc list"); } -int InsetTOC::Linuxdoc(LString &file) + +InsetBase::Code InsetTOC::lyxCode() const { - file += ""; + if (getCmdName() == "tableofcontents") + return InsetBase::TOC_CODE; + return InsetBase::NO_CODE; +} + + +int InsetTOC::plaintext(Buffer const & buffer, odocstream & os, + OutputParams const &) const +{ + os << getScreenLabel(buffer) << "\n\n"; + + buffer.tocBackend().writePlaintextTocList(getCmdName(), os); + + os << "\n"; return 0; } -int InsetTOC::DocBook(LString &file) +int InsetTOC::docbook(Buffer const &, odocstream & os, + OutputParams const &) const { - file += ""; + if (getCmdName() == "tableofcontents") + os << ""; return 0; } + + +} // namespace lyx