X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetmarginal.C;h=c8f418bcb062c813609ddd6fbb050268e5090c1e;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=b5cb2537602ff1bc9776e656dba99d2308642129;hpb=ee72ce87743857b4317da00e6e09cb6842095664;p=lyx.git diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index b5cb253760..c8f418bcb0 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -1,100 +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 "Painter.h" -#include "lyxtext.h" -#include "support/LOstream.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() : InsetCollapsable() + +InsetMarginal::InsetMarginal(BufferParams const & bp) + : InsetFootlike(bp) { setLabel(_("margin")); - LyXFont font(LyXFont::ALL_SANE); - font.decSize(); - font.decSize(); - font.setColor(LColor::footnote); - setLabelFont(font); - setAutoCollapse(false); - setInsetName("Marginal"); + setInsetName(from_ascii("Marginal")); } -void InsetMarginal::Write(Buffer const * buf, ostream & os) const +InsetMarginal::InsetMarginal(InsetMarginal const & in) + : InsetFootlike(in) { - os << getInsetName() << "\n"; - InsetCollapsable::Write(buf, os); + setLabel(_("margin")); + setInsetName(from_ascii("Marginal")); } -Inset * InsetMarginal::Clone() const +auto_ptr InsetMarginal::doClone() const { - InsetMarginal * result = new InsetMarginal; - result->init(this); - - result->collapsed = collapsed; - return result; + return auto_ptr(new InsetMarginal(*this)); } -char const * InsetMarginal::EditMessage() const +docstring const InsetMarginal::editMessage() const { return _("Opened Marginal Note Inset"); } -int InsetMarginal::Latex(Buffer const * buf, - ostream & os, bool fragile, bool fp) const +int InsetMarginal::latex(Buffer const & buf, odocstream & os, + OutputParams const & runparams) const { - os << "\\marginpar{%\n"; - - int i = InsetText::Latex(buf, os, fragile, fp); - os << "}%\n"; - - return i + 2; + os << "%\n\\marginpar{"; + int const i = InsetText::latex(buf, os, runparams); + os << "%\n}"; + return i + 2; } - -bool InsetMarginal::InsertInset(BufferView * bv, Inset * inset) +int InsetMarginal::docbook(Buffer const & buf, odocstream & os, + OutputParams const & runparams) const { - if (!InsertInsetAllowed(inset)) - return false; - - return InsetText::InsertInset(bv, inset); -} + os << ""; + int const i = InsetText::docbook(buf, os, runparams); + os << ""; - -bool InsetMarginal::InsertInsetAllowed(Inset * inset) const -{ - if ((inset->LyxCode() == Inset::FOOT_CODE) || - (inset->LyxCode() == Inset::MARGIN_CODE)) { - return false; - } - return true; + return i; } -LyXFont InsetMarginal::GetDrawFont(BufferView * bv, - LyXParagraph * p, int pos) const -{ - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; -} +} // namespace lyx