]> git.lyx.org Git - features.git/commitdiff
clone NVI, other small stuff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 23 Nov 2004 23:04:52 +0000 (23:04 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 23 Nov 2004 23:04:52 +0000 (23:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9295 a592a061-630c-0410-9148-cb99ea01b6c8

188 files changed:
src/ChangeLog
src/LColor.C
src/LColor.h
src/insets/ChangeLog
src/insets/inset.C
src/insets/inset.h
src/insets/insetbase.C
src/insets/insetbase.h
src/insets/insetbibitem.C
src/insets/insetbibitem.h
src/insets/insetbibtex.C
src/insets/insetbibtex.h
src/insets/insetbox.C
src/insets/insetbox.h
src/insets/insetbranch.C
src/insets/insetbranch.h
src/insets/insetcharstyle.C
src/insets/insetcharstyle.h
src/insets/insetcite.h
src/insets/insetenv.C
src/insets/insetenv.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetexternal.C
src/insets/insetexternal.h
src/insets/insetfloat.C
src/insets/insetfloat.h
src/insets/insetfloatlist.h
src/insets/insetfoot.C
src/insets/insetfoot.h
src/insets/insetgraphics.C
src/insets/insetgraphics.h
src/insets/insethfill.C
src/insets/insethfill.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetindex.h
src/insets/insetlabel.C
src/insets/insetlabel.h
src/insets/insetlatexaccent.C
src/insets/insetlatexaccent.h
src/insets/insetline.h
src/insets/insetmarginal.C
src/insets/insetmarginal.h
src/insets/insetnewline.h
src/insets/insetnote.C
src/insets/insetnote.h
src/insets/insetoptarg.C
src/insets/insetoptarg.h
src/insets/insetpagebreak.h
src/insets/insetquotes.C
src/insets/insetquotes.h
src/insets/insetref.h
src/insets/insetspace.C
src/insets/insetspace.h
src/insets/insetspecialchar.C
src/insets/insetspecialchar.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/insettheorem.C
src/insets/insettheorem.h
src/insets/insettoc.C
src/insets/insettoc.h
src/insets/inseturl.h
src/insets/insetvspace.C
src/insets/insetvspace.h
src/insets/insetwrap.C
src/insets/insetwrap.h
src/insets/render_base.h
src/insets/render_preview.h
src/lyxlength.h
src/mathed/ChangeLog
src/mathed/command_inset.C
src/mathed/command_inset.h
src/mathed/math_amsarrayinset.C
src/mathed/math_amsarrayinset.h
src/mathed/math_arrayinset.C
src/mathed/math_arrayinset.h
src/mathed/math_atom.C
src/mathed/math_atom.h
src/mathed/math_biginset.C
src/mathed/math_biginset.h
src/mathed/math_binominset.C
src/mathed/math_binominset.h
src/mathed/math_boldsymbolinset.C
src/mathed/math_boldsymbolinset.h
src/mathed/math_boxedinset.C
src/mathed/math_boxedinset.h
src/mathed/math_boxinset.C
src/mathed/math_boxinset.h
src/mathed/math_braceinset.C
src/mathed/math_braceinset.h
src/mathed/math_casesinset.C
src/mathed/math_casesinset.h
src/mathed/math_charinset.C
src/mathed/math_charinset.h
src/mathed/math_colorinset.C
src/mathed/math_colorinset.h
src/mathed/math_commentinset.C
src/mathed/math_commentinset.h
src/mathed/math_decorationinset.C
src/mathed/math_decorationinset.h
src/mathed/math_deliminset.C
src/mathed/math_deliminset.h
src/mathed/math_dfracinset.C
src/mathed/math_dfracinset.h
src/mathed/math_diffinset.C
src/mathed/math_diffinset.h
src/mathed/math_dotsinset.C
src/mathed/math_dotsinset.h
src/mathed/math_envinset.C
src/mathed/math_envinset.h
src/mathed/math_exfuncinset.C
src/mathed/math_exfuncinset.h
src/mathed/math_exintinset.C
src/mathed/math_exintinset.h
src/mathed/math_fboxinset.C
src/mathed/math_fboxinset.h
src/mathed/math_fontinset.C
src/mathed/math_fontinset.h
src/mathed/math_fontoldinset.C
src/mathed/math_fontoldinset.h
src/mathed/math_fracinset.C
src/mathed/math_fracinset.h
src/mathed/math_frameboxinset.C
src/mathed/math_frameboxinset.h
src/mathed/math_gridinset.C
src/mathed/math_gridinset.h
src/mathed/math_hullinset.C
src/mathed/math_hullinset.h
src/mathed/math_kerninset.C
src/mathed/math_kerninset.h
src/mathed/math_lefteqninset.C
src/mathed/math_lefteqninset.h
src/mathed/math_liminset.C
src/mathed/math_liminset.h
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_macroarg.C
src/mathed/math_macroarg.h
src/mathed/math_macrotemplate.C
src/mathed/math_macrotemplate.h
src/mathed/math_makeboxinset.C
src/mathed/math_makeboxinset.h
src/mathed/math_matrixinset.C
src/mathed/math_matrixinset.h
src/mathed/math_mboxinset.C
src/mathed/math_mboxinset.h
src/mathed/math_numberinset.C
src/mathed/math_numberinset.h
src/mathed/math_oversetinset.C
src/mathed/math_oversetinset.h
src/mathed/math_rootinset.C
src/mathed/math_rootinset.h
src/mathed/math_scriptinset.C
src/mathed/math_scriptinset.h
src/mathed/math_sizeinset.C
src/mathed/math_sizeinset.h
src/mathed/math_spaceinset.C
src/mathed/math_spaceinset.h
src/mathed/math_splitinset.C
src/mathed/math_splitinset.h
src/mathed/math_sqrtinset.C
src/mathed/math_sqrtinset.h
src/mathed/math_stackrelinset.C
src/mathed/math_stackrelinset.h
src/mathed/math_stringinset.C
src/mathed/math_stringinset.h
src/mathed/math_substackinset.C
src/mathed/math_substackinset.h
src/mathed/math_symbolinset.C
src/mathed/math_symbolinset.h
src/mathed/math_tabularinset.C
src/mathed/math_tabularinset.h
src/mathed/math_tfracinset.C
src/mathed/math_tfracinset.h
src/mathed/math_undersetinset.C
src/mathed/math_undersetinset.h
src/mathed/math_unknowninset.C
src/mathed/math_unknowninset.h
src/mathed/math_xarrowinset.C
src/mathed/math_xarrowinset.h
src/paragraph.C
src/pariterator.h
src/tabular.C
src/tabular.h

index f70d86ac623992bf5951ad28ecf928234f11e054..1d3e4d62527efc0a6bad08683b497439dc5b66af 100644 (file)
@@ -1,3 +1,18 @@
+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.
index 1642e4f6c35cd2f270f45792c7c4069997569467..b2f1ba545fb5cc54cacea464eac6d175d36df273 100644 (file)
@@ -160,10 +160,10 @@ LColor::~LColor()
 {}
 
 
-void LColor::operator=(LColor const & c)
+LColor & LColor::operator=(LColor tmp)
 {
-       LColor tmp(c);
        boost::swap(pimpl_, tmp.pimpl_);
+       return *this;
 }
 
 
index b410378dc23ba89e2439af64334c2590472bb70a..700bb66abaf0ac9269b2c32f07fc217ea39281f6 100644 (file)
@@ -189,7 +189,7 @@ public:
        ///
        ~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.
index 144237db5734c2afc60becb6aba5acbd6bf04167..eddd062b5be3ddeb5d9e8527347c3c9d96e46141 100644 (file)
@@ -1,3 +1,21 @@
+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.
 
@@ -43,7 +61,7 @@
 
 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>
 
@@ -64,7 +82,7 @@
        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>
 
index 1f6014002595ee05dd85830a1b494c3409255767..c467ebe6d2d344b0e3afa4bb136e18e3839b3549 100644 (file)
@@ -82,7 +82,7 @@ int InsetOld::scroll(bool) const
 }
 
 
-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);
index ece7a34e29bbc6c15c954a89b6bc9b10ddd1c097..11fd79bfe19234e497eed0652dfdb40d849722d0 100644 (file)
@@ -34,8 +34,6 @@ public:
        ///
        InsetOld();
        ///
-       InsetOld(InsetOld const & in);
-       ///
        int ascent() const;
        ///
        int descent() const;
@@ -58,12 +56,16 @@ public:
        ///
        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
@@ -78,10 +80,10 @@ private:
  *  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
index f40b4d52a777b35d0c5266c63ffb2ad3654af1a8..9968f41d7323ea0507f686a4e199b06fdb8e180f 100644 (file)
@@ -103,6 +103,14 @@ TranslatorMap const build_translator()
 } // namespace anon
 
 
+InsetBase::InsetBase()
+{}
+
+
+InsetBase::InsetBase(InsetBase const &)
+{}
+
+
 InsetBase::Code InsetBase::translate(std::string const & name)
 {
        static TranslatorMap const translator = build_translator();
index d87ac7c15a96ddae2fb8a22e4215d985d3b5e4b8..adb1bd09447583abb1a5fb6dc7286ca3d60e6526 100644 (file)
 #ifndef INSETBASE_H
 #define INSETBASE_H
 
+#include <boost/assert.hpp>
+
 #include <string>
+#include <typeinfo>
 #include <vector>
 #include <memory>
 
@@ -61,7 +64,13 @@ public:
        /// 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; }
@@ -351,9 +360,6 @@ public:
         *  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; }
@@ -376,6 +382,13 @@ public:
        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;
 };
 
 
index 2e74ad680349874207d70066b11cfc98ce041f06..f90e68efecb184f8281d98fd1ed9c51f0119ac1d 100644 (file)
@@ -47,7 +47,7 @@ InsetBibitem::InsetBibitem(InsetCommandParams const & p)
 }
 
 
-auto_ptr<InsetBase> InsetBibitem::clone() const
+auto_ptr<InsetBase> InsetBibitem::doClone() const
 {
        auto_ptr<InsetBibitem> b(new InsetBibitem(params()));
        b->setCounter(counter);
index b05d22fe4ac1aefbc4038683c28dbd0094b34f5e..b91d9f01590cb0d7228e3506d43b1060300037e8 100644 (file)
@@ -24,8 +24,6 @@ class InsetBibitem : public InsetCommand {
 public:
        ///
        InsetBibitem(InsetCommandParams const &);
-       ///
-       std::auto_ptr<InsetBase> clone() const;
        /** Currently \bibitem is used as a LyX2.x command,
            so we need this method.
        */
@@ -53,6 +51,8 @@ protected:
        ///
        virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
+
        ///
        int counter;
        ///
index dd21b522cbccc44ea96468ddebd656c81f2f9d01..22c3886751c26fd60fcbcb94aa7b47573346528d 100644 (file)
@@ -62,7 +62,7 @@ InsetBibtex::InsetBibtex(InsetCommandParams const & p)
 {}
 
 
-std::auto_ptr<InsetBase> InsetBibtex::clone() const
+std::auto_ptr<InsetBase> InsetBibtex::doClone() const
 {
        return std::auto_ptr<InsetBase>(new InsetBibtex(*this));
 }
index 0a7cbf7093a71798a37cca582c9a118b35bb216a..1ab4d856944001767fe902377a6a6a2b70de51ef 100644 (file)
@@ -23,8 +23,6 @@ public:
        ///
        InsetBibtex(InsetCommandParams const &);
        ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
        std::string const getScreenLabel(Buffer const &) const;
        ///
        EDITABLE editable() const { return IS_EDITABLE; }
@@ -47,8 +45,10 @@ public:
        ///
        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
index f93283ad24742059107792264bf1620b942467e2..e1836d5e23d3b3731aea90124f572ff14cb36685 100644 (file)
@@ -104,7 +104,7 @@ InsetBox::~InsetBox()
 }
 
 
-auto_ptr<InsetBase> InsetBox::clone() const
+auto_ptr<InsetBase> InsetBox::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetBox(*this));
 }
