]> git.lyx.org Git - lyx.git/commitdiff
Juergen S's tabular patch. Good stuff !
authorJohn Levon <levon@movementarian.org>
Wed, 27 Nov 2002 18:47:09 +0000 (18:47 +0000)
committerJohn Levon <levon@movementarian.org>
Wed, 27 Nov 2002 18:47:09 +0000 (18:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5735 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlTabular.C
src/frontends/controllers/ControlTabular.h
src/frontends/qt2/ChangeLog
src/frontends/qt2/QTabular.C
src/frontends/qt2/QTabular.h
src/frontends/qt2/QTabularDialog.C
src/frontends/qt2/QTabularDialog.h
src/frontends/qt2/qsetborder.C
src/frontends/qt2/qsetborder.h
src/frontends/qt2/ui/QTabularDialog.ui

index bd88ed48b40269ce4526d558092c7f9f79788205..0498eec7ff7973c6e0bfa94ed4c994c7c2828284 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-27  Juergen Spitzmueller  <j.spitzmueller@gmx.de>
+
+       * ControlTabular.[Ch]: Add isMulticolumnCell
+
 2002-11-27  Angus Leeming  <leeming@lyx.org>
 
        * ControlMath.C (ControlMath): initialise active_.
index 45092900093559843365b660c14324487e9fc715..ce5f4d0dd063e0d05a515014f2fcf4f43817ae3f 100644 (file)
@@ -154,3 +154,9 @@ bool ControlTabular::metric() const
 {
        return lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER;
 }
+
+bool ControlTabular::isMulticolumnCell() const
+{
+       int cell(inset()->getActCell());
+       return tabular()->IsMultiColumn(cell);
+}
index 86499c516ed3a8e630ccc12a4b3a0bc1a132382f..e05ad7eefab0e8e9e5eb89a686a12023f959fb1b 100644 (file)
@@ -46,6 +46,9 @@ public:
  
        /// return true if units should default to metric
        bool metric() const;
+       
+       /// return true if actual cell is multicolumn
+       bool isMulticolumnCell() const;
  
 private:
 
index 2222bdee6a2a1db040eb20fd6f1b6c2e20541f28..088c316f974528530683777d1cc450985b34f5c4 100644 (file)
@@ -1,3 +1,10 @@
+2002-11-27  Juergen Spitzmueller  <j.spitzmueller@gmx.de>
+
+       * ui/TabularDialog.ui
+       * QTabular.[Ch]
+       * QTabularDialog.[Ch]: implement most functions
+       * qsetborder.[Ch]: fixes
+
 2002-11-27  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * Alert_pimpl.C (askForText_pimpl): use boost.format
index 369e55166611d0174b82d69487291a48f3143706..d7ffedca830fd6e1fdbf7438901df47935e6f827 100644 (file)
@@ -4,6 +4,8 @@
  * Licence details can be found in the file COPYING.
  *
  * \author John Levon
+ * \author Juergen Spitzmueller
+ * \author Herbert Voss
  *
  * Full author contact details are available in file CREDITS
  */
@@ -18,6 +20,7 @@
 #include "insets/insettabular.h"
 #include "gettext.h"
 #include "support/lstrings.h"
+#include "lyxrc.h"
 
 #include "QTabularDialog.h"
 #include "QTabular.h"
@@ -26,6 +29,8 @@
 #include <qpushbutton.h>
 #include <qlineedit.h>
 #include <qcheckbox.h>
+#include "lengthcombo.h"
+#include "qsetborder.h"
  
 typedef Qt2CB<ControlTabular, Qt2DB<QTabularDialog> > base_class;
 
@@ -48,19 +53,53 @@ bool QTabular::isValid()
        return true;
 }
 
