4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Matthias Ettrich
10 * \author Jürgen Vigna
11 * \author Edwin Leuven
13 * \author Scott Kostyshak
15 * Full author contact details are available in file CREDITS.
18 // Things to think of when designing the new tabular support:
19 // - color support (colortbl, color)
20 // - decimal alignment (dcloumn)
21 // - custom lines (hhline)
24 #ifndef INSET_TABULAR_H
25 #define INSET_TABULAR_H
28 #include "InsetText.h"
30 #include "support/Length.h"
31 #include "support/types.h"
53 class InsetTableCell : public InsetText
57 explicit InsetTableCell(Buffer * buf);
58 /// We need this since generation of the default is deprecated
59 /// (since we declare the assignment constuctor below).
60 InsetTableCell(InsetTableCell const & in) = default;
62 InsetCode lyxCode() const override { return CELL_CODE; }
64 Inset * clone() const override { return new InsetTableCell(*this); }
66 bool getStatus(Cursor & cur, FuncRequest const & cmd,
67 FuncStatus & status) const override;
69 void toggleFixedWidth(bool fw) { isFixedWidth = fw; }
71 void toggleVarWidth(bool vw) { isVarwidth = vw; }
73 void toggleMultiCol(bool m) { isMultiColumn = m; }
75 void toggleMultiRow(bool m) { isMultiRow = m; }
77 void setContentAlignment(LyXAlignment al) {contentAlign = al; }
78 /// writes the contents of the cell as a string, optionally
79 /// descending into insets
80 docstring asString(bool intoInsets = true);
82 docstring xhtml(XMLStream &, OutputParams const &) const override;
84 void docbook(XMLStream &, OutputParams const &) const override;
86 void addToToc(DocIterator const & di, bool output_active,
87 UpdateType utype, TocBackend & backend) const override;
89 void metrics(MetricsInfo &, Dimension &) const override;
90 /// Needs to be same as InsetTabular
91 bool inheritFont() const override { return false; }
92 /// Can the cell contain several paragraphs?
93 bool allowMultiPar() const override { return !isMultiRow && (!isMultiColumn || isFixedWidth); }
95 bool canPaintChange(BufferView const &) const override { return false; }
98 InsetTableCell() = delete;
100 void operator=(InsetTableCell const &) = delete;
102 // These booleans are supposed to track whether the cell has had its
103 // width explicitly set and whether it is part of a multicolumn, respectively.
104 // We need to know this to determine whether
105 // layout changes and paragraph customization are allowed---that is,
106 // we need it in forcePlainLayout() and allowParagraphCustomization().
107 // Unfortunately, that information is not readily available in
108 // InsetTableCell. In the case of multicolumn cells, it is present
109 // in CellData, and so would be available here if CellData were to
110 // become a member of InsetTableCell. But in the other case, it isn't
111 // even available there, but is held in Tabular::ColumnData.
112 // So, the present solution uses this boolean to track the information
113 // we need to track, and tries to keep it updated. This is not ideal,
114 // but the other solutions are no better. These are:
115 // (i) Keep a pointer in InsetTableCell to the table;
116 // (ii) Find the table by iterating over the Buffer's insets.
117 // Solution (i) raises the problem of updating the pointer when an
118 // InsetTableCell is copied, and we'd therefore need a copy constructor
119 // in InsetTabular and then in Tabular, which seems messy, given how
120 // complicated those classes are. Solution (ii) involves a lot of
121 // iterating, since this information is needed quite often, and so may
123 // So, well, if someone can do better, please do!
133 // FIXME: Here the thoughts from the comment above also apply.
135 LyXAlignment contentAlign;
136 /// should paragraph indentation be omitted in any case?
137 bool neverIndent() const override { return true; }
139 LyXAlignment contentAlignment() const override { return contentAlign; }
141 bool usePlainLayout() const override { return true; }
143 bool allowParagraphCustomization(idx_type = 0) const override;
145 bool forceLocalFontSwitch() const override;
146 /// Is the width forced to some value?
147 bool hasFixedWidth() const override { return isFixedWidth; }
152 // A helper struct for tables
255 RESET_FORMAL_DEFAULT,
269 TOGGLE_VARWIDTH_COLUMN,
273 UNSET_ROTATE_TABULAR,
275 TOGGLE_ROTATE_TABULAR,
308 SET_SPECIAL_MULTICOLUMN,
326 TABULAR_VALIGN_MIDDLE,
328 TABULAR_VALIGN_BOTTOM,
330 LONGTABULAR_ALIGN_LEFT,
332 LONGTABULAR_ALIGN_CENTER,
334 LONGTABULAR_ALIGN_RIGHT,
349 CELL_BEGIN_OF_MULTICOLUMN,
351 CELL_PART_OF_MULTICOLUMN,
353 CELL_BEGIN_OF_MULTIROW,
355 CELL_PART_OF_MULTIROW
363 LYX_VALIGN_MIDDLE = 1,
365 LYX_VALIGN_BOTTOM = 2
371 LYX_LONGTABULAR_ALIGN_LEFT = 0,
373 LYX_LONGTABULAR_ALIGN_CENTER = 1,
375 LYX_LONGTABULAR_ALIGN_RIGHT = 2
416 // we have this header type (is set in the getLT... functions)
418 // double borders on top
420 // double borders on bottom
422 // used for FirstHeader & LastFooter and if this is true
423 // all the rows marked as FirstHeader or LastFooter are
424 // ignored in the output and it is set to be empty!
428 /// index indicating an invalid position
429 static const idx_type npos = static_cast<idx_type>(-1);
432 Tabular(Buffer * buf, col_type columns_arg, row_type rows_arg);
434 /// Returns true if there is a topline, returns false if not
435 bool topLine(idx_type cell) const;
436 /// Returns true if there is a topline, returns false if not
437 bool bottomLine(idx_type cell) const;
438 /// Returns true if there is a topline, returns false if not
439 /// If \p ignore_bt is true, we return the state as if booktabs was
441 bool leftLine(idx_type cell, bool const ignore_bt = false) const;
442 /// Returns true if there is a topline, returns false if not
443 /// If \p ignore_bt is true, we return the state as if booktabs was
445 bool rightLine(idx_type cell, bool const ignore_bt = false) const;
446 /// Returns whether the top line is trimmed left and/or right
447 std::pair<bool, bool> topLineTrim(idx_type const cell) const;
448 /// Returns whether the bottom line is trimmed left and/or right
449 std::pair<bool, bool> bottomLineTrim(idx_type const cell) const;
451 /// return space occupied by the second horizontal line and
452 /// interline space above row \p row in pixels
453 int interRowSpace(row_type row) const;
455 int interColumnSpace(idx_type cell) const;
457 /* returns the maximum over all rows */
459 int cellWidth(idx_type cell) const;
461 int cellHeight(idx_type cell) const;
467 row_type nrows() const {return row_info.size();}
469 col_type ncols() const {return column_info.size();}
471 int rowAscent(row_type row) const;
473 int rowDescent(row_type row) const;
475 void setRowAscent(row_type row, int height);
477 void setRowDescent(row_type row, int height);
479 void setTopLine(idx_type cell, bool line);
481 void setBottomLine(idx_type cell, bool line);
483 void setTopLineLTrim(idx_type cell, bool val);
485 void setBottomLineLTrim(idx_type cell, bool val);
487 void setTopLineRTrim(idx_type cell, bool val);
489 void setBottomLineRTrim(idx_type cell, bool val);
491 void setTopLineTrim(idx_type cell, std::pair<bool, bool>);
493 void setBottomLineTrim(idx_type cell, std::pair<bool, bool>);
495 void setLeftLine(idx_type cell, bool line);
497 void setRightLine(idx_type cell, bool line);
499 bool rowTopLine(row_type row) const;
501 bool rowBottomLine(row_type row) const;
503 bool columnLeftLine(col_type column) const;
505 bool columnRightLine(col_type column) const;
507 void setAlignment(idx_type cell, LyXAlignment align,
508 bool onlycolumn = false);
510 void setVAlignment(idx_type cell, VAlignment align,
511 bool onlycolumn = false);
513 void setTabularWidth(Length const & l) { tabular_width = l; }
515 Length tabularWidth() const { return tabular_width; }
517 void setColumnPWidth(Cursor &, idx_type, Length const &);
519 bool setMColumnPWidth(Cursor &, idx_type, Length const &);
521 bool toggleVarwidth(idx_type, bool const);
523 bool setMROffset(Cursor &, idx_type, Length const &);
525 void setAlignSpecial(idx_type cell, docstring const & special,
528 LyXAlignment getAlignment(idx_type cell,
529 bool onlycolumn = false) const;
531 VAlignment getVAlignment(idx_type cell,
532 bool onlycolumn = false) const;
533 /// The vertical offset of the table due to the vertical
534 /// alignment with respect to the baseline.
535 int offsetVAlignment() const;
537 Length const getPWidth(idx_type cell) const;
539 Length const getMROffset(idx_type cell) const;
541 int textHOffset(idx_type cell) const;
543 int textVOffset(idx_type cell) const;
545 void appendRow(row_type row);
547 void deleteRow(row_type row, bool const force = false);
549 void copyRow(row_type row);
551 void insertRow(row_type row, bool copy);
553 void moveColumn(col_type col_start, col_type col_end,
554 ColDirection direction);
556 void moveRow(row_type row_start, row_type row_end,
557 RowDirection direction);
559 void appendColumn(col_type column);
561 void deleteColumn(col_type column, bool const force = false);
563 void copyColumn(col_type column);
565 void insertColumn(col_type column, bool copy);
567 idx_type getFirstCellInRow(row_type row, bool const ct = false) const;
569 idx_type getLastCellInRow(row_type row, bool const ct = false) const;
571 idx_type getFirstRow(bool const ct = false) const;
573 idx_type getLastRow(bool const ct = false) const;
575 idx_type numberOfCellsInRow(row_type row) const;
577 void write(std::ostream &) const;
581 void latex(otexstream &, OutputParams const &) const;
582 /// serialise the table in DocBook, according to buffer parameters
583 void docbook(XMLStream &, OutputParams const &) const;
585 docstring xhtml(XMLStream &, OutputParams const &) const;
587 void plaintext(odocstringstream &,
588 OutputParams const & runparams, int const depth,
589 bool onlydata, char_type delim, size_t max_length = INT_MAX) const;
591 bool isMultiColumn(idx_type cell) const;
593 bool hasMultiColumn(col_type cell) const;
595 bool hasVarwidthColumn() const;
597 bool isVTypeColumn(col_type cell) const;
599 idx_type setMultiColumn(Cursor & cur, idx_type cell, idx_type number,
600 bool const right_border);
602 void unsetMultiColumn(idx_type cell);
604 bool isPartOfMultiColumn(row_type row, col_type column) const;
606 bool isPartOfMultiRow(row_type row, col_type column) const;
608 bool isMultiRow(idx_type cell) const;
610 bool hasMultiRow(row_type r) const;
612 idx_type setMultiRow(Cursor & cur, idx_type cell, idx_type number,
613 bool const bottom_border,
614 LyXAlignment const halign);
616 void unsetMultiRow(idx_type cell);
618 row_type cellRow(idx_type cell) const;
620 col_type cellColumn(idx_type cell) const;
622 void setRotateCell(idx_type cell, int);
624 int getRotateCell(idx_type cell) const;
626 bool needRotating() const;
628 bool isLastCell(idx_type cell) const;
630 idx_type cellAbove(idx_type cell) const;
632 idx_type cellBelow(idx_type cell) const;
633 /// \return the index of the VISIBLE cell at row, column
634 /// this will be the same as the cell in the previous row,
635 /// e.g., if the cell is part of a multirow
636 idx_type cellIndex(row_type row, col_type column) const;
638 void setUsebox(idx_type cell, BoxType);
640 BoxType getUsebox(idx_type cell) const;
642 // Long Tabular Options support functions
644 void setLTHead(row_type row, bool flag, ltType const &, bool first);
646 bool getRowOfLTHead(row_type row, ltType &) const;
648 bool getRowOfLTFirstHead(row_type row, ltType &) const;
650 void setLTFoot(row_type row, bool flag, ltType const &, bool last);
652 bool getRowOfLTFoot(row_type row, ltType &) const;
654 bool getRowOfLTLastFoot(row_type row, ltType &) const;
656 void setLTNewPage(row_type row, bool what);
658 bool getLTNewPage(row_type row) const;
660 idx_type setLTCaption(Cursor & cur, row_type row, bool what);
662 bool ltCaption(row_type row) const;
664 bool haveLTHead(bool withcaptions = true) const;
666 bool haveLTFirstHead(bool withcaptions = true) const;
668 bool haveLTFoot(bool withcaptions = true) const;
670 bool haveLTLastFoot(bool withcaptions = true) const;
672 bool haveLTCaption(CaptionType captiontype = CAPTION_ANY) const;
674 // end longtable support
677 /// there is a subtle difference between these two methods.
680 /// cellInset(cellIndex(r,c));
681 /// can return different things. this is because cellIndex(r,c)
682 /// returns the VISIBLE cell at r,c, which may be the same as the
683 /// cell at the previous row or column, if we're dealing with some
684 /// multirow or multicell.
685 std::shared_ptr<InsetTableCell> cellInset(idx_type cell);
686 std::shared_ptr<InsetTableCell> cellInset(row_type row, col_type column);
687 InsetTableCell const * cellInset(idx_type cell) const;
690 void setCellInset(row_type row, col_type column,
691 std::shared_ptr<InsetTableCell>);
692 /// Search for \param inset in the tabular, with the
694 void validate(LaTeXFeatures &) const;
697 // FIXME Now that cells have an InsetTableCell as their insets, rather
698 // than an InsetText, it'd be possible to reverse the relationship here,
699 // so that cell_vector was a vector<InsetTableCell> rather than a
700 // vector<CellData>, and an InsetTableCell had a CellData as a member,
701 // or perhaps just had its members as members.
706 explicit CellData(Buffer *);
708 CellData(CellData const &);
710 CellData & operator=(CellData const &);
722 LyXAlignment alignment;
724 VAlignment valignment;
725 /// width of the part before the decimal
727 /// width of the decimal part
740 bool top_line_rtrimmed;
742 bool top_line_ltrimmed;
744 bool bottom_line_rtrimmed;
746 bool bottom_line_ltrimmed;
752 docstring align_special;
754 Length p_width; // this is only set for multicolumn!!!
756 std::shared_ptr<InsetTableCell> inset;
759 CellData const & cellInfo(idx_type cell) const;
761 CellData & cellInfo(idx_type cell);
763 typedef std::vector<CellData> cell_vector;
765 typedef std::vector<cell_vector> cell_vvector;
776 /// Extra space between the top line and this row
778 /// Ignore top_space if true and use the default top space
779 bool top_space_default;
780 /// Extra space between this row and the bottom line
782 /// Ignore bottom_space if true and use the default bottom space
783 bool bottom_space_default;
784 /// Extra space between the bottom line and the next top line
785 Length interline_space;
786 /// Ignore interline_space if true and use the default interline space
787 bool interline_space_default;
788 /// This are for longtabulars only
791 /// a row of endfirsthead
795 /// row of endlastfoot
797 /// row for a newpage
805 typedef std::vector<RowData> row_vector;
813 LyXAlignment alignment;
815 VAlignment valignment;
821 docstring align_special;
823 docstring decimal_point;
830 typedef std::vector<ColumnData> column_vector;
833 idx_type numberofcells;
835 std::vector<row_type> rowofcell;
837 std::vector<col_type> columnofcell;
841 column_vector column_info;
843 cell_vvector cell_info;
845 Length tabular_width;
851 VAlignment tabular_valignment;
855 HAlignment longtabular_alignment;
857 bool is_long_tabular;
860 /// endfirsthead data
868 void init(Buffer *, row_type rows_arg,
869 col_type columns_arg);
871 void updateIndexes();
873 bool setFixedWidth(row_type r, col_type c);
874 /// return true of update is needed
875 bool updateColumnWidths(MetricsInfo & mi);
877 idx_type columnSpan(idx_type cell) const;
879 idx_type rowSpan(idx_type cell) const;
881 BoxType useBox(idx_type cell) const;
883 // helper function for Latex
885 void TeXTopHLine(otexstream &, row_type row, std::list<col_type>,
886 std::list<col_type>) const;
888 void TeXBottomHLine(otexstream &, row_type row, std::list<col_type>,
889 std::list<col_type>) const;
891 void TeXCellPreamble(otexstream &, idx_type cell, bool & ismulticol, bool & ismultirow,
892 bool const bidi) const;
894 void TeXCellPostamble(otexstream &, idx_type cell, bool ismulticol, bool ismultirow) const;
896 void TeXLongtableHeaderFooter(otexstream &, OutputParams const &, std::list<col_type>,
897 std::list<col_type>) const;
899 bool isValidRow(row_type const row) const;
901 void TeXRow(otexstream &, row_type const row,
902 OutputParams const &, std::list<col_type>, std::list<col_type>) const;
904 // helper functions for plain text
906 bool plaintextTopHLine(odocstringstream &, row_type row,
907 std::vector<unsigned int> const &) const;
909 bool plaintextBottomHLine(odocstringstream &, row_type row,
910 std::vector<unsigned int> const &) const;
912 void plaintextPrintCell(odocstringstream &,
913 OutputParams const &,
914 idx_type cell, row_type row, col_type column,
915 std::vector<unsigned int> const &,
916 bool onlydata, size_t max_length) const;
917 /// auxiliary function for DocBook
918 void docbookRow(XMLStream &, row_type, OutputParams const &,
919 bool header = false) const;
920 /// auxiliary function for DocBook: export this row as HTML
921 void docbookRowAsHTML(XMLStream &, row_type, OutputParams const &,
923 /// auxiliary function for DocBook: export this row as CALS
924 void docbookRowAsCALS(XMLStream &, row_type, OutputParams const &) const;
926 docstring xhtmlRow(XMLStream & xs, row_type, OutputParams const &,
927 bool header = false) const;
929 /// change associated Buffer
930 void setBuffer(Buffer & buffer);
931 /// retrieve associated Buffer
932 Buffer const & buffer() const { return *buffer_; }
933 /// retrieve associated Buffer
934 Buffer & buffer() { return *buffer_; }
942 class InsetTabular : public Inset
946 InsetTabular(Buffer *, row_type rows = 1,
947 col_type columns = 1);
951 void setBuffer(Buffer & buffer) override;
954 static void string2params(std::string const &, InsetTabular &);
956 static std::string params2string(InsetTabular const &);
958 void read(Lexer &) override;
960 void write(std::ostream &) const override;
962 void metrics(MetricsInfo &, Dimension &) const override;
964 void draw(PainterInfo & pi, int x, int y) const override;
966 void drawSelection(PainterInfo & pi, int x, int y) const override;
968 void drawBackground(PainterInfo & pi, int x, int y) const override;
970 bool editable() const override { return true; }
972 bool hasSettings() const override { return true; }
974 bool insetAllowed(InsetCode code) const override;
976 bool allowSpellCheck() const override { return true; }
978 bool canTrackChanges() const override { return true; }
980 bool canPaintChange(BufferView const &) const override { return true; }
981 /** returns false if, when outputting LaTeX, font changes should
982 be closed before generating this inset. This is needed for
983 insets that may contain several paragraphs */
984 bool inheritFont() const override { return false; }
986 bool allowMultiPar() const override;
988 bool allowsCaptionVariation(std::string const &) const override;
990 bool isTable() const override { return true; }
992 RowFlags rowFlags() const override;
994 void latex(otexstream &, OutputParams const &) const override;
996 int plaintext(odocstringstream & ods, OutputParams const & op,
997 size_t max_length = INT_MAX) const override;
999 void docbook(XMLStream &, OutputParams const &) const override;
1001 docstring xhtml(XMLStream &, OutputParams const &) const override;
1003 void validate(LaTeXFeatures & features) const override;
1005 InsetCode lyxCode() const override { return TABULAR_CODE; }
1007 std::string contextMenu(BufferView const &, int, int) const override;
1009 std::string contextMenuName() const override;
1010 /// get offset of this cursor slice relative to our upper left corner
1011 void cursorPos(BufferView const & bv, CursorSlice const & sl,
1012 bool boundary, int & x, int & y) const override;
1013 /// Executes a space-separated sequence of tabular-features requests
1014 void tabularFeatures(Cursor & cur, std::string const & what);
1015 /// Change a single tabular feature; does not handle undo.
1016 void tabularFeatures(Cursor & cur, Tabular::Feature feature,
1017 std::string const & val = std::string());
1019 size_t nargs() const override { return tabular.numberofcells; }
1021 std::shared_ptr<InsetTableCell const> cell(idx_type) const;
1023 std::shared_ptr<InsetTableCell> cell(idx_type);
1025 Text * getText(int) const override;
1027 /// does the inset contain changes ?
1028 bool isChanged() const override;
1029 /// set the change for the entire inset
1030 void setChange(Change const & change) override;
1031 /// accept the changes within the inset
1032 void acceptChanges() override;
1033 /// reject the changes within the inset
1034 void rejectChanges() override;
1036 // this should return true if we have a "normal" cell, otherwise false.
1037 // "normal" means without width set!
1038 /// should all paragraphs be output with "Standard" layout?
1039 bool allowParagraphCustomization(idx_type cell = 0) const override;
1041 void addPreview(DocIterator const & inset_pos,
1042 graphics::PreviewLoader &) const override;
1044 /// lock cell with given index
1045 void edit(Cursor & cur, bool front, EntryDirection entry_from) override;
1046 /// get table row from x coordinate
1047 int rowFromY(Cursor & cur, int y) const;
1048 /// get table column from y coordinate
1049 int columnFromX(Cursor & cur, int x) const;
1051 Inset * editXY(Cursor & cur, int x, int y) override;
1052 /// can we go further down on mouse click?
1053 bool descendable(BufferView const &) const override { return true; }
1054 /// Update the counters of this inset and of its contents
1055 void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
1057 void addToToc(DocIterator const & di, bool output_active,
1058 UpdateType utype, TocBackend & backend) const override;
1061 bool completionSupported(Cursor const &) const override;
1063 bool inlineCompletionSupported(Cursor const & cur) const override;
1065 bool automaticInlineCompletion() const override;
1067 bool automaticPopupCompletion() const override;
1069 bool showCompletionCursor() const override;
1071 CompletionList const * createCompletionList(Cursor const & cur) const override;
1073 docstring completionPrefix(Cursor const & cur) const override;
1075 bool insertCompletion(Cursor & cur, docstring const & s, bool finished) override;
1077 void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const override;
1079 bool usePlainLayout() const override { return true; }
1081 docstring layoutName() const override { return from_ascii("Tabular"); }
1085 InsetTabular * asInsetTabular() override { return this; }
1087 InsetTabular const * asInsetTabular() const override { return this; }
1089 bool isRightToLeft(Cursor & cur) const;
1090 /// writes the cells between stidx and enidx as a string, optionally
1091 /// descending into the insets
1092 docstring asString(idx_type stidx, idx_type enidx, bool intoInsets = true);
1094 ParagraphList asParList(idx_type stidx, idx_type enidx);
1096 /// Returns whether the cell in the specified row and column is selected.
1097 bool isCellSelected(Cursor & cur, row_type row, col_type col) const;
1099 void setLayoutForHiddenCells(DocumentClass const & dc);
1101 // Public structures and variables
1103 mutable Tabular tabular;
1107 InsetTabular(InsetTabular const &);
1109 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
1111 bool getFeatureStatus(Cursor & cur, std::string const & s,
1112 std::string const & argument, FuncStatus & status) const;
1114 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
1116 Inset * clone() const override { return new InsetTabular(*this); }
1119 bool hitSelectRow(BufferView const & bv, int x) const;
1121 bool hitSelectColumn(BufferView const & bv, int y) const;
1122 /// Returns true if coordinates are on row/column selection zones
1123 bool clickable(BufferView const &, int x, int y) const override;
1126 void drawCellLines(PainterInfo &, int x, int y, row_type row,
1127 idx_type cell) const;
1129 void setCursorFromCoordinates(Cursor & cur, int x, int y) const;
1132 void moveNextCell(Cursor & cur,
1133 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
1135 void movePrevCell(Cursor & cur,
1136 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
1138 int cellXPos(idx_type cell) const;
1140 int cellYPos(idx_type cell) const;
1142 bool copySelection(Cursor & cur);
1144 bool pasteClipboard(Cursor & cur);
1146 void cutSelection(Cursor & cur);
1148 void getSelection(Cursor & cur, row_type & rs, row_type & re,
1149 col_type & cs, col_type & ce) const;
1151 bool insertPlaintextString(BufferView &, docstring const & buf, bool usePaste);
1153 /// return the "Manhattan distance" to nearest corner
1154 int dist(BufferView &, idx_type cell, int x, int y) const;
1155 /// return the cell nearest to x, y
1156 idx_type getNearestCell(BufferView &, int x, int y) const;
1158 /// test the rotation state of the given cell range.
1159 bool oneCellHasRotationState(bool rotated,
1160 row_type row_start, row_type row_end,
1161 col_type col_start, col_type col_end) const;
1163 /// true when selecting rows with the mouse
1165 /// true when selecting columns with the mouse
1169 std::string const featureAsString(Tabular::Feature feature);
1171 /// Split cell on decimal symbol
1172 InsetTableCell splitCell(InsetTableCell & head, docstring const & decimal_sym, bool & hassep);
1176 #endif // INSET_TABULAR_H