index 49281cbdf86b208af8b127617c1e4f193f82dbc6..a29ac78520a7451f2fb71d2575087da4d0b37fa5 100644 (file)
@@ -56,13 +56,9 @@ class InsetBox : public InsetCollapsable {
 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; }
@@ -104,11 +100,13 @@ public:
                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();
        ///
index 4803d186e308b8d0ce85703f63bf349ec85f7572..d199b7ce06c5b39030c64a4fa249eae727ef49c2 100644 (file)
@@ -60,7 +60,7 @@ InsetBranch::~InsetBranch()
 }
 
 
-auto_ptr<InsetBase> InsetBranch::clone() const
+auto_ptr<InsetBase> InsetBranch::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetBranch(*this));
 }
index 4cb870a15516c4a09af7e03fdab54b70683650e8..f0c002ba05fbf2c3bb787693b97bf8b74c93bdc3 100644 (file)
@@ -37,13 +37,9 @@ class InsetBranch : public InsetCollapsable {
 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; }
@@ -80,11 +76,13 @@ public:
        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();
        ///
index 1cf5be9773cac86da79ab4ec89947186b4194cab..9d8e51eb43cca743245898c31c6133a8daf37fc6 100644 (file)
@@ -72,7 +72,7 @@ InsetCharStyle::InsetCharStyle(InsetCharStyle const & in)
 }
 
 
-auto_ptr<InsetBase> InsetCharStyle::clone() const
+auto_ptr<InsetBase> InsetCharStyle::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetCharStyle(*this));
 }
@@ -122,13 +122,13 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
        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);
@@ -142,16 +142,16 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
                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());
        }
 }
@@ -191,7 +191,7 @@ bool InsetCharStyle::getStatus(LCursor & cur, FuncRequest const & cmd,
                case LFUN_BREAKPARAGRAPH_SKIP:
                        status.enabled(false);
                        return true;
-                       
+
                default:
                        return InsetCollapsable::getStatus(cur, cmd, status);
                }
index d9c5405fc21c9d2cf219ebf29f251d14534fa493..c926e0ccf19c7b46682dcdca2feb561311c32ed3 100644 (file)
@@ -44,10 +44,6 @@ class InsetCharStyle : public InsetCollapsable {
 public:
        ///
        InsetCharStyle(BufferParams const &, CharStyles::iterator);
-       /// Copy constructor
-       InsetCharStyle(InsetCharStyle const &);
-       ///
-       virtual std::auto_ptr<InsetBase> clone() const;
        ///
        std::string const editMessage() const;
        ///
@@ -81,15 +77,16 @@ public:
        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();
        ///
index fd90c887fca04c1e5379d75ca2ab062d767e2d2d..aa2b742ffe558c9b78f3d03531a78acdd0e6dea1 100644 (file)
@@ -25,10 +25,6 @@ public:
        ///
        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; }
@@ -46,6 +42,11 @@ public:
        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;
 
index 5980ab9aedaa0d40540568eccbf90dcd14397a84..478d2a9f359ba1940387330a5e2638404f7342f0 100644 (file)
@@ -41,7 +41,7 @@ InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
 {}
 
 
-auto_ptr<InsetBase> InsetEnvironment::clone() const
+auto_ptr<InsetBase> InsetEnvironment::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetEnvironment(*this));
 }
index ae5b231862a2cb30114b17428d93288d3679350b..3385a4cda0ed9e28c59998dd26ec039e2f3be900 100644 (file)
@@ -21,14 +21,10 @@ public:
        ///
        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 &,
@@ -45,8 +41,10 @@ public:
             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_;
 };
index 0804464617dd81988cfbec05993f1d09f2f2611d..f8de91372a2ac4ce9777ca660b936ab2cabd888e 100644 (file)
@@ -72,7 +72,7 @@ InsetERT::InsetERT(InsetERT const & in)
 }
 
 
-auto_ptr<InsetBase> InsetERT::clone() const
+auto_ptr<InsetBase> InsetERT::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetERT(*this));
 }
@@ -250,7 +250,7 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd,
                case LFUN_UNDERLINE:
                        status.enabled(false);
                        return true;
-                       
+
                default:
                        return InsetCollapsable::getStatus(cur, cmd, status);
                }
index 2c1a84e1d2ed0f21e0225d1ab8eafead7d72ba9b..9cb08225e3e4f485a78bb711e73c0ffaac62b27a 100644 (file)
@@ -32,10 +32,6 @@ public:
        ///
        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);
        ///
@@ -73,11 +69,13 @@ public:
        ///
        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();
        ///
index b4548c62501c2d17680b1ce274221969e4645035..33e477c44d95ba653d2e00285d5b0ec3df30df30 100644 (file)
@@ -415,7 +415,7 @@ InsetExternal::InsetExternal(InsetExternal const & other)
 {}
 
 
-auto_ptr<InsetBase> InsetExternal::clone() const
+auto_ptr<InsetBase> InsetExternal::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetExternal(*this));
 }
index c2e38d952961f1ea96bff91291a64e850cf66be2..34901ec1d76be4de6da0be035909bd72fc47f40e 100644 (file)
@@ -105,12 +105,8 @@ class InsetExternal : public InsetOld, public boost::signals::trackable
 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; }
@@ -150,9 +146,12 @@ public:
        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.
         */
index 41d7dffe8efacbc9138ddca60c4f13ed1fdbbaba..156bd62f704add00bc919f28cebb4aa24cce67b5 100644 (file)
@@ -271,7 +271,7 @@ void InsetFloat::validate(LaTeXFeatures & features) const
 }
 
 
-auto_ptr<InsetBase> InsetFloat::clone() const
+auto_ptr<InsetBase> InsetFloat::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetFloat(*this));
 }
index 633d0a75330087d20e321948541b1ef4a254adc6..a5b4867fba1f76860e04e80554a4ebccf5a77753 100644 (file)
@@ -51,8 +51,6 @@ public:
        ///
        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 &,
@@ -84,6 +82,8 @@ public:
 protected:
        virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
+
        ///
        InsetFloatParams params_;
 };
index 197b2dc18285b1ff20f21d9289e91d8233d39f43..c257013f7c5a0173db6448a6032f21c06cd52106 100644 (file)
@@ -24,10 +24,6 @@ public:
        ///
        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; }
@@ -53,6 +49,11 @@ public:
                  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
index 409a0107e28c60b018b0e20b174b0294041c06d3..0ed4db0936ad0cca6a193579f68fcf816d5eb102 100644 (file)
@@ -45,7 +45,7 @@ InsetFoot::InsetFoot(InsetFoot const & in)
 }
 
 
-auto_ptr<InsetBase> InsetFoot::clone() const
+auto_ptr<InsetBase> InsetFoot::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetFoot(*this));
 }
index e99370063d8d67c86fb238138cbc5debf7d34170..821b7c51418c6ad78ff36c7d6fc1341ecf0972f1 100644 (file)
@@ -23,10 +23,6 @@ public:
        ///
        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 &,
@@ -36,6 +32,10 @@ public:
                    OutputParams const & runparams) const;
        ///
        std::string const editMessage() const;
+protected:
+       InsetFoot(InsetFoot const &);
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 017ab2a5c69fddd1fb135b0db3d2b66b0487eb42..8fd76dee93867838e51e13197e5def442620afa4 100644 (file)
@@ -167,7 +167,7 @@ InsetGraphics::InsetGraphics(InsetGraphics const & ig)
 }
 
 
-auto_ptr<InsetBase> InsetGraphics::clone() const
+auto_ptr<InsetBase> InsetGraphics::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetGraphics(*this));
 }
index 2e8535c65f79986ce1ac2c5de463f0f33c28d422..2a552da5116fa6095a87f46cc3ae6f982121cf2c 100644 (file)
@@ -29,8 +29,6 @@ public:
        ///
        InsetGraphics();
        ///
-       InsetGraphics(InsetGraphics const &);
-       ///
        ~InsetGraphics();
        ///
        void metrics(MetricsInfo &, Dimension &) const;
@@ -65,9 +63,6 @@ public:
        /// 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.
        */
@@ -82,12 +77,14 @@ public:
        ///
        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);
 
index 0e43c963f4876a1c3058caacc1bd579dcbb7ea57..32e4bb40bdc9446a451deb26914559d11daeb599 100644 (file)
@@ -22,7 +22,7 @@ InsetHFill::InsetHFill()
 {}
 
 
-std::auto_ptr<InsetBase> InsetHFill::clone() const
+std::auto_ptr<InsetBase> InsetHFill::doClone() const
 {
        return std::auto_ptr<InsetBase>(new InsetHFill);
 }
index 2d21203a12ea819fa7d61a5cacceea7c929b1bdb..3a670743a36bd50e71647ca11379936e639e563d 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        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; }
@@ -46,7 +44,8 @@ public:
        /// 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
index befd4eb611a20706808907b07af941a44edc47be..cb9a12c09a972d3221b56078038c95627ddaa43d 100644 (file)
@@ -226,7 +226,7 @@ void InsetInclude::set(InsetCommandParams const & p, Buffer const & buffer)
 }
 
 
-auto_ptr<InsetBase> InsetInclude::clone() const
+auto_ptr<InsetBase> InsetInclude::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetInclude(*this));
 }
index b0aae9d27f52fea1a0665a2f289445abebc3b288..3e140a22f7c66fb13cc1f3ad1b23ab7aacea9015 100644 (file)
@@ -28,12 +28,8 @@ class InsetInclude: public InsetOld {
 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;
        ///
@@ -82,9 +78,12 @@ public:
        ///
        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.
         */
index 997ec4a76a4551a41b51ec7376f1c2f93129ec9b..78842a281aa1cf6cef8c8cdeb5cf9e65fbe19491 100644 (file)
@@ -24,10 +24,6 @@ public:
        ///
        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; }
@@ -36,6 +32,10 @@ public:
        ///
        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()));
+       }
 };
 
 
@@ -43,10 +43,6 @@ class InsetPrintIndex : public InsetCommand {
 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;
        ///
@@ -57,6 +53,10 @@ public:
        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
index c8e7c0c7f4aaf9be57d084e5f925ca2c261bc839..7e19d69bd22c4286dc8295eb69d9ece91a9f1add 100644 (file)
@@ -40,7 +40,7 @@ InsetLabel::InsetLabel(InsetCommandParams const & p)
 {}
 
 
-std::auto_ptr<InsetBase> InsetLabel::clone() const
+std::auto_ptr<InsetBase> InsetLabel::doClone() const
 {
        return std::auto_ptr<InsetBase>(new InsetLabel(params()));
 }
index 3d18632c0de63aa6a41b149179e459778e244a57..8ea8190e2ff1d60062a324c267aa139c8e2b62fc 100644 (file)
@@ -19,8 +19,6 @@ public:
        ///
        InsetLabel(InsetCommandParams const &);
        ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
        std::string const getScreenLabel(Buffer const &) const;
        ///
        EDITABLE editable() const { return IS_EDITABLE; }
@@ -41,8 +39,9 @@ public:
        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
index 95a3ffc3de8ebb5ad4bb5773c54125aa1aed69eb..33f6d6ad585da3f420a4060409e1e3a36a3ea3b8 100644 (file)
@@ -49,7 +49,7 @@ InsetLatexAccent::InsetLatexAccent(string const & str)
 }
 
 
