X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetmarginal.C;h=c8f418bcb062c813609ddd6fbb050268e5090c1e;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=86bba7f28efcd51249a71be4cac387699f115792;hpb=946895278050e4a464c9591e99232a72f5f4dec9;p=lyx.git diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index 86bba7f28e..c8f418bcb0 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -1,84 +1,77 @@ -/* 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" + +namespace lyx { + +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"); + setInsetName(from_ascii("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(from_ascii("Marginal")); } -char const * InsetMarginal::EditMessage() const +auto_ptr InsetMarginal::doClone() 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 +docstring 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, odocstream & 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; } - -#if 0 -LyXFont InsetMarginal::GetDrawFont(BufferView * bv, - LyXParagraph * p, int pos) const +int InsetMarginal::docbook(Buffer const & buf, odocstream & os, + OutputParams const & runparams) const { - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; + os << ""; + int const i = InsetText::docbook(buf, os, runparams); + os << ""; + + return i; } -#endif + + +} // namespace lyx