+
+void QTabular::update_borders()
+{
+       LyXTabular * tabular(controller().tabular());
+       int cell(controller().inset()->getActCell());
  
+       if (controller().isMulticolumnCell()) {
+               dialog_->borders->setTop(tabular->TopLine(cell)?1:0);
+               dialog_->borders->setBottom(tabular->BottomLine(cell)?1:0);
+               // pay attention to left/right lines: they are only allowed
+               // to set if we are in first/last cell of row or if the left/right
+               // cell is also a multicolumn.
+               if (tabular->IsFirstCellInRow(cell) || tabular->IsMultiColumn(cell-1)) {
+                       dialog_->borders->setLeft(tabular->LeftLine(cell)?1:0);
+                       // FIXME: setEnabled(cell_options_->check_border_left, true);
+               } else {
+                       dialog_->borders->setLeft(false);
+                       // FIXME: setEnabled(cell_options_->check_border_left, false);
+               }
+               if (tabular->IsLastCellInRow(cell) || tabular->IsMultiColumn(cell+1)) {
+                       dialog_->borders->setRight(tabular->RightLine(cell)?1:0);
+                       // FIXME: setEnabled(cell_options_->check_border_right, true);
+               } else {
+                       dialog_->borders->setRight(false);
+                       // FIXME: setEnabled(cell_options_->check_border_right, false);
+               }
+       } else {
+               dialog_->borders->setTop(tabular->TopLine(cell, true));
+               dialog_->borders->setBottom(tabular->BottomLine(cell, true));
+               dialog_->borders->setLeft(tabular->LeftLine(cell, true));
+               dialog_->borders->setRight(tabular->RightLine(cell, true));
+       }
+}
+
+
 void QTabular::update_contents()
 {
        LyXTabular * tabular(controller().tabular());
        int cell(controller().inset()->getActCell());
+
        int row(tabular->row_of_cell(cell));
        int col(tabular->column_of_cell(cell));
  
-       dialog_->tabularRowED->setText(tostr(row + 1).c_str()); 
+       dialog_->tabularRowED->setText(tostr(row + 1).c_str());
        dialog_->tabularColumnED->setText(tostr(col + 1).c_str());
 
-       bool const multicol(tabular->IsMultiColumn(cell));
+       bool const multicol(controller().isMulticolumnCell());
 
        dialog_->multicolumnCB->setChecked(multicol);
 
@@ -69,518 +108,224 @@ void QTabular::update_contents()
 
        dialog_->longTabularCB->setChecked(tabular->IsLongTabular());
 
-#if 0
-       if (tabular->IsMultiColumn(cell)) {
-               fl_set_button(cell_options_->check_border_top,
-                             tabular->TopLine(cell)?1:0);
-               setEnabled(cell_options_->check_border_top, true);
-               fl_set_button(cell_options_->check_border_bottom,
-                             tabular->BottomLine(cell)?1:0);
-               setEnabled(cell_options_->check_border_bottom, true);
-               // pay attention to left/right lines they are only allowed
-               // to set if we are in first/last cell of row or if the left/right
-               // cell is also a multicolumn.
-               if (tabular->IsFirstCellInRow(cell) ||
-                   tabular->IsMultiColumn(cell-1)) {
-                       fl_set_button(cell_options_->check_border_left,
-                                     tabular->LeftLine(cell)?1:0);
-                       setEnabled(cell_options_->check_border_left, true);
-               } else {
-                       fl_set_button(cell_options_->check_border_left, 0);
-                       setEnabled(cell_options_->check_border_left, false);
-               }
-               if (tabular->IsLastCellInRow(cell) ||
-                   tabular->IsMultiColumn(cell+1)) {
-                       fl_set_button(cell_options_->check_border_right,
-                                     tabular->RightLine(cell)?1:0);
-                       setEnabled(cell_options_->check_border_right, true);
-               } else {
-                       fl_set_button(cell_options_->check_border_right, 0);
-                       setEnabled(cell_options_->check_border_right, false);
-               }
-               pwidth = tabular->GetMColumnPWidth(cell);
-               align = tabular->GetAlignment(cell);
-               if (align == LYX_ALIGN_LEFT)
-                       fl_set_button(cell_options_->radio_align_left, 1);
-               else if (align == LYX_ALIGN_RIGHT)
-                       fl_set_button(cell_options_->radio_align_right, 1);
-               else
-                       fl_set_button(cell_options_->radio_align_center, 1);
-
-               align = tabular->GetVAlignment(cell);
-               fl_set_button(cell_options_->radio_valign_top, 0);
-               fl_set_button(cell_options_->radio_valign_bottom, 0);
-               fl_set_button(cell_options_->radio_valign_center, 0);
-               if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
-                       fl_set_button(cell_options_->radio_valign_center, 1);
-               else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
-                       fl_set_button(cell_options_->radio_valign_bottom, 1);
-               else
-                       fl_set_button(cell_options_->radio_valign_top, 1);
+       update_borders();
 
+       LyXLength pwidth;
+       string special;
+       
+       if (multicol) {
                special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
-               fl_set_input(cell_options_->input_special_multialign, special.c_str());
-               bool const metric(controller().metric());
-               string const default_unit = metric ? "cm" : "in";
-               updateWidgetsFromLength(cell_options_->input_mcolumn_width,
-                                       cell_options_->choice_value_mcolumn_width,
-                                       pwidth, default_unit);
-
-               if (bc().bp().isReadOnly()) {
-                       setEnabled(cell_options_->input_special_multialign, true);
-                       setEnabled(cell_options_->input_mcolumn_width, true);
-                       setEnabled(cell_options_->choice_value_mcolumn_width, true);
-               }
-
-               setEnabled(cell_options_->radio_valign_top,    !pwidth.zero());
-               setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
-               setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
-
-               setEnabled(cell_options_->radio_align_left,   true);
-               setEnabled(cell_options_->radio_align_right,  true);
-               setEnabled(cell_options_->radio_align_center, true);
+               pwidth = tabular->GetMColumnPWidth(cell);
        } else {
-               fl_set_button(cell_options_->check_border_top, 0);
-               setEnabled(cell_options_->check_border_top, false);
-
-               fl_set_button(cell_options_->check_border_bottom, 0);
-               setEnabled(cell_options_->check_border_bottom, false);
-
-               fl_set_button(cell_options_->check_border_left, 0);
-               setEnabled(cell_options_->check_border_left, false);
-
-               fl_set_button(cell_options_->check_border_right, 0);
-               setEnabled(cell_options_->check_border_right, false);
-
-               fl_set_button(cell_options_->radio_align_left, 0);
-               setEnabled(cell_options_->radio_align_left, false);
-
-               fl_set_button(cell_options_->radio_align_right, 0);
-               setEnabled(cell_options_->radio_align_right, false);
-
-               fl_set_button(cell_options_->radio_align_center, 0);
-               setEnabled(cell_options_->radio_align_center, false);
-
-               fl_set_button(cell_options_->radio_valign_top, 0);
-               setEnabled(cell_options_->radio_valign_top, false);
-
-               fl_set_button(cell_options_->radio_valign_bottom, 0);
-               setEnabled(cell_options_->radio_valign_bottom, false);
-
-               fl_set_button(cell_options_->radio_valign_center, 0);
-               setEnabled(cell_options_->radio_valign_center, false);
-
-               fl_set_input(cell_options_->input_special_multialign, "");
-               setEnabled(cell_options_->input_special_multialign, false);
-
-               fl_set_input(cell_options_->input_mcolumn_width, "");
-               setEnabled(cell_options_->input_mcolumn_width, false);
-               setEnabled(cell_options_->choice_value_mcolumn_width, false);
+               special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
+               pwidth = tabular->GetColumnPWidth(cell);
        }
-       if (tabular->TopLine(cell, true))
-               fl_set_button(column_options_->check_border_top, 1);
-       else
-               fl_set_button(column_options_->check_border_top, 0);
-       if (tabular->BottomLine(cell, true))
-               fl_set_button(column_options_->check_border_bottom, 1);
-       else
-               fl_set_button(column_options_->check_border_bottom, 0);
-       if (tabular->LeftLine(cell, true))
-               fl_set_button(column_options_->check_border_left, 1);
-       else
-               fl_set_button(column_options_->check_border_left, 0);
-       if (tabular->RightLine(cell, true))
-               fl_set_button(column_options_->check_border_right, 1);
-       else
-               fl_set_button(column_options_->check_border_right, 0);
-       special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
-       fl_set_input(column_options_->input_special_alignment, special.c_str());
+       
+       dialog_->specialAlignmentED->setText(special.c_str());
 
        bool const isReadonly = bc().bp().isReadOnly();
-       setEnabled(column_options_->input_special_alignment, !isReadonly);
-
-       pwidth = tabular->GetColumnPWidth(cell);
-       bool const metric = lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER;
-       string const default_unit = metric ? "cm" : "in";
-       updateWidgetsFromLength(column_options_->input_column_width,
-                               column_options_->choice_value_column_width,
-                               pwidth, default_unit);
-       setEnabled(column_options_->input_column_width, !isReadonly);
-       setEnabled(column_options_->choice_value_column_width, !isReadonly);
-
-       setEnabled(cell_options_->check_useminipage, !pwidth.zero());
+       dialog_->specialAlignmentED->setEnabled(!isReadonly);
+
+       LyXLength::UNIT default_unit = controller().metric() ? LyXLength::CM : LyXLength::CM;
        if (!pwidth.zero()) {
-               if (tabular->GetUsebox(cell) == 2)
-                       fl_set_button(cell_options_->check_useminipage, 1);
-               else
-                       fl_set_button(cell_options_->check_useminipage, 0);
+               dialog_->widthED->setText(tostr(pwidth.value()).c_str());
+               dialog_->widthUnit->setCurrentItem(pwidth.unit());
        } else {
-               fl_set_button(cell_options_->check_useminipage, 0);
+               dialog_->widthED->setText("");
+               dialog_->widthUnit->setCurrentItem(default_unit);
        }
-       align = tabular->GetAlignment(cell, true);
-       fl_set_button(column_options_->radio_align_left, 0);
-       fl_set_button(column_options_->radio_align_right, 0);
-       fl_set_button(column_options_->radio_align_center, 0);
-       if (align == LYX_ALIGN_LEFT)
-               fl_set_button(column_options_->radio_align_left, 1);
-       else if (align == LYX_ALIGN_RIGHT)
-               fl_set_button(column_options_->radio_align_right, 1);
-       else
-               fl_set_button(column_options_->radio_align_center, 1);
-       align = tabular->GetVAlignment(cell, true);
-       fl_set_button(column_options_->radio_valign_top, 0);
-       fl_set_button(column_options_->radio_valign_bottom, 0);
-       fl_set_button(column_options_->radio_valign_center, 0);
-       if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
-               fl_set_button(column_options_->radio_valign_center, 1);
-       else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
-               fl_set_button(column_options_->radio_valign_bottom, 1);
-       else
-               fl_set_button(column_options_->radio_valign_top, 1);
+       dialog_->widthED->setEnabled(!isReadonly);
+       dialog_->widthUnit->setEnabled(!isReadonly);
+
+       int align = 0;
+       switch(tabular->GetAlignment(cell)) {
+       case LYX_ALIGN_LEFT:
+               align = 1;
+               break;
+       case LYX_ALIGN_CENTER:
+               align = 2;
+               break;
+       case LYX_ALIGN_RIGHT:
+               align = 3;
+               break;
+       default:
+               align = 0;
+               break;
+       }
+       dialog_->hAlignCB->setCurrentItem(align);
+
+       int valign = 0;
+       switch(tabular->GetVAlignment(cell)) {
+       case LyXTabular::LYX_VALIGN_TOP:
+               valign = 0;
+               break;
+       case LyXTabular::LYX_VALIGN_CENTER:
+               valign = 1;
+               break;
+       case LyXTabular::LYX_VALIGN_BOTTOM:
+               valign = 2;
+               break;
+       default:
+               valign = 1;
+               break;
+       }
+       if (pwidth.zero())
+               valign = 1;
+       dialog_->vAlignCB->setCurrentItem(valign);
 
-       setEnabled(column_options_->radio_align_left,   true);
-       setEnabled(column_options_->radio_align_right,  true);
-       setEnabled(column_options_->radio_align_center, true);
-       setEnabled(column_options_->radio_valign_top,    !pwidth.zero());
-       setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
-       setEnabled(column_options_->radio_valign_center, !pwidth.zero());
+       dialog_->hAlignCB->setEnabled(true);
+       dialog_->vAlignCB->setEnabled(!pwidth.zero());
 
-       if ( is a long tabular ) {
+       if (tabular->IsLongTabular()) {
                LyXTabular::ltType ltt;
                bool use_empty;
                bool row_set = tabular->GetRowOfLTHead(row, ltt);
-               fl_set_button(longtable_options_->check_lt_head, row_set);
+               dialog_->headerStatusCB->setChecked(row_set);
                if (ltt.set) {
-                       fl_set_button(longtable_options_->check_head_2border_above,
-                                     ltt.topDL);
-                       fl_set_button(longtable_options_->check_head_2border_above,
-                                     ltt.topDL);
+                       dialog_->headerBorderAboveCB->setChecked(ltt.topDL);
+                       dialog_->headerBorderBelowCB->setChecked(ltt.bottomDL);
                        use_empty = true;
                } else {
-                       setEnabled(longtable_options_->check_head_2border_above, 0);
-                       setEnabled(longtable_options_->check_head_2border_below, 0);
-                       fl_set_button(longtable_options_->check_head_2border_above,0);
-                       fl_set_button(longtable_options_->check_head_2border_above,0);
-                       fl_set_button(longtable_options_->check_1head_empty,0);
-                       setEnabled(longtable_options_->check_1head_empty, 0);
+                       dialog_->headerBorderAboveCB->setChecked(false);
+                       dialog_->headerBorderBelowCB->setChecked(false);
+                       dialog_->headerBorderAboveCB->setEnabled(false);
+                       dialog_->headerBorderBelowCB->setEnabled(false);
+                       dialog_->firstheaderNoContentsCB->setChecked(false);
+                       dialog_->firstheaderNoContentsCB->setEnabled(false);
                        use_empty = false;
                }
                //
                row_set = tabular->GetRowOfLTFirstHead(row, ltt);
-               fl_set_button(longtable_options_->check_lt_firsthead, row_set);
+               dialog_->firstheaderStatusCB->setChecked(row_set);
                if (ltt.set && (!ltt.empty || !use_empty)) {
-                       fl_set_button(longtable_options_->check_1head_2border_above,
-                                     ltt.topDL);
-                       fl_set_button(longtable_options_->check_1head_2border_above,
-                                     ltt.topDL);
+                       dialog_->firstheaderBorderAboveCB->setChecked(ltt.topDL);
+                       dialog_->firstheaderBorderBelowCB->setChecked(ltt.bottomDL);
                } else {
-                       setEnabled(longtable_options_->check_1head_2border_above, 0);
-                       setEnabled(longtable_options_->check_1head_2border_below, 0);
-                       fl_set_button(longtable_options_->check_1head_2border_above,0);
-                       fl_set_button(longtable_options_->check_1head_2border_above,0);
+                       dialog_->firstheaderBorderAboveCB->setEnabled(false);
+                       dialog_->firstheaderBorderBelowCB->setEnabled(false);
+                       dialog_->firstheaderBorderAboveCB->setChecked(false);
+                       dialog_->firstheaderBorderBelowCB->setChecked(false);
                        if (use_empty) {
-                               fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
+                               dialog_->firstheaderNoContentsCB->setChecked(ltt.empty);
                                if (ltt.empty)
-                                       setEnabled(longtable_options_->check_lt_firsthead, 0);
+                                       dialog_->firstheaderStatusCB->setEnabled(false);
                        }
                }
                //
                row_set = tabular->GetRowOfLTFoot(row, ltt);
-               fl_set_button(longtable_options_->check_lt_foot, row_set);
+               dialog_->footerStatusCB->setChecked(row_set);
                if (ltt.set) {
-                       fl_set_button(longtable_options_->check_foot_2border_above,
-                                     ltt.topDL);
-                       fl_set_button(longtable_options_->check_foot_2border_above,
-                                     ltt.topDL);
+                       dialog_->footerBorderAboveCB->setChecked(ltt.topDL);
+                       dialog_->footerBorderBelowCB->setChecked(ltt.bottomDL);
                        use_empty = true;
                } else {
-                       setEnabled(longtable_options_->check_foot_2border_above, 0);
-                       setEnabled(longtable_options_->check_foot_2border_below, 0);
-                       fl_set_button(longtable_options_->check_foot_2border_above,0);
-                       fl_set_button(longtable_options_->check_foot_2border_above,0);
-                       fl_set_button(longtable_options_->check_lastfoot_empty, 0);
-                       setEnabled(longtable_options_->check_lastfoot_empty, 0);
+                       dialog_->footerBorderAboveCB->setChecked(false);
+                       dialog_->footerBorderBelowCB->setChecked(false);
+                       dialog_->footerBorderAboveCB->setEnabled(false);
+                       dialog_->footerBorderBelowCB->setEnabled(false);
+                       dialog_->lastfooterNoContentsCB->setChecked(false);
+                       dialog_->lastfooterNoContentsCB->setEnabled(false);
                        use_empty = false;
                }
                //
                row_set = tabular->GetRowOfLTLastFoot(row, ltt);
-               fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
+               dialog_->lastfooterStatusCB->setChecked(row_set);
                if (ltt.set && (!ltt.empty || !use_empty)) {
-                       fl_set_button(longtable_options_->check_lastfoot_2border_above,
-                                     ltt.topDL);
-                       fl_set_button(longtable_options_->check_lastfoot_2border_above,
-                                     ltt.topDL);
+                       dialog_->lastfooterBorderAboveCB->setChecked(ltt.topDL);
+                       dialog_->lastfooterBorderBelowCB->setChecked(ltt.bottomDL);
                } else {
-                       setEnabled(longtable_options_->check_lastfoot_2border_above,0);
-                       setEnabled(longtable_options_->check_lastfoot_2border_below,0);
-                       fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
-                       fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
+                       dialog_->lastfooterBorderAboveCB->setEnabled(false);
+                       dialog_->lastfooterBorderBelowCB->setEnabled(false);
+                       dialog_->lastfooterBorderAboveCB->setChecked(false);
+                       dialog_->lastfooterBorderBelowCB->setChecked(false);
                        if (use_empty) {
-                               fl_set_button(longtable_options_->check_lastfoot_empty,
-                                             ltt.empty);
+                               dialog_->lastfooterNoContentsCB->setChecked(ltt.empty);
                                if (ltt.empty)
-                                       setEnabled(longtable_options_->check_lt_lastfoot, 0);
+                                       dialog_->lastfooterStatusCB->setEnabled(false);
                        }
                }
-               fl_set_button(longtable_options_->check_lt_newpage,
-                             tabular->GetLTNewPage(row));
+               dialog_->newpageCB->setChecked(tabular->GetLTNewPage(row));
        } else {
-               fl_set_button(longtable_options_->check_lt_firsthead, 0);
-               fl_set_button(longtable_options_->check_1head_2border_above, 0);
-               fl_set_button(longtable_options_->check_1head_2border_above, 0);
-               fl_set_button(longtable_options_->check_1head_empty, 0);
-               fl_set_button(longtable_options_->check_lt_head, 0);
-               fl_set_button(longtable_options_->check_head_2border_above, 0);
-               fl_set_button(longtable_options_->check_head_2border_above, 0);
-               fl_set_button(longtable_options_->check_lt_foot, 0);
-               fl_set_button(longtable_options_->check_foot_2border_above, 0);
-               fl_set_button(longtable_options_->check_foot_2border_above, 0);
-               fl_set_button(longtable_options_->check_lt_lastfoot, 0);
-               fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
-               fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
-               fl_set_button(longtable_options_->check_lastfoot_empty, 0);
-               fl_set_button(longtable_options_->check_lt_newpage, 0);
+               dialog_->headerStatusCB->setChecked(false);
+               dialog_->headerBorderAboveCB->setChecked(false);
+               dialog_->headerBorderBelowCB->setChecked(false);
+               dialog_->firstheaderStatusCB->setChecked(false);
+               dialog_->firstheaderBorderAboveCB->setChecked(false);
+               dialog_->firstheaderBorderBelowCB->setChecked(false);
+               dialog_->firstheaderNoContentsCB->setChecked(false);
+               dialog_->footerStatusCB->setChecked(false);
+               dialog_->footerBorderAboveCB->setChecked(false);
+               dialog_->footerBorderBelowCB->setChecked(false);
+               dialog_->lastfooterStatusCB->setChecked(false);
+               dialog_->lastfooterBorderAboveCB->setChecked(false);
+               dialog_->lastfooterBorderBelowCB->setChecked(false);
+               dialog_->lastfooterNoContentsCB->setChecked(false);
+               dialog_->newpageCB->setChecked(false);
        }
-#endif
 }
 
-
-#if 0 
-ButtonPolicy::SMInput FormTabular::input(FL_OBJECT * ob, long)
+void QTabular::closeGUI()
 {
-       int s;
-       LyXTabular::Feature num = LyXTabular::LAST_ACTION;
-       string special;
+       // ugly hack to auto-apply the stuff that hasn't been
+       // yet. don't let this continue to exist ...
 
        InsetTabular * inset(controller().inset());
        LyXTabular * tabular(controller().tabular());
-       int cell = inset->getActCell();
 
-       // ugly hack to auto-apply the stuff that hasn't been
-       // yet. don't let this continue to exist ...
-       if (ob == dialog_->button_close) {
-               closing_ = true;
-               string str1 =
-                       getLengthFromWidgets(column_options_->input_column_width,
-                                            column_options_->choice_value_column_width);
-               string str2;
-               LyXLength llen = tabular->GetColumnPWidth(cell);
-               if (!llen.zero())
-                       str2 = llen.asString();
-               if (str1 != str2)
-                       input(column_options_->input_column_width, 0);
-               str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
-                                           cell_options_->choice_value_mcolumn_width);
-               llen = tabular->GetMColumnPWidth(cell);
-               if (llen.zero())
-                       str2 = "";
+       // apply the fixed width values
+       int cell = inset->getActCell();
+       string str1 = LyXLength(dialog_->widthED->text().toDouble(),
+                       dialog_->widthUnit->currentLengthItem()).asString();
+       string str2;
+       LyXLength llen(tabular->GetColumnPWidth(cell));
+       if (llen.zero())
+               str2 = "";
+       else
+               str2 = llen.asString();
+       if (str1 != str2) {
+               if (controller().isMulticolumnCell())
+                       controller().set(LyXTabular::SET_MPWIDTH, str1);
                else
-                       str2 = llen.asString();
-               if (str1 != str2)
-                       input(cell_options_->input_mcolumn_width, 0);
-               str1 = getString(column_options_->input_special_alignment);
-               str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
-               if (str1 != str2)
-                       input(column_options_->input_special_alignment, 0);
-               str1 = getString(cell_options_->input_special_multialign);
+                       controller().set(LyXTabular::SET_PWIDTH, str1);
+       }
+
+       // apply the special alignment
+       str1 = dialog_->specialAlignmentED->text().latin1();
+       if (controller().isMulticolumnCell())
                str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
-               if (str1 != str2)
-                       input(cell_options_->input_special_multialign, 0);
-               closing_ = false;
-               controller().OKButton(); 
-               return ButtonPolicy::SMI_VALID;
+       else
+               str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
+       if (str1 != str2) {
+               if (controller().isMulticolumnCell())
+                       controller().set(LyXTabular::SET_SPECIAL_MULTI, str1);
+               else
+                       controller().set(LyXTabular::SET_SPECIAL_COLUMN, str1);
        }
+}
+#if 0
+// the unported rest...
+// not shure if and where this is needed (JSpitzm)
+ButtonPolicy::SMInput FormTabular::input(FL_OBJECT * ob, long)
+{
+       InsetTabular * inset(controller().inset());
+       LyXTabular * tabular(controller().tabular());
+
+       int cell = inset->getActCell();
 
+       FIXME: Where to place?
        if (actCell_ != cell) {
                update();
                postWarning(_("Wrong Cursor position, updated window"));
                return ButtonPolicy::SMI_VALID;
        }
+
+       FIXME: Necessary in QT?
        // No point in processing directives that you can't do anything with
        // anyhow, so exit now if the buffer is read-only.
        if (bc().bp().isReadOnly()) {
                update();
                return ButtonPolicy::SMI_VALID;
        }
-       if ((ob == column_options_->input_column_width) ||
-           (ob == column_options_->choice_value_column_width)) {
-               string const str =
-                       getLengthFromWidgets(column_options_->input_column_width,
-                                            column_options_->choice_value_column_width);
-               controller().set(LyXTabular::SET_PWIDTH, str);
-
-               //check if the input is valid
-               string const input = getString(column_options_->input_column_width);
-               if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
-                       postWarning(_("Invalid Length (valid example: 10mm)"));
-                       return ButtonPolicy::SMI_INVALID;
-               }
-
-               update(); // update for alignment
-               return ButtonPolicy::SMI_VALID;
-       }
-
-       if ((ob == cell_options_->input_mcolumn_width) ||
-           (ob == cell_options_->choice_value_mcolumn_width)) {
-               string const str =
-                       getLengthFromWidgets(cell_options_->input_mcolumn_width,
-                                            cell_options_->choice_value_mcolumn_width);
-               controller().set(LyXTabular::SET_MPWIDTH, str);
-
-               //check if the input is valid
-               string const input = getString(cell_options_->input_mcolumn_width);
-               if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
-                       postWarning(_("Invalid Length (valid example: 10mm)"));
-                       return ButtonPolicy::SMI_INVALID;
-               }
-               update(); // update for alignment
-               return ButtonPolicy::SMI_VALID;
-       }
-
-       if (ob == tabular_options_->button_set_borders)
-               num = LyXTabular::SET_ALL_LINES;
-       else if (ob == tabular_options_->button_unset_borders)
-               num = LyXTabular::UNSET_ALL_LINES;
-       else if (ob == column_options_->check_border_top)
-               num = LyXTabular::TOGGLE_LINE_TOP;
-       else if (ob == column_options_->check_border_bottom)
-               num = LyXTabular::TOGGLE_LINE_BOTTOM;
-       else if (ob == column_options_->check_border_left)
-               num = LyXTabular::TOGGLE_LINE_LEFT;
-       else if (ob == column_options_->check_border_right)
-               num = LyXTabular::TOGGLE_LINE_RIGHT;
-       else if (ob == column_options_->radio_align_left)
-               num = LyXTabular::ALIGN_LEFT;
-       else if (ob == column_options_->radio_align_right)
-               num = LyXTabular::ALIGN_RIGHT;
-       else if (ob == column_options_->radio_align_center)
-               num = LyXTabular::ALIGN_CENTER;
-       else if (ob == column_options_->radio_valign_top)
-               num = LyXTabular::VALIGN_TOP;
-       else if (ob == column_options_->radio_valign_bottom)
-               num = LyXTabular::VALIGN_BOTTOM;
-       else if (ob == column_options_->radio_valign_center)
-               num = LyXTabular::VALIGN_CENTER;
-       else if (ob == cell_options_->check_multicolumn)
-               num = LyXTabular::MULTICOLUMN;
-       else if (ob == tabular_options_->check_longtable) {
-               if (fl_get_button(tabular_options_->check_longtable))
-                       num = LyXTabular::SET_LONGTABULAR;
-               else
-                       num = LyXTabular::UNSET_LONGTABULAR;
-       } else if (ob == tabular_options_->check_rotate_tabular) {
-               s = fl_get_button(tabular_options_->check_rotate_tabular);
-               if (s)
-                       num = LyXTabular::SET_ROTATE_TABULAR;
-               else
-                       num = LyXTabular::UNSET_ROTATE_TABULAR;
-       } else if (ob == cell_options_->check_rotate_cell) {
-               s = fl_get_button(cell_options_->check_rotate_cell);
-               if (s)
-                       num = LyXTabular::SET_ROTATE_CELL;
-               else
-                       num = LyXTabular::UNSET_ROTATE_CELL;
-       } else if (ob == cell_options_->check_useminipage) {
-               num = LyXTabular::SET_USEBOX;
-               special = "2";
-       } else if ((ob == longtable_options_->check_lt_firsthead) ||
-                  (ob == longtable_options_->check_1head_2border_above) ||
-                  (ob == longtable_options_->check_1head_2border_below) ||
-                  (ob == longtable_options_->check_1head_empty) ||
-                  (ob == longtable_options_->check_lt_head) ||
-                  (ob == longtable_options_->check_head_2border_above) ||
-                  (ob == longtable_options_->check_head_2border_below) ||
-                  (ob == longtable_options_->check_lt_foot) ||
-                  (ob == longtable_options_->check_foot_2border_above) ||
-                  (ob == longtable_options_->check_foot_2border_below) ||
-                  (ob == longtable_options_->check_lt_lastfoot) ||
-                  (ob == longtable_options_->check_lastfoot_2border_above) ||
-                  (ob == longtable_options_->check_lastfoot_2border_below) ||
-                  (ob == longtable_options_->check_lastfoot_empty)) {
-               num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
-       } else if (ob == longtable_options_->check_lt_newpage) {
-               num = LyXTabular::SET_LTNEWPAGE;
-       } else if (ob == column_options_->input_special_alignment) {
-               special = getString(column_options_->input_special_alignment);
-               num = LyXTabular::SET_SPECIAL_COLUMN;
-       } else if (ob == cell_options_->input_special_multialign) {
-               special = getString(cell_options_->input_special_multialign);
-               num = LyXTabular::SET_SPECIAL_MULTI;
-       } else if (ob == cell_options_->check_border_top)
-               num = LyXTabular::M_TOGGLE_LINE_TOP;
-       else if (ob == cell_options_->check_border_bottom)
-               num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
-       else if (ob == cell_options_->check_border_left)
-               num = LyXTabular::M_TOGGLE_LINE_LEFT;
-       else if (ob == cell_options_->check_border_right)
-               num = LyXTabular::M_TOGGLE_LINE_RIGHT;
-       else if (ob == cell_options_->radio_align_left)
-               num = LyXTabular::M_ALIGN_LEFT;
-       else if (ob == cell_options_->radio_align_right)
-               num = LyXTabular::M_ALIGN_RIGHT;
-       else if (ob == cell_options_->radio_align_center)
-               num = LyXTabular::M_ALIGN_CENTER;
-       else if (ob == cell_options_->radio_valign_top)
-               num = LyXTabular::M_VALIGN_TOP;
-       else if (ob == cell_options_->radio_valign_bottom)
-               num = LyXTabular::M_VALIGN_BOTTOM;
-       else if (ob == cell_options_->radio_valign_center)
-               num = LyXTabular::M_VALIGN_CENTER;
-       else
-               return ButtonPolicy::SMI_VALID;
-
-       controller().set(num, special);
-       update();
-
-       return ButtonPolicy::SMI_VALID;
-}
-
-int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
-{
-       bool flag = fl_get_button(ob);
-       if ((ob == longtable_options_->check_1head_2border_above) ||
-           (ob == longtable_options_->check_head_2border_above) ||
-           (ob == longtable_options_->check_foot_2border_above) ||
-           (ob == longtable_options_->check_lastfoot_2border_above)) {
-               special = "dl_above";
-       } else if ((ob == longtable_options_->check_1head_2border_below) ||
-                  (ob == longtable_options_->check_head_2border_below) ||
-                  (ob == longtable_options_->check_foot_2border_below) ||
-                  (ob == longtable_options_->check_lastfoot_2border_below)) {
-               special = "dl_below";
-       } else if ((ob == longtable_options_->check_1head_empty) ||
-                  (ob == longtable_options_->check_lastfoot_empty)) {
-               special = "empty";
-       } else {
-               special = "";
-       }
-       if ((ob == longtable_options_->check_lt_firsthead) ||
-           (ob == longtable_options_->check_1head_2border_above) ||
-           (ob == longtable_options_->check_1head_2border_below) ||
-           (ob == longtable_options_->check_1head_empty)) {
-               return (flag ? LyXTabular::SET_LTFIRSTHEAD :
-                       LyXTabular::UNSET_LTFIRSTHEAD);
-       } else if ((ob == longtable_options_->check_lt_head) ||
-                          (ob == longtable_options_->check_head_2border_above) ||
-                          (ob == longtable_options_->check_head_2border_below)) {
-               return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
-       } else if ((ob == longtable_options_->check_lt_foot) ||
-                  (ob == longtable_options_->check_foot_2border_above) ||
-                  (ob == longtable_options_->check_foot_2border_below)) {
-               return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
-       } else if ((ob == longtable_options_->check_lt_lastfoot) ||
-                  (ob == longtable_options_->check_lastfoot_2border_above) ||
-                  (ob == longtable_options_->check_lastfoot_2border_below) ||
-                  (ob == longtable_options_->check_lastfoot_empty)) {
-               return (flag ? LyXTabular::SET_LTLASTFOOT :
-                       LyXTabular::UNSET_LTLASTFOOT);
-       }
 
-       return LyXTabular::LAST_ACTION;
 }
 #endif
