+ rotateTabularCB->setChecked(tabular.rotate != 0);
+ if (rotateTabularCB->isChecked()) {
+ if (longTabularCB->isChecked())
+ rotateTabularAngleSB->setValue(90);
+ else
+ rotateTabularAngleSB->setValue(tabular.rotate != 0 ? tabular.rotate : 90);
+ }
+
+ // In what follows, we check the borders of all selected cells,
+ // and if there are diverging settings, we use the LINE_UNDECIDED
+ // border status.
+ GuiSetBorder::BorderState ltop = GuiSetBorder::LINE_UNDEF;
+ GuiSetBorder::BorderState lbottom = GuiSetBorder::LINE_UNDEF;
+ GuiSetBorder::BorderState lleft = GuiSetBorder::LINE_UNDEF;
+ GuiSetBorder::BorderState lright = GuiSetBorder::LINE_UNDEF;
+ GuiSetBorder::BorderState ltop_ltrim = GuiSetBorder::LINE_UNDEF;
+ GuiSetBorder::BorderState ltop_rtrim = GuiSetBorder::LINE_UNDEF;
+ GuiSetBorder::BorderState lbottom_ltrim = GuiSetBorder::LINE_UNDEF;
+ GuiSetBorder::BorderState lbottom_rtrim = GuiSetBorder::LINE_UNDEF;
+ CursorSlice const & beg = bv->cursor().selBegin();
+ CursorSlice const & end = bv->cursor().selEnd();
+ if (beg != end) {
+ Tabular::col_type cs = tabular.cellColumn(beg.idx());
+ Tabular::col_type ce = tabular.cellColumn(end.idx());
+ if (cs > ce)
+ swap(cs, ce);
+ Tabular::row_type rs = tabular.cellRow(beg.idx());
+ Tabular::row_type re = tabular.cellRow(end.idx());
+ if (rs > re)
+ swap(rs, re);
+ for (Tabular::row_type r = rs; r <= re; ++r)
+ for (Tabular::col_type c = cs; c <= ce; ++c) {
+ idx_type const cc = tabular.cellIndex(r, c);
+ ltop = borderState(ltop, tabular.topLine(cc));
+ lbottom = borderState(lbottom, tabular.bottomLine(cc));
+ lleft = borderState(lleft, tabular.leftLine(cc));
+ lright = borderState(lright, tabular.rightLine(cc));
+ ltop_ltrim = borderState(ltop_ltrim, !tabular.topLineTrim(cc).first);
+ ltop_rtrim = borderState(ltop_rtrim, !tabular.topLineTrim(cc).second);
+ lbottom_ltrim = borderState(lbottom_ltrim, !tabular.bottomLineTrim(cc).first);
+ lbottom_rtrim = borderState(lbottom_rtrim, !tabular.bottomLineTrim(cc).second);
+ // store left/right borders for the case of formal/nonformal switch
+ orig_leftborder_ = borderState(lleft, tabular.leftLine(cc, true));
+ orig_rightborder_ = borderState(lright, tabular.rightLine(cc, true));
+ }
+ } else {
+ ltop = tabular.topLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
+ lbottom = tabular.bottomLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
+ lleft = tabular.leftLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
+ lright = tabular.rightLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
+ ltop_ltrim = tabular.topLineTrim(cell).first ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
+ ltop_rtrim = tabular.topLineTrim(cell).second ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
+ lbottom_ltrim = tabular.bottomLineTrim(cell).first ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
+ lbottom_rtrim = tabular.bottomLineTrim(cell).second ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
+ // store left/right borders for the case of formal/nonformal switch
+ orig_leftborder_ = tabular.leftLine(cell, true) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
+ orig_rightborder_ = tabular.rightLine(cell, true) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
+ }
+ borders->setTop(ltop);
+ borders->setBottom(lbottom);
+ borders->setLeft(lleft);
+ borders->setRight(lright);
+ borders->setTopLeftTrim(ltop_ltrim);
+ borders->setTopRightTrim(ltop_rtrim);
+ borders->setBottomLeftTrim(lbottom_ltrim);
+ borders->setBottomRightTrim(lbottom_rtrim);