]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.C
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / insets / insettabular.C
index f5ca11fc7e20aa7729b3407f9cc7d76a15621b11..fc9b4834a284dd3366922c95cdc6047e3c6219b9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * \author Jürgen Vigna
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
@@ -32,6 +32,7 @@
 #include "undo_funcs.h"
 #include "WordLangTuple.h"
 #include "metricsinfo.h"
+#include "paragraph_funcs.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
@@ -200,9 +201,9 @@ auto_ptr<InsetBase> InsetTabular::clone() const
 }
 
 
-Buffer const * InsetTabular::buffer() const
+Buffer const & InsetTabular::buffer() const
 {
-       return buffer_;
+       return *buffer_;
 }
 
 
@@ -219,14 +220,14 @@ void InsetTabular::buffer(Buffer * b)
 }
 
 
-void InsetTabular::write(Buffer const * buf, ostream & os) const
+void InsetTabular::write(Buffer const & buf, ostream & os) const
 {
        os << "Tabular" << endl;
        tabular.write(buf, os);
 }
 
 
-void InsetTabular::read(Buffer const * buf, LyXLex & lex)
+void InsetTabular::read(Buffer const & buf, LyXLex & lex)
 {
        bool const old_format = (lex.getString() == "\\LyXTable");
 
@@ -421,7 +422,7 @@ void InsetTabular::insetUnlock(BufferView * bv)
 
 void InsetTabular::updateLocal(BufferView * bv) const
 {
-       bv->updateInset();
+       bv->updateInset(this);
        if (locked)
                resetPos(bv);
 }
@@ -855,14 +856,14 @@ InsetOld::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
                        updateLocal(bv);
                break;
        case LFUN_NEXT: {
-               if (hs) 
+               if (hs)
                        clearSelection();
                int column = actcol;
                unlockInsetInInset(bv, the_locking_inset);
-               if (bv->text->top_y() + bv->painter().paperHeight() <
+               if (bv->top_y() + bv->painter().paperHeight() <
                    top_baseline + tabular.getHeightOfTabular())
                        {
-                               bv->scrollDocView(bv->text->top_y() + bv->painter().paperHeight());
+                               bv->scrollDocView(bv->top_y() + bv->painter().paperHeight());
                                actcell = tabular.getCellBelow(first_visible_cell) + column;
                        } else {
                                actcell = tabular.getFirstCellInRow(tabular.rows() - 1) + column;
@@ -877,7 +878,7 @@ InsetOld::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
                int column = actcol;
                unlockInsetInInset(bv, the_locking_inset);
                if (top_baseline < 0) {
-                       bv->scrollDocView(bv->text->top_y() - bv->painter().paperHeight());
+                       bv->scrollDocView(bv->top_y() - bv->painter().paperHeight());
                        if (top_baseline > 0)
                                actcell = column;
                        else
@@ -1084,29 +1085,29 @@ InsetOld::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
 }
 
 
-int InsetTabular::latex(Buffer const * buf, ostream & os,
+int InsetTabular::latex(Buffer const & buf, ostream & os,
                        LatexRunParams const & runparams) const
 {
        return tabular.latex(buf, os, runparams);
 }
 
 
-int InsetTabular::ascii(Buffer const * buf, ostream & os, int ll) const
+int InsetTabular::ascii(Buffer const & buf, ostream & os, int ll) const
 {
        if (ll > 0)
-               return tabular.ascii(buf, os, (int)parOwner()->params().depth(),
+               return tabular.ascii(buf, os, ownerPar(buf, this).params().depth(),
                                      false, 0);
        return tabular.ascii(buf, os, 0, false, 0);
 }
 
 
-int InsetTabular::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetTabular::linuxdoc(Buffer const & buf, ostream & os) const
 {
        return tabular.linuxdoc(buf,os);
 }
 
 
-int InsetTabular::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetTabular::docbook(Buffer const & buf, ostream & os, bool mixcont) const
 {
        int ret = 0;
        InsetOld * master;
@@ -1979,7 +1980,7 @@ bool InsetTabular::insetHit(BufferView *, int x, int) const
 }
 
 
-void InsetTabular::deleteLyXText(BufferView * bv, bool recursive) const
+void InsetTabular::deleteLyXText(BufferView * /*bv*/, bool /*recursive*/) const
 {
        //resizeLyXText(bv, recursive);
 }
@@ -2244,8 +2245,8 @@ bool InsetTabular::copySelection(BufferView * bv)
                                    true, true);
 
        ostringstream os;
-       paste_tabular->ascii(bv->buffer(), os,
-                            (int)parOwner()->params().depth(), true, '\t');
+       paste_tabular->ascii(*bv->buffer(), os,
+                            ownerPar(*bv->buffer(), this).params().depth(), true, '\t');
        bv->stuffClipboard(STRCONV(os.str()));
        return true;
 }
@@ -2711,9 +2712,8 @@ int InsetTabularMailer::string2params(string const & in, InsetTabular & inset)
        if (!lex.isOK())
                return -1;
 
-       Buffer const * const buffer = inset.buffer();
-       if (buffer)
-               inset.read(buffer, lex);
+       Buffer const & buffer = inset.buffer();
+       inset.read(buffer, lex);
 
        // We can't set the active cell, but we can tell the frontend
        // what it is.
@@ -2723,9 +2723,7 @@ int InsetTabularMailer::string2params(string const & in, InsetTabular & inset)
 
 string const InsetTabularMailer::params2string(InsetTabular const & inset)
 {
-       Buffer const * const buffer = inset.buffer();
-       if (!buffer)
-               return string();
+       Buffer const & buffer = inset.buffer();
 
        ostringstream data;
        data << name_ << " \\active_cell " << inset.getActCell() << '\n';