index 572d6ccce095ea88003b5644f0351241c0dbb19f..451fd42dd5c4becc0115d3fda29a0d063ac5ddb2 100644 (file)
@@ -6,6 +6,8 @@
  *
  * \author John Levon
  * \author Kalle Dalheimer
+ * \author Juergen Spitzmueller
+ * \author Herbert Voss
  *
  * Full author contact details are available in file CREDITS
  */
@@ -37,10 +39,14 @@ protected:
 private:
        /// We can't use this ...
        virtual void apply() {}
+       /// update borders
+       virtual void update_borders();
        /// update
        virtual void update_contents();
        /// build the dialog
        virtual void build_dialog();
+       /// save some values before closing the gui
+       virtual void closeGUI();
 };
 
 #endif // QTABULAR_H
index 89cf557b50d6e2baa2bf12a845c9050dde3abb64..0fd8c38f28e40924006e6707b3105b7bcc57e410 100644 (file)
@@ -4,6 +4,8 @@
  * Licence details can be found in the file COPYING.
  *
  * \author John Levon
+ * \author Juergen Spitzmueller
+ * \author Herbert Voss
  *
  * Full author contact details are available in file CREDITS
  */
 #include "QTabular.h"
 #include "QTabularDialog.h"
 #include "tabular.h"