-auto_ptr<InsetBase> InsetLatexAccent::clone() const
+auto_ptr<InsetBase> InsetLatexAccent::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetLatexAccent(contents));
 }
index 09f6748c8849de2da6a4b1a6217320a4effd7f62..854fdb5f785c31674c24054cd8e957a613a2de81 100644 (file)
@@ -60,8 +60,6 @@ public:
        ///
        bool directWrite() const;
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        InsetOld::Code lyxCode()const;
        ///
        inline bool canDisplay();
@@ -118,6 +116,9 @@ public:
        };
 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();
        ///
index 9e5fb6c1871d1eb004415040348b7e1148b4ac35..504854f8afac4b1271eb98ca567c0a0d72f91e1a 100644 (file)
@@ -20,10 +20,6 @@ public:
 
        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;
@@ -51,6 +47,11 @@ public:
        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
index e46838c06e78c61dfc7da8acfdb42cf864a29c29..9147236c8b72e5eefffdb926e0550d6547c58045 100644 (file)
@@ -40,7 +40,7 @@ InsetMarginal::InsetMarginal(InsetMarginal const & in)
 }
 
 
-auto_ptr<InsetBase> InsetMarginal::clone() const
+auto_ptr<InsetBase> InsetMarginal::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetMarginal(*this));
 }
index bc51d737569f16d3534b7885f419eebaab8d18d4..36d395d4092495cd39aeb32b8c96f4bb2dcdcb2b 100644 (file)
@@ -24,16 +24,16 @@ public:
        ///
        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
index e3b3879609d2c666be2edde0eaef61ebe9910dd7..8f9589c7af977c15525a41031b2b4fa82ddbdcf0 100644 (file)
@@ -20,10 +20,6 @@ public:
 
        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;
@@ -50,6 +46,11 @@ public:
        /// 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
index 3be5403fb54ccff288c0a69101b7009932e47a06..ec0eb9018d6dc8a1b3c0e8a99f5fe6c5f113a7ee 100644 (file)
@@ -123,7 +123,7 @@ InsetNote::~InsetNote()
 }
 
 
-auto_ptr<InsetBase> InsetNote::clone() const
+auto_ptr<InsetBase> InsetNote::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetNote(*this));
 }
index 65d05ce4cc9a65464bcdb2365d7394a8f4ce60f4..9f46783116bf8668e1e19b3d2a667ce558812daa 100644 (file)
@@ -39,13 +39,9 @@ class InsetNote : public InsetCollapsable {
 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; }
@@ -74,11 +70,14 @@ public:
        ///
        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();
        ///
index 9c2d88c75a1761655d53a814adcbbf6753dfd78a..6b889fd726c74141f2e78636ec03fbf3a8b6471c 100644 (file)
@@ -45,7 +45,7 @@ InsetOptArg::InsetOptArg(InsetOptArg const & in)
 }
 
 
-auto_ptr<InsetBase> InsetOptArg::clone() const
+auto_ptr<InsetBase> InsetOptArg::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetOptArg(*this));
 }
index 0b2deee38b8adde7f5615562214530b4d80bca3e..2dc95bc4710812fd0f3bbc20a6b7d2c62ee7402f 100644 (file)
@@ -24,9 +24,6 @@ class InsetOptArg : public InsetCollapsable {
 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
@@ -40,6 +37,10 @@ public:
                          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
index bbcda7852249c38bfcce86acb5cb97ee7a7c095e..ca0440cdebbe3115bb8ca0f4b97658917a051dab 100644 (file)
@@ -20,10 +20,6 @@ public:
 
        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;
@@ -49,6 +45,11 @@ public:
        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
index ffbe7286c4cd20219d48aa5ab88dc944c9186ad1..3b548cd69da21aa0734d42f2755bf7064712d578 100644 (file)
@@ -365,7 +365,7 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
 }
 
 
-auto_ptr<InsetBase> InsetQuotes::clone() const
+auto_ptr<InsetBase> InsetQuotes::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetQuotes(language_, side_, times_));
 }
index f8d453b98360d3f1de34763d3dac71afe13adb90..c88dfeb8bfb0ed703617de97e493ca94e88a8106 100644 (file)
@@ -70,8 +70,6 @@ public:
        /// 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;
@@ -103,6 +101,8 @@ public:
        bool isChar() const { return true; }
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
+
        ///
        quote_language language_;
        ///
index 239d3317f0e748514a8bcb304d0a83f1aae2a6ea..f5fcd2bc7793e4d8711fc6340916cdda060b7bc2 100644 (file)
@@ -35,12 +35,6 @@ public:
 
        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;
        ///
@@ -64,9 +58,14 @@ public:
        ///
        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;
 };
index 11cc7925e14f87bf62556a4b40e53632059deaa0..ef95d15d79f5bb2c17ed6da3edd3102aa4b7d431 100644 (file)
@@ -255,7 +255,7 @@ int InsetSpace::docbook(Buffer const &, ostream & os,
 }
 
 
-auto_ptr<InsetBase>  InsetSpace::clone() const
+auto_ptr<InsetBase> InsetSpace::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetSpace(kind_));
 }
index eb87db4acb36172949632383a10c49139a8eb9f6..cd9d813f868590aa714ca8fa11ac53c08845e045 100644 (file)
@@ -73,8 +73,6 @@ public:
        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; }
@@ -87,6 +85,8 @@ public:
        // a line separator)?
        bool isSpace() const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
+
        /// And which kind is this?
        Kind kind_;
 };
index c9ea76abe57ac075718fedc1e171cd0802afc1be..528abb78bbb92a46cd0812290f3d47359ae84f71 100644 (file)
@@ -243,7 +243,7 @@ int InsetSpecialChar::docbook(Buffer const &, ostream & os,
 }
 
 
-auto_ptr<InsetBase> InsetSpecialChar::clone() const
+auto_ptr<InsetBase> InsetSpecialChar::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetSpecialChar(kind_));
 }
index 2dadf74798c05c9b2967ec5ed328d85c0b053fde..6f6c607518d49ad59d4b950166718eb2fa287f06 100644 (file)
@@ -65,8 +65,6 @@ public:
        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; }
@@ -80,6 +78,8 @@ public:
        // 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_;
 };
index 77560cc055fd586611695d172bbe874ecb0cf9c2..f283968386aeb035c042749a3b25e124306c7fd3 100644 (file)
@@ -46,6 +46,8 @@ using lyx::support::ltrim;
 using lyx::support::strToInt;
 using lyx::support::strToDbl;
 
+using boost::shared_ptr;
+
 using std::auto_ptr;
 using std::endl;
 using std::max;
@@ -170,7 +172,7 @@ InsetTabular::~InsetTabular()
 }
 
 
-auto_ptr<InsetBase> InsetTabular::clone() const
+auto_ptr<InsetBase> InsetTabular::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetTabular(*this));
 }
@@ -239,7 +241,7 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
                        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);
@@ -288,7 +290,7 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
                                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;
@@ -475,7 +477,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
 
        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);
@@ -487,7 +489,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
 
        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);
@@ -499,7 +501,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
 
        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) {
@@ -516,7 +518,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
 
        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) {
@@ -584,7 +586,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
        // 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;
@@ -603,7 +605,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                if (tablemode(cur))
                        cutSelection(cur);
                else
-                       cell(cur.idx()).dispatch(cur, cmd);
+                       cell(cur.idx())->dispatch(cur, cmd);
                break;
 
        case LFUN_COPY:
@@ -645,7 +647,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
 
                        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) {
@@ -654,13 +656,13 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                                        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;
@@ -671,7 +673,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                        }
                        // 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
@@ -688,12 +690,12 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                        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;
        }
 
@@ -878,7 +880,7 @@ bool InsetTabular::getStatus(LCursor & cur, FuncRequest const & cmd,
 
        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);
        }
 }
 
@@ -893,7 +895,7 @@ int InsetTabular::latex(Buffer const & buf, ostream & os,
 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);
 }
 
@@ -941,13 +943,13 @@ void InsetTabular::validate(LaTeXFeatures & features) const
 }
 
 
-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);
 }
@@ -955,7 +957,7 @@ InsetText & InsetTabular::cell(int 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);
 }
 
 
@@ -972,13 +974,13 @@ InsetBase * InsetTabular::setPos(LCursor & cur, int x, int y) const
                }
        }
        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;
 
@@ -1026,7 +1028,7 @@ void InsetTabular::moveNextCell(LCursor & cur)
        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));
@@ -1052,7 +1054,7 @@ void InsetTabular::movePrevCell(LCursor & cur)
 {
        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);
@@ -1176,8 +1178,8 @@ void InsetTabular::tabularFeatures(LCursor & cur,
        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;
 
@@ -1517,8 +1519,8 @@ bool InsetTabular::pasteSelection(LCursor & cur)
 {
        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) {
@@ -1536,9 +1538,9 @@ bool InsetTabular::pasteSelection(LCursor & cur)
                                --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;
@@ -1555,7 +1557,7 @@ void InsetTabular::cutSelection(LCursor & cur)
        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();
@@ -1602,21 +1604,21 @@ size_t InsetTabular::nargs() const
 
 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();
@@ -1643,7 +1645,7 @@ bool InsetTabular::insertAsciiString(BufferView & bv, string const & buf,
        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) {
@@ -1678,7 +1680,7 @@ bool InsetTabular::insertAsciiString(BufferView & bv, string const & buf,
        }
 
        string::size_type op = 0;
-       int cells = loctab->getNumberOfCells();
+       int const cells = loctab->getNumberOfCells();
        p = 0;
        cols = ocol;
        rows = loctab->rows();
@@ -1693,10 +1695,10 @@ bool InsetTabular::insertAsciiString(BufferView & bv, string const & buf,
                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;
                        }
@@ -1704,10 +1706,10 @@ bool InsetTabular::insertAsciiString(BufferView & bv, string const & buf,
                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;
@@ -1720,10 +1722,10 @@ bool InsetTabular::insertAsciiString(BufferView & bv, string const & buf,
        }
        // 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;
 }
@@ -1735,7 +1737,7 @@ void InsetTabular::addPreview(PreviewLoader & loader) const
        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);
        }
 }
 
index ec48c8ae6b2a864b2f346c06c53a4df3d1cfd18b..54e279e3d2ce14a1475b2041ef95b742401fefab 100644 (file)
@@ -50,12 +50,8 @@ public:
        ///
        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;
@@ -66,7 +62,7 @@ public:
        ///
        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
@@ -90,7 +86,7 @@ public:
        ///
        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;
        ///
@@ -107,9 +103,9 @@ public:
        /// 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;
 
@@ -141,11 +137,14 @@ public:
        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;
index ba6feb7617bebfc96a5168a871c7f8b84bf349dc..7ac46bc85cec9ae305a90d4df7cc7b9de9fce6fa 100644 (file)
@@ -59,6 +59,9 @@ using lyx::graphics::PreviewLoader;
 using lyx::support::isStrUnsignedInt;
 using lyx::support::strToUnsignedInt;
 
+using boost::bind;
+using boost::ref;
+
 using std::endl;
 using std::for_each;
 using std::max;
@@ -83,33 +86,22 @@ InsetText::InsetText(BufferParams const & bp)
 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;
 }
 
@@ -118,10 +110,8 @@ void InsetText::clear(bool just_mark_erased)
 {
        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;
        }
 
