X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetmarginal.C;h=e46838c06e78c61dfc7da8acfdb42cf864a29c29;hb=5603df4a5b7e511b31026c9a4f8f55b2b10fde57;hp=b4aa735602644e5ab46ad291ac3763b7574276b7;hpb=7521b5d20f42102cf444e3fd8718a088a60d0098;p=lyx.git diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index b4aa735602..e46838c06e 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -1,46 +1,48 @@ -/* 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; + + +InsetMarginal::InsetMarginal(BufferParams const & bp) + : InsetFootlike(bp) +{ + setLabel(_("margin")); + setInsetName("Marginal"); +} -InsetMarginal::InsetMarginal() - : InsetFootlike() +InsetMarginal::InsetMarginal(InsetMarginal const & in) + : InsetFootlike(in) { setLabel(_("margin")); setInsetName("Marginal"); } -Inset * InsetMarginal::clone(Buffer const &, bool same_id) const +auto_ptr InsetMarginal::clone() const { - InsetMarginal * result = new InsetMarginal; - result->inset.init(&inset, same_id); - - result->collapsed = collapsed; - if (same_id) - result->id_ = id_; - return result; + return auto_ptr(new InsetMarginal(*this)); } @@ -50,23 +52,11 @@ string const InsetMarginal::editMessage() const } -int InsetMarginal::latex(Buffer const * buf, - std::ostream & os, bool fragile, bool fp) const +int InsetMarginal::latex(Buffer const & buf, ostream & os, + OutputParams const & runparams) const { os << "%\n\\marginpar{"; - - int const i = inset.latex(buf, os, fragile, fp); + int const i = InsetText::latex(buf, os, runparams); os << "%\n}"; - return i + 2; } - - -bool InsetMarginal::insertInsetAllowed(Inset * in) const -{ - if ((in->lyxCode() == Inset::FOOT_CODE) || - (in->lyxCode() == Inset::MARGIN_CODE)) { - return false; - } - return true; -}