+#include "lengthcombo.h"
+#include "qsetborder.h"
 
+#include <qcheckbox.h>
 #include <qpushbutton.h>
+#include <qlineedit.h>
 
 
 QTabularDialog::QTabularDialog(QTabular * form)
@@ -43,7 +49,11 @@ void QTabularDialog::closeEvent(QCloseEvent * e)
        form_->slotWMHide();
        e->accept();
 }
+
+void QTabularDialog::close_clicked()
+{
+       form_->closeGUI();
+}
 
 void QTabularDialog::columnAppend_clicked()
 {
@@ -65,5 +75,367 @@ void QTabularDialog::columnDelete_clicked()
  
 void QTabularDialog::rowDelete_clicked()
 {
-       form_->controller().set(LyXTabular::DELETE_COLUMN);
+       form_->controller().set(LyXTabular::DELETE_ROW);
+}
+
+void QTabularDialog::borderSet_clicked()
+{
+       form_->controller().set(LyXTabular::SET_ALL_LINES);
+       form_->update_borders();
+       form_->changed();
+}
+
+void QTabularDialog::borderUnset_clicked()
+{
+       form_->controller().set(LyXTabular::UNSET_ALL_LINES);
+       form_->update_borders();
+       form_->changed();
+}
+
+void QTabularDialog::leftBorder_changed()
+{
+       if (form_->controller().isMulticolumnCell())
+               form_->controller().set(LyXTabular::M_TOGGLE_LINE_LEFT);
+       else
+               form_->controller().set(LyXTabular::TOGGLE_LINE_LEFT);
+       form_->changed();
+}
+
+void QTabularDialog::rightBorder_changed()
+{
+       if (form_->controller().isMulticolumnCell())
+               form_->controller().set(LyXTabular::M_TOGGLE_LINE_RIGHT);
+       else
+               form_->controller().set(LyXTabular::TOGGLE_LINE_RIGHT);
+       form_->changed();
+}
+
+void QTabularDialog::topBorder_changed()
+{
+       if (form_->controller().isMulticolumnCell())
+               form_->controller().set(LyXTabular::M_TOGGLE_LINE_TOP);
+       else
+               form_->controller().set(LyXTabular::TOGGLE_LINE_TOP);
+       form_->changed();
+}
+
+void QTabularDialog::bottomBorder_changed()
+{
+       if (form_->controller().isMulticolumnCell())
+               form_->controller().set(LyXTabular::M_TOGGLE_LINE_BOTTOM);
+       else
+               form_->controller().set(LyXTabular::TOGGLE_LINE_BOTTOM);
+       form_->changed();
+}
+
+void QTabularDialog::specialAlignment_changed()
+{
+       string special = specialAlignmentED->text().latin1();
+       if (form_->controller().isMulticolumnCell())
+               form_->controller().set(LyXTabular::SET_SPECIAL_MULTI, special);
+       else
+               form_->controller().set(LyXTabular::SET_SPECIAL_COLUMN, special);
+}
+
+void QTabularDialog::width_changed()
+{
+       string const width =
+               LyXLength(widthED->text().toDouble(),
+                         widthUnit->currentLengthItem()).asString();
+       if (form_->controller().isMulticolumnCell())
+               form_->controller().set(LyXTabular::SET_MPWIDTH, width);
+       else
+               form_->controller().set(LyXTabular::SET_PWIDTH, width);
+}
+
+void QTabularDialog::multicolumn_clicked()
+{
+       form_->controller().set(LyXTabular::MULTICOLUMN);
+       form_->changed();
+}
+
+void QTabularDialog::rotateTabular_checked(int state)
+{
+       switch(state) {
+       case 0:
+               form_->controller().set(LyXTabular::UNSET_ROTATE_TABULAR);
+               break;
+       case 1:
+               // "no change state", should not happen
+               break;
+       case 2:
+               form_->controller().set(LyXTabular::SET_ROTATE_TABULAR);
+               break;
+       }
 }
+
+void QTabularDialog::rotateCell_checked(int state)
+{
+       switch(state) {
+       case 0:
+               form_->controller().set(LyXTabular::UNSET_ROTATE_CELL);
+               break;
+       case 1:
+               // "no change state", should not happen
+               break;
+       case 2:
+               form_->controller().set(LyXTabular::SET_ROTATE_CELL);
+               break;
+       }
+}
+
+void QTabularDialog::hAlign_changed(int align)
+{
+       LyXTabular::Feature num;
+       LyXTabular::Feature multi_num;
+
+       switch(align) {
+               case 0:
+               {
+                       num = LyXTabular::ALIGN_BLOCK;
+                       //FIXME: multi_num no equivalent
+                       break;
+               }
+               case 1:
+               {
+                       num = LyXTabular::ALIGN_LEFT;
+                       multi_num = LyXTabular::M_ALIGN_LEFT;
+                       break;
+               }
+               case 2:
+               {
+                       num = LyXTabular::ALIGN_CENTER;
+                       multi_num = LyXTabular::M_ALIGN_CENTER;
+                       break;
+               }
+               case 3:
+               {
+                       num = LyXTabular::ALIGN_RIGHT;
+                       multi_num = LyXTabular::M_ALIGN_RIGHT;
+                       break;
+               }
+       }
+       if (form_->controller().isMulticolumnCell())
+               form_->controller().set(multi_num);
+       else
+               form_->controller().set(num);
+}
+
+void QTabularDialog::vAlign_changed(int align)
+{
+       LyXTabular::Feature num;
+       LyXTabular::Feature multi_num;
+
+       switch(align) {
+               case 0:
+               {
+                       num = LyXTabular::VALIGN_TOP;
+                       multi_num = LyXTabular::M_VALIGN_TOP;
+                       break;
+               }
+               case 1:
+               {
+                       num = LyXTabular::VALIGN_CENTER;
+                       multi_num = LyXTabular::M_VALIGN_CENTER;
+                       break;
+               }
+               case 2:
+               {
+                       num = LyXTabular::VALIGN_BOTTOM;
+                       multi_num = LyXTabular::M_VALIGN_BOTTOM;
+                       break;
+               }
+       }
+       if (form_->controller().isMulticolumnCell())
+               form_->controller().set(multi_num);
+       else
+               form_->controller().set(num);
+}
+
+void QTabularDialog::longTabular_changed(int state)
+{
+       switch(state) {
+       case 0:
+               form_->controller().set(LyXTabular::UNSET_LONGTABULAR);
+               break;
+       case 1:
+               // "no change state", should not happen
+               break;
+       case 2:
+               form_->controller().set(LyXTabular::SET_LONGTABULAR);
+               break;
+       }
+       form_->changed();
+}
+
+void QTabularDialog::ltNewpage_clicked()
+{
+       form_->controller().set(LyXTabular::SET_LTNEWPAGE);
+       form_->changed();
+}
+
+void QTabularDialog::ltHeaderStatus_clicked()
+{
+       bool enable(headerStatusCB->isChecked());
+       if (enable)
+               form_->controller().set(LyXTabular::SET_LTHEAD, "");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
+       headerBorderAboveCB->setEnabled(enable);
+       headerBorderBelowCB->setEnabled(enable);
+       firstheaderNoContentsCB->setEnabled(enable);
+       form_->changed();
+}
+
+
+void QTabularDialog::ltHeaderBorderAbove_clicked()
+{
+       if (headerBorderAboveCB->isChecked())
+               form_->controller().set(LyXTabular::SET_LTHEAD, "dl_above");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
+       form_->changed();
+}
+
+
+void QTabularDialog::ltHeaderBorderBelow_clicked()
+{
+       if (headerBorderBelowCB->isChecked())
+               form_->controller().set(LyXTabular::SET_LTHEAD, "dl_below");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
+       form_->changed();
+}
+
+
+void QTabularDialog::ltFirstHeaderBorderAbove_clicked()
+{
+       if (firstheaderBorderAboveCB->isChecked())
+               form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_above");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
+       form_->changed();
+}
+
+
+void QTabularDialog::ltFirstHeaderBorderBelow_clicked()
+{
+       if (firstheaderBorderBelowCB->isChecked())
+               form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_below");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
+       form_->changed();
+}
+
+
+void QTabularDialog::ltFirstHeaderStatus_clicked()
+{
+       bool enable(firstheaderStatusCB->isChecked());
+       if (enable)
+               form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
+       firstheaderBorderAboveCB->setEnabled(enable);
+       firstheaderBorderBelowCB->setEnabled(enable);
+       form_->changed();
+}
+
+
+void QTabularDialog::ltFirstHeaderEmpty_clicked()
+{
+       bool enable(firstheaderNoContentsCB->isChecked());
+       if (enable)
+               form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "empty");
+       else {
+               ltFirstHeaderBorderBelow_clicked();
+               ltFirstHeaderBorderAbove_clicked();
+       }
+       firstheaderStatusCB->setEnabled(!enable);
+       firstheaderBorderAboveCB->setEnabled(!enable);
+       firstheaderBorderBelowCB->setEnabled(!enable);
+       form_->changed();
+}
+
+
+void QTabularDialog::ltFooterStatus_clicked()
+{
+       bool enable(footerStatusCB->isChecked());
+       if (enable)
+               form_->controller().set(LyXTabular::SET_LTFOOT, "");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
+       footerBorderAboveCB->setEnabled(enable);
+       footerBorderBelowCB->setEnabled(enable);
+       lastfooterNoContentsCB->setEnabled(enable);
+       form_->changed();
+}
+
+
+void QTabularDialog::ltFooterBorderAbove_clicked()
+{
+       if (footerBorderAboveCB->isChecked())
+               form_->controller().set(LyXTabular::SET_LTFOOT, "dl_above");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
+       form_->changed();
+}
+
+
+void QTabularDialog::ltFooterBorderBelow_clicked()
+{
+       if (footerBorderBelowCB->isChecked())
+               form_->controller().set(LyXTabular::SET_LTFOOT, "dl_below");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
+       form_->changed();
+}
+
+
+void QTabularDialog::ltLastFooterStatus_clicked()
+{
+       bool enable(lastfooterStatusCB->isChecked());
+       if (enable)
+               form_->controller().set(LyXTabular::SET_LTLASTFOOT, "");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
+       lastfooterBorderAboveCB->setEnabled(enable);
+       lastfooterBorderBelowCB->setEnabled(enable);
+       form_->changed();
+}
+
+
+void QTabularDialog::ltLastFooterBorderAbove_clicked()
+{
+       if (lastfooterBorderAboveCB->isChecked())
+               form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_above");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
+       form_->changed();
+}
+
+
+void QTabularDialog::ltLastFooterBorderBelow_clicked()
+{
+       if (lastfooterBorderBelowCB->isChecked())
+               form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_below");
+       else
+               form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
+       form_->changed();
+}
+
+
+void QTabularDialog::ltLastFooterEmpty_clicked()
+{
+       bool enable(lastfooterNoContentsCB->isChecked());
+       if (enable)
+               form_->controller().set(LyXTabular::SET_LTLASTFOOT, "empty");
+       else {
+               ltLastFooterBorderBelow_clicked();
+               ltLastFooterBorderAbove_clicked();
+       }
+       lastfooterStatusCB->setEnabled(!enable);
+       lastfooterBorderAboveCB->setEnabled(!enable);
+       lastfooterBorderBelowCB->setEnabled(!enable);
+       form_->changed();
+}
+
index 28b36cf81c88cb884083f648428d4b483fbf969f..8a0f0a6dff3ca69fb3fc6816605b5bab5784c234 100644 (file)
@@ -5,6 +5,8 @@
  * Licence details can be found in the file COPYING.
  *
  * \author John Levon