@@ -135,7 +125,7 @@ void InsetText::clear(bool just_mark_erased)
 }
 
 
-auto_ptr<InsetBase> InsetText::clone() const
+auto_ptr<InsetBase> InsetText::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetText(*this));
 }
@@ -336,7 +326,7 @@ int InsetText::plaintext(Buffer const & buf, ostream & os,
        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;
 }
 
@@ -360,7 +350,7 @@ int InsetText::docbook(Buffer const & buf, ostream & os,
 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)));
 }
 
 
@@ -409,8 +399,9 @@ void InsetText::markNew(bool track_changes)
 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);
 }
 
 
@@ -476,15 +467,15 @@ void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
 // 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));
 }
 
 
index fe4e93230c6c5cd591632dc497479584f3064109..65b1f6ded1a076cf1a250440e06cfbf2f951f517 100644 (file)
@@ -41,13 +41,7 @@ public:
        ///
        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);
        ///
@@ -79,7 +73,7 @@ public:
        ///
        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;
        ///
@@ -143,9 +137,12 @@ public:
        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 &);
        ///
index 9f1ee9f0a023ccf97ffa404393e4c370e895b8dc..92e1f7789fd04867b51138ae802e29e247350b13 100644 (file)
@@ -56,7 +56,7 @@ void InsetTheorem::write(Buffer const * buf, ostream & os) const
 }
 
 
-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)
index ce91284428c9d06323760bcd56f0d744d3a07e50..b4e00a9d736d7a437a199f5bdf60b460b6dcf084 100644 (file)
@@ -25,8 +25,6 @@ public:
        ///
        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;
@@ -38,6 +36,8 @@ public:
        ///
        string const editMessage() const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
+
        ///
        mutable unsigned int center_indent_;
 };
index fa91fa2855a4c72efbe7d4cd3b2eaaa4fd9d0932..c109646a39ab9d6bd200817a7070212b46a258cb 100644 (file)
@@ -30,7 +30,7 @@ InsetTOC::InsetTOC(InsetCommandParams const & p)
 {}
 
 
-std::auto_ptr<InsetBase> InsetTOC::clone() const
+std::auto_ptr<InsetBase> InsetTOC::doClone() const
 {
        return std::auto_ptr<InsetBase>(new InsetTOC(*this));
 }
index 98813a7f1ad706e0d7254b91cbd59342f022a588..2adb8a447264bec93a1dfa370af3c6ec77a05e52 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        explicit InsetTOC(InsetCommandParams const &);
        ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
        std::string const getScreenLabel(Buffer const &) const;
        ///
        EDITABLE editable() const { return IS_EDITABLE; }
@@ -39,6 +37,8 @@ public:
        ///
        int docbook(Buffer const &, std::ostream &,
                    OutputParams const &) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 3f30120b32c75cd80054121c21168b58e40c1506..24f55a846c85cf26878cb2bb922af681aae3a45c 100644 (file)
@@ -25,10 +25,6 @@ public:
        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;
@@ -50,6 +46,10 @@ public:
        ///
        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
index 5946dd70e26f6cf58b4dfe07fe9ba0091fba01c9..368d1a259bcebb2f1024cf1b45667e08af543224 100644 (file)
@@ -54,7 +54,7 @@ InsetVSpace::~InsetVSpace()
 }
 
 
-std::auto_ptr<InsetBase> InsetVSpace::clone() const
+std::auto_ptr<InsetBase> InsetVSpace::doClone() const
 {
        return std::auto_ptr<InsetBase>(new InsetVSpace(*this));
 }
index b7e0ef444654c51fe54995a7c6add6a4159d373f..e12046ece0ac1159dcdf59636d311d75d3fc69f5 100644 (file)
@@ -26,8 +26,6 @@ public:
        ///
        ~InsetVSpace();
        ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
@@ -57,6 +55,8 @@ protected:
        virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
+       
        ///
        VSpace space_;
 };
index 0fa0ad530662f96fc65587b104ad53a4d70f6fe5..60f264e69bf9a6455940c4f6ba06c0aac20215a6 100644 (file)
@@ -169,7 +169,7 @@ void InsetWrap::validate(LaTeXFeatures & features) const
 }
 
 
-auto_ptr<InsetBase> InsetWrap::clone() const
+auto_ptr<InsetBase> InsetWrap::doClone() const
 {
        return auto_ptr<InsetBase>(new InsetWrap(*this));
 }
index bfd3f59c01bd639403f21f9f9e68e4f496b3e5a7..7ed0dc42a5e5a0986547b412bc225eb522f29af5 100644 (file)
@@ -47,8 +47,6 @@ public:
        ///
        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 &,
@@ -70,6 +68,8 @@ protected:
        ///
        virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
+
        ///
        InsetWrapParams params_;
 };
index 23a5e9af4394dff47cf791e4bc51cbd6ce1ec43d..ba9221fbf70830cd9023afeb45692d7d8b62a3b4 100644 (file)
@@ -45,7 +45,7 @@ public:
 protected:
        RenderBase() {}
        RenderBase(RenderBase const &) {}
-       void operator=(RenderBase const &) {}
+       RenderBase & operator=(RenderBase const &) { return *this; }
 
        /// Cached
        mutable Dimension dim_;
index 46ebf16cdbb836af5aa1e316eaded22d63008256..b525f8633111150bf70b4f867f82a47e31a13709 100644 (file)
@@ -84,7 +84,7 @@ public:
 
 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 &);
index 2b0f33e6a7584a7978647ead66416f0ceb3f794f..78416cbefd35de1b9b281b30f5044440a0dd7b6b 100644 (file)
@@ -53,6 +53,12 @@ public:
        /// "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;
        ///
index c640f2015fd3d4ddfdc94083bcf1ee831575a071..5bd6636eb1a0686132813074aacfacbf249f58d8 100644 (file)
@@ -1,3 +1,13 @@
+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
index 076dfd34b9a08e80471a16eee64cb5f6fc48398d..3e4c7f4055c802baea836ed0de1c8cfce77bdb04 100644 (file)
@@ -30,7 +30,7 @@ CommandInset::CommandInset(string const & name)
 }
 
 
-auto_ptr<InsetBase> CommandInset::clone() const
+auto_ptr<InsetBase> CommandInset::doClone() const
 {
        return auto_ptr<InsetBase>(new CommandInset(*this));
 }
index ffec6a762545dbc52ba8c4c2cb22575900ddac9a..b0de073df565ac55419f8a303c6b176dca587c27 100644 (file)
@@ -24,8 +24,6 @@ public:
        ///
        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;
@@ -40,6 +38,8 @@ public:
        ///
        std::string const & commandname() const { return name_; }
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
+
        ///
        std::string name_;
        ///
index 6fdca3e708c506c3b696f7143b19f6df61e091b0..448fd152a7c8da7915aff71611e0f0d347ace590 100644 (file)
@@ -30,7 +30,7 @@ MathAMSArrayInset::MathAMSArrayInset(string const & name)
 {}
 
 
-auto_ptr<InsetBase> MathAMSArrayInset::clone() const
+auto_ptr<InsetBase> MathAMSArrayInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathAMSArrayInset(*this));
 }
index 87c64ee868ef346879e3a4ee29cd5314cac78b87..6185a6c2a5fb0664690ae27474193d13b0373e58 100644 (file)
@@ -23,8 +23,6 @@ public:
        ///
        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;
@@ -39,6 +37,7 @@ public:
        void normalize(NormalStream &) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        char const * name_left() const;
        ///
index 28dc9e9569dd349089858719912270d19b912f33..1e1554d45cdcb6391fbb3e7d0139ac57efabdfa2 100644 (file)
@@ -69,7 +69,7 @@ MathArrayInset::MathArrayInset(string const & name, string const & str)
 }
 
 
-auto_ptr<InsetBase> MathArrayInset::clone() const
+auto_ptr<InsetBase> MathArrayInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathArrayInset(*this));
 }
index dbd9fe3bc035b5aa70429a703d351c8c8375ef49..a61e7c036b3609b50bcf8e223bf02b6a988f3d4e 100644 (file)
@@ -28,8 +28,6 @@ public:
        /// 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;
@@ -48,6 +46,7 @@ public:
        void maple(MapleStream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        std::string name_;
 };
index bd5cda75be3aec9bbe5a9d2be7819ba77e7e862a..4b8259f1ff75e08b2f0906ac643ddd28a2100b54 100644 (file)
@@ -34,12 +34,13 @@ MathAtom::MathAtom(MathAtom const & at)
 }
 
 
-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;
 }
 
 
index 37553df1edd0540fd253794f9f31536f9baeb17a..e4e2ce99a4811c809f2868286e62c6d15d5449b6 100644 (file)
@@ -55,7 +55,7 @@ public:
        /// 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_; }
index c259c4cafa0550a55f5d19a7d26d94e892210083..ade63c123b3c9671fcb3e54c6be67ed3021e3e15 100644 (file)
@@ -25,7 +25,7 @@ MathBigInset::MathBigInset(string const & name, string const & delim)
 {}
 
 
-auto_ptr<InsetBase> MathBigInset::clone() const
+auto_ptr<InsetBase> MathBigInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathBigInset(*this));
 }
index df6899e234ff7fb78bf20c30a96b88a6055a2ab3..f9547cc469e848e58f9ab8b32db861eac4580f09 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        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;
@@ -33,6 +31,7 @@ public:
        void normalize(NormalStream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        size_type size() const;
        ///
index 7e3016271ab553e174d64965977a972678d3b443..7e89c8f3f3a2c3f886eae54607c2cbe0d6bdd0ff 100644 (file)
@@ -25,7 +25,7 @@ MathBinomInset::MathBinomInset(bool choose)
 {}
 
 
-auto_ptr<InsetBase> MathBinomInset::clone() const
+auto_ptr<InsetBase> MathBinomInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathBinomInset(*this));
 }
index ee2703c8cda3f1cd16717b91caad7557b1946266..08a8985765661edd8bb3328ddb4f29796bfbfcaa 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        explicit MathBinomInset(bool choose = false);
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        void write(WriteStream & os) const;
        ///
        void normalize(NormalStream &) const;
@@ -31,6 +29,7 @@ public:
        ///
        void draw(PainterInfo &, int x, int y) const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        int dw() const;
        ///
index c17b3ff7918ddc134d4fcf5bc47f36afaab566d7..fc847197e4032c57f95bfce58329ebe28ee7a21f 100644 (file)
@@ -24,7 +24,7 @@ MathBoldsymbolInset::MathBoldsymbolInset()
 {}
 
 
-auto_ptr<InsetBase> MathBoldsymbolInset::clone() const
+auto_ptr<InsetBase> MathBoldsymbolInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathBoldsymbolInset(*this));
 }
index 489a122345712694a4c8545c14275b6ff0eac597..cb5a6eb046fa5d1acecf7f4406e594c7bc1a2a33 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        MathBoldsymbolInset();
        ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
@@ -36,6 +34,8 @@ public:
        void write(WriteStream & os) const;
        ///
        void infoize(std::ostream & os) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index df4f2a112d0fe831ef3e7dbb98f72d49ae8476aa..d16e4b169ced7fb9705815d5e9a61c85dd96dc97 100644 (file)
@@ -29,7 +29,7 @@ MathBoxedInset::MathBoxedInset()
 {}
 
 
-auto_ptr<InsetBase> MathBoxedInset::clone() const
+auto_ptr<InsetBase> MathBoxedInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathBoxedInset(*this));
 }
@@ -74,4 +74,3 @@ void MathBoxedInset::validate(LaTeXFeatures & features) const
 {
        features.require("amsmath");
 }
