X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetmarginal.C;h=e46838c06e78c61dfc7da8acfdb42cf864a29c29;hb=5603df4a5b7e511b31026c9a4f8f55b2b10fde57;hp=9d078780a9a08d4a876ac80c14bf73ef34487716;hpb=45a03f4f67bb00f8142e465c615f348f0622eb32;p=lyx.git diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index 9d078780a9..e46838c06e 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -1,73 +1,62 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1998 The LyX Team. +/** + * \file insetmarginal.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * ====================================================== + * \author Jürgen Vigna + * \author Lars Gullik Bjønnes + * + * Full author contact details are available in file CREDITS. */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "insetmarginal.h" + #include "gettext.h" -#include "lyxfont.h" -#include "BufferView.h" -#include "lyxtext.h" -#include "insets/insettext.h" -#include "support/LOstream.h" -#include "debug.h" +#include "paragraph.h" +#include "support/std_ostream.h" + + +using std::string; +using std::auto_ptr; using std::ostream; -using std::endl; -InsetMarginal::InsetMarginal() - : InsetFootlike() +InsetMarginal::InsetMarginal(BufferParams const & bp) + : InsetFootlike(bp) { setLabel(_("margin")); setInsetName("Marginal"); } -Inset * InsetMarginal::Clone() const +InsetMarginal::InsetMarginal(InsetMarginal const & in) + : InsetFootlike(in) { - InsetMarginal * result = new InsetMarginal; - result->inset->init(inset); - - result->collapsed = collapsed; - return result; + setLabel(_("margin")); + setInsetName("Marginal"); } -string const InsetMarginal::EditMessage() const +auto_ptr InsetMarginal::clone() const { - return _("Opened Marginal Note Inset"); + return auto_ptr(new InsetMarginal(*this)); } -int InsetMarginal::Latex(Buffer const * buf, - ostream & os, bool fragile, bool fp) const +string const InsetMarginal::editMessage() const { - os << "\\marginpar{%\n"; - - int i = inset->Latex(buf, os, fragile, fp); - os << "}%\n"; - - return i + 2; + return _("Opened Marginal Note Inset"); } -bool InsetMarginal::InsertInsetAllowed(Inset * in) const +int InsetMarginal::latex(Buffer const & buf, ostream & os, + OutputParams const & runparams) const { - if ((in->LyxCode() == Inset::FOOT_CODE) || - (in->LyxCode() == Inset::MARGIN_CODE)) { - return false; - } - return true; + os << "%\n\\marginpar{"; + int const i = InsetText::latex(buf, os, runparams); + os << "%\n}"; + return i + 2; }