+ * \author Juergen Spitzmueller
+ * \author Herbert Voss
  *
  * Full author contact details are available in file CREDITS
  */
@@ -27,12 +29,42 @@ public:
 
 protected slots:
        virtual void change_adaptor();
+       
+       virtual void close_clicked();
        virtual void columnAppend_clicked();
        virtual void rowAppend_clicked();
        virtual void columnDelete_clicked(); 
        virtual void rowDelete_clicked();
+       virtual void borderSet_clicked();
+       virtual void borderUnset_clicked();
+       virtual void leftBorder_changed();
+       virtual void rightBorder_changed();
+       virtual void topBorder_changed();
+       virtual void bottomBorder_changed();
+       virtual void multicolumn_clicked();
+       virtual void rotateTabular_checked(int state);
+       virtual void rotateCell_checked(int state);
+       virtual void hAlign_changed(int align);
+       virtual void vAlign_changed(int align);
+       virtual void specialAlignment_changed();
+       virtual void width_changed();
+       virtual void longTabular_changed(int state);
+       virtual void ltNewpage_clicked();
+       virtual void ltHeaderStatus_clicked();
+       virtual void ltHeaderBorderAbove_clicked();
+       virtual void ltHeaderBorderBelow_clicked();
+       virtual void ltFirstHeaderStatus_clicked();
+       virtual void ltFirstHeaderBorderAbove_clicked();
+       virtual void ltFirstHeaderBorderBelow_clicked();
+       virtual void ltFirstHeaderEmpty_clicked();
+       virtual void ltFooterStatus_clicked();
+       virtual void ltFooterBorderAbove_clicked();
+       virtual void ltFooterBorderBelow_clicked();
+       virtual void ltLastFooterStatus_clicked();
+       virtual void ltLastFooterBorderAbove_clicked();
+       virtual void ltLastFooterBorderBelow_clicked();
+       virtual void ltLastFooterEmpty_clicked();
+
 protected:
        virtual void closeEvent(QCloseEvent * e);
  
