From: Uwe Stöhr Date: Sat, 11 Jul 2009 13:09:45 +0000 (+0000) Subject: - support for longtable alignment, fileformat change X-Git-Tag: 2.0.0~6091 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=424943af89d722183805874b13942c09ff2b2a5a;p=features.git - support for longtable alignment, fileformat change - GUI support for table alignment (all comments to the polished layout of the table dialog welcome) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30477 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/development/FORMAT b/development/FORMAT index da14ad6d2f..43adc0a653 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,10 @@ LyX file-format changes ----------------------- +2009-07-11 Uwe Stöhr + * Format incremented to 363: support for horizontal longtable + alignment. + 2009-06-11 Jürgen Spitzmüller * Format incremented to 362: support for the applemac encoding. diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 28786725ca..8966865917 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -727,6 +727,23 @@ def revert_applemac(document): document.header[i] = "\\encoding auto" +def revert_longtable_align(document): + " Remove longtable alignment setting " + i = 0 + j = 0 + while True: + i = find_token(document.body, "\\begin_inset Tabular", i) + if i == -1: + break + # the alignment is 2 lines below \\begin_inset Tabular + j = document.body[i+2].find("longtabularalignment") + if j == -1: + break + document.body[i+2] = document.body[i+2][:j-1] + document.body[i+2] = document.body[i+2] + '>' + i = i + 1 + + ## # Conversion hub # @@ -748,10 +765,12 @@ convert = [[346, []], [359, [convert_nomencl_width]], [360, []], [361, []], - [362, []] + [362, []], + [363, []] ] -revert = [[361, [revert_applemac]], +revert = [[362, [revert_longtable_align]], + [361, [revert_applemac]], [360, []], [359, [revert_nomencl_cwidth]], [358, [revert_nomencl_width]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 755a6166a0..369dff14f8 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -127,7 +127,7 @@ namespace { // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -int const LYX_FORMAT = 362; // jspitzm: support applemac encoding +int const LYX_FORMAT = 363; // uwestoehr: support for longtable alignment typedef map DepClean; typedef map > RefCache; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 0585e9e3c5..6acb25a3ff 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -2045,9 +2045,10 @@ void LyXAction::init() * \li Params: : append-row|append-column|delete-row|delete-column|copy-row|copy-column| toggle-line-top|toggle-line-bottom|toggle-line-left|toggle-line-right| align-left|align-right|align-center|align-block|valign-top|valign-bottom| - valign-middle|m-align-left|m-align-right|m-align-center|m-valign-top| - m-valign-bottom|m-valign-middle|multicolumn|set-all-lines|unset-all-lines| - set-longtabular|unset-longtabular|set-pwidth|set-mpwidth| + valign-middle|longtabular-align-left|longtabular-align-center| + longtabular-align-right|m-align-left|m-align-right|m-align-center| + m-valign-top|m-valign-bottom|m-valign-middle|multicolumn|set-all-lines| + unset-all-lines|set-longtabular|unset-longtabular|set-pwidth|set-mpwidth| set-rotate-tabular|unset-rotate-tabular|toggle-rotate-tabular| set-rotate-cell|unset-rotate-cell|toggle-rotate-cell|set-usebox|set-lthead| unset-lthead|set-ltfirsthead|unset-ltfirsthead|set-ltfoot|unset-ltfoot| diff --git a/src/frontends/qt4/GuiTabular.cpp b/src/frontends/qt4/GuiTabular.cpp index 76c4f95da7..c162f1fa0c 100644 --- a/src/frontends/qt4/GuiTabular.cpp +++ b/src/frontends/qt4/GuiTabular.cpp @@ -82,6 +82,8 @@ GuiTabular::GuiTabular(GuiView & lv) longtableGB, SLOT(setEnabled(bool))); connect(longTabularCB, SIGNAL(toggled(bool)), newpageCB, SLOT(setEnabled(bool))); + connect(longTabularCB, SIGNAL(toggled(bool)), + alignmentGB, SLOT(setEnabled(bool))); connect(hAlignCB, SIGNAL(activated(int)), this, SLOT(hAlign_changed(int))); connect(vAlignCB, SIGNAL(activated(int)), @@ -138,9 +140,17 @@ GuiTabular::GuiTabular(GuiView & lv) this, SLOT(rotateTabular())); connect(rotateCellCB, SIGNAL(clicked()), this, SLOT(rotateCell())); + connect(TableAlignCB, SIGNAL(activated(int)), + this, SLOT(tableAlignment_changed(int))); connect(longTabularCB, SIGNAL(clicked()), this, SLOT(longTabular())); - + connect(leftRB, SIGNAL(clicked()), + this, SLOT(ltAlignment_clicked())); + connect(centerRB, SIGNAL(clicked()), + this, SLOT(ltAlignment_clicked())); + connect(rightRB, SIGNAL(clicked()), + this, SLOT(ltAlignment_clicked())); + bc().setPolicy(ButtonPolicy::IgnorantPolicy); bc().addReadOnly(topspaceED); @@ -163,6 +173,7 @@ GuiTabular::GuiTabular(GuiView & lv) bc().addReadOnly(widthUnit); bc().addReadOnly(hAlignCB); bc().addReadOnly(vAlignCB); + bc().addReadOnly(TableAlignCB); bc().addReadOnly(borderSetPB); bc().addReadOnly(borderUnsetPB); bc().addReadOnly(borders); @@ -182,7 +193,10 @@ GuiTabular::GuiTabular(GuiView & lv) bc().addReadOnly(lastfooterBorderBelowCB); bc().addReadOnly(lastfooterNoContentsCB); bc().addReadOnly(newpageCB); - + bc().addReadOnly(leftRB); + bc().addReadOnly(centerRB); + bc().addReadOnly(rightRB); + // initialize the length validator bc().addCheckedLineEdit(widthED, fixedWidthColLA); bc().addCheckedLineEdit(topspaceED, topspaceLA); @@ -420,6 +434,19 @@ void GuiTabular::vAlign_changed(int align) } +void GuiTabular::tableAlignment_changed(int align) +{ + switch (align) { + case 0: set(Tabular::TABULAR_VALIGN_TOP); + break; + case 1: set(Tabular::TABULAR_VALIGN_MIDDLE); + break; + case 2: set(Tabular::TABULAR_VALIGN_BOTTOM); + break; + } +} + + void GuiTabular::longTabular() { longTabular(longTabularCB->isChecked()); @@ -587,6 +614,18 @@ void GuiTabular::ltLastFooterEmpty_clicked() } +void GuiTabular::ltAlignment_clicked() +{ + if (leftRB->isChecked()) + set(Tabular::LONGTABULAR_ALIGN_LEFT); + else if (centerRB->isChecked()) + set(Tabular::LONGTABULAR_ALIGN_CENTER); + else if (rightRB->isChecked()) + set(Tabular::LONGTABULAR_ALIGN_RIGHT); + changed(); +} + + void GuiTabular::update_borders() { Tabular::idx_type const cell = getActiveCell(); @@ -787,6 +826,23 @@ void GuiTabular::updateContents() hAlignCB->setEnabled(true); vAlignCB->setEnabled(!pwidth.zero()); + int tableValign = 0; + switch (tabular_.tabular_valignment) { + case Tabular::LYX_VALIGN_TOP: + tableValign = 0; + break; + case Tabular::LYX_VALIGN_MIDDLE: + tableValign = 1; + break; + case Tabular::LYX_VALIGN_BOTTOM: + tableValign = 2; + break; + default: + tableValign = 0; + break; + } + TableAlignCB->setCurrentIndex(tableValign); + if (!tabular_.is_long_tabular) { headerStatusCB->setChecked(false); headerBorderAboveCB->setChecked(false); @@ -809,6 +865,21 @@ void GuiTabular::updateContents() captionStatusCB->blockSignals(false); return; } + + switch (tabular_.longtabular_alignment) { + case Tabular::LYX_LONGTABULAR_ALIGN_LEFT: + leftRB->setChecked(true); + break; + case Tabular::LYX_LONGTABULAR_ALIGN_CENTER: + centerRB->setChecked(true); + break; + case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT: + rightRB->setChecked(true); + break; + default: + centerRB->setChecked(true); + break; + } captionStatusCB->blockSignals(true); captionStatusCB->setChecked(tabular_.ltCaption(row)); captionStatusCB->blockSignals(false); diff --git a/src/frontends/qt4/GuiTabular.h b/src/frontends/qt4/GuiTabular.h index f70d988daa..158a0ad6f1 100644 --- a/src/frontends/qt4/GuiTabular.h +++ b/src/frontends/qt4/GuiTabular.h @@ -49,6 +49,7 @@ private Q_SLOTS: void rotateCell(); void hAlign_changed(int align); void vAlign_changed(int align); + void tableAlignment_changed(int align); void specialAlignment_changed(); void width_changed(); void longTabular(); @@ -67,6 +68,7 @@ private Q_SLOTS: void ltLastFooterBorderAbove_clicked(); void ltLastFooterBorderBelow_clicked(); void ltLastFooterEmpty_clicked(); + void ltAlignment_clicked(); void on_captionStatusCB_toggled(); private: diff --git a/src/frontends/qt4/ui/TabularUi.ui b/src/frontends/qt4/ui/TabularUi.ui index 331413f5c4..5203e4c2f1 100644 --- a/src/frontends/qt4/ui/TabularUi.ui +++ b/src/frontends/qt4/ui/TabularUi.ui @@ -1,274 +1,476 @@ - + TabularUi - - + + 0 0 - 436 - 359 + 378 + 415 - + - + true - - + + 9 - + 6 - - - + + + + 6 + + + 0 + + + + + Current cell: + + + + + + + + 0 + 0 + + + + + 40 + 32767 + + + + Qt::NoFocus + + + Current row position + + + + + + + + 0 + 0 + + + + + 40 + 32767 + + + + Qt::NoFocus + + + Current column position + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + + 0 + 0 + + + + Close + + + false + + + + + + + + - + QTabWidget::Rounded - + 0 - - + + &Table Settings - - - 9 - - - 6 - - - - - Column Width + + + + + Column settings - - - 9 - - - 6 - - - + + + + + &Horizontal alignment: + + + hAlignCB + + - - - + + + + Horizontal alignment in column + + + + Justified + + + + + Left + + + + + Center + + + + + Right + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + &Width: + + + widthED + + + + + + true - + Fixed width of the column - + - - - + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 7 + 20 + + + + + + + + &Vertical alignment in row: + + + vAlignCB + + + + + + Specifies the vertical alignment of this cell in relation to the baseline of the row. - + Top - + Middle - + Bottom - - - - &Width: + + + + Qt::Horizontal - - widthED + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + Merge cells + + + &Multicolumn - - - - &Vertical alignment in row: + + + + + + + Cell setting + + + + + + Rotate this cell by 90 degrees - - vAlignCB + + Rotate &cell 90 degrees - - - - &Horizontal alignment: + + + + true - - hAlignCB + + Table-wide settings + + + + + Verti&cal alignment: + + + vAlignCB + + + + + + + Specifies the vertical alignment of this cell in relation to the baseline of the row. + + + 1 + + + + Top + + + + + Middle + + + + + Bottom + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 153 + 20 + + + + + + + + true + + + Rotate the table by 90 degrees + + + &Rotate table 90 degrees + + + + - - - - Horizontal alignment in column - - - - Justified - - - - - Left - - + + - - Center - + + + LaTe&X argument: + + + specialAlignmentED + + - - Right - + + + Custom column format (LaTeX) + + - + - - - - Qt::Horizontal - - - QSizePolicy::Expanding + + + + Qt::Vertical - + 20 - 20 + 68 - - - - true - - - Rotate the table by 90 degrees - - - &Rotate table 90 degrees - - - - - - - Rotate this cell by 90 degrees - - - Rotate &cell 90 degrees - - - - - - - Merge cells - - - &Multicolumn - - - - - - - LaTe&X argument: - - - specialAlignmentED - - - - - - - Custom column format (LaTeX) - - - - - + + &Borders - - + + 9 - + 6 - - - + + + 0 - + 6 - - - + + + All Borders - - + + 9 - + 6 - - - + + + Set all borders of the current (selected) cell(s) - + &Set - - - + + + Unset all borders of the current (selected) cell(s) - + C&lear @@ -276,15 +478,15 @@ - + - + Qt::Horizontal - + QSizePolicy::Expanding - + 20 20 @@ -292,37 +494,37 @@ - - - + + + Style - - + + 9 - + 6 - - - + + + Use formal (a.k.a. booktabs) border style (no vertical borders) - + Fo&rmal - + true - - - + + + Use default (grid-like) border style - + De&fault @@ -330,12 +532,12 @@ - + - + Qt::Vertical - + 20 31 @@ -343,178 +545,176 @@ - - - + + + Set Borders - - + + 9 - + 6 - - - - - 0 - 0 + + + + 0 0 - + - - - + + + 0 0 0 - - - + + + 230 240 249 - - - + + + 255 255 255 - - - + + + 242 247 252 - - - + + + 115 120 124 - - - + + + 154 160 166 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 16 145 210 - - - + + + 255 255 255 - - - + + + 0 0 255 - - - + + + 255 0 255 - - - + + + 232 232 232 @@ -523,153 +723,153 @@ - - - + + + 0 0 0 - - - + + + 230 240 249 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 115 120 124 - - - + + + 154 160 166 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 16 145 210 - - - + + + 255 255 255 - - - + + + 0 0 255 - - - + + + 255 0 255 - - - + + + 232 232 232 @@ -678,153 +878,153 @@ - - - + + + 128 128 128 - - - + + + 230 240 249 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 115 120 124 - - - + + + 154 160 166 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 16 145 210 - - - + + + 255 255 255 - - - + + + 0 0 255 - - - + + + 255 0 255 - - - + + + 232 232 232 @@ -834,30 +1034,28 @@ - + QFrame::StyledPanel - + QFrame::Sunken - - + + 9 - + 6 - - - - - 0 - 0 + + + + 0 0 - + Set borders of the current (selected) cell(s) @@ -868,122 +1066,122 @@ - - - + + + Additional Space - - + + 9 - + 6 - - - + + + T&op of row: - + topspaceCO - - + + - - + + - - + + - + None - + Default - + Custom - - + + - + None - + Default - + Custom - - + + - - + + - - - + + + Botto&m of row: - + bottomspaceCO - - + + - - - + + + Bet&ween rows: - + interlinespaceCO - - + + - + None - + Default - + Custom - - + + @@ -992,246 +1190,224 @@ - - + + &Longtable - - - 9 - - - 6 - - - - - Qt::Vertical - - - - 91 - 31 - - - - - - - - false - - - Set a page break on the current row + + + + + Select for tables that span multiple pages - - Page &break on current row + + &Use long table - - - + + + false - - Settings + + Row settings - - + + 9 - + 6 - - - + + + Status - - - + + + Border above - - - + + + Border below - - - + + + Contents - - - + + + Header: - - - + + + Repeat this row as header on every (except the first) page - + on - - - + + + - + double - - - + + + double - - - + + + First header: - - - + + + This row is the header of the first page - + - + on - - - + + + double - - - + + + double - - - + + + Don't output the first header - + is empty - - - + + + Footer: - - - + + + Repeat this row as footer on every (except the last) page - + on - - - + + + double - - - + + + double - - - + + + Last footer: - - - + + + This row is the footer of the last page - + on - - - + + + double - - - + + + double - - - + + + Don't output the last footer - + is empty - - - + + + Caption: - - - + + + on @@ -1239,119 +1415,72 @@ - - - - Select for tables that span multiple pages + + + + false - - &Use long table + + Set a page break on the current row + + + Page &break on current row + + + + false + + + Longtable alignment + + + + + + Left + + + + + + + Center + + + true + + + + + + + Right + + + + + + + + + + Qt::Vertical + + + + 20 + 91 + + + + - - - - 0 - - - 6 - - - - - Current cell: - - - - - - - - 0 - 0 - 0 - 0 - - - - - 40 - 32767 - - - - Qt::NoFocus - - - Current row position - - - - - - - - 0 - 0 - 0 - 0 - - - - - 40 - 32767 - - - - Qt::NoFocus - - - Current column position - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - - 0 - 0 - 0 - 0 - - - - Close - - - false - - - - - @@ -1408,7 +1537,7 @@ newpageCB - qt_i18n.h + qt_i18n.h diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 93381ca6ce..001be8e7d7 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -163,6 +163,9 @@ TabularFeature tabularFeature[] = { Tabular::TABULAR_VALIGN_TOP, "tabular-valign-top"}, { Tabular::TABULAR_VALIGN_MIDDLE, "tabular-valign-middle"}, { Tabular::TABULAR_VALIGN_BOTTOM, "tabular-valign-bottom"}, + { Tabular::LONGTABULAR_ALIGN_LEFT, "longtabular-align-left" }, + { Tabular::LONGTABULAR_ALIGN_CENTER, "longtabular-align-center" }, + { Tabular::LONGTABULAR_ALIGN_RIGHT, "longtabular-align-right" }, { Tabular::LAST_ACTION, "" } }; @@ -257,6 +260,20 @@ string const tostr(LyXAlignment const & num) } +string const tostr(Tabular::HAlignment const & num) +{ + switch (num) { + case Tabular::LYX_LONGTABULAR_ALIGN_LEFT: + return "left"; + case Tabular::LYX_LONGTABULAR_ALIGN_CENTER: + return "center"; + case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT: + return "right"; + } + return string(); +} + + string const tostr(Tabular::VAlignment const & num) { switch (num) { @@ -304,6 +321,20 @@ bool string2type(string const str, LyXAlignment & num) } +bool string2type(string const str, Tabular::HAlignment & num) +{ + if (str == "left") + num = Tabular::LYX_LONGTABULAR_ALIGN_LEFT; + else if (str == "center" ) + num = Tabular::LYX_LONGTABULAR_ALIGN_CENTER; + else if (str == "right") + num = Tabular::LYX_LONGTABULAR_ALIGN_RIGHT; + else + return false; + return true; +} + + bool string2type(string const str, Tabular::VAlignment & num) { if (str == "top") @@ -393,6 +424,14 @@ bool getTokenValue(string const & str, char const * token, LyXAlignment & num) } +bool getTokenValue(string const & str, char const * token, + Tabular::HAlignment & num) +{ + string tmp; + return getTokenValue(str, token, tmp) && string2type(tmp, num); +} + + bool getTokenValue(string const & str, char const * token, Tabular::VAlignment & num) { @@ -598,6 +637,7 @@ void Tabular::init(Buffer & buf, row_type rows_arg, updateIndexes(); is_long_tabular = false; tabular_valignment = LYX_VALIGN_MIDDLE; + longtabular_alignment = LYX_LONGTABULAR_ALIGN_CENTER; rotate = false; use_booktabs = false; size_t row_count = row_info.size(); @@ -1288,6 +1328,7 @@ void Tabular::write(ostream & os) const << write_attribute("booktabs", use_booktabs) << write_attribute("islongtable", is_long_tabular) << write_attribute("tabularvalignment", tabular_valignment) + << write_attribute("longtabularalignment", longtabular_alignment) << write_attribute("firstHeadTopDL", endfirsthead.topDL) << write_attribute("firstHeadBottomDL", endfirsthead.bottomDL) << write_attribute("firstHeadEmpty", endfirsthead.empty) @@ -1387,6 +1428,7 @@ void Tabular::read(Lexer & lex) getTokenValue(line, "booktabs", use_booktabs); getTokenValue(line, "islongtable", is_long_tabular); getTokenValue(line, "tabularvalignment", tabular_valignment); + getTokenValue(line, "longtabularalignment", longtabular_alignment); getTokenValue(line, "firstHeadTopDL", endfirsthead.topDL); getTokenValue(line, "firstHeadBottomDL", endfirsthead.bottomDL); getTokenValue(line, "firstHeadEmpty", endfirsthead.empty); @@ -2313,20 +2355,30 @@ int Tabular::latex(odocstream & os, OutputParams const & runparams) const os << "\\begin{sideways}\n"; ++ret; } - if (is_long_tabular) + if (is_long_tabular) { os << "\\begin{longtable}"; - else + switch (longtabular_alignment) { + case LYX_LONGTABULAR_ALIGN_LEFT: + os << "[l]"; + break; + case LYX_LONGTABULAR_ALIGN_CENTER: + break; + case LYX_LONGTABULAR_ALIGN_RIGHT: + os << "[r]"; + break; + } + } else { os << "\\begin{tabular}"; - - switch (tabular_valignment) { + switch (tabular_valignment) { case LYX_VALIGN_TOP: os << "[t]"; break; + case LYX_VALIGN_MIDDLE: + break; case LYX_VALIGN_BOTTOM: os << "[b]"; break; - case LYX_VALIGN_MIDDLE: - break; + } } os << "{"; @@ -3083,7 +3135,7 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const BufferView * bv = pi.base.bv; Cursor & cur = pi.base.bv->cursor(); - // FIXME: As the full backrgound is painted in drawSelection(), + // FIXME: As the full background is painted in drawSelection(), // we have no choice but to do a full repaint for the Text cells. pi.full_repaint = true; @@ -3915,6 +3967,19 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd, == Tabular::LYX_VALIGN_BOTTOM); break; + case Tabular::LONGTABULAR_ALIGN_LEFT: + status.setOnOff(tabular.longtabular_alignment + == Tabular::LYX_LONGTABULAR_ALIGN_LEFT); + break; + case Tabular::LONGTABULAR_ALIGN_CENTER: + status.setOnOff(tabular.longtabular_alignment + == Tabular::LYX_LONGTABULAR_ALIGN_CENTER); + break; + case Tabular::LONGTABULAR_ALIGN_RIGHT: + status.setOnOff(tabular.longtabular_alignment + == Tabular::LYX_LONGTABULAR_ALIGN_RIGHT); + break; + case Tabular::UNSET_ROTATE_TABULAR: status.setOnOff(!tabular.rotate); break; @@ -4091,6 +4156,22 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd, } +Inset::DisplayType InsetTabular::display() const +{ + if (tabular.is_long_tabular) { + switch (tabular.longtabular_alignment) { + case Tabular::LYX_LONGTABULAR_ALIGN_LEFT: + return AlignLeft; + case Tabular::LYX_LONGTABULAR_ALIGN_CENTER: + return AlignCenter; + case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT: + return AlignRight; + } + } else + return Inline; +} + + int InsetTabular::latex(odocstream & os, OutputParams const & runparams) const { return tabular.latex(os, runparams); @@ -4703,6 +4784,20 @@ void InsetTabular::tabularFeatures(Cursor & cur, tabular.tabular_valignment = Tabular::LYX_VALIGN_BOTTOM; break; + case Tabular::LONGTABULAR_ALIGN_LEFT: + tabular.longtabular_alignment = Tabular::LYX_LONGTABULAR_ALIGN_LEFT; + break; + + case Tabular::LONGTABULAR_ALIGN_CENTER: + tabular.longtabular_alignment = Tabular::LYX_LONGTABULAR_ALIGN_CENTER; + break; + + case Tabular::LONGTABULAR_ALIGN_RIGHT: + tabular.longtabular_alignment = Tabular::LYX_LONGTABULAR_ALIGN_RIGHT; + break; + + + case Tabular::SET_ROTATE_CELL: for (row_type i = sel_row_start; i <= sel_row_end; ++i) for (col_type j = sel_col_start; j <= sel_col_end; ++j) diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index e81cbc0e57..905fdcd98c 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -184,6 +184,12 @@ public: /// TABULAR_VALIGN_BOTTOM, /// + LONGTABULAR_ALIGN_LEFT, + /// + LONGTABULAR_ALIGN_CENTER, + /// + LONGTABULAR_ALIGN_RIGHT, + /// LAST_ACTION }; /// @@ -205,6 +211,15 @@ public: /// LYX_VALIGN_MIDDLE = 2 }; + /// + enum HAlignment { + /// + LYX_LONGTABULAR_ALIGN_LEFT = 0, + /// + LYX_LONGTABULAR_ALIGN_CENTER = 1, + /// + LYX_LONGTABULAR_ALIGN_RIGHT = 2 + }; enum BoxType { /// @@ -569,6 +584,8 @@ public: VAlignment tabular_valignment; // // for long tabulars + /// + HAlignment longtabular_alignment; // bool is_long_tabular; /// endhead data @@ -750,7 +767,7 @@ public: insets that may contain several paragraphs */ bool noFontChange() const { return true; } /// - DisplayType display() const { return tabular.is_long_tabular ? AlignCenter : Inline; } + DisplayType display() const; /// int latex(odocstream &, OutputParams const &) const; ///