-
index f41510f976c3f91ce1643426e2e04b5672ea5dd5..c87ade2aab14bfc0aba8fafc3c52a44e0ef7bb2a 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        MathBoxedInset();
        ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
        void validate(LaTeXFeatures & features) const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
@@ -34,6 +32,8 @@ public:
        void normalize(NormalStream & ns) const;
        ///
        void infoize(std::ostream & os) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 10e070c8b75dc492f3a13e573db64790695eb6e1..a5af582e8cfdaeac15de34ccc322569a43243128 100644 (file)
@@ -25,7 +25,7 @@ MathBoxInset::MathBoxInset(string const & name)
 {}
 
 
-auto_ptr<InsetBase> MathBoxInset::clone() const
+auto_ptr<InsetBase> MathBoxInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathBoxInset(*this));
 }
index eef210737b4197dda787f48f67e676b32c7fa365..df9bcd6cff566150af7de2c64c57f5f4620fe020 100644 (file)
@@ -26,8 +26,6 @@ public:
        ///
        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;
@@ -41,6 +39,7 @@ public:
        void infoize(std::ostream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        std::string name_;
 };
index a23154cb2b9fed7cb735ed196e775df710ebadd9..fe63f1b8b90989af49ed2b57a3451a7384b992b5 100644 (file)
@@ -33,7 +33,7 @@ MathBraceInset::MathBraceInset(MathArray const & ar)
 }
 
 
-auto_ptr<InsetBase> MathBraceInset::clone() const
+auto_ptr<InsetBase> MathBraceInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathBraceInset(*this));
 }
index 29bfd2524bcaeef80f8d5893fba6a89da9efe468..c6c0af1747a9594a19e54b9c0f7180f1addc0d98 100644 (file)
@@ -23,8 +23,6 @@ public:
        ///
        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; }
@@ -46,6 +44,8 @@ public:
        void mathmlize(MathMLStream &) const;
        ///
        void infoize(std::ostream & os) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index eaea9c43f5a54ff17d27443113fbfb82ffe614ce..fc1b3316282e2503228fbf399d5b13d7f7aa4522 100644 (file)
@@ -25,7 +25,7 @@ MathCasesInset::MathCasesInset(row_type n)
 {}
 
 
-auto_ptr<InsetBase> MathCasesInset::clone() const
+auto_ptr<InsetBase> MathCasesInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathCasesInset(*this));
 }
index 9ee1fa1a8a69b6d0e2d131088593f9648f21b9f8..cb93c6c41a088148f49aae40795941ad76226c4d 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        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;
@@ -38,6 +36,8 @@ public:
        void write(WriteStream & os) const;
        ///
        void validate(LaTeXFeatures & features) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 8578aa81486d7eec75be2960c4da77436dd69d2b..2f64372ee7b6fe1302dabcc7673605fbbbf02b84 100644 (file)
@@ -51,7 +51,7 @@ MathCharInset::MathCharInset(char c)
 
 
 
-auto_ptr<InsetBase> MathCharInset::clone() const
+auto_ptr<InsetBase> MathCharInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathCharInset(*this));
 }
index 76a1feab001a61fb5476971bf6ae88a0504ad211..7c63e71dc013b3f9c1722e02c52820dd914f63e0 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        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;
@@ -47,6 +45,7 @@ public:
        bool isRelOp() const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// the character
        char char_;
        /// cached width
index 5a87a63f8501f03ca1abb569607505252c49957c..4c48ea074560b866186a0dbd6290cc0a92c53172 100644 (file)
@@ -28,7 +28,7 @@ MathColorInset::MathColorInset(bool oldstyle)
 {}
 
 
-auto_ptr<InsetBase> MathColorInset::clone() const
+auto_ptr<InsetBase> MathColorInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathColorInset(*this));
 }
index 3f16f4e6d43e36508d1ff5c6c7d9da15ec7adfdf..604fb08098782eb77f1a6a4767d196c37ff787ed 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        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; }
@@ -37,6 +35,7 @@ public:
        ///
        void infoize(std::ostream & os) const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// width of '[' in current font
        mutable int w_;
        ///
index 0d82240115b5cfaf26b62020e601fc85c537d308..790871ccbe1204683796be45d5e66d7bf47b6699 100644 (file)
@@ -32,7 +32,7 @@ MathCommentInset::MathCommentInset(string const & str)
 }
 
 
-auto_ptr<InsetBase> MathCommentInset::clone() const
+auto_ptr<InsetBase> MathCommentInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathCommentInset(*this));
 }
index b08df8860c20c2dc47fd9fa16b248a454e106346..509ae0c6610b6d8ea48ebb864dea41377c345028 100644 (file)
@@ -25,8 +25,6 @@ public:
        ///
        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;
@@ -47,5 +45,7 @@ public:
        void mathmlize(MathMLStream &) const;
        ///
        void infoize(std::ostream & os) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 #endif
index 25dd231ca4ab8fe5679d1dd8f2c111c24e9ba69e..d824ba585de89981c42a8aadcd4a1315c1a8461a 100644 (file)
@@ -32,7 +32,7 @@ MathDecorationInset::MathDecorationInset(latexkeys const * key)
 }
 
 
-auto_ptr<InsetBase> MathDecorationInset::clone() const
+auto_ptr<InsetBase> MathDecorationInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathDecorationInset(*this));
 }
index 37f8df1893d6a29a667656f24523beb2bd836fad..f6ede8de733cedbd930592aaf7807df8686d9d09 100644 (file)
@@ -24,8 +24,6 @@ public:
        ///
        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;
@@ -39,6 +37,7 @@ public:
        bool isScriptable() const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        bool upper() const;
        ///
index 549ea335a354ec57fb90f44b858ace755074fdd4..ee5dc03f933bb832fed5826b7b6bf50c6ad567d4 100644 (file)
@@ -64,7 +64,7 @@ MathDelimInset::MathDelimInset
 }
 
 
-auto_ptr<InsetBase> MathDelimInset::clone() const
+auto_ptr<InsetBase> MathDelimInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathDelimInset(*this));
 }
index 5a59875854a53cd5af423638f6f705f8fa8415ab..23955f8d009aff28b945cb2221a0e5626a1e24e1 100644 (file)
@@ -26,8 +26,6 @@ public:
        ///
        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; }
@@ -61,6 +59,7 @@ public:
        ///
        std::string right_;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        mutable int dw_;
 };
index 33e3095735ea2eb3f262d5de108e1bd37b188dc3..3b0c76d2800997b8405bdb96fc28b41d1f4eaeba 100644 (file)
@@ -28,7 +28,7 @@ MathDfracInset::MathDfracInset()
 {}
 
 
-auto_ptr<InsetBase> MathDfracInset::clone() const
+auto_ptr<InsetBase> MathDfracInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathDfracInset(*this));
 }
index e1c91202f30c57d41cf7dc192f49b4c72f94d864..1a24b1b5e616ae0077b071cf18c864b5f7e2aa2b 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        MathDfracInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo &, int x, int y) const;
@@ -32,6 +30,8 @@ public:
        void mathmlize(MathMLStream &) const;
        ///
        void validate(LaTeXFeatures & features) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 3d32081793a735a3b3a6936d4138a08ac3b38d9b..4b7cdac9ff933f1f2fe8721dd5880cd20018fb60 100644 (file)
@@ -24,7 +24,7 @@ MathDiffInset::MathDiffInset()
 {}
 
 
-auto_ptr<InsetBase> MathDiffInset::clone() const
+auto_ptr<InsetBase> MathDiffInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathDiffInset(*this));
 }
index 4eaeaf44f90b393301fc8bd3e9d4e6090927063b..b25140ec4a170e373bcafa8cd0bfb2cd4ef979ae 100644 (file)
@@ -21,9 +21,7 @@
 class MathDiffInset : public MathNestInset {
 public:
        ///
-       explicit MathDiffInset();
-       ///
-       virtual std::auto_ptr<InsetBase> clone() const;
+       MathDiffInset();
        ///
        void addDer(MathArray const & der);
        ///
@@ -41,6 +39,8 @@ public:
        void mathmlize(MathMLStream &) const;
        ///
        void write(WriteStream & os) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 8ab3afe6feec3c4f4b2d737091087297c96cef60..1c7b4ff3a97f9f9ee94dca7cd2b90685b7aeb7c5 100644 (file)
@@ -26,7 +26,7 @@ MathDotsInset::MathDotsInset(latexkeys const * key)
 {}
 
 
-auto_ptr<InsetBase> MathDotsInset::clone() const
+auto_ptr<InsetBase> MathDotsInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathDotsInset(*this));
 }
index 79f5cef64feef086064a735658f1c11339063df8..90cd39ade86ab74b25c5f58e170913184b25b3a4 100644 (file)
@@ -23,8 +23,6 @@ public:
        ///
        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;
@@ -35,5 +33,7 @@ protected:
        mutable int dh_;
        ///
        latexkeys const * key_;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 #endif
index d0a282f1e794e75b45114fc7e6d79dbacaf80183..14942be2b16635486096c4a8afbb1590d5a4cf5f 100644 (file)
@@ -26,7 +26,7 @@ MathEnvInset::MathEnvInset(string const & name)
 {}
 
 
-auto_ptr<InsetBase> MathEnvInset::clone() const
+auto_ptr<InsetBase> MathEnvInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathEnvInset(*this));
 }
index 27bc2365d2906a4de59ea659f477b5d8cb670ea2..ab32bda5e6da01a31977084d615e03f7d25ed480 100644 (file)
@@ -23,8 +23,6 @@ public:
        ///
        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;
@@ -36,6 +34,7 @@ public:
        void infoize(std::ostream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// name of that environment
        std::string name_;
 };
index b6e5d609218b059a64d2c0d25dfa6864ff77a73a..1655e7fd958052f7fab5ed9d3b8dcc607e88a0ff 100644 (file)
@@ -33,7 +33,7 @@ MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar)
 }
 
 
-auto_ptr<InsetBase> MathExFuncInset::clone() const
+auto_ptr<InsetBase> MathExFuncInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathExFuncInset(*this));
 }
index 222cb482cc8e0ca9efdf30e0f7ef8e3fb297f1f6..d999d9af0dd6d2e43dd40887ba88fa83030a9a2c 100644 (file)
@@ -28,8 +28,6 @@ public:
        ///
        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;
@@ -48,6 +46,7 @@ public:
        void octave(OctaveStream &) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        std::string const name_;
 };
index e41dad31346ccb8ff075bd239999bab548313280..bd4afb918a8c1c933056fbdd26419a6981656855 100644 (file)
@@ -35,7 +35,7 @@ MathExIntInset::MathExIntInset(string const & name)
 // 3 - upper
 
 
-auto_ptr<InsetBase> MathExIntInset::clone() const
+auto_ptr<InsetBase> MathExIntInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathExIntInset(*this));
 }
index b1e11d8814fd0c9fe85b5f8d2e2104f0ddc20be5..8047fe21c86ae45656b19c2e92e67a87febc10cf 100644 (file)
@@ -27,8 +27,6 @@ public:
        ///
        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;
@@ -48,6 +46,7 @@ public:
        ///
        void write(WriteStream & os) const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        bool hasScripts() const;
 
index 33ab17d14f3e2f87645890ff9c60bf05a6d2dd44..6fbbb38c8b5d0d185578b011f87a2fbed30ad083 100644 (file)
@@ -28,7 +28,7 @@ MathFboxInset::MathFboxInset()
 {}
 
 
