]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.C
fixes to biblio and insetgraphics from herbert; disable LAYOUT_PARAGRAPH when needed
[lyx.git] / src / insets / insettabular.C
index 32b45f29f181b55cd89beda3b5de40721170141f..c504aa15ff5299e79a363437ba60731cfcf62cbe 100644 (file)
@@ -645,9 +645,10 @@ bool InsetTabular::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
                        }
                        if (in->getInsetFromID(id)) {
                                actcell = i;
-                               the_locking_inset = in;
-                               locked = true;
-                               resetPos(bv);
+                               in->edit(bv);
+//                             the_locking_inset = in;
+//                             locked = true;
+//                             resetPos(bv);
                                return the_locking_inset->lockInsetInInset(bv, inset);
                        }
                }
@@ -1069,6 +1070,10 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
        case LFUN_HOMESEL:
        case LFUN_END:
        case LFUN_ENDSEL:
+       case LFUN_BEGINNINGBUF:
+       case LFUN_BEGINNINGBUFSEL: 
+       case LFUN_ENDBUF:
+       case LFUN_ENDBUFSEL:
                break;
        case LFUN_LAYOUT_TABULAR:
                bv->owner()->getDialogs()->showTabular(this);
@@ -1222,7 +1227,12 @@ int InsetTabular::ascii(Buffer const * buf, ostream & os, int ll) const
 
 int InsetTabular::linuxdoc(Buffer const * buf, ostream & os) const
 {
-       return tabular->ascii(buf,os, (int)parOwner()->params().depth(), false, 0);
+       os << "<![CDATA[";
+       int const ret = tabular->ascii(buf,os,
+                                      (int)parOwner()->params().depth(),
+                                      false, 0);
+       os << "]]>";
+       return ret;
 }
 
 
@@ -2105,37 +2115,18 @@ int InsetTabular::getMaxWidthOfCell(BufferView * bv, int cell) const
        
        if (len.zero())
                return -1;
-#ifdef WITH_WARNINGS
-#warning Remove use of VSpace as soon as LyXLength::inPixels exists (JMarc)
-#endif
-       return VSpace(len).inPixels(bv);
+       return len.inPixels(latexTextWidth(bv), bv->text->defaultHeight());
 }
 
 
 int InsetTabular::getMaxWidth(BufferView * bv,
                               UpdatableInset const * inset) const
 {
-       int cell = tabular->cur_cell;
-       if (tabular->GetCellInset(cell) != inset) {
-               cell = actcell;
-               if (tabular->GetCellInset(cell) != inset) {
-                       
-                       lyxerr[Debug::INSETTEXT] << "Actcell not equal to actual cell!\n";
-                       cell = -1;
-               }
-       }
-       
-       int const n = tabular->GetNumberOfCells();
+       int cell = tabular->GetCellFromInset(inset, actcell);
 
        if (cell == -1) {
-               for (cell = 0; cell < n; ++cell) {
-                       if (tabular->GetCellInset(cell) == inset)
-                               break;
-               }
-       }
-       
-       if (cell >= n) {
-               lyxerr << "Own inset not found, shouldn't really happen!\n";
+               lyxerr << "Own inset not found, shouldn't really happen!"
+                      << endl;
                return -1;
        }
        
@@ -2653,7 +2644,7 @@ void InsetTabular::toggleSelection(BufferView * bv, bool kill_selection)
 
 
 bool InsetTabular::searchForward(BufferView * bv, string const & str,
-                                 bool const & cs, bool const & mw)
+                                 bool cs, bool mw)
 {
        nodraw(true);
        if (the_locking_inset) {
@@ -2681,7 +2672,7 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str,
 
 
 bool InsetTabular::searchBackward(BufferView * bv, string const & str,
-                               bool const & cs, bool const & mw)
+                               bool cs, bool mw)
 {
        nodraw(true);
        if (the_locking_inset) {
@@ -2718,30 +2709,11 @@ bool InsetTabular::insetAllowed(Inset::Code code) const
 
 bool InsetTabular::forceDefaultParagraphs(Inset const * in) const
 {
-       int const n = tabular->GetNumberOfCells();
-       static int last = 0;
+       const int cell = tabular->GetCellFromInset(in, actcell);
 
-       // maybe some speedup
-       if ((last < n) && tabular->GetCellInset(last) == in) {
-               if (tabular->GetPWidth(last+1).zero())
-                       return true;
-               return false;
-       }
-       if ((++last < n) && tabular->GetCellInset(last) == in) {
-               if (tabular->GetPWidth(last).zero())
-                       return true;
-               return false;
-       }
+       if (cell != -1)
+               return tabular->GetPWidth(cell).zero();
 
-       for(int i=0; i < n; ++i) {
-               if (tabular->GetCellInset(i) == in) {
-                       last = i;
-                       if (tabular->GetPWidth(i).zero())
-                               return true;
-                       return false;
-               }
-       }
-       last = 0;
        // well we didn't obviously find it so maybe our owner knows more
        if (owner())
                return owner()->forceDefaultParagraphs(in);