+2004-11-23 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * tabular.C (cellstruct): use initialization, store a shared_ptr
+ to insettext instead of the insettext directly, adjust to fit.
+ (operator=): new function
+ (swap): new function
+ (rowstruct): use initialization
+ (columnstruct): use initialization
+ (ltType): use initialization
+
+
+ * lyxlength.h (swap): new function
+
+ * LColor.[Ch] (operator=): use the common semantics
+
2004-11-22 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxfind.C (findNextChange): update the bufferview after setting
code; return true also for digits
(isWord, isKomma): remove
- * text.C (cursorRightOneWord, cursorLeftOneWord, getWord):
+ * text.C (cursorRightOneWord, cursorLeftOneWord, getWord):
* lyxfind.C (MatchString()): use isLetter instead of isWord
2004-11-17 Lars Gullik Bjonnes <larsbj@gullik.net>
* pariterator.h (operatir=): comment out un-implemented member
- function.
+ function.
* paragraph.h: resolve ambiguity found by gcc 4.0 with the use of a
static cast.
{}
-void LColor::operator=(LColor const & c)
+LColor & LColor::operator=(LColor tmp)
{
- LColor tmp(c);
boost::swap(pimpl_, tmp.pimpl_);
+ return *this;
}
///
~LColor();
///
- void operator=(LColor const &);
+ LColor & operator=(LColor);
/** set the given LyX color to the color defined by the X11 name given
* \returns true if successful.
+2004-11-23 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * render_base.h (operator=): use common semantics
+
+ * insettext.C (operator=): delete this
+ (copy constructor): implement this properly
+ (init): use for_each and bind
+ (clear): ditto
+ (appendParagraphs): ditto
+
+ * insettabular.C: add more const. Adjust for changes in tabular.
+
+ * insetbase.h: Use NVI on clone. Add virtual doClone and update
+ all children, also make copy constructor protected. Added some
+ safe-guards to clone.
+
+ * insets: adjust to fit.
+
2004-11-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insetoptarg.C (latexOptional): return number of lines instead of
* insetcharstyle.[Ch]:
* insetert.[Ch]: implement getStatus
-
+
* insetcharstyle.C (draw): visual clue when the cursor is inside
the inset
2004-11-02 José Matos <jamatos@lyx.org>
* insetcharstyle.C (docbook):
- * insetlabel.C (linuxdoc, docbook):
+ * insetlabel.C (linuxdoc, docbook):
* insetref.C (linuxdoc, docbook): escape chacters in id to produce
always legal output.
2004-11-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
- * insetcharstyle.C (priv_dispatch): prevent paragraph breaks
+ * insetcharstyle.C (priv_dispatch): prevent paragraph breaks
2004-11-01 Georg Baum <Georg.Baum@post.rwth-aachen.de>
InsetText methods rather than outputVerbatim (escapes special
characters) [bug 1731]
* insetcharstyle.C (outputVerbatim): remove this function.
- * insetcharstyle.C (priv_dispatch): fix typo in LFUN_MOUSE_PRESS,
+ * insetcharstyle.C (priv_dispatch): fix typo in LFUN_MOUSE_PRESS,
which caused an infinite loop.
2004-10-29 José Matos <jamatos@lyx.org>
2004-10-26 Angus Leeming <leeming@lyx.org>
- * ExternalSupport.C (updateExternal):
+ * ExternalSupport.C (updateExternal):
* insetgraphics.C (copyFileIfNeeded): use the new Movers to move
external files to the temp directory.
* graphicinset.C (draw): add a comment for the #if 0 block.
- * insetexternal.h: remove Params::parameters variable.
+ * insetexternal.h: remove Params::parameters variable.
* insetexternal.C (read, write): rewrite to output new ExternalInset
format and read it back making full use of LyXLex.
* insetexternal.C: all c-library variables have been moved into
namespace std. Wrap using std::xyz declarations inside a #ifndef
- CXX_GLOBAL_CSTD block.
+ CXX_GLOBAL_CSTD block.
2002-06-05 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
}
-void InsetOld::setPosCache(PainterInfo const & pi, int x, int y) const
+void InsetOld::setPosCache(PainterInfo const &, int x, int y) const
{
//lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl;
theCoords.insets_.add(this, x, y);
///
InsetOld();
///
- InsetOld(InsetOld const & in);
- ///
int ascent() const;
///
int descent() const;
///
bool forceDefaultParagraphs(InsetBase const * inset) const;
protected:
+ ///
+ InsetOld(InsetOld const & in);
///
mutable int scx;
///
mutable Dimension dim_;
private:
+ InsetOld & operator=(InsetOld const &) const;
+
///
std::string name_;
/** We store the LColor::color value as an int to get LColor.h out
* having to expose inset.h.
*/
class InsetOld_code {
- InsetOld::Code val_;
+ InsetBase::Code val_;
public:
- InsetOld_code(InsetOld::Code val) : val_(val) {}
- operator InsetOld::Code() const { return val_; }
+ InsetOld_code(InsetBase::Code val) : val_(val) {}
+ operator InsetBase::Code() const { return val_; }
};
#endif
} // namespace anon
+InsetBase::InsetBase()
+{}
+
+
+InsetBase::InsetBase(InsetBase const &)
+{}
+
+
InsetBase::Code InsetBase::translate(std::string const & name)
{
static TranslatorMap const translator = build_translator();
#ifndef INSETBASE_H
#define INSETBASE_H
+#include <boost/assert.hpp>
+
#include <string>
+#include <typeinfo>
#include <vector>
#include <memory>
/// virtual base class destructor
virtual ~InsetBase() {}
/// replicate ourselves
- virtual std::auto_ptr<InsetBase> clone() const = 0;
+ std::auto_ptr<InsetBase> clone() const
+ {
+ std::auto_ptr<InsetBase> b = doClone();
+ BOOST_ASSERT(typeid(*b) == typeid(*this));
+ return b;
+ }
+
/// identification as math inset
virtual MathInset * asMathInset() { return 0; }
* defaults to empty.
*/
virtual void addPreview(lyx::graphics::PreviewLoader &) const {}
-protected:
- // the real dispatcher
- virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
public:
/// returns LyX code associated with the inset. Used for TOC, ...)
virtual Code lyxCode() const { return NO_CODE; }
virtual int ascent() const { return 10; }
/// pretty arbitrary
virtual int descent() const { return 10; }
+protected:
+ InsetBase();
+ InsetBase(InsetBase const &);
+ // the real dispatcher
+ virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const = 0;
};
}
-auto_ptr<InsetBase> InsetBibitem::clone() const
+auto_ptr<InsetBase> InsetBibitem::doClone() const
{
auto_ptr<InsetBibitem> b(new InsetBibitem(params()));
b->setCounter(counter);
public:
///
InsetBibitem(InsetCommandParams const &);
- ///
- std::auto_ptr<InsetBase> clone() const;
/** Currently \bibitem is used as a LyX2.x command,
so we need this method.
*/
///
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
///
int counter;
///
{}
-std::auto_ptr<InsetBase> InsetBibtex::clone() const
+std::auto_ptr<InsetBase> InsetBibtex::doClone() const
{
return std::auto_ptr<InsetBase>(new InsetBibtex(*this));
}
///
InsetBibtex(InsetCommandParams const &);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
std::string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
void validate(LaTeXFeatures &) const;
protected:
- ///
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
};
#endif // INSET_BIBTEX_H
}
-auto_ptr<InsetBase> InsetBox::clone() const
+auto_ptr<InsetBase> InsetBox::doClone() const
{
return auto_ptr<InsetBase>(new InsetBox(*this));
}
public:
///
InsetBox(BufferParams const &, std::string const &);
- /// Copy constructor
- InsetBox(InsetBox const &);
///
~InsetBox();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
std::string const editMessage() const;
///
InsetOld::Code lyxCode() const { return InsetOld::BOX_CODE; }
Doublebox
};
protected:
- ///
+ InsetBox(InsetBox const &);
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
friend class InsetBoxParams;
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/// used by the constructors
void init();
///
}
-auto_ptr<InsetBase> InsetBranch::clone() const
+auto_ptr<InsetBase> InsetBranch::doClone() const
{
return auto_ptr<InsetBase>(new InsetBranch(*this));
}
public:
///
InsetBranch(BufferParams const &, InsetBranchParams const &);
- /// Copy constructor
- InsetBranch(InsetBranch const &);
///
~InsetBranch();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
std::string const editMessage() const;
///
InsetOld::Code lyxCode() const { return InsetOld::BRANCH_CODE; }
bool isBranchSelected(BranchList const & branchlist) const;
protected:
- ///
+ InsetBranch(InsetBranch const &);
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
friend class InsetBranchParams;
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/// used by the constructors
void init();
///
}
-auto_ptr<InsetBase> InsetCharStyle::clone() const
+auto_ptr<InsetBase> InsetCharStyle::doClone() const
{
return auto_ptr<InsetBase>(new InsetCharStyle(*this));
}
int desc = InsetText::descent();
if (has_label_)
desc -= ascent();
-
+
pi.pain.line(x, y + desc - 4, x, y + desc, params_.labelfont.color());
- pi.pain.line(x, y + desc, x + dim_.wid - 2, y + desc,
+ pi.pain.line(x, y + desc, x + dim_.wid - 2, y + desc,
params_.labelfont.color());
- pi.pain.line(x + dim_.wid - 2, y + desc, x + dim_.wid - 2, y + desc - 4,
+ pi.pain.line(x + dim_.wid - 2, y + desc, x + dim_.wid - 2, y + desc - 4,
params_.labelfont.color());
-
+
// the name of the charstyle. Can be toggled.
if (has_label_) {
LyXFont font(params_.labelfont);
pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a,
params_.type, font, LColor::none, LColor::none);
}
-
+
// a visual clue when the cursor is inside the inset
LCursor & cur = pi.base.bv->cursor();
if (cur.isInside(this)) {
y -= ascent();
pi.pain.line(x, y + 4, x, y, params_.labelfont.color());
pi.pain.line(x + 4, y, x, y, params_.labelfont.color());
- pi.pain.line(x + dim_.wid - 2, y + 4, x + dim_.wid - 2, y,
+ pi.pain.line(x + dim_.wid - 2, y + 4, x + dim_.wid - 2, y,
params_.labelfont.color());
- pi.pain.line(x + dim_.wid - 6, y, x + dim_.wid - 2, y,
+ pi.pain.line(x + dim_.wid - 6, y, x + dim_.wid - 2, y,
params_.labelfont.color());
}
}
case LFUN_BREAKPARAGRAPH_SKIP:
status.enabled(false);
return true;
-
+
default:
return InsetCollapsable::getStatus(cur, cmd, status);
}
public:
///
InsetCharStyle(BufferParams const &, CharStyles::iterator);
- /// Copy constructor
- InsetCharStyle(InsetCharStyle const &);
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
///
std::string const editMessage() const;
///
InsetCharStyleParams const & params() const { return params_; }
protected:
- ///
+ InsetCharStyle(InsetCharStyle const &);
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
///
bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
- ///
friend class InsetCharStyleParams;
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/// used by the constructors
void init();
///
///
InsetCitation(InsetCommandParams const &);
///
- std::auto_ptr<InsetBase> clone() const {
- return std::auto_ptr<InsetBase>(new InsetCitation(params()));
- }
- ///
std::string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
void validate(LaTeXFeatures &) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const
+ {
+ return std::auto_ptr<InsetBase>(new InsetCitation(params()));
+ }
+
/// This function does the donkey work of creating the pretty label
std::string const generateLabel(Buffer const &) const;
{}
-auto_ptr<InsetBase> InsetEnvironment::clone() const
+auto_ptr<InsetBase> InsetEnvironment::doClone() const
{
return auto_ptr<InsetBase>(new InsetEnvironment(*this));
}
///
InsetEnvironment(BufferParams const &, std::string const & name);
///
- InsetEnvironment(InsetEnvironment const &);
- ///
void write(Buffer const & buf, std::ostream & os) const;
///
void read(Buffer const & buf, LyXLex & lex);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
InsetOld::Code lyxCode() const { return InsetOld::ENVIRONMENT_CODE; }
///
int latex(Buffer const &, std::ostream &,
be closed before generating this inset. This is needed for
insets that may contain several paragraphs */
bool noFontChange() const { return true; }
-
+protected:
+ InsetEnvironment(InsetEnvironment const &);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// the layout
LyXLayout_ptr layout_;
};
}
-auto_ptr<InsetBase> InsetERT::clone() const
+auto_ptr<InsetBase> InsetERT::doClone() const
{
return auto_ptr<InsetBase>(new InsetERT(*this));
}
case LFUN_UNDERLINE:
status.enabled(false);
return true;
-
+
default:
return InsetCollapsable::getStatus(cur, cmd, status);
}
///
InsetERT(BufferParams const &, CollapseStatus status = Open);
///
- InsetERT(InsetERT const &);
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
InsetERT(BufferParams const &,
Language const *, std::string const & contents, CollapseStatus status);
///
///
bool forceDefaultParagraphs(InsetBase const *) const { return true; }
protected:
+ InsetERT(InsetERT const &);
///
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
///
bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
void init();
///
{}
-auto_ptr<InsetBase> InsetExternal::clone() const
+auto_ptr<InsetBase> InsetExternal::doClone() const
{
return auto_ptr<InsetBase>(new InsetExternal(*this));
}
public:
InsetExternal();
///
- InsetExternal(InsetExternal const &);
- ///
virtual ~InsetExternal();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
virtual InsetOld::Code lyxCode() const { return EXTERNAL_CODE; }
///
virtual EDITABLE editable() const { return IS_EDITABLE; }
void edit(LCursor & cur, bool left);
protected:
+ InsetExternal(InsetExternal const &);
///
void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/** This method is connected to the graphics loader, so we are
* informed when the image has been loaded.
*/
}
-auto_ptr<InsetBase> InsetFloat::clone() const
+auto_ptr<InsetBase> InsetFloat::doClone() const
{
return auto_ptr<InsetBase>(new InsetFloat(*this));
}
///
void validate(LaTeXFeatures & features) const;
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
InsetOld::Code lyxCode() const { return InsetOld::FLOAT_CODE; }
///
int latex(Buffer const &, std::ostream &,
protected:
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
///
InsetFloatParams params_;
};
///
InsetFloatList(std::string const & type);
///
- virtual std::auto_ptr<InsetBase> clone() const {
- return std::auto_ptr<InsetBase>(new InsetFloatList(getCmdName()));
- }
- ///
std::string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
OutputParams const & runparams) const;
///
void validate(LaTeXFeatures & features) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const
+ {
+ return std::auto_ptr<InsetBase>(new InsetFloatList(getCmdName()));
+ }
};
#endif
}
-auto_ptr<InsetBase> InsetFoot::clone() const
+auto_ptr<InsetBase> InsetFoot::doClone() const
{
return auto_ptr<InsetBase>(new InsetFoot(*this));
}
///
InsetFoot(BufferParams const &);
///
- InsetFoot(InsetFoot const &);
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
InsetOld::Code lyxCode() const { return InsetOld::FOOT_CODE; }
///
int latex(Buffer const &, std::ostream &,
OutputParams const & runparams) const;
///
std::string const editMessage() const;
+protected:
+ InsetFoot(InsetFoot const &);
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
}
-auto_ptr<InsetBase> InsetGraphics::clone() const
+auto_ptr<InsetBase> InsetGraphics::doClone() const
{
return auto_ptr<InsetBase>(new InsetGraphics(*this));
}
///
InsetGraphics();
///
- InsetGraphics(InsetGraphics const &);
- ///
~InsetGraphics();
///
void metrics(MetricsInfo &, Dimension &) const;
/// returns LyX code associated with the inset. Used for TOC, ...)
InsetOld::Code lyxCode() const { return InsetOld::GRAPHICS_CODE; }
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
-
/** Set the inset parameters, used by the GUIndependent dialog.
Return true of new params are different from what was so far.
*/
///
void editGraphics(InsetGraphicsParams const &, Buffer const &) const;
protected:
+ InsetGraphics(InsetGraphics const &);
///
void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
- ///
friend class InsetGraphicsMailer;
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/// Read the inset native format
void readInsetGraphics(LyXLex & lex, std::string const & bufpath);
{}
-std::auto_ptr<InsetBase> InsetHFill::clone() const
+std::auto_ptr<InsetBase> InsetHFill::doClone() const
{
return std::auto_ptr<InsetBase>(new InsetHFill);
}
///
void metrics(MetricsInfo &, Dimension &) const;
///
- std::auto_ptr<InsetBase> clone() const;
- ///
std::string const getScreenLabel(Buffer const &) const;
///
InsetOld::Code lyxCode() const { return InsetOld::HFILL_CODE; }
/// is this equivalent to a space (which is BTW different from
// a line separator)?
bool isSpace() const;
-
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
}
-auto_ptr<InsetBase> InsetInclude::clone() const
+auto_ptr<InsetBase> InsetInclude::doClone() const
{
return auto_ptr<InsetBase>(new InsetInclude(*this));
}
public:
///
InsetInclude(InsetCommandParams const &);
- InsetInclude(InsetInclude const &);
~InsetInclude();
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
-
/// Override these InsetButton methods if Previewing
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
///
void addPreview(lyx::graphics::PreviewLoader &) const;
protected:
+ InsetInclude(InsetInclude const &);
///
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/** Slot receiving a signal that the external file has changed
* and the preview should be regenerated.
*/
///
InsetIndex(InsetCommandParams const &);
///
- virtual std::auto_ptr<InsetBase> clone() const {
- return std::auto_ptr<InsetBase>(new InsetIndex(params()));
- }
- ///
std::string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const {
+ return std::auto_ptr<InsetBase>(new InsetIndex(params()));
+ }
};
public:
///
InsetPrintIndex(InsetCommandParams const &);
- ///
- virtual std::auto_ptr<InsetBase> clone() const {
- return std::auto_ptr<InsetBase>(new InsetPrintIndex(params()));
- }
/// Updates needed features for this inset.
void validate(LaTeXFeatures & features) const;
///
bool display() const { return true; }
///
std::string const getScreenLabel(Buffer const &) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const {
+ return std::auto_ptr<InsetBase>(new InsetPrintIndex(params()));
+ }
};
#endif
{}
-std::auto_ptr<InsetBase> InsetLabel::clone() const
+std::auto_ptr<InsetBase> InsetLabel::doClone() const
{
return std::auto_ptr<InsetBase>(new InsetLabel(params()));
}
///
InsetLabel(InsetCommandParams const &);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
std::string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;
protected:
- ///
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
}
-auto_ptr<InsetBase> InsetLatexAccent::clone() const
+auto_ptr<InsetBase> InsetLatexAccent::doClone() const
{
return auto_ptr<InsetBase>(new InsetLatexAccent(contents));
}
///
bool directWrite() const;
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
InsetOld::Code lyxCode()const;
///
inline bool canDisplay();
};
private:
friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
+
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/// Check if we know the modifier and can display it ok on screen.
void checkContents();
///
InsetLine() {}
- std::auto_ptr<InsetBase> clone() const {
- return std::auto_ptr<InsetBase>(new InsetLine);
- }
-
InsetOld::Code lyxCode() const { return InsetOld::LINE_CODE; }
void metrics(MetricsInfo &, Dimension &) const;
bool display() const { return true; }
///
void validate(LaTeXFeatures & features) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const
+ {
+ return std::auto_ptr<InsetBase>(new InsetLine);
+ }
};
#endif // INSET_NEWLINE_H
}
-auto_ptr<InsetBase> InsetMarginal::clone() const
+auto_ptr<InsetBase> InsetMarginal::doClone() const
{
return auto_ptr<InsetBase>(new InsetMarginal(*this));
}
///
InsetMarginal(BufferParams const &);
///
- InsetMarginal(InsetMarginal const &);
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
InsetOld::Code lyxCode() const { return InsetOld::MARGIN_CODE; }
///
int latex(Buffer const &, std::ostream &,
OutputParams const &) const;
///
std::string const editMessage() const;
+protected:
+ InsetMarginal(InsetMarginal const &);
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
InsetNewline() {}
- virtual std::auto_ptr<InsetBase> clone() const {
- return std::auto_ptr<InsetBase>(new InsetNewline);
- }
-
InsetOld::Code lyxCode() const { return InsetOld::NEWLINE_CODE; }
void metrics(MetricsInfo &, Dimension &) const;
/// is this equivalent to a space (which is BTW different from
// a line separator)?
bool isSpace() const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const
+ {
+ return std::auto_ptr<InsetBase>(new InsetNewline);
+ }
};
#endif // INSET_NEWLINE_H
}
-auto_ptr<InsetBase> InsetNote::clone() const
+auto_ptr<InsetBase> InsetNote::doClone() const
{
return auto_ptr<InsetBase>(new InsetNote(*this));
}
public:
///
InsetNote(BufferParams const &, std::string const &);
- /// Copy constructor
- InsetNote(InsetNote const &);
///
~InsetNote();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
std::string const editMessage() const;
///
InsetOld::Code lyxCode() const { return InsetOld::NOTE_CODE; }
///
InsetNoteParams const & params() const { return params_; }
protected:
+ InsetNote(InsetNote const &);
///
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
friend class InsetNoteParams;
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/// used by the constructors
void init();
///
}
-auto_ptr<InsetBase> InsetOptArg::clone() const
+auto_ptr<InsetBase> InsetOptArg::doClone() const
{
return auto_ptr<InsetBase>(new InsetOptArg(*this));
}
public:
InsetOptArg(BufferParams const &);
- InsetOptArg(InsetOptArg const &);
- /// make a duplicate of this inset
- virtual std::auto_ptr<InsetBase> clone() const;
/// code of the inset
InsetOld::Code lyxCode() const { return InsetOld::OPTARG_CODE; }
/// return an message upon editing
OutputParams const &) const;
/// Write out tothe .lyx file
void write(Buffer const & buf, std::ostream & os) const;
+protected:
+ InsetOptArg(InsetOptArg const &);
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif // INSETOPTARG_H
InsetPagebreak() {}
- std::auto_ptr<InsetBase> clone() const {
- return std::auto_ptr<InsetBase>(new InsetPagebreak);
- }
-
InsetOld::Code lyxCode() const { return InsetOld::LINE_CODE; }
void metrics(MetricsInfo &, Dimension &) const;
bool directWrite() const { return true; }
bool display() const { return true; }
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const
+ {
+ return std::auto_ptr<InsetBase>(new InsetPagebreak);
+ }
};
#endif // INSET_NEWLINE_H
}
-auto_ptr<InsetBase> InsetQuotes::clone() const
+auto_ptr<InsetBase> InsetQuotes::doClone() const
{
return auto_ptr<InsetBase>(new InsetQuotes(language_, side_, times_));
}
/// Direct access to inner/outer quotation marks
InsetQuotes(char c, quote_language l, quote_times t);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo &, Dimension &) const;
///
void draw(PainterInfo & pi, int x, int y) const;
bool isChar() const { return true; }
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
///
quote_language language_;
///
InsetRef(InsetCommandParams const &, Buffer const &);
- InsetRef(InsetRef const &);
-
- ///
- virtual std::auto_ptr<InsetBase> clone() const {
- return std::auto_ptr<InsetBase>(new InsetRef(*this));
- }
///
std::string const getScreenLabel(Buffer const &) const;
///
///
void validate(LaTeXFeatures & features) const;
protected:
+ InsetRef(InsetRef const &);
+
///
void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const {
+ return std::auto_ptr<InsetBase>(new InsetRef(*this));
+ }
///
bool isLatex;
};
}
-auto_ptr<InsetBase> InsetSpace::clone() const
+auto_ptr<InsetBase> InsetSpace::doClone() const
{
return auto_ptr<InsetBase>(new InsetSpace(kind_));
}
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
InsetOld::Code lyxCode() const { return InsetOld::SPACE_CODE; }
/// We don't need \begin_inset and \end_inset
bool directWrite() const { return true; }
// a line separator)?
bool isSpace() const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/// And which kind is this?
Kind kind_;
};
}
-auto_ptr<InsetBase> InsetSpecialChar::clone() const
+auto_ptr<InsetBase> InsetSpecialChar::doClone() const
{
return auto_ptr<InsetBase>(new InsetSpecialChar(kind_));
}
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
InsetOld::Code lyxCode() const { return InsetOld::SPECIALCHAR_CODE; }
/// We don't need \begin_inset and \end_inset
bool directWrite() const { return true; }
// should we break lines after this inset?
bool isLineSeparator() const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
/// And which kind is this?
Kind kind_;
};
using lyx::support::strToInt;
using lyx::support::strToDbl;
+using boost::shared_ptr;
+
using std::auto_ptr;
using std::endl;
using std::max;
}
-auto_ptr<InsetBase> InsetTabular::clone() const
+auto_ptr<InsetBase> InsetTabular::doClone() const
{
return auto_ptr<InsetBase>(new InsetTabular(*this));
}
if (!p_width.zero()) {
m.base.textwidth = p_width.inPixels(mi.base.textwidth);
}
- tabular.getCellInset(cell).metrics(m, dim);
+ tabular.getCellInset(cell)->metrics(m, dim);
maxAsc = max(maxAsc, dim.asc);
maxDesc = max(maxDesc, dim.des);
tabular.setWidthOfCell(cell, dim.wid);
drawCellSelection(pi, nx, y, i, j, idx);
int const cx = nx + tabular.getBeginningOfTextInCell(idx);
- cell(idx).draw(pi, cx, y);
+ cell(idx)->draw(pi, cx, y);
drawCellLines(pi.pain, nx, y, i, idx);
nx += tabular.getWidthOfColumn(idx);
++idx;
case LFUN_RIGHTSEL:
case LFUN_RIGHT:
- cell(cur.idx()).dispatch(cur, cmd);
+ cell(cur.idx())->dispatch(cur, cmd);
cur.dispatched(); // override the cell's decision
if (sl == cur.top())
isRightToLeft(cur) ? movePrevCell(cur) : moveNextCell(cur);
case LFUN_LEFTSEL:
case LFUN_LEFT:
- cell(cur.idx()).dispatch(cur, cmd);
+ cell(cur.idx())->dispatch(cur, cmd);
cur.dispatched(); // override the cell's decision
if (sl == cur.top())
isRightToLeft(cur) ? moveNextCell(cur) : movePrevCell(cur);
case LFUN_DOWNSEL:
case LFUN_DOWN:
- cell(cur.idx()).dispatch(cur, cmd);
+ cell(cur.idx())->dispatch(cur, cmd);
cur.dispatched(); // override the cell's decision
if (sl == cur.top())
if (tabular.row_of_cell(cur.idx()) != tabular.rows() - 1) {
case LFUN_UPSEL:
case LFUN_UP:
- cell(cur.idx()).dispatch(cur, cmd);
+ cell(cur.idx())->dispatch(cur, cmd);
cur.dispatched(); // override the cell's decision
if (sl == cur.top())
if (tabular.row_of_cell(cur.idx()) != 0) {
// insert file functions
case LFUN_FILE_INSERT_ASCII_PARA:
case LFUN_FILE_INSERT_ASCII: {
- string tmpstr = getContentsOfAsciiFile(&cur.bv(), cmd.argument, false);
+ string const tmpstr = getContentsOfAsciiFile(&cur.bv(), cmd.argument, false);
if (!tmpstr.empty() && !insertAsciiString(cur.bv(), tmpstr, false))
cur.undispatched();
break;
if (tablemode(cur))
cutSelection(cur);
else
- cell(cur.idx()).dispatch(cur, cmd);
+ cell(cur.idx())->dispatch(cur, cmd);
break;
case LFUN_COPY:
string::size_type op = 0;
int cell = 0;
- int cells = paste_tabular->getNumberOfCells();
+ int const cells = paste_tabular->getNumberOfCells();
cols = 0;
LyXFont font;
for (size_t p = 0; cell < cells && p < len; ++p) {
break;
switch (clip[p]) {
case '\t':
- paste_tabular->getCellInset(cell).
+ paste_tabular->getCellInset(cell)->
setText(clip.substr(op, p - op), font);
++cols;
++cell;
break;
case '\n':
- paste_tabular->getCellInset(cell).
+ paste_tabular->getCellInset(cell)->
setText(clip.substr(op, p - op), font);
while (cols++ < maxCols)
++cell;
}
// check for the last cell if there is no trailing '\n'
if (cell < cells && op < len)
- paste_tabular->getCellInset(cell).
+ paste_tabular->getCellInset(cell)->
setText(clip.substr(op, len - op), font);
} else if (!insertAsciiString(cur.bv(), clip, true)) {
// so that the clipboard is used and it goes on
pasteSelection(cur);
break;
}
- cell(cur.idx()).dispatch(cur, cmd);
+ cell(cur.idx())->dispatch(cur, cmd);
break;
default:
// we try to handle this event in the insets dispatch function.
- cell(cur.idx()).dispatch(cur, cmd);
+ cell(cur.idx())->dispatch(cur, cmd);
break;
}
default:
// we try to handle this event in the insets dispatch function.
- return cell(cur.idx()).getStatus(cur, cmd, status);
+ return cell(cur.idx())->getStatus(cur, cmd, status);
}
}
int InsetTabular::plaintext(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
- int dp = runparams.linelen ? runparams.depth : 0;
+ int const dp = runparams.linelen ? runparams.depth : 0;
return tabular.plaintext(buf, os, runparams, dp, false, 0);
}
}
-InsetText const & InsetTabular::cell(int idx) const
+shared_ptr<InsetText const> InsetTabular::cell(int idx) const
{
return tabular.getCellInset(idx);
}
-InsetText & InsetTabular::cell(int idx)
+shared_ptr<InsetText> InsetTabular::cell(int idx)
{
return tabular.getCellInset(idx);
}
void InsetTabular::getCursorPos(LCursor const & cur, int & x, int & y) const
{
- cell(cur.idx()).getCursorPos(cur, x, y);
+ cell(cur.idx())->getCursorPos(cur, x, y);
}
}
}
cur.idx() = idx_min;
- InsetBase * inset = cell(cur.idx()).text_.editXY(cur, x, y);
+ InsetBase * inset = cell(cur.idx())->text_.editXY(cur, x, y);
//lyxerr << "# InsetTabular::setPos()\n" << cur << endl;
return inset;
}
-int InsetTabular::getCellXPos(int cell) const
+int InsetTabular::getCellXPos(int const cell) const
{
int c = cell;
if (isRightToLeft(cur)) {
lyxerr << "InsetTabular::moveNextCell A cur: " << endl;
if (tabular.isFirstCellInRow(cur.idx())) {
- int row = tabular.row_of_cell(cur.idx());
+ int const row = tabular.row_of_cell(cur.idx());
if (row == tabular.rows() - 1)
return;
cur.idx() = tabular.getCellBelow(tabular.getLastCellInRow(row));
{
if (isRightToLeft(cur)) {
if (tabular.isLastCellInRow(cur.idx())) {
- int row = tabular.row_of_cell(cur.idx());
+ int const row = tabular.row_of_cell(cur.idx());
if (row == 0)
return;
cur.idx() = tabular.getFirstCellInRow(row);
recordUndo(cur, Undo::ATOMIC);
getSelection(cur, sel_row_start, sel_row_end, sel_col_start, sel_col_end);
- int row = tabular.row_of_cell(cur.idx());
- int column = tabular.column_of_cell(cur.idx());
+ int const row = tabular.row_of_cell(cur.idx());
+ int const column = tabular.column_of_cell(cur.idx());
bool flag = true;
LyXTabular::ltType ltt;
{
if (!paste_tabular)
return false;
- int actcol = tabular.column_of_cell(cur.idx());
- int actrow = tabular.row_of_cell(cur.idx());
+ int const actcol = tabular.column_of_cell(cur.idx());
+ int const actrow = tabular.row_of_cell(cur.idx());
for (int r1 = 0, r2 = actrow;
r1 < paste_tabular->rows() && r2 < tabular.rows();
++r1, ++r2) {
--c1;
continue;
}
- InsetText & inset = tabular.getCellInset(r2, c2);
+ shared_ptr<InsetText> inset = tabular.getCellInset(r2, c2);
inset = paste_tabular->getCellInset(r1, c1);
- inset.markNew();
+ inset->markNew();
}
}
return true;
getSelection(cur, rs, re, cs, ce);
for (int i = rs; i <= re; ++i)
for (int j = cs; j <= ce; ++j)
- cell(tabular.getCellNumber(i, j)).clear(track);
+ cell(tabular.getCellNumber(i, j))->clear(track);
// cursor position might be invalid now
cur.pos() = cur.lastpos();
LyXText * InsetTabular::getText(int idx) const
{
- return size_t(idx) < nargs() ? cell(idx).getText(0) : 0;
+ return size_t(idx) < nargs() ? cell(idx)->getText(0) : 0;
}
void InsetTabular::markErased()
{
for (idx_type idx = 0; idx < nargs(); ++idx)
- cell(idx).markErased();
+ cell(idx)->markErased();
}
bool InsetTabular::forceDefaultParagraphs(InsetBase const *) const
{
#if 0
- const int cell = tabular.getCellFromInset(in);
+ int const cell = tabular.getCellFromInset(in);
if (cell != -1)
return tabular.getPWidth(cell).zero();
int cols = 1;
int rows = 1;
int maxCols = 1;
- string::size_type len = buf.length();
+ string::size_type const len = buf.length();
string::size_type p = 0;
while (p < len && (p = buf.find_first_of("\t\n", p)) != string::npos) {
}
string::size_type op = 0;
- int cells = loctab->getNumberOfCells();
+ int const cells = loctab->getNumberOfCells();
p = 0;
cols = ocol;
rows = loctab->rows();
case '\t':
// we can only set this if we are not too far right
if (cols < columns) {
- InsetText & inset = loctab->getCellInset(cell);
- Paragraph & par = inset.text_.getPar(0);
- LyXFont const font = inset.text_.getFont(par, 0);
- inset.setText(buf.substr(op, p - op), font);
+ shared_ptr<InsetText> inset = loctab->getCellInset(cell);
+ Paragraph & par = inset->text_.getPar(0);
+ LyXFont const font = inset->text_.getFont(par, 0);
+ inset->setText(buf.substr(op, p - op), font);
++cols;
++cell;
}
case '\n':
// we can only set this if we are not too far right
if (cols < columns) {
- InsetText & inset = tabular.getCellInset(cell);
- Paragraph & par = inset.text_.getPar(0);
- LyXFont const font = inset.text_.getFont(par, 0);
- inset.setText(buf.substr(op, p - op), font);
+ shared_ptr<InsetText> inset = tabular.getCellInset(cell);
+ Paragraph & par = inset->text_.getPar(0);
+ LyXFont const font = inset->text_.getFont(par, 0);
+ inset->setText(buf.substr(op, p - op), font);
}
cols = ocol;
++row;
}
// check for the last cell if there is no trailing '\n'
if (cell < cells && op < len) {
- InsetText & inset = loctab->getCellInset(cell);
- Paragraph & par = inset.text_.getPar(0);
- LyXFont const font = inset.text_.getFont(par, 0);
- inset.setText(buf.substr(op, len - op), font);
+ shared_ptr<InsetText> inset = loctab->getCellInset(cell);
+ Paragraph & par = inset->text_.getPar(0);
+ LyXFont const font = inset->text_.getFont(par, 0);
+ inset->setText(buf.substr(op, len - op), font);
}
return true;
}
int const columns = tabular.columns();
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < columns; ++j)
- tabular.getCellInset(i, j).addPreview(loader);
+ tabular.getCellInset(i, j)->addPreview(loader);
}
}
///
InsetTabular(Buffer const &, int rows = 1, int columns = 1);
///
- InsetTabular(InsetTabular const &);
- ///
~InsetTabular();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void read(Buffer const &, LyXLex &);
///
void write(Buffer const &, std::ostream &) const;
///
std::string const editMessage() const;
///
- bool insetAllowed(InsetOld::Code) const { return true; }
+ bool insetAllowed(InsetBase::Code) const { return true; }
///
bool isTextInset() const { return true; }
/** returns true if, when outputing LaTeX, font changes should
///
void validate(LaTeXFeatures & features) const;
///
- Code lyxCode() const { return InsetOld::TABULAR_CODE; }
+ Code lyxCode() const { return InsetBase::TABULAR_CODE; }
/// get the absolute screen x,y of the cursor
void getCursorPos(LCursor const & cur, int & x, int & y) const;
///
/// number of cells
size_t nargs() const;
///
- InsetText const & cell(int) const;
+ boost::shared_ptr<InsetText const> cell(int) const;
///
- InsetText & cell(int);
+ boost::shared_ptr<InsetText> cell(int);
///
LyXText * getText(int) const;
mutable LyXTabular tabular;
protected:
+ InsetTabular(InsetTabular const &);
///
void priv_dispatch(LCursor & cur, FuncRequest & cmd);
///
bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
///
void drawCellLines(Painter &, int x, int baseline,
int row, int cell) const;
using lyx::support::isStrUnsignedInt;
using lyx::support::strToUnsignedInt;
+using boost::bind;
+using boost::ref;
+
using std::endl;
using std::for_each;
using std::max;
InsetText::InsetText(InsetText const & in)
: UpdatableInset(in), text_(in.text_.bv_owner)
{
- // this is ugly...
- operator=(in);
-}
-
-
-InsetText::InsetText() : text_(0)
-{}
-
-
-void InsetText::operator=(InsetText const & in)
-{
- UpdatableInset::operator=(in);
autoBreakRows_ = in.autoBreakRows_;
drawFrame_ = in.drawFrame_;
frame_color_ = in.frame_color_;
- text_ = LyXText(in.text_.bv_owner);
text_.paragraphs() = in.text_.paragraphs();
init();
}
+InsetText::InsetText() : text_(0)
+{}
+
+
void InsetText::init()
{
- ParagraphList::iterator pit = paragraphs().begin();
- ParagraphList::iterator end = paragraphs().end();
- for (; pit != end; ++pit)
- pit->setInsetOwner(this);
+ for_each(paragraphs().begin(), paragraphs().end(),
+ bind(&Paragraph::setInsetOwner, _1, this));
old_par = -1;
}
{
ParagraphList & pars = paragraphs();
if (just_mark_erased) {
- ParagraphList::iterator it = pars.begin();
- ParagraphList::iterator end = pars.end();
- for (; it != end; ++it)
- it->markErased();
+ for_each(pars.begin(), pars.end(),
+ bind(&Paragraph::markErased, _1));
return;
}
}
-auto_ptr<InsetBase> InsetText::clone() const
+auto_ptr<InsetBase> InsetText::doClone() const
{
return auto_ptr<InsetBase>(new InsetText(*this));
}
for (; it != end; ++it)
asciiParagraph(buf, *it, os, runparams, it == beg);
- //FIXME: Give the total numbers of lines
+ // FIXME: Give the total numbers of lines
return 0;
}
void InsetText::validate(LaTeXFeatures & features) const
{
for_each(paragraphs().begin(), paragraphs().end(),
- boost::bind(&Paragraph::validate, _1, boost::ref(features)));
+ bind(&Paragraph::validate, _1, ref(features)));
}
void InsetText::setText(string const & data, LyXFont const & font)
{
clear(false);
+ Paragraph & first = paragraphs().front();
for (unsigned int i = 0; i < data.length(); ++i)
- paragraphs().begin()->insertChar(i, data[i], font);
+ first.insertChar(i, data[i], font);
}
// And it probably does. You have to take a look at this John. (Lgb)
#warning John, have a look here. (Lgb)
#endif
+ ParagraphList & pl = paragraphs();
+
ParagraphList::iterator pit = plist.begin();
- ParagraphList::iterator ins = paragraphs().insert(paragraphs().end(), *pit);
+ ParagraphList::iterator ins = pl.insert(pl.end(), *pit);
++pit;
- mergeParagraph(buffer->params(), paragraphs(),
- ins - paragraphs().begin() - 1);
+ mergeParagraph(buffer->params(), pl, ins - pl.begin() - 1);
- ParagraphList::iterator pend = plist.end();
- for (; pit != pend; ++pit)
- paragraphs().push_back(*pit);
+ for_each(pit, plist.end(),
+ bind(&ParagraphList::push_back, ref(pl), _1));
}
///
explicit InsetText(BufferParams const &);
///
- explicit InsetText();
- ///
- InsetText(InsetText const &);
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
- void operator=(InsetText const & it);
+ InsetText();
/// empty inset to empty par, or just mark as erased
void clear(bool just_mark_erased);
///
///
void validate(LaTeXFeatures & features) const;
///
- InsetOld::Code lyxCode() const { return InsetOld::TEXT_CODE; }
+ Code lyxCode() const { return TEXT_CODE; }
/// FIXME, document
void getCursorPos(LCursor const & cur, int & x, int & y) const;
///
bool allowSpellCheck() const { return true; }
protected:
+ InsetText(InsetText const &);
///
void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
///
void updateLocal(LCursor &);
///
}
-auto_ptr<InsetBase> InsetTheorem::clone() const
+auto_ptr<InsetBase> InsetTheorem::doClone() const
{
#ifdef WITH_WARNINGS
#warning Is this inset used? If YES this is WRONG!!! (Jug)
///
void write(Buffer const & buf, std::ostream & os) const;
///
- virtual InsetBase * clone() const;
- ///
Inset::Code lyxCode() const { return Inset::THEOREM_CODE; }
///
void metrics(MetricsInfo &, Dimension &) const;
///
string const editMessage() const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
///
mutable unsigned int center_indent_;
};
{}
-std::auto_ptr<InsetBase> InsetTOC::clone() const
+std::auto_ptr<InsetBase> InsetTOC::doClone() const
{
return std::auto_ptr<InsetBase>(new InsetTOC(*this));
}
///
explicit InsetTOC(InsetCommandParams const &);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
std::string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
explicit
InsetUrl(InsetCommandParams const &);
///
- virtual std::auto_ptr<InsetBase> clone() const {
- return std::auto_ptr<InsetBase>(new InsetUrl(params()));
- }
- ///
InsetOld::Code lyxCode() const { return InsetOld::URL_CODE; }
///
void validate(LaTeXFeatures &) const;
///
int docbook(Buffer const &, std::ostream &,
OutputParams const &) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const {
+ return std::auto_ptr<InsetBase>(new InsetUrl(params()));
+ }
};
#endif
}
-std::auto_ptr<InsetBase> InsetVSpace::clone() const
+std::auto_ptr<InsetBase> InsetVSpace::doClone() const
{
return std::auto_ptr<InsetBase>(new InsetVSpace(*this));
}
///
~InsetVSpace();
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
///
VSpace space_;
};
}
-auto_ptr<InsetBase> InsetWrap::clone() const
+auto_ptr<InsetBase> InsetWrap::doClone() const
{
return auto_ptr<InsetBase>(new InsetWrap(*this));
}
///
void validate(LaTeXFeatures & features) const;
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
InsetOld::Code lyxCode() const { return InsetOld::WRAP_CODE; }
///
int latex(Buffer const &, std::ostream &,
///
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
///
InsetWrapParams params_;
};
protected:
RenderBase() {}
RenderBase(RenderBase const &) {}
- void operator=(RenderBase const &) {}
+ RenderBase & operator=(RenderBase const &) { return *this; }
/// Cached
mutable Dimension dim_;
private:
/// Not implemented.
- void operator=(RenderPreview const &);
+ RenderPreview & operator=(RenderPreview const &);
/// This method is connected to the PreviewLoader::imageReady signal.
void imageReady(lyx::graphics::PreviewImage const &);
/// "data" must be a decimal number, followed by a unit
explicit LyXLength(std::string const & data);
+ void swap(LyXLength & rhs)
+ {
+ std::swap(val_, rhs.val_);
+ std::swap(unit_, rhs.unit_);
+ }
+
///
double value() const;
///
+2004-11-24 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * math_hullinset.C (operator): use common semantics
+
+2004-11-23 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * math_atom.C (operator): use common semantics
+
+ * Adjust for clone changes
+
2004-11-22 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* math_hullinset.[Ch] (rowChangeOK): new
}
-auto_ptr<InsetBase> CommandInset::clone() const
+auto_ptr<InsetBase> CommandInset::doClone() const
{
return auto_ptr<InsetBase>(new CommandInset(*this));
}
///
explicit CommandInset(std::string const & name);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
std::string const & commandname() const { return name_; }
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
+
///
std::string name_;
///
{}
-auto_ptr<InsetBase> MathAMSArrayInset::clone() const
+auto_ptr<InsetBase> MathAMSArrayInset::doClone() const
{
return auto_ptr<InsetBase>(new MathAMSArrayInset(*this));
}
///
MathAMSArrayInset(std::string const & name);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pain, int x, int y) const;
void normalize(NormalStream &) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
char const * name_left() const;
///
}
-auto_ptr<InsetBase> MathArrayInset::clone() const
+auto_ptr<InsetBase> MathArrayInset::doClone() const
{
return auto_ptr<InsetBase>(new MathArrayInset(*this));
}
/// convienience constructor from whitespace/newline seperated data
MathArrayInset(std::string const &, std::string const & str);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void maple(MapleStream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
std::string name_;
};
}
-void MathAtom::operator=(MathAtom const & at)
+MathAtom & MathAtom::operator=(MathAtom const & at)
{
if (&at == this)
- return;
+ return *this;
MathAtom tmp(at);
swap(tmp.nucleus_, nucleus_);
+ return *this;
}
/// we really need to clean up
~MathAtom();
/// assignment invokes nucleus_->clone()
- void operator=(MathAtom const &);
+ MathAtom & operator=(MathAtom const &);
/// access to the inset (checked with gprof)
MathInset * nucleus() { return nucleus_; }
MathInset const * nucleus() const { return nucleus_; }
{}
-auto_ptr<InsetBase> MathBigInset::clone() const
+auto_ptr<InsetBase> MathBigInset::doClone() const
{
return auto_ptr<InsetBase>(new MathBigInset(*this));
}
///
MathBigInset(std::string const & name, std::string const & delim);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void normalize(NormalStream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
size_type size() const;
///
{}
-auto_ptr<InsetBase> MathBinomInset::clone() const
+auto_ptr<InsetBase> MathBinomInset::doClone() const
{
return auto_ptr<InsetBase>(new MathBinomInset(*this));
}
///
explicit MathBinomInset(bool choose = false);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void write(WriteStream & os) const;
///
void normalize(NormalStream &) const;
///
void draw(PainterInfo &, int x, int y) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
int dw() const;
///
{}
-auto_ptr<InsetBase> MathBoldsymbolInset::clone() const
+auto_ptr<InsetBase> MathBoldsymbolInset::doClone() const
{
return auto_ptr<InsetBase>(new MathBoldsymbolInset(*this));
}
///
MathBoldsymbolInset();
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void write(WriteStream & os) const;
///
void infoize(std::ostream & os) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathBoxedInset::clone() const
+auto_ptr<InsetBase> MathBoxedInset::doClone() const
{
return auto_ptr<InsetBase>(new MathBoxedInset(*this));
}
{
features.require("amsmath");
}
-
///
MathBoxedInset();
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void validate(LaTeXFeatures & features) const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
void normalize(NormalStream & ns) const;
///
void infoize(std::ostream & os) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathBoxInset::clone() const
+auto_ptr<InsetBase> MathBoxInset::doClone() const
{
return auto_ptr<InsetBase>(new MathBoxInset(*this));
}
///
explicit MathBoxInset(std::string const & name);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
mode_type currentMode() const { return TEXT_MODE; }
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
void infoize(std::ostream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
std::string name_;
};
}
-auto_ptr<InsetBase> MathBraceInset::clone() const
+auto_ptr<InsetBase> MathBraceInset::doClone() const
{
return auto_ptr<InsetBase>(new MathBraceInset(*this));
}
///
MathBraceInset(MathArray const & ar);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
MathBraceInset const * asBraceInset() const { return this; }
/// we write extra braces in any case...
bool extraBraces() const { return true; }
void mathmlize(MathMLStream &) const;
///
void infoize(std::ostream & os) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathCasesInset::clone() const
+auto_ptr<InsetBase> MathCasesInset::doClone() const
{
return auto_ptr<InsetBase>(new MathCasesInset(*this));
}
///
explicit MathCasesInset(row_type rows = 1u);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void write(WriteStream & os) const;
///
void validate(LaTeXFeatures & features) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
-auto_ptr<InsetBase> MathCharInset::clone() const
+auto_ptr<InsetBase> MathCharInset::doClone() const
{
return auto_ptr<InsetBase>(new MathCharInset(*this));
}
///
explicit MathCharInset(char c);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
bool isRelOp() const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// the character
char char_;
/// cached width
{}
-auto_ptr<InsetBase> MathColorInset::clone() const
+auto_ptr<InsetBase> MathColorInset::doClone() const
{
return auto_ptr<InsetBase>(new MathColorInset(*this));
}
///
explicit MathColorInset(bool oldstyle);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
/// we write extra braces in any case...
bool extraBraces() const { return true; }
///
void infoize(std::ostream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// width of '[' in current font
mutable int w_;
///
}
-auto_ptr<InsetBase> MathCommentInset::clone() const
+auto_ptr<InsetBase> MathCommentInset::doClone() const
{
return auto_ptr<InsetBase>(new MathCommentInset(*this));
}
///
explicit MathCommentInset(std::string const &);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void mathmlize(MathMLStream &) const;
///
void infoize(std::ostream & os) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
}
-auto_ptr<InsetBase> MathDecorationInset::clone() const
+auto_ptr<InsetBase> MathDecorationInset::doClone() const
{
return auto_ptr<InsetBase>(new MathDecorationInset(*this));
}
///
explicit MathDecorationInset(latexkeys const * key);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void draw(PainterInfo &, int x, int y) const;
///
void write(WriteStream & os) const;
bool isScriptable() const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
bool upper() const;
///
}
-auto_ptr<InsetBase> MathDelimInset::clone() const
+auto_ptr<InsetBase> MathDelimInset::doClone() const
{
return auto_ptr<InsetBase>(new MathDelimInset(*this));
}
///
MathDelimInset(std::string const & left, std::string const & right, MathArray const &);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
MathDelimInset * asDelimInset() { return this; }
///
MathDelimInset const * asDelimInset() const { return this; }
///
std::string right_;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
mutable int dw_;
};
{}
-auto_ptr<InsetBase> MathDfracInset::clone() const
+auto_ptr<InsetBase> MathDfracInset::doClone() const
{
return auto_ptr<InsetBase>(new MathDfracInset(*this));
}
///
MathDfracInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
void mathmlize(MathMLStream &) const;
///
void validate(LaTeXFeatures & features) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathDiffInset::clone() const
+auto_ptr<InsetBase> MathDiffInset::doClone() const
{
return auto_ptr<InsetBase>(new MathDiffInset(*this));
}
class MathDiffInset : public MathNestInset {
public:
///
- explicit MathDiffInset();
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
+ MathDiffInset();
///
void addDer(MathArray const & der);
///
void mathmlize(MathMLStream &) const;
///
void write(WriteStream & os) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathDotsInset::clone() const
+auto_ptr<InsetBase> MathDotsInset::doClone() const
{
return auto_ptr<InsetBase>(new MathDotsInset(*this));
}
///
explicit MathDotsInset(latexkeys const * l);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
mutable int dh_;
///
latexkeys const * key_;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathEnvInset::clone() const
+auto_ptr<InsetBase> MathEnvInset::doClone() const
{
return auto_ptr<InsetBase>(new MathEnvInset(*this));
}
///
MathEnvInset(std::string const & name_);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void draw(PainterInfo &, int x, int y) const;
///
void write(WriteStream & os) const;
void infoize(std::ostream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// name of that environment
std::string name_;
};
}
-auto_ptr<InsetBase> MathExFuncInset::clone() const
+auto_ptr<InsetBase> MathExFuncInset::doClone() const
{
return auto_ptr<InsetBase>(new MathExFuncInset(*this));
}
///
MathExFuncInset(std::string const & name, MathArray const & ar);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void octave(OctaveStream &) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
std::string const name_;
};
// 3 - upper
-auto_ptr<InsetBase> MathExIntInset::clone() const
+auto_ptr<InsetBase> MathExIntInset::doClone() const
{
return auto_ptr<InsetBase>(new MathExIntInset(*this));
}
///
explicit MathExIntInset(std::string const & name_);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void symbol(std::string const &);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void write(WriteStream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
bool hasScripts() const;
{}
-auto_ptr<InsetBase> MathFboxInset::clone() const
+auto_ptr<InsetBase> MathFboxInset::doClone() const
{
return auto_ptr<InsetBase>(new MathFboxInset(*this));
}
{
os << "FBox: ";
}
-
///
MathFboxInset();
///
- std::auto_ptr<InsetBase> clone() const;
- ///
mode_type currentMode() const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
void normalize(NormalStream & ns) const;
///
void infoize(std::ostream & os) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathFontInset::clone() const
+auto_ptr<InsetBase> MathFontInset::doClone() const
{
return auto_ptr<InsetBase>(new MathFontInset(*this));
}
///
explicit MathFontInset(latexkeys const * key);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
MathFontInset * asFontInset() { return this; }
///
MathFontInset const * asFontInset() const { return this; }
void infoize(std::ostream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// the font to be used on screen
latexkeys const * key_;
};
}
-auto_ptr<InsetBase> MathFontOldInset::clone() const
+auto_ptr<InsetBase> MathFontOldInset::doClone() const
{
return auto_ptr<InsetBase>(new MathFontOldInset(*this));
}
public:
///
explicit MathFontOldInset(latexkeys const * key);
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
/// we are in text mode.
mode_type currentMode() const { return TEXT_MODE; }
/// we write extra braces in any case...
void infoize(std::ostream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// the font to be used on screen
latexkeys const * key_;
};
{}
-auto_ptr<InsetBase> MathFracInset::clone() const
+auto_ptr<InsetBase> MathFracInset::doClone() const
{
return auto_ptr<InsetBase>(new MathFracInset(*this));
}
///
explicit MathFracInset(bool atop = false);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
///
void mathmlize(MathMLStream &) const;
public:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
- const bool atop_;
+ bool const atop_;
};
#endif
{}
-auto_ptr<InsetBase> MathFrameboxInset::clone() const
+auto_ptr<InsetBase> MathFrameboxInset::doClone() const
{
return auto_ptr<InsetBase>(new MathFrameboxInset(*this));
}
///
MathFrameboxInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
mode_type currentMode() const { return TEXT_MODE; }
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// width of '[' in current font
mutable int w_;
};
}
-auto_ptr<InsetBase> MathGridInset::clone() const
+auto_ptr<InsetBase> MathGridInset::doClone() const
{
return auto_ptr<InsetBase>(new MathGridInset(*this));
}
* This is the base to all grid-like editable math objects
*/
class MathGridInset : public MathNestInset {
-
public:
/// additional per-cell information
/// Ensures that the dialog is closed.
~MathGridInset();
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi) const;
///
void metrics(MetricsInfo & mi, Dimension &) const;
std::vector<CellInfo> cellinfo_;
///
char v_align_; // add approp. type
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathHullInset::clone() const
+auto_ptr<InsetBase> MathHullInset::doClone() const
{
return auto_ptr<InsetBase>(new MathHullInset(*this));
}
-void MathHullInset::operator=(MathHullInset const & other)
+MathHullInset & MathHullInset::operator=(MathHullInset const & other)
{
if (this == &other)
- return;
+ return *this;
*static_cast<MathGridInset*>(this) = MathGridInset(other);
type_ = other.type_;
nonum_ = other.nonum_;
label_ = other.label_;
preview_.reset(new RenderPreview(*other.preview_, this));
+
+ return *this;
}
name = "informalequation";
string bname = name;
- if (!label(0).empty())
+ if (!label(0).empty())
bname += " id=\"" + sgml::cleanID(buf, runparams, label(0)) + "\"";
ms << MTag(bname.c_str());
MathGridInset::mathmlize(ms);
ms << ETag("math");
} else {
- ms << MTag("alt role=\"tex\"");
+ ms << MTag("alt role=\"tex\"");
res = latex(buf, ls, runparams);
ms << subst(subst(ls.str(), "&", "&"), "<", "<");
ms << ETag("alt");
}
-
+
ms << "<graphic fileref=\"eqn/";
- if ( !label(0).empty())
+ if ( !label(0).empty())
ms << sgml::cleanID(buf, runparams, label(0));
else {
ms << sgml::uniqueID("anon");
}
- if (runparams.flavor == OutputParams::XML)
+ if (runparams.flavor == OutputParams::XML)
ms << "\"/>";
- else
+ else
ms << "\">";
-
+
ms << ETag(name.c_str());
return ms.line() + res;
}
///
explicit MathHullInset(std::string const & type);
///
- MathHullInset(MathHullInset const &);
- ///
~MathHullInset();
///
- std::auto_ptr<InsetBase> clone() const;
- ///
- void operator=(MathHullInset const &);
+ MathHullInset & operator=(MathHullInset const &);
///
mode_type currentMode() const;
///
protected:
- ///
- void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+ MathHullInset(MathHullInset const &);
+
+ virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+
/// do we want to handle this event?
bool getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & status) const;
std::string eolString(row_type row, bool fragile) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
void setType(std::string const & type);
///
{}
-auto_ptr<InsetBase> MathKernInset::clone() const
+auto_ptr<InsetBase> MathKernInset::doClone() const
{
return auto_ptr<InsetBase>(new MathKernInset(*this));
}
///
explicit MathKernInset(std::string const & wid);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
void normalize(NormalStream & ns) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// width in em
LyXLength wid_;
};
{}
-auto_ptr<InsetBase> MathLefteqnInset::clone() const
+auto_ptr<InsetBase> MathLefteqnInset::doClone() const
{
return auto_ptr<InsetBase>(new MathLefteqnInset(*this));
}
///
MathLefteqnInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
std::string name() const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
void draw(PainterInfo & pi, int x, int y) const;
///
void infoize(std::ostream & os) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
}
-auto_ptr<InsetBase> MathLimInset::clone() const
+auto_ptr<InsetBase> MathLimInset::doClone() const
{
return auto_ptr<InsetBase>(new MathLimInset(*this));
}
///
MathLimInset(MathArray const & f, MathArray const & x, MathArray const & x0);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void mathmlize(MathMLStream &) const;
///
void write(WriteStream & os) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathMacro::clone() const
+auto_ptr<InsetBase> MathMacro::doClone() const
{
return auto_ptr<InsetBase>(new MathMacro(*this));
}
/// A macro can be built from an existing template
MathMacro(std::string const & name, int numargs);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void draw(PainterInfo & pi, int x, int y) const;
///
void drawExpanded(PainterInfo & pi, int x, int y) const;
void infoize2(std::ostream &) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
void updateExpansion() const;
///
}
-auto_ptr<InsetBase> MathMacroArgument::clone() const
+auto_ptr<InsetBase> MathMacroArgument::doClone() const
{
return auto_ptr<InsetBase>(new MathMacroArgument(*this));
}
///
explicit MathMacroArgument(std::size_t);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
void write(WriteStream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// A number between 1 and 9
std::size_t number_;
///
}
-auto_ptr<InsetBase> MathMacroTemplate::clone() const
+auto_ptr<InsetBase> MathMacroTemplate::doClone() const
{
return auto_ptr<InsetBase>(new MathMacroTemplate(*this));
}
///
explicit MathMacroTemplate(std::istream & is);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void edit(LCursor & cur, bool left);
///
EDITABLE editable() const { return HIGHLY_EDITABLE; }
InsetBase::Code lyxCode() const { return MATHMACRO_CODE; }
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// prefix in inset
std::string prefix() const;
{}
-auto_ptr<InsetBase> MathMakeboxInset::clone() const
+auto_ptr<InsetBase> MathMakeboxInset::doClone() const
{
return auto_ptr<InsetBase>(new MathMakeboxInset(*this));
}
///
MathMakeboxInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
void infoize(std::ostream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// width of '[' in current font
mutable int w_;
};
{}
-auto_ptr<InsetBase> MathMatrixInset::clone() const
+auto_ptr<InsetBase> MathMatrixInset::doClone() const
{
return auto_ptr<InsetBase>(new MathMatrixInset(*this));
}
class MathMatrixInset : public MathGridInset {
public:
///
- MathMatrixInset(MathGridInset const &);
+ explicit MathMatrixInset(MathGridInset const &);
///
- MathMatrixInset(std::string const & str);
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
+ explicit MathMatrixInset(std::string const & str);
/// identifies MatrixInsets
MathMatrixInset const * asMatrixInset() const { return this; }
void mathmlize(MathMLStream &) const;
///
void octave(OctaveStream &) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
}
-auto_ptr<InsetBase> MathMBoxInset::clone() const
+auto_ptr<InsetBase> MathMBoxInset::doClone() const
{
return auto_ptr<InsetBase>(new MathMBoxInset(*this));
}
class MathMBoxInset : public MathDimInset {
public:
///
- MathMBoxInset(BufferView & bv);
- ///
- std::auto_ptr<InsetBase> clone() const;
+ explicit MathMBoxInset(BufferView & bv);
/// this stores metrics information in cache_
void metrics(MetricsInfo & mi, Dimension & dim) const;
/// draw according to cached metrics
mutable LyXText text_;
///
BufferView * const bv_;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathNumberInset::clone() const
+auto_ptr<InsetBase> MathNumberInset::doClone() const
{
return auto_ptr<InsetBase>(new MathNumberInset(*this));
}
///
explicit MathNumberInset(std::string const & s);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
void write(WriteStream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// the number as string
std::string str_;
};
using std::auto_ptr;
-auto_ptr<InsetBase> MathOversetInset::clone() const
+auto_ptr<InsetBase> MathOversetInset::doClone() const
{
return auto_ptr<InsetBase>(new MathOversetInset(*this));
}
features.require("amsmath");
MathNestInset::validate(features);
}
-
/// Inset for overset
class MathOversetInset : public MathFracbaseInset {
public:
- ///
- std::auto_ptr<InsetBase> clone() const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void normalize(NormalStream &) const;
///
void validate(LaTeXFeatures & features) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathRootInset::clone() const
+auto_ptr<InsetBase> MathRootInset::doClone() const
{
return auto_ptr<InsetBase>(new MathRootInset(*this));
}
///
MathRootInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
bool idxUpDown(LCursor & cur, bool up) const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
void maple(MapleStream &) const;
///
void octave(OctaveStream &) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
}
-
-auto_ptr<InsetBase> MathScriptInset::clone() const
+auto_ptr<InsetBase> MathScriptInset::doClone() const
{
return auto_ptr<InsetBase>(new MathScriptInset(*this));
}
/// create inset with single script and given nucleus
MathScriptInset(MathAtom const & at, bool up);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
void priv_dispatch(LCursor & cur, FuncRequest & cmd);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// returns x offset for main part
int dxx() const;
/// returns width of nucleus if any
{}
-auto_ptr<InsetBase> MathSizeInset::clone() const
+auto_ptr<InsetBase> MathSizeInset::doClone() const
{
return auto_ptr<InsetBase>(new MathSizeInset(*this));
}
public:
///
explicit MathSizeInset(latexkeys const * l);
- ///
- virtual std::auto_ptr<InsetBase> clone() const;
/// we write extra braces in any case...
bool extraBraces() const { return true; }
///
void normalize(NormalStream &) const;
///
void infoize(std::ostream & os) const;
-
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
latexkeys const * key_;
///
}
-auto_ptr<InsetBase> MathSpaceInset::clone() const
+auto_ptr<InsetBase> MathSpaceInset::doClone() const
{
return auto_ptr<InsetBase>(new MathSpaceInset(*this));
}
///
explicit MathSpaceInset(std::string const & name);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
MathSpaceInset const * asSpaceInset() const { return this; }
///
MathSpaceInset * asSpaceInset() { return this; }
///
void write(WriteStream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
int space_;
};
}
-auto_ptr<InsetBase> MathSplitInset::clone() const
+auto_ptr<InsetBase> MathSplitInset::doClone() const
{
return auto_ptr<InsetBase>(new MathSplitInset(*this));
}
///
explicit MathSplitInset(std::string const & name);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void write(WriteStream & os) const;
///
int defaultColSpace(col_type) { return 0; }
///
char defaultColAlign(col_type);
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
std::string name_;
};
{}
-auto_ptr<InsetBase> MathSqrtInset::clone() const
+auto_ptr<InsetBase> MathSqrtInset::doClone() const
{
return auto_ptr<InsetBase>(new MathSqrtInset(*this));
}
///
MathSqrtInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void draw(PainterInfo &, int x, int y) const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
void octave(OctaveStream &) const;
///
void mathmlize(MathMLStream &) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathStackrelInset::clone() const
+auto_ptr<InsetBase> MathStackrelInset::doClone() const
{
return auto_ptr<InsetBase>(new MathStackrelInset(*this));
}
///
MathStackrelInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void write(WriteStream & os) const;
///
void normalize(NormalStream &) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathStringInset::clone() const
+auto_ptr<InsetBase> MathStringInset::doClone() const
{
return auto_ptr<InsetBase>(new MathStringInset(*this));
}
///
explicit MathStringInset(std::string const & s);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void write(WriteStream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
/// the string
std::string str_;
};
{}
-auto_ptr<InsetBase> MathSubstackInset::clone() const
+auto_ptr<InsetBase> MathSubstackInset::doClone() const
{
return auto_ptr<InsetBase>(new MathSubstackInset(*this));
}
///
MathSubstackInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void normalize(NormalStream &) const;
///
void maple(MapleStream &) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathSymbolInset::clone() const
+auto_ptr<InsetBase> MathSymbolInset::doClone() const
{
return auto_ptr<InsetBase>(new MathSymbolInset(*this));
}
///
explicit MathSymbolInset(std::string const & name);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
void infoize2(std::ostream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
latexkeys const * sym_;
///
{}
-auto_ptr<InsetBase> MathTabularInset::clone() const
+auto_ptr<InsetBase> MathTabularInset::doClone() const
{
return auto_ptr<InsetBase>(new MathTabularInset(*this));
}
///
MathTabularInset(std::string const &, char valign, std::string const & halign);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
void maple(MapleStream &) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
std::string name_;
};
{}
-auto_ptr<InsetBase> MathTfracInset::clone() const
+auto_ptr<InsetBase> MathTfracInset::doClone() const
{
return auto_ptr<InsetBase>(new MathTfracInset(*this));
}
///
MathTfracInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
void mathmlize(MathMLStream &) const;
///
void validate(LaTeXFeatures & features) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
-auto_ptr<InsetBase> MathUndersetInset::clone() const
+auto_ptr<InsetBase> MathUndersetInset::doClone() const
{
return auto_ptr<InsetBase>(new MathUndersetInset(*this));
}
features.require("amsmath");
MathNestInset::validate(features);
}
-
/// Inset for underset
class MathUndersetInset : public MathFracbaseInset {
public:
- ///
- std::auto_ptr<InsetBase> clone() const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void normalize(NormalStream & ns) const;
///
void validate(LaTeXFeatures & features) const;
+private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif
{}
-auto_ptr<InsetBase> MathUnknownInset::clone() const
+auto_ptr<InsetBase> MathUnknownInset::doClone() const
{
return auto_ptr<InsetBase>(new MathUnknownInset(*this));
}
explicit MathUnknownInset(std::string const & name,
bool final = true, bool black = false);
///
- std::auto_ptr<InsetBase> clone() const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
bool final() const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
std::string name_;
/// are we finished creating the name?
{}
-auto_ptr<InsetBase> MathXArrowInset::clone() const
+auto_ptr<InsetBase> MathXArrowInset::doClone() const
{
return auto_ptr<InsetBase>(new MathXArrowInset(*this));
}
///
explicit MathXArrowInset(std::string const & name);
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
void draw(PainterInfo & pi, int x, int y) const;
///
void write(WriteStream & os) const;
void normalize(NormalStream & os) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
bool upper() const;
///
++column;
}
if (!asdefault)
- column += startTeXParParams(bparams, os,
+ column += startTeXParParams(bparams, os,
runparams.moving_arg);
}
ParIterator(DocIterator const &);
/// This really should be implemented...
- //void operator=(ParIterator const &);
+ //ParIterator & operator=(ParIterator const &);
///
ParIterator & operator++();
///
using lyx::support::strToInt;
using lyx::support::suffixIs;
+using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
+
using std::abs;
using std::endl;
using std::getline;
}
-bool getTokenValue(string const & str, const char * token, string & ret)
+bool getTokenValue(string const & str, char const * token, string & ret)
{
ret.erase();
size_t token_length = strlen(token);
}
-bool getTokenValue(string const & str, const char * token, int & num)
+bool getTokenValue(string const & str, char const * token, int & num)
{
string tmp;
num = 0;
}
-bool getTokenValue(string const & str, const char * token, LyXAlignment & num)
+bool getTokenValue(string const & str, char const * token, LyXAlignment & num)
{
string tmp;
return getTokenValue(str, token, tmp) && string2type(tmp, num);
}
-bool getTokenValue(string const & str, const char * token,
+bool getTokenValue(string const & str, char const * token,
LyXTabular::VAlignment & num)
{
string tmp;
}
-bool getTokenValue(string const & str, const char * token,
+bool getTokenValue(string const & str, char const * token,
LyXTabular::BoxType & num)
{
string tmp;
}
-bool getTokenValue(string const & str, const char * token, bool & flag)
+bool getTokenValue(string const & str, char const * token, bool & flag)
{
// set the flag always to false as this should be the default for bools
// not in the file-format.
}
-bool getTokenValue(string const & str, const char * token, LyXLength & len)
+bool getTokenValue(string const & str, char const * token, LyXLength & len)
{
// set the lenght to be zero() as default as this it should be if not
// in the file format.
/// Define a few methods for the inner structs
LyXTabular::cellstruct::cellstruct(BufferParams const & bp)
- : inset(bp)
-{
- cellno = 0;
- width_of_cell = 0;
- multicolumn = LyXTabular::CELL_NORMAL;
- alignment = LYX_ALIGN_CENTER;
- valignment = LYX_VALIGN_TOP;
- top_line = true;
- bottom_line = false;
- left_line = true;
- right_line = false;
- usebox = BOX_NONE;
- rotate = false;
+ : cellno(0),
+ width_of_cell(0),
+ multicolumn(LyXTabular::CELL_NORMAL),
+ alignment(LYX_ALIGN_CENTER),
+ valignment(LYX_VALIGN_TOP),
+ top_line(true),
+ bottom_line(false),
+ left_line(true),
+ right_line(false),
+ usebox(BOX_NONE),
+ rotate(false),
+ inset(new InsetText(bp))
+{}
+
+
+LyXTabular::cellstruct::cellstruct(cellstruct const & cs)
+ : cellno(cs.cellno),
+ width_of_cell(cs.width_of_cell),
+ multicolumn(cs.multicolumn),
+ alignment(cs.alignment),
+ valignment(cs.valignment),
+ top_line(cs.top_line),
+ bottom_line(cs.bottom_line),
+ left_line(cs.left_line),
+ right_line(cs.right_line),
+ usebox(cs.usebox),
+ rotate(cs.rotate),
+ align_special(cs.align_special),
+ p_width(cs.p_width),
+ inset(dynamic_cast<InsetText*>(cs.inset->clone().release()))
+{}
+
+
+LyXTabular::cellstruct &
+LyXTabular::cellstruct::operator=(cellstruct cs)
+{
+ swap(cs);
+ return *this;
+}
+
+
+void
+LyXTabular::cellstruct::swap(cellstruct & rhs)
+{
+ std::swap(cellno, rhs.cellno);
+ std::swap(width_of_cell, rhs.width_of_cell);
+ std::swap(multicolumn, rhs.multicolumn);
+ std::swap(alignment, rhs.alignment);
+ std::swap(valignment, rhs.valignment);
+ std::swap(top_line, rhs.top_line);
+ std::swap(bottom_line, rhs.bottom_line);
+ std::swap(left_line, rhs.left_line);
+ std::swap(right_line, rhs.right_line);
+ std::swap(usebox, rhs.usebox);
+ std::swap(rotate, rhs.rotate);
+ std::swap(align_special, rhs.align_special);
+ p_width.swap(rhs.p_width);
+ inset.swap(rhs.inset);
}
LyXTabular::rowstruct::rowstruct()
-{
- top_line = true;
- bottom_line = false;
- ascent_of_row = 0;
- descent_of_row = 0;
- endhead = false;
- endfirsthead = false;
- endfoot = false;
- endlastfoot = false;
- newpage = false;
-}
+ : ascent_of_row(0),
+ descent_of_row(0),
+ top_line(true),
+ bottom_line(false),
+ endhead(false),
+ endfirsthead(false),
+ endfoot(false),
+ endlastfoot(false),
+ newpage(false)
+{}
LyXTabular::columnstruct::columnstruct()
+ : alignment(LYX_ALIGN_CENTER),
+ valignment(LYX_VALIGN_TOP),
+ left_line(true),
+ right_line(false),
+ width_of_column(0)
{
- left_line = true;
- right_line = false;
- alignment = LYX_ALIGN_CENTER;
- valignment = LYX_VALIGN_TOP;
- width_of_column = 0;
}
LyXTabular::ltType::ltType()
-{
- topDL = false;
- bottomDL = false;
- empty = false;
-}
+ : topDL(false),
+ bottomDL(false),
+ empty(false)
+{}
LyXTabular::LyXTabular(BufferParams const & bp, int rows_arg, int columns_arg)
for (int j = 0; j < columns_; ++j) {
// When debugging it can be nice to set
// this to true.
- cell_info[i][j].inset.setDrawFrame(false);
+ cell_info[i][j].inset->setDrawFrame(false);
cell_info[i][j].cellno = cellno++;
}
cell_info[i].back().right_line = true;
}
-void LyXTabular::appendRow(BufferParams const & bp, int cell)
+void LyXTabular::appendRow(BufferParams const & bp, int const cell)
{
++rows_;
- int row = row_of_cell(cell);
+ int const row = row_of_cell(cell);
row_vector::iterator rit = row_info.begin() + row;
row_info.insert(rit, rowstruct());
if (bp.tracking_changes)
for (int j = 0; j < columns_; ++j)
- cell_info[row + 1][j].inset.markNew(true);
+ cell_info[row + 1][j].inset->markNew(true);
set_row_column_number_info();
}
-void LyXTabular::deleteRow(int row)
+void LyXTabular::deleteRow(int const row)
{
// Not allowed to delete last row
if (rows_ == 1)
}
-void LyXTabular::appendColumn(BufferParams const & bp, int cell)
+void LyXTabular::appendColumn(BufferParams const & bp, int const cell)
{
++columns_;
}
//++column;
for (int i = 0; i < rows_; ++i) {
- cell_info[i][column + 1].inset.clear(false);
+ cell_info[i][column + 1].inset->clear(false);
if (bp.tracking_changes)
- cell_info[i][column + 1].inset.markNew(true);
+ cell_info[i][column + 1].inset->markNew(true);
}
fixCellNums();
}
-void LyXTabular::deleteColumn(int column)
+void LyXTabular::deleteColumn(int const column)
{
// Not allowed to delete last column
if (columns_ == 1)
for (int column = 0; column < columns_; ++column) {
if (isPartOfMultiColumn(row,column))
continue;
- cell_info[row][column].inset.setAutoBreakRows(
+ cell_info[row][column].inset->setAutoBreakRows(
!getPWidth(getCellNumber(row, column)).zero());
}
}
}
-int LyXTabular::numberOfCellsInRow(int cell) const
+int LyXTabular::numberOfCellsInRow(int const cell) const
{
int const row = row_of_cell(cell);
int result = 0;
// returns 1 if there is a topline, returns 0 if not
-bool LyXTabular::topLine(int cell, bool onlycolumn) const
+bool LyXTabular::topLine(int const cell, bool const onlycolumn) const
{
if (!onlycolumn && isMultiColumn(cell))
return cellinfo_of_cell(cell).top_line;
for (int i = 0; i < rows_; ++i) {
int const cell = getCellNumber(i, j);
// because of multicolumns
- getCellInset(cell).setAutoBreakRows(!getPWidth(cell).zero());
+ getCellInset(cell)->setAutoBreakRows(!getPWidth(cell).zero());
}
}
return false;
cellinfo_of_cell(cell).p_width = width;
- getCellInset(cell).setAutoBreakRows(!width.zero());
+ getCellInset(cell)->setAutoBreakRows(!width.zero());
return true;
}
<< write_attribute("special", cell_info[i][j].align_special)
<< ">\n";
os << "\\begin_inset ";
- cell_info[i][j].inset.write(buf, os);
+ cell_info[i][j].inset->write(buf, os);
os << "\n\\end_inset\n"
<< "</cell>\n";
}
getTokenValue(line, "special", cell_info[i][j].align_special);
l_getline(is, line);
if (prefixIs(line, "\\begin_inset")) {
- cell_info[i][j].inset.read(buf, lex);
+ cell_info[i][j].inset->read(buf, lex);
l_getline(is, line);
}
if (!prefixIs(line, "</cell>")) {
for (int i = 1; i < number; ++i) {
cellstruct & cs1 = cellinfo_of_cell(cell + i);
cs1.multicolumn = CELL_PART_OF_MULTICOLUMN;
- cs.inset.appendParagraphs(buffer, cs1.inset.paragraphs());
- cs1.inset.clear(false);
+ cs.inset->appendParagraphs(buffer, cs1.inset->paragraphs());
+ cs1.inset->clear(false);
}
set_row_column_number_info();
}
int LyXTabular::TeXRow(ostream & os, int i, Buffer const & buf,
OutputParams const & runparams) const
{
- int ret = 0;
int cell = getCellNumber(i, 0);
- ret += TeXTopHLine(os, i);
+ int ret = TeXTopHLine(os, i);
for (int j = 0; j < columns_; ++j) {
if (isPartOfMultiColumn(i, j))
continue;
ret += TeXCellPreamble(os, cell);
- InsetText & inset = getCellInset(cell);
+ shared_ptr<InsetText> inset = getCellInset(cell);
- Paragraph & par = inset.paragraphs().front();
+ Paragraph const & par = inset->paragraphs().front();
bool rtl = par.isRightToLeftPar(buf.params())
&& !par.empty()
&& getPWidth(cell).zero();
if (rtl)
os << "\\R{";
- ret += inset.latex(buf, os, runparams);
+ ret += inset->latex(buf, os, runparams);
if (rtl)
os << '}';
for (int j = 0; j < columns_; ++j) {
if (isPartOfMultiColumn(i, j))
continue;
- InsetText & inset = getCellInset(cell);
+ shared_ptr<InsetText> inset = getCellInset(cell);
- ret += inset.linuxdoc(buf, os, runparams);
+ ret += inset->linuxdoc(buf, os, runparams);
if (isLastCellInRow(cell)) {
os << "@\n";
}
os << '>';
- ret += getCellInset(cell).docbook(buf, os, runparams);
+ ret += getCellInset(cell)->docbook(buf, os, runparams);
os << "</entry>\n";
++cell;
}
bool onlydata) const
{
ostringstream sstr;
- int ret = getCellInset(cell).plaintext(buf, sstr, runparams);
+ int const ret = getCellInset(cell)->plaintext(buf, sstr, runparams);
if (onlydata) {
os << sstr.str();
if (isMultiColumnReal(cell))
continue;
ostringstream sstr;
- getCellInset(cell).plaintext(buf, sstr, runparams);
+ getCellInset(cell)->plaintext(buf, sstr, runparams);
if (clen[j] < sstr.str().length())
clen[j] = sstr.str().length();
}
if (!isMultiColumnReal(cell) || isPartOfMultiColumn(i, j))
continue;
ostringstream sstr;
- getCellInset(cell).plaintext(buf, sstr, runparams);
+ getCellInset(cell)->plaintext(buf, sstr, runparams);
int len = int(sstr.str().length());
int const n = cells_in_multicolumn(cell);
for (int k = j; len > 0 && k < j + n - 1; ++k)
int cell = 0;
for (int i = 0; i < rows_; ++i) {
if (!onlydata && asciiTopHLine(os, i, clen))
- for (int j = 0; j < depth; ++j)
- os << " ";
+ os << string(depth * 2, ' ');
for (int j = 0; j < columns_; ++j) {
if (isPartOfMultiColumn(i, j))
continue;
}
os << endl;
if (!onlydata) {
- for (int j = 0; j < depth; ++j)
- os << " ";
+ os << string(depth * 2, ' ');
if (asciiBottomHLine(os, i, clen))
- for (int j = 0; j < depth; ++j)
- os << " ";
+ os << string(depth * 2, ' ');
}
}
return ret;
}
-InsetText & LyXTabular::getCellInset(int cell) const
+shared_ptr<InsetText> LyXTabular::getCellInset(int cell) const
{
return cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;
}
-InsetText & LyXTabular::getCellInset(int row, int column) const
+shared_ptr<InsetText> LyXTabular::getCellInset(int row, int column) const
{
return cell_info[row][column].inset;
}
}
for (int cell = 0, n = getNumberOfCells(); cell < n; ++cell)
- if (&getCellInset(cell) == inset) {
+ if (getCellInset(cell).get() == inset) {
lyxerr[Debug::INSETTEXT] << "LyXTabular::getCellFromInset: "
<< "cell=" << cell << endl;
return cell;
if (getVAlignment(cell) != LYX_VALIGN_TOP ||
(!getPWidth(cell).zero() && !isMultiColumn(cell)))
features.require("array");
- getCellInset(cell).validate(features);
+ getCellInset(cell)->validate(features);
}
}
{
for (int i = 0; i < rows_; ++i)
for (int j = 0; j < columns_; ++j)
- getCellInset(i, j).getLabelList(buffer, list);
+ getCellInset(i, j)->getLabelList(buffer, list);
}
LyXTabular::BoxType LyXTabular::useParbox(int cell) const
{
- ParagraphList const & parlist = getCellInset(cell).paragraphs();
+ ParagraphList const & parlist = getCellInset(cell)->paragraphs();
ParagraphList::const_iterator cit = parlist.begin();
ParagraphList::const_iterator end = parlist.end();
#include "lyxlength.h"
#include "insets/insettext.h"
+#include <boost/shared_ptr.hpp>
+
#include <iosfwd>
#include <vector>
///
// end longtable support
///
- InsetText & getCellInset(int cell) const;
+ boost::shared_ptr<InsetText> getCellInset(int cell) const;
///
- InsetText & getCellInset(int row, int column) const;
+ boost::shared_ptr<InsetText> getCellInset(int row, int column) const;
/// Search for \param inset in the tabular, with the
///
int getCellFromInset(InsetBase const * inset) const;
///
cellstruct(BufferParams const &);
///
+ cellstruct(cellstruct const &);
+ ///
+ cellstruct & operator=(cellstruct);
+ ///
+ void swap(cellstruct & rhs);
+ ///
int cellno;
///
int width_of_cell;
///
LyXLength p_width; // this is only set for multicolumn!!!
///
- InsetText inset;
+ boost::shared_ptr<InsetText> inset;
};
cellstruct & cellinfo_of_cell(int cell) const;
///