-auto_ptr<InsetBase> MathFboxInset::clone() const
+auto_ptr<InsetBase> MathFboxInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathFboxInset(*this));
 }
@@ -75,4 +75,3 @@ void MathFboxInset::infoize(std::ostream & os) const
 {
        os << "FBox: ";
 }
-
index 215eaf4cda14020f02041cbcee7cdd1c6d041526..405a7c5b2782c6abc02829f6b3a742b539ed212c 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        MathFboxInset();
        ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
        mode_type currentMode() const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
@@ -34,6 +32,8 @@ public:
        void normalize(NormalStream & ns) const;
        ///
        void infoize(std::ostream & os) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index b4ad80771cd9858be080f9e46211bd66c2d190a6..4a72b3110213926bdcebb96da92b9f49fc195b86 100644 (file)
@@ -26,7 +26,7 @@ MathFontInset::MathFontInset(latexkeys const * key)
 {}
 
 
-auto_ptr<InsetBase> MathFontInset::clone() const
+auto_ptr<InsetBase> MathFontInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathFontInset(*this));
 }
index 5174823b0435ab38c55385dbb159f797a1cb69bf..efe6ce2033b032db71660a79ffd2f48c80dfb3c8 100644 (file)
@@ -23,8 +23,6 @@ public:
        ///
        explicit MathFontInset(latexkeys const * key);
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        MathFontInset * asFontInset() { return this; }
        ///
        MathFontInset const * asFontInset() const { return this; }
@@ -46,6 +44,7 @@ public:
        void infoize(std::ostream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// the font to be used on screen
        latexkeys const * key_;
 };
index 6b2a27174be1f5a2fe937986f92472e7d68839cd..e339c27ac3a2c668cb0441cfd3447eb3abc82809 100644 (file)
@@ -27,7 +27,7 @@ MathFontOldInset::MathFontOldInset(latexkeys const * key)
 }
 
 
-auto_ptr<InsetBase> MathFontOldInset::clone() const
+auto_ptr<InsetBase> MathFontOldInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathFontOldInset(*this));
 }
index 09a0df3baa81f83525968da10f957f2d7cc078a7..0db0702c1ecca171d0caeb8e4dcd38c9ca575ecd 100644 (file)
@@ -22,8 +22,6 @@ class MathFontOldInset : public MathNestInset {
 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...
@@ -44,6 +42,7 @@ public:
        void infoize(std::ostream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// the font to be used on screen
        latexkeys const * key_;
 };
index b694d72fe117a26e798080362cc9a36b8555597a..829ddf5134d26a178fbf029a431059fbd61e16b3 100644 (file)
@@ -29,7 +29,7 @@ MathFracInset::MathFracInset(bool atop)
 {}
 
 
-auto_ptr<InsetBase> MathFracInset::clone() const
+auto_ptr<InsetBase> MathFracInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathFracInset(*this));
 }
index 90ea9c9fd755026bb7c5d378b6861ff1e3c6353b..2707fe8cc0c9d4b1034f46695fd9848660e5fec9 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        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;
@@ -49,8 +47,9 @@ public:
        ///
        void mathmlize(MathMLStream &) const;
 public:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
-       const bool atop_;
+       bool const atop_;
 };
 
 #endif
index 805e217cf55a277ead93cd9354be2e097a5a96a8..bb6badd6bb7590b1404052c1f5fa8de8f591ccd3 100644 (file)
@@ -25,7 +25,7 @@ MathFrameboxInset::MathFrameboxInset()
 {}
 
 
-auto_ptr<InsetBase> MathFrameboxInset::clone() const
+auto_ptr<InsetBase> MathFrameboxInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathFrameboxInset(*this));
 }
index e7adbdd52fe3ff536f0ce8120a6f18cdbacf1f5e..7c7ea77b00d7f9356cf0a2c491d79ff56f1774e4 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        MathFrameboxInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
@@ -33,6 +31,7 @@ public:
        ///
        mode_type currentMode() const { return TEXT_MODE; }
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// width of '[' in current font
        mutable int w_;
 };
index 07325ab759e092b8b6ec9002c1f97a227476ef7c..dd25e080413667743dbd78d1087b63fe3c532756 100644 (file)
@@ -186,7 +186,7 @@ MathGridInset::~MathGridInset()
 }
 
 
-auto_ptr<InsetBase> MathGridInset::clone() const
+auto_ptr<InsetBase> MathGridInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathGridInset(*this));
 }
index 225051b7f2a70bc0521665d702c15bdbad08a88d..52ff62a52bb78caf092b5671ddfdeea115a2c8cc 100644 (file)
@@ -20,7 +20,6 @@
  *  This is the base to all grid-like editable math objects
  */
 class MathGridInset : public MathNestInset {
-
 public:
 
        /// additional per-cell information
@@ -94,8 +93,6 @@ public:
        /// Ensures that the dialog is closed.
        ~MathGridInset();
        ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
        void metrics(MetricsInfo & mi) const;
        ///
        void metrics(MetricsInfo & mi, Dimension &) const;
@@ -238,6 +235,8 @@ public:
        std::vector<CellInfo> cellinfo_;
        ///
        char v_align_; // add approp. type
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 94674cdb14027dd0fe55cc72389cf193f2887921..7bf1b7903e08f88daae19c92dfd8a85f28ea3428 100644 (file)
@@ -158,21 +158,23 @@ MathHullInset::~MathHullInset()
 {}
 
 
-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;
 }
 
 
@@ -1355,7 +1357,7 @@ int MathHullInset::docbook(Buffer const & buf, ostream & os,
                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());
 
@@ -1373,23 +1375,23 @@ int MathHullInset::docbook(Buffer const & buf, ostream & os,
                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(), "&", "&amp;"), "<", "&lt;");
                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;
 }
index 4d50f5e9a60a7fe343115944ddf7c5049d64aea1..8f6d205d50d5eebbaf8f0223d93eb33ec1bb32d8 100644 (file)
@@ -26,13 +26,9 @@ public:
        ///
        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;
        ///
@@ -122,8 +118,10 @@ public:
 
 
 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;
@@ -131,6 +129,7 @@ protected:
        std::string eolString(row_type row, bool fragile) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        void setType(std::string const & type);
        ///
index a7ac65c906f124264e7f5b7ae44bca37938ec561..b07c8eee1e60ae6a2583d961f0ac9b76ff12fa5a 100644 (file)
@@ -34,7 +34,7 @@ MathKernInset::MathKernInset(string const & s)
 {}
 
 
-auto_ptr<InsetBase> MathKernInset::clone() const
+auto_ptr<InsetBase> MathKernInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathKernInset(*this));
 }
index 3a3de3b7c45210e37e7867fb7c293fc16b7d824e..48d50638b817ea07a3ef28e8f410b66bb4313c50 100644 (file)
@@ -28,8 +28,6 @@ public:
        ///
        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;
@@ -38,6 +36,7 @@ public:
        ///
        void normalize(NormalStream & ns) const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// width in em
        LyXLength wid_;
 };
index fd2c691a3ff54fdf80e9142ee2da7a59d584b3d1..46771075a9dfc11bfef616edb983709084d390e9 100644 (file)
@@ -24,7 +24,7 @@ MathLefteqnInset::MathLefteqnInset()
 {}
 
 
-auto_ptr<InsetBase> MathLefteqnInset::clone() const
+auto_ptr<InsetBase> MathLefteqnInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathLefteqnInset(*this));
 }
index 71a5ae71ec063f422640e42377e5d71960b45586..d5fe40ee6b2ffc05daa3cae46eb8b4ca4d0a8176 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        MathLefteqnInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        std::string name() const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
@@ -31,5 +29,7 @@ public:
        void draw(PainterInfo & pi, int x, int y) const;
        ///
        void infoize(std::ostream & os) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 #endif
index 79712556cf26ee623614467acc90dbb10cea08ab..c86c4741fced4a025a6fd5f3275a98a62f8961b2 100644 (file)
@@ -29,7 +29,7 @@ MathLimInset::MathLimInset
 }
 
 
-auto_ptr<InsetBase> MathLimInset::clone() const
+auto_ptr<InsetBase> MathLimInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathLimInset(*this));
 }
index cd9d2579c53660e7c6c2490667a5201e1a9a6d8e..fb246ddea77a464cfff507836c4f9985a5406dc4 100644 (file)
@@ -23,8 +23,6 @@ public:
        ///
        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;
@@ -39,6 +37,8 @@ public:
        void mathmlize(MathMLStream &) const;
        ///
        void write(WriteStream & os) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index f1e1f495e79c65f3e572988eeaec8fa818a4f98d..10a2286c1878829e32ac1dae9cda4430056bc291 100644 (file)
@@ -33,7 +33,7 @@ MathMacro::MathMacro(string const & name, int numargs)
 {}
 
 
-auto_ptr<InsetBase> MathMacro::clone() const
+auto_ptr<InsetBase> MathMacro::doClone() const
 {
        return auto_ptr<InsetBase>(new MathMacro(*this));
 }
index 28a184aa68ee99aa9bb4dd08100bbc78e0ad2378..2a3637578f4bf3f26b8b86ea8080d0de97065441 100644 (file)
@@ -25,8 +25,6 @@ public:
        /// 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;
@@ -52,6 +50,7 @@ public:
        void infoize2(std::ostream &) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        void updateExpansion() const;
        ///
index 777bb5c94cf3403667a641aa93b32fa0317d1717..d4b7adf986cd0dca92b9ab8669874e06b1b6e796 100644 (file)
@@ -35,7 +35,7 @@ MathMacroArgument::MathMacroArgument(size_t n)
 }
 
 
-auto_ptr<InsetBase> MathMacroArgument::clone() const
+auto_ptr<InsetBase> MathMacroArgument::doClone() const
 {
        return auto_ptr<InsetBase>(new MathMacroArgument(*this));
 }
index d7d763d878a1e74eb949921b80b8e20c2ed93afc..0db549d7abe84662ab89c25afb29523a5329b7d9 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        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;
@@ -38,6 +36,7 @@ public:
        void write(WriteStream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// A number between 1 and 9
        std::size_t number_;
        ///
index c0b869b985f0becf435601e640dd12dbd0ead14e..d4051c66983e08cc439f47bc5274551c6a11868b 100644 (file)
@@ -64,7 +64,7 @@ MathMacroTemplate::MathMacroTemplate(std::istream & is)
 }
 
 
-auto_ptr<InsetBase> MathMacroTemplate::clone() const
+auto_ptr<InsetBase> MathMacroTemplate::doClone() const
 {
        return auto_ptr<InsetBase>(new MathMacroTemplate(*this));
 }
index ff888046ae90db9dfc281692d6e7ad6be13faf12..54ff52f3174f6b04f2c211741d344c8cd99c1fbf 100644 (file)
@@ -31,8 +31,6 @@ public:
        ///
        explicit MathMacroTemplate(std::istream & is);
        ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
        void edit(LCursor & cur, bool left);
        ///
        EDITABLE editable() const { return HIGHLY_EDITABLE; }
@@ -62,6 +60,7 @@ public:
        InsetBase::Code lyxCode() const { return MATHMACRO_CODE; }
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// prefix in inset
        std::string prefix() const;
 
index 9c16adc0ce0135233cd986ace365e7efea18dd75..a3d6d4b480b07b0a1875c6ff541c3089b38063b2 100644 (file)
@@ -25,7 +25,7 @@ MathMakeboxInset::MathMakeboxInset()
 {}
 
 