index e8a5556354e6c2959455660c8aa00415e43c9d59..6af668cb5de1cc5e15ebe0cce354966d874f23af 100644 (file)
@@ -87,6 +87,7 @@ void QSetBorder::mousePressEvent(QMouseEvent * e)
                }
        }
        update();
+       emit clicked();
 }
 
 
@@ -142,21 +143,33 @@ void QSetBorder::drawBottom(bool draw)
 void QSetBorder::setLeft(bool border)
 {
        left_ = border;
+       drawLeft(border);
 }
 
 void QSetBorder::setRight(bool border)
 {
        right_ = border;
+       drawRight(border);
 }
 
 void QSetBorder::setTop(bool border)
 {
        top_ = border;
+       drawTop(border);
 }
 
 void QSetBorder::setBottom(bool border)
 {
        bottom_ = border;
+       drawBottom(border);
+}
+
+void QSetBorder::setAll(bool border)
+{
+       setLeft(border);
+       setRight(border);
+       setTop(border);
+       setBottom(border);
 }
 
 bool QSetBorder::getLeft()
index 41c1150e70079a725b0c00c3cedc407a35e31e02..0c68d66ceca3d89ef14a83d26fead1857534559d 100644 (file)
@@ -34,12 +34,14 @@ signals:
        void leftSet(bool);
        void topSet(bool);
        void bottomSet(bool);
