]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.C
Make it compile when USE_BOOST_FORMAT is unset
[lyx.git] / src / insets / insettabular.C
index c60e46324faec03963681955e4c0cd7f0bc47c40..fbe8c938e1247cca0100f21a48aabd902dc14082 100644 (file)
@@ -1,11 +1,11 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file insettabular.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Jürgen Vigna
  *
- *           Copyright 2001 The LyX Team.
- *
- * ======================================================
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
@@ -86,6 +86,7 @@ TabularFeature tabularFeature[] =
        { LyXTabular::ALIGN_LEFT, "align-left" },
        { LyXTabular::ALIGN_RIGHT, "align-right" },
        { LyXTabular::ALIGN_CENTER, "align-center" },
+       { LyXTabular::ALIGN_BLOCK, "align-block" },
        { LyXTabular::VALIGN_TOP, "valign-top" },
        { LyXTabular::VALIGN_BOTTOM, "valign-bottom" },
        { LyXTabular::VALIGN_CENTER, "valign-center" },
@@ -1563,7 +1564,7 @@ void InsetTabular::resetPos(BufferView * bv) const
 #warning This should be fixed in the right manner (20011128 Jug)
 #endif
        // fast hack to fix infinite repaintings!
-       if (in_reset_pos > 10)
+       if (in_reset_pos > 0)
                return;
 
        int cell = 0;
@@ -1880,6 +1881,9 @@ void InsetTabular::tabularFeatures(BufferView * bv,
        case LyXTabular::ALIGN_CENTER:
                setAlign = LYX_ALIGN_CENTER;
                break;
+       case LyXTabular::ALIGN_BLOCK:
+               setAlign = LYX_ALIGN_BLOCK;
+               break;
        case LyXTabular::M_VALIGN_TOP:
        case LyXTabular::VALIGN_TOP:
                setVAlign = LyXTabular::LYX_VALIGN_TOP;
@@ -1926,6 +1930,13 @@ void InsetTabular::tabularFeatures(BufferView * bv,
                        }
                        updateLocal(bv, INIT, true);
                }
+
+               if (vallen.zero()
+                   && tabular->GetAlignment(actcell, true) == LYX_ALIGN_BLOCK)
+                       tabularFeatures(bv, LyXTabular::ALIGN_CENTER, string());
+               else if (!vallen.zero()
+                        && tabular->GetAlignment(actcell, true) != LYX_ALIGN_BLOCK)
+                       tabularFeatures(bv, LyXTabular::ALIGN_BLOCK, string());
        }
        break;
        case LyXTabular::SET_MPWIDTH:
@@ -2050,6 +2061,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
        case LyXTabular::ALIGN_LEFT:
        case LyXTabular::ALIGN_RIGHT:
        case LyXTabular::ALIGN_CENTER:
+       case LyXTabular::ALIGN_BLOCK:
                for (int i = sel_row_start; i <= sel_row_end; ++i)
                        for (int j = sel_col_start; j <= sel_col_end; ++j)
                                tabular->SetAlignment(
@@ -2243,7 +2255,7 @@ int InsetTabular::getMaxWidthOfCell(BufferView * bv, int cell) const
 
        if (len.zero())
                return -1;
-       return len.inPixels(latexTextWidth(bv), bv->text->defaultHeight());
+       return len.inPixels(latexTextWidth(bv));
 }
 
 
@@ -2420,6 +2432,10 @@ FuncStatus InsetTabular::getStatus(string const & what) const
        case LyXTabular::ALIGN_CENTER:
                status.setOnOff(tabular->GetAlignment(actcell, flag) == LYX_ALIGN_CENTER);
                break;
+       case LyXTabular::ALIGN_BLOCK:
+               status.disabled(tabular->GetPWidth(actcell).zero());
+               status.setOnOff(tabular->GetAlignment(actcell, flag) == LYX_ALIGN_BLOCK);
+               break;
        case LyXTabular::M_VALIGN_TOP:
                flag = false;
        case LyXTabular::VALIGN_TOP:
@@ -2529,7 +2545,7 @@ bool InsetTabular::copySelection(BufferView * bv)
        ostringstream sstr;
        paste_tabular->ascii(bv->buffer(), sstr,
                             (int)parOwner()->params().depth(), true, '\t');
-       bv->stuffClipboard(sstr.str().c_str());
+       bv->stuffClipboard(STRCONV(sstr.str()));
        return true;
 }