-auto_ptr<InsetBase> MathMakeboxInset::clone() const
+auto_ptr<InsetBase> MathMakeboxInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathMakeboxInset(*this));
 }
index b6e8a8d58266e432797f521a5ae3b12193974e2b..5ddf3618e38547fd018e225817bc4b23630914f9 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        MathMakeboxInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
@@ -36,6 +34,7 @@ public:
        ///
        void infoize(std::ostream & os) const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// width of '[' in current font
        mutable int w_;
 };
index f1343b47362f52326f42b1c13c21dc6d57cbf230..bbd3f17bfee905ea8f640daefb2d1043048e6957 100644 (file)
@@ -22,7 +22,7 @@ MathMatrixInset::MathMatrixInset(MathGridInset const & p)
 {}
 
 
-auto_ptr<InsetBase> MathMatrixInset::clone() const
+auto_ptr<InsetBase> MathMatrixInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathMatrixInset(*this));
 }
index 027c18a2c3ca5f45065d59c67d49f9bbd4db2ffe..43b58cba337379100cc16252e1d69b8fbb0246e9 100644 (file)
 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; }
 
@@ -40,6 +38,8 @@ public:
        void mathmlize(MathMLStream &) const;
        ///
        void octave(OctaveStream &) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index c3f090db000e8d73283536517af0225100c483c9..43ddc1823b3dddca3d4c1b9f632e6c4ec256b6f2 100644 (file)
@@ -40,7 +40,7 @@ MathMBoxInset::MathMBoxInset(BufferView & bv)
 }
 
 
-auto_ptr<InsetBase> MathMBoxInset::clone() const
+auto_ptr<InsetBase> MathMBoxInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathMBoxInset(*this));
 }
index 9a8be27272e2f4d2f4381cbf107c92d5435fa501..a7199541c7ba961b7eb35fbe3bc3f871bbf60a56 100644 (file)
@@ -21,9 +21,7 @@
 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
@@ -50,6 +48,8 @@ protected:
        mutable LyXText text_;
        ///
        BufferView * const bv_;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 01ffcf170f4e749e2e1473ce1aa6fcefd182fa8a..30647cf3c57b9de3d10ad04ed453b43e43b01f41 100644 (file)
@@ -25,7 +25,7 @@ MathNumberInset::MathNumberInset(string const & s)
 {}
 
 
-auto_ptr<InsetBase> MathNumberInset::clone() const
+auto_ptr<InsetBase> MathNumberInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathNumberInset(*this));
 }
index fc9ed67070804c1f6a2363d3d14cee0851c16abc..c936b8d034470317feb64e575a24442f7a4869ed 100644 (file)
@@ -23,8 +23,6 @@ public:
        ///
        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;
@@ -45,6 +43,7 @@ public:
        void write(WriteStream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// the number as string
        std::string str_;
 };
index 1d8a8ee8f3d0b580b833b5005ec6e4e117c35afd..ed4670407bdd501d8f47efe493b9fe37e250f020 100644 (file)
@@ -21,7 +21,7 @@ using std::max;
 using std::auto_ptr;
 
 
-auto_ptr<InsetBase> MathOversetInset::clone() const
+auto_ptr<InsetBase> MathOversetInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathOversetInset(*this));
 }
@@ -84,4 +84,3 @@ void MathOversetInset::validate(LaTeXFeatures & features) const
        features.require("amsmath");
        MathNestInset::validate(features);
 }
-
index c7f0a4c30b889681c1c974a51504abc9557c76fd..f73ac6149b6c541a538bfad6b7db742509ca459a 100644 (file)
@@ -18,8 +18,6 @@
 /// Inset for overset
 class MathOversetInset : public MathFracbaseInset {
 public:
-       ///
-       std::auto_ptr<InsetBase> clone() const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
@@ -34,6 +32,8 @@ public:
        void normalize(NormalStream &) const;
        ///
        void validate(LaTeXFeatures & features) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 85025a1add6a931df12584d86266bac323fa0120..646cbfa789a443f618b7d3405c3f27e791eac714 100644 (file)
@@ -29,7 +29,7 @@ MathRootInset::MathRootInset()
 {}
 
 
-auto_ptr<InsetBase> MathRootInset::clone() const
+auto_ptr<InsetBase> MathRootInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathRootInset(*this));
 }
index 025304b3340947e48c034011a3c01e8bfb2f0625..19e762930023b28433fb49f7410ea5b9add59387 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        MathRootInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        bool idxUpDown(LCursor & cur, bool up) const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
@@ -40,6 +38,8 @@ public:
        void maple(MapleStream &) const;
        ///
        void octave(OctaveStream &) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index bb6cbe81e5d1614dde158443191df094c1912190..55f9a6159af2d0be1f4bdb1379aaadbddaa3c3b0 100644 (file)
@@ -47,8 +47,7 @@ MathScriptInset::MathScriptInset(MathAtom const & at, bool up)
 }
 
 
-
-auto_ptr<InsetBase> MathScriptInset::clone() const
+auto_ptr<InsetBase> MathScriptInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathScriptInset(*this));
 }
index 3855f6f251a9564556a8255ca2dc87cacda6ea30..fc853613eadceda3b7521e3c485f780129ce1627 100644 (file)
@@ -28,8 +28,6 @@ public:
        /// 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;
@@ -103,6 +101,7 @@ protected:
        ///
        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
index 49966d2292aabeca201cfadd124471bd30418ed0..7bed06ea227d51762f7bd61101dd589dabd5a4db 100644 (file)
@@ -29,7 +29,7 @@ MathSizeInset::MathSizeInset(latexkeys const * l)
 {}
 
 
-auto_ptr<InsetBase> MathSizeInset::clone() const
+auto_ptr<InsetBase> MathSizeInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathSizeInset(*this));
 }
index 2ec061a0e36e2e169160cdea75838583d2d76e0a..5847ac1f1f2dd7edd8befadea99d831435bc2865 100644 (file)
@@ -23,8 +23,6 @@ class MathSizeInset : public MathNestInset {
 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; }
        ///
@@ -38,8 +36,8 @@ public:
        void normalize(NormalStream &) const;
        ///
        void infoize(std::ostream & os) const;
-
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        latexkeys const * key_;
        ///
index a3599f655bbc3de57a98c14749ad164e54cdb377..411903116b5395ff6a48dfdc38df62037e7f94a5 100644 (file)
@@ -46,7 +46,7 @@ MathSpaceInset::MathSpaceInset(string const & name)
 }
 
 
-auto_ptr<InsetBase> MathSpaceInset::clone() const
+auto_ptr<InsetBase> MathSpaceInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathSpaceInset(*this));
 }
index d43d384a5f272667272c1b0b6dc8118def38d815..c6fad086d4a618d470f974d2fdf4da04a795f30a 100644 (file)
@@ -23,8 +23,6 @@ public:
        ///
        explicit MathSpaceInset(std::string const & name);
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        MathSpaceInset const * asSpaceInset() const { return this; }
        ///
        MathSpaceInset * asSpaceInset() { return this; }
@@ -54,6 +52,7 @@ public:
        ///
        void write(WriteStream & os) const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        int space_;
 };
index 90388dbd385318f6aea0556563aa267aab23dedc..e903a04b8482ad0d9e9f5aa4fb47a45d2c84612b 100644 (file)
@@ -27,7 +27,7 @@ MathSplitInset::MathSplitInset(string const & name)
 }
 
 
-auto_ptr<InsetBase> MathSplitInset::clone() const
+auto_ptr<InsetBase> MathSplitInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathSplitInset(*this));
 }
index 98ac168c2383c17979cd9ed0153104459bbc5f04..49faf48f4e4974844857e6eb38fa956db99ea44d 100644 (file)
@@ -20,14 +20,13 @@ public:
        ///
        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_;
 };
index 61da212107f5e328df9948c40b0b0e01d758f561..4705ae78461cf74f8c202dc4f061c2f2a74d57ce 100644 (file)
@@ -25,7 +25,7 @@ MathSqrtInset::MathSqrtInset()
 {}
 
 
-auto_ptr<InsetBase> MathSqrtInset::clone() const
+auto_ptr<InsetBase> MathSqrtInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathSqrtInset(*this));
 }
index 7279ef3e810dfe584cfcb05a3c8669d737dac24e..b7679268425b7e62ad1f4cc24ab6ab09a03c84b5 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        MathSqrtInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        void draw(PainterInfo &, int x, int y) const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
@@ -44,5 +42,7 @@ public:
        void octave(OctaveStream &) const;
        ///
        void mathmlize(MathMLStream &) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 #endif
index 4254f1869da8340b0732a0d905a75e3ecc4c0b9f..d5a1c5bfb5b600431115eea45f9304b4c4ab4f36 100644 (file)
@@ -23,7 +23,7 @@ MathStackrelInset::MathStackrelInset()
 {}
 
 
-auto_ptr<InsetBase> MathStackrelInset::clone() const
+auto_ptr<InsetBase> MathStackrelInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathStackrelInset(*this));
 }
index f53033a9788bd593d861b3b62dbddb38fbeeda8c..31f33f4c86595abf2e594720d9dce933ddeca3b4 100644 (file)
@@ -25,8 +25,6 @@ public:
        ///
        MathStackrelInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
@@ -35,6 +33,8 @@ public:
        void write(WriteStream & os) const;
        ///
        void normalize(NormalStream &) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index dfb664c26c68b5f6a588d14c438fb730969c8996..4800e32eddfe34b9996e8cbed0ed31f284fb39c7 100644 (file)
@@ -25,7 +25,7 @@ MathStringInset::MathStringInset(string const & s)
 {}
 
 
-auto_ptr<InsetBase> MathStringInset::clone() const
+auto_ptr<InsetBase> MathStringInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathStringInset(*this));
 }
index bbbd670348893bdab95da87e4e4d0b26c0f48ac5..f233b5169fa6aee1e8328b147b80b95d2e81868b 100644 (file)
@@ -24,8 +24,6 @@ public:
        ///
        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;
@@ -48,6 +46,7 @@ public:
        void write(WriteStream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// the string
        std::string str_;
 };
index 696a9986e9559d52964832ff468127a53d71f6bc..6a288af21b3baccc48de603b3b78ef0f3b8853d1 100644 (file)
@@ -23,7 +23,7 @@ MathSubstackInset::MathSubstackInset()
 {}
 
 
-auto_ptr<InsetBase> MathSubstackInset::clone() const
+auto_ptr<InsetBase> MathSubstackInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathSubstackInset(*this));
 }
index 1f4dcdc2095537a638a7a43863ddfc3ebdebe1df..8013695740924d0ff4d04e00c8b21265324ecc4b 100644 (file)
@@ -22,8 +22,6 @@ public:
        ///
        MathSubstackInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
@@ -40,6 +38,8 @@ public:
        void normalize(NormalStream &) const;
        ///
        void maple(MapleStream &) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 8a4359cff5fc60abd1bcd79ef12b7c7717271ac3..d3cc5a1daa691ac42e8eea67a418d282cd1ff084 100644 (file)
@@ -40,7 +40,7 @@ MathSymbolInset::MathSymbolInset(string const & name)
 {}
 
 
-auto_ptr<InsetBase> MathSymbolInset::clone() const
+auto_ptr<InsetBase> MathSymbolInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathSymbolInset(*this));
 }
index ebda7fc20f2d4e9ab8d67aeb4c04f60cbdce1fd8..29fcafb4eab681390b53be7a48de4500ec7bad91 100644 (file)
@@ -29,8 +29,6 @@ public:
        ///
        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;