+       void clicked();
 
 public slots:
        void setLeft(bool);
        void setRight(bool);
        void setTop(bool);
        void setBottom(bool);
+       void setAll(bool);
 
 protected:
        void mousePressEvent(QMouseEvent * e);
index cc0301d6c53dd49cbfec54dfc5431ebb0cd16dea..7e6bad63b482c5218064900e8fb48a183257892f 100644 (file)
@@ -13,8 +13,8 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>452</width>
-            <height>307</height>
+            <width>434</width>
+            <height>292</height>
         </rect>
     </property>
     <property stdset="1">
                     </widget>
                     <widget row="0"  column="1" >
                         <class>QComboBox</class>
+                        <item>
+                            <property>
+                                <name>text</name>
+                                <string>Block</string>
+                            </property>
+                        </item>
                         <item>
                             <property>
                                 <name>text</name>
             <verdata>5</verdata>
         </sizepolicy>
         <pixmap>image0</pixmap>
+        <signal>rightSet(bool)</signal>
+        <signal>leftSet(bool)</signal>
+        <signal>bottomSet(bool)</signal>
+        <signal>clicked()</signal>
+        <signal>topSet(bool)</signal>
+        <slot access="public">leftBorder_changed()</slot>
+        <slot access="public">rightBorder_changed()</slot>
+        <slot access="public">topBorder_changed()</slot>
+        <slot access="public">bottomBorder_changed()</slot>
     </customwidget>
 </customwidgets>
 <images>
         <receiver>QTabularDialogBase</receiver>
         <slot>columnDelete_clicked()</slot>
     </connection>
