X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetmarginal.C;h=e46838c06e78c61dfc7da8acfdb42cf864a29c29;hb=5603df4a5b7e511b31026c9a4f8f55b2b10fde57;hp=0ab7524a9a9cbf02ccb323af694c430a97d201a0;hpb=85a5ea7bfc80e179a61a99f2955455e84d3384cc;p=lyx.git diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index 0ab7524a9a..e46838c06e 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -1,70 +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" -InsetMarginal::InsetMarginal() - : InsetFootlike() +using std::string; +using std::auto_ptr; +using std::ostream; + + +InsetMarginal::InsetMarginal(BufferParams const & bp) + : InsetFootlike(bp) { setLabel(_("margin")); setInsetName("Marginal"); } -Inset * InsetMarginal::clone(Buffer const &) 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, - std::ostream & os, bool fragile, bool fp) const +string const InsetMarginal::editMessage() const { - os << "\\marginpar{%\n"; - - int const 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; }