@@ -68,6 +66,7 @@ public:
        void infoize2(std::ostream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        latexkeys const * sym_;
        ///
index 571b1bc30b6dfc2141b0f455672f8717325fccd5..78712160eb708282cecf92fdebf53262d5491551 100644 (file)
@@ -39,7 +39,7 @@ MathTabularInset::MathTabularInset(string const & name, char valign,
 {}
 
 
-auto_ptr<InsetBase> MathTabularInset::clone() const
+auto_ptr<InsetBase> MathTabularInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathTabularInset(*this));
 }
index 88224601b2efb5a67e9513c8200e2f86deabe97b..e2476d246e5d6c44c64445777cf4674003bdebc0 100644 (file)
@@ -26,8 +26,6 @@ public:
        ///
        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;
@@ -44,6 +42,7 @@ public:
        void maple(MapleStream &) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        std::string name_;
 };
index f18d6caed3904dc1b756ae3e9b549cc07fa1001f..9671363c2f79bdd7fa1c54caa4df2e3692244494 100644 (file)
@@ -31,7 +31,7 @@ MathTfracInset::MathTfracInset()
 {}
 
 
-auto_ptr<InsetBase> MathTfracInset::clone() const
+auto_ptr<InsetBase> MathTfracInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathTfracInset(*this));
 }
index b2727ebfdb344df4142876e68bd4798d5daa6cf2..c384f256673c5a714abc3b01f8569201f603b436 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        MathTfracInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo &, int x, int y) const;
@@ -32,6 +30,8 @@ public:
        void mathmlize(MathMLStream &) const;
        ///
        void validate(LaTeXFeatures & features) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index b0ee5632dfeb83c505b34a1b43d2d796b1112257..5ba13ad186baab4e8bdfe5d765035bff844f2972 100644 (file)
@@ -22,7 +22,7 @@ using std::auto_ptr;
 
 
 
-auto_ptr<InsetBase> MathUndersetInset::clone() const
+auto_ptr<InsetBase> MathUndersetInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathUndersetInset(*this));
 }
@@ -96,4 +96,3 @@ void MathUndersetInset::validate(LaTeXFeatures & features) const
        features.require("amsmath");
        MathNestInset::validate(features);
 }
-
index c6473e1980c6118c02581b34e57f99d06f0d5cbc..c80a23497e1c7f1b62ac218eab220a82e25dd199 100644 (file)
@@ -18,8 +18,6 @@
 /// Inset for underset
 class MathUndersetInset : public MathFracbaseInset {
 public:
-       ///
-       std::auto_ptr<InsetBase> clone() const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
@@ -36,6 +34,8 @@ public:
        void normalize(NormalStream & ns) const;
        ///
        void validate(LaTeXFeatures & features) const;
+private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
 };
 
 #endif
index 496b274c0549c8c3212992261cd9277629cbed1d..12a29cab568d8a34ba62b86d2c54640fd87db1a6 100644 (file)
@@ -25,7 +25,7 @@ MathUnknownInset::MathUnknownInset(string const & nm, bool final, bool black)
 {}
 
 
-auto_ptr<InsetBase> MathUnknownInset::clone() const
+auto_ptr<InsetBase> MathUnknownInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathUnknownInset(*this));
 }
index af0971777a499aa4813b3d4a3d3cb5c5da9c3fe4..0dcb683f3254cd144f86c5a0266d47c371631a2d 100644 (file)
@@ -22,8 +22,6 @@ public:
        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;
@@ -51,6 +49,7 @@ public:
        ///
        bool final() const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        std::string name_;
        /// are we finished creating the name?
index 0867aa84e9f81f0fa7d5b336b9c1ccda56ae39f2..3676171d5438914e4e26993668b5863ba3cde1ac 100644 (file)
@@ -25,7 +25,7 @@ MathXArrowInset::MathXArrowInset(string const & name)
 {}
 
 
-auto_ptr<InsetBase> MathXArrowInset::clone() const
+auto_ptr<InsetBase> MathXArrowInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathXArrowInset(*this));
 }
index a828e3f5f6c79c90324982b3572e34f6a837c053..dd0a5b1e24a49b55ff5882e97124f0325f5c0826 100644 (file)
@@ -21,8 +21,6 @@ public:
        ///
        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;
@@ -32,6 +30,7 @@ public:
        void normalize(NormalStream & os) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        bool upper() const;
        ///
index d39d43403975ae77404bfc57d963b5c3f1df4c42..946c8e03c921c3da6b4de6492346ddf64b28e88a 100644 (file)
@@ -944,7 +944,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
                        ++column;
                }
                if (!asdefault)
-                       column += startTeXParParams(bparams, os, 
+                       column += startTeXParParams(bparams, os,
                                                    runparams.moving_arg);
        }
 
index 2fbb0abb1a68a702e218ab13f8d9f1b32a14bcdc..5f8281de7ce0fa85fd27617f65c1f434b99f1a00 100644 (file)
@@ -50,7 +50,7 @@ public:
        ParIterator(DocIterator const &);
 
        /// This really should be implemented...
-       //void operator=(ParIterator const &);
+       //ParIterator & operator=(ParIterator const &);
        ///
        ParIterator & operator++();
        ///
index 34f3e1927379452a96c06c1901b22a470dd5a9e2..6343b925aef8d377bc08f34a501eddf5192ad7ca 100644 (file)
@@ -40,6 +40,9 @@ using lyx::support::rtrim;
 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;
@@ -205,7 +208,7 @@ bool string2type(string const str, bool & num)
 }
 
 
-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);
@@ -227,7 +230,7 @@ bool getTokenValue(string const & str, const char * token, string & ret)
 }
 
 
-bool getTokenValue(string const & str, const char * token, int & num)
+bool getTokenValue(string const & str, char const * token, int & num)
 {
        string tmp;
        num = 0;
@@ -238,14 +241,14 @@ bool getTokenValue(string const & str, const char * token, int & num)
 }
 
 
-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;
@@ -253,7 +256,7 @@ bool getTokenValue(string const & str, const char * token,
 }
 
 
-bool getTokenValue(string const & str, const char * token,
+bool getTokenValue(string const & str, char const * token,
                                   LyXTabular::BoxType & num)
 {
        string tmp;
@@ -261,7 +264,7 @@ bool getTokenValue(string const & str, const char * token,
 }
 
 
-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.
@@ -271,7 +274,7 @@ bool getTokenValue(string const & str, const char * token, bool & flag)
 }
 
 
-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.
@@ -296,52 +299,95 @@ void l_getline(istream & is, string & str)
 /// 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)
@@ -379,7 +425,7 @@ void LyXTabular::fixCellNums()
                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;
@@ -389,11 +435,11 @@ void LyXTabular::fixCellNums()
 }
 
 
-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());
@@ -413,13 +459,13 @@ void LyXTabular::appendRow(BufferParams const & bp, int cell)
 
        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)
@@ -432,7 +478,7 @@ void LyXTabular::deleteRow(int row)
 }
 
 
-void LyXTabular::appendColumn(BufferParams const & bp, int cell)
+void LyXTabular::appendColumn(BufferParams const & bp, int const cell)
 {
        ++columns_;
 
@@ -455,15 +501,15 @@ void LyXTabular::appendColumn(BufferParams const & bp, int cell)
        }
        //++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)
@@ -514,7 +560,7 @@ void LyXTabular::set_row_column_number_info()
                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());
                }
        }
@@ -527,7 +573,7 @@ int LyXTabular::getNumberOfCells() const
 }
 
 
-int LyXTabular::numberOfCellsInRow(int cell) const
+int LyXTabular::numberOfCellsInRow(int const cell) const
 {
        int const row = row_of_cell(cell);
        int result = 0;
@@ -539,7 +585,7 @@ int LyXTabular::numberOfCellsInRow(int cell) const
 
 
 // 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;
@@ -813,7 +859,7 @@ void LyXTabular::setColumnPWidth(int cell, LyXLength const & width)
        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());
        }
 }
 
@@ -824,7 +870,7 @@ bool LyXTabular::setMColumnPWidth(int cell, LyXLength const & width)
                return false;
 
        cellinfo_of_cell(cell).p_width = width;
-       getCellInset(cell).setAutoBreakRows(!width.zero());
+       getCellInset(cell)->setAutoBreakRows(!width.zero());
        return true;
 }
 
@@ -1125,7 +1171,7 @@ void LyXTabular::write(Buffer const & buf, ostream & os) const
                           << 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";
                }
@@ -1325,7 +1371,7 @@ void LyXTabular::read(Buffer const & buf, LyXLex & lex)
                        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>")) {
@@ -1378,8 +1424,8 @@ void LyXTabular::setMultiColumn(Buffer * buffer, int cell, int number)
        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();
 }
@@ -1987,24 +2033,23 @@ bool LyXTabular::isValidRow(int row) const
 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 << '}';
 
@@ -2154,9 +2199,9 @@ int LyXTabular::linuxdoc(Buffer const & buf, ostream & 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";
@@ -2215,7 +2260,7 @@ int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row,
                }
 
                os << '>';
-               ret += getCellInset(cell).docbook(buf, os, runparams);
+               ret += getCellInset(cell)->docbook(buf, os, runparams);
                os << "</entry>\n";
                ++cell;
        }
@@ -2412,7 +2457,7 @@ int LyXTabular::asciiPrintCell(Buffer const & buf, ostream & os,
                               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();
@@ -2476,7 +2521,7 @@ int LyXTabular::plaintext(Buffer const & buf, ostream & os,
                                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();
                        }
@@ -2488,7 +2533,7 @@ int LyXTabular::plaintext(Buffer const & buf, ostream & os,
                                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)
@@ -2501,8 +2546,7 @@ int LyXTabular::plaintext(Buffer const & buf, ostream & os,
        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;
@@ -2514,24 +2558,22 @@ int LyXTabular::plaintext(Buffer const & buf, ostream & os,
                }
                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;
 }
@@ -2546,7 +2588,7 @@ int LyXTabular::getCellFromInset(InsetBase const * inset) const
        }
 
        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;
@@ -2572,7 +2614,7 @@ void LyXTabular::validate(LaTeXFeatures & features) const
                if (getVAlignment(cell) != LYX_VALIGN_TOP ||
                     (!getPWidth(cell).zero() && !isMultiColumn(cell)))
                        features.require("array");
-               getCellInset(cell).validate(features);
+               getCellInset(cell)->validate(features);
        }
 }
 
@@ -2582,13 +2624,13 @@ void LyXTabular::getLabelList(Buffer const & buffer,
 {
        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();
 
index f4cdf9cf80bc488aa3f412d8a91acc6a26846728..62de87e810e8818f7315327bf58d0e52f9569b3a 100644 (file)
@@ -18,6 +18,8 @@
 #include "lyxlength.h"
 #include "insets/insettext.h"
 
+#include <boost/shared_ptr.hpp>
+
 #include <iosfwd>
 #include <vector>
 
@@ -364,9 +366,9 @@ public:
        ///
        // 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;
@@ -385,6 +387,12 @@ public:
                ///
                cellstruct(BufferParams const &);
                ///
+               cellstruct(cellstruct const &);
+               ///
+               cellstruct & operator=(cellstruct);
+               ///
+               void swap(cellstruct & rhs);
+               ///
                int cellno;
                ///
                int width_of_cell;
@@ -411,7 +419,7 @@ public:
                ///
                LyXLength p_width; // this is only set for multicolumn!!!
                ///
-               InsetText inset;
+               boost::shared_ptr<InsetText> inset;
        };
        cellstruct & cellinfo_of_cell(int cell) const;
        ///