-    <connection>
-        <sender>rowDeletePB</sender>
-        <signal>clicked()</signal>
-        <receiver>QTabularDialogBase</receiver>
-        <slot>columnDelete_clicked()</slot>
-    </connection>
     <connection>
         <sender>borderSetPB</sender>
         <signal>clicked()</signal>
         <sender>rotateTabularCB</sender>
         <signal>stateChanged(int)</signal>
         <receiver>QTabularDialogBase</receiver>
-        <slot>rotateTabular_checked()</slot>
+        <slot>rotateTabular_checked(int)</slot>
+    </connection>
+    <connection>
+        <sender>rotateCellCB</sender>
+        <signal>stateChanged(int)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>rotateCell_checked(int)</slot>
     </connection>
     <connection>
         <sender>longTabularCB</sender>
         <receiver>newpageCB</receiver>
         <slot>setEnabled(bool)</slot>
     </connection>
-    <slot access="protected">columnDelete_clicked()</slot>
+    <connection>
+        <sender>rowDeletePB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>rowDelete_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>hAlignCB</sender>
+        <signal>activated(int)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>hAlign_changed(int)</slot>
+    </connection>
+    <connection>
+        <sender>vAlignCB</sender>
+        <signal>activated(int)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>vAlign_changed(int)</slot>
+    </connection>
+    <connection>
+        <sender>multicolumnCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>multicolumn_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>longTabularCB</sender>
+        <signal>stateChanged(int)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>longTabular_changed(int)</slot>
+    </connection>
+    <connection>
+        <sender>newpageCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltNewpage_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>headerStatusCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltHeaderStatus_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>headerBorderAboveCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltHeaderBorderAbove_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>headerBorderBelowCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltHeaderBorderBelow_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>firstheaderStatusCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltFirstHeaderStatus_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>firstheaderBorderAboveCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltFirstHeaderBorderAbove_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>firstheaderBorderBelowCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltFirstHeaderBorderBelow_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>firstheaderNoContentsCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltFirstHeaderEmpty_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>footerStatusCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltFooterStatus_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>footerBorderAboveCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltFooterBorderAbove_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>footerBorderBelowCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltFooterBorderBelow_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>lastfooterStatusCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltLastFooterStatus_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>lastfooterBorderAboveCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltLastFooterBorderAbove_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>lastfooterBorderBelowCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltLastFooterBorderBelow_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>lastfooterNoContentsCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>ltLastFooterEmpty_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>specialAlignmentED</sender>
+        <signal>returnPressed()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>specialAlignment_changed()</slot>
+    </connection>
+    <connection>
+        <sender>widthED</sender>
+        <signal>returnPressed()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>width_changed()</slot>
+    </connection>
+    <connection>
+        <sender>widthUnit</sender>
+        <signal>selectionChanged(LyXLength::UNIT)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>width_changed()</slot>
+    </connection>
+    <connection>
+        <sender>closePB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>close_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>borders</sender>
+        <signal>topSet(bool)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>topBorder_changed()</slot>
+    </connection>
+    <connection>
+        <sender>borders</sender>
+        <signal>bottomSet(bool)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>bottomBorder_changed()</slot>
+    </connection>
+    <connection>
+        <sender>borders</sender>
+        <signal>rightSet(bool)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>rightBorder_changed()</slot>
+    </connection>
+    <connection>
+        <sender>borders</sender>
+        <signal>leftSet(bool)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>leftBorder_changed()</slot>
+    </connection>
+    <slot access="protected">borderSet_clicked()</slot>
+    <slot access="protected">borderUnset_clicked()</slot>
+    <slot access="protected">border_toggled()</slot>
     <slot access="protected">change_adaptor()</slot>
     <slot access="protected">columnAppend_clicked()</slot>
+    <slot access="protected">columnDelete_clicked()</slot>
+    <slot access="protected">hAlign_changed(int)</slot>
+    <slot access="protected">vAlign_changed(int)</slot>
+    <slot access="protected">rotateTabular_checked(int)</slot>
+    <slot access="protected">rotateCell_checked(int)</slot>
+    <slot access="protected">multicolumn_clicked()</slot>
     <slot access="protected">rowAppend_clicked()</slot>
     <slot access="protected">rowDelete_clicked()</slot>
-    <slot access="protected">borderSet_clicked()</slot>
-    <slot access="protected">borderUnset_clicked()</slot>
-    <slot access="protected">rotateTabular_checked()</slot>
-    <slot access="protected">border_toggled()</slot>
+    <slot access="protected">leftBorder_changed()</slot>
+    <slot access="protected">rightBorder_changed()</slot>
+    <slot access="protected">topBorder_changed()</slot>
+    <slot access="protected">bottomBorder_changed()</slot>
+    <slot access="protected">longTabular_changed(int)</slot>
+    <slot access="protected">ltNewpage_clicked()</slot>
+    <slot access="protected">ltHeaderStatus_clicked()</slot>
+    <slot access="protected">ltHeaderBorderAbove_clicked()</slot>
+    <slot access="protected">ltHeaderBorderBelow_clicked()</slot>
+    <slot access="protected">ltFirstHeaderStatus_clicked()</slot>
+    <slot access="protected">ltFirstHeaderBorderAbove_clicked()</slot>
+    <slot access="protected">ltFirstHeaderBorderBelow_clicked()</slot>
+    <slot access="protected">ltFirstHeaderEmpty_clicked()</slot>
+    <slot access="protected">ltFooterStatus_clicked()</slot>
+    <slot access="protected">ltFooterBorderAbove_clicked()</slot>
+    <slot access="protected">ltFooterBorderBelow_clicked()</slot>
+    <slot access="protected">ltLastFooterStatus_clicked()</slot>
+    <slot access="protected">ltLastFooterBorderAbove_clicked()</slot>
+    <slot access="protected">ltLastFooterBorderBelow_clicked()</slot>
+    <slot access="protected">ltLastFooterEmpty_clicked()</slot>
+    <slot access="protected">specialAlignment_changed()</slot>
+    <slot access="protected">width_changed()</slot>
+    <slot access="protected">close_clicked()</slot>
     <slot access="public">setEnabled(bool)</slot>
 </connections>
 <tabstops>
     <tabstop>TabWidget</tabstop>
+    <tabstop>specialAlignmentED</tabstop>
     <tabstop>columnAddPB</tabstop>
+    <tabstop>columnDeletePB</tabstop>
+    <tabstop>rowAddPB</tabstop>
+    <tabstop>rowDeletePB</tabstop>
+    <tabstop>hAlignCB</tabstop>
+    <tabstop>multicolumnCB</tabstop>
+    <tabstop>widthED</tabstop>
+    <tabstop>widthUnit</tabstop>
+    <tabstop>vAlignCB</tabstop>
+    <tabstop>rotateTabularCB</tabstop>
+    <tabstop>rotateCellCB</tabstop>
     <tabstop>closePB</tabstop>
+    <tabstop>borderSetPB</tabstop>
+    <tabstop>borderUnsetPB</tabstop>
+    <tabstop>longTabularCB</tabstop>
+    <tabstop>headerStatusCB</tabstop>
+    <tabstop>firstheaderStatusCB</tabstop>
+    <tabstop>footerStatusCB</tabstop>
+    <tabstop>lastfooterStatusCB</tabstop>
+    <tabstop>headerBorderAboveCB</tabstop>
+    <tabstop>firstheaderBorderAboveCB</tabstop>
+    <tabstop>footerBorderAboveCB</tabstop>
+    <tabstop>lastfooterBorderAboveCB</tabstop>
+    <tabstop>lastfooterBorderBelowCB</tabstop>
+    <tabstop>footerBorderBelowCB</tabstop>
+    <tabstop>firstheaderBorderBelowCB</tabstop>
+    <tabstop>headerBorderBelowCB</tabstop>
+    <tabstop>lastfooterNoContentsCB</tabstop>
+    <tabstop>firstheaderNoContentsCB</tabstop>
+    <tabstop>newpageCB</tabstop>
 </tabstops>
 </UI>