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 toggleMultiCol(bool m) { isMultiColumn = m; }
73 void toggleMultiRow(bool m) { isMultiRow = m; }
75 void setContentAlignment(LyXAlignment al) {contentAlign = al; }
76 /// writes the contents of the cell as a string, optionally
77 /// descending into insets
78 docstring asString(bool intoInsets = true);
80 docstring xhtml(XMLStream &, OutputParams const &) const override;
82 void docbook(XMLStream &, OutputParams const &) const override;
84 void addToToc(DocIterator const & di, bool output_active,
85 UpdateType utype, TocBackend & backend) const override;
87 void metrics(MetricsInfo &, Dimension &) const override;
88 /// Needs to be same as InsetTabular
89 bool inheritFont() const override { return false; }
90 /// Can the cell contain several paragraphs?
91 bool allowMultiPar() const override { return !isMultiRow && (!isMultiColumn || isFixedWidth); }
94 InsetTableCell() = delete;
96 void operator=(InsetTableCell const &) = delete;
98 // These booleans are supposed to track whether the cell has had its
99 // width explicitly set and whether it is part of a multicolumn, respectively.
100 // We need to know this to determine whether
101 // layout changes and paragraph customization are allowed---that is,
102 // we need it in forcePlainLayout() and allowParagraphCustomization().
103 // Unfortunately, that information is not readily available in
104 // InsetTableCell. In the case of multicolumn cells, it is present
105 // in CellData, and so would be available here if CellData were to
106 // become a member of InsetTableCell. But in the other case, it isn't
107 // even available there, but is held in Tabular::ColumnData.
108 // So, the present solution uses this boolean to track the information
109 // we need to track, and tries to keep it updated. This is not ideal,
110 // but the other solutions are no better. These are:
111 // (i) Keep a pointer in InsetTableCell to the table;
112 // (ii) Find the table by iterating over the Buffer's insets.
113 // Solution (i) raises the problem of updating the pointer when an
114 // InsetTableCell is copied, and we'd therefore need a copy constructor
115 // in InsetTabular and then in Tabular, which seems messy, given how
116 // complicated those classes are. Solution (ii) involves a lot of
117 // iterating, since this information is needed quite often, and so may
119 // So, well, if someone can do better, please do!
127 // FIXME: Here the thoughts from the comment above also apply.
129 LyXAlignment contentAlign;
130 /// should paragraph indentation be omitted in any case?
131 bool neverIndent() const override { return true; }
133 LyXAlignment contentAlignment() const override { return contentAlign; }
135 bool usePlainLayout() const override { return true; }
137 bool forcePlainLayout(idx_type = 0) const override;
139 bool allowParagraphCustomization(idx_type = 0) const override;
141 bool forceLocalFontSwitch() const override;
142 /// Is the width forced to some value?
143 bool hasFixedWidth() const override { return isFixedWidth; }
148 // A helper struct for tables
251 RESET_FORMAL_DEFAULT,
265 TOGGLE_VARWIDTH_COLUMN,
269 UNSET_ROTATE_TABULAR,
271 TOGGLE_ROTATE_TABULAR,
304 SET_SPECIAL_MULTICOLUMN,
322 TABULAR_VALIGN_MIDDLE,
324 TABULAR_VALIGN_BOTTOM,
326 LONGTABULAR_ALIGN_LEFT,
328 LONGTABULAR_ALIGN_CENTER,
330 LONGTABULAR_ALIGN_RIGHT,
345 CELL_BEGIN_OF_MULTICOLUMN,
347 CELL_PART_OF_MULTICOLUMN,
349 CELL_BEGIN_OF_MULTIROW,
351 CELL_PART_OF_MULTIROW
359 LYX_VALIGN_MIDDLE = 1,
361 LYX_VALIGN_BOTTOM = 2
367 LYX_LONGTABULAR_ALIGN_LEFT = 0,
369 LYX_LONGTABULAR_ALIGN_CENTER = 1,
371 LYX_LONGTABULAR_ALIGN_RIGHT = 2
412 // we have this header type (is set in the getLT... functions)
414 // double borders on top
416 // double borders on bottom
418 // used for FirstHeader & LastFooter and if this is true
419 // all the rows marked as FirstHeader or LastFooter are
420 // ignored in the output and it is set to be empty!
424 /// index indicating an invalid position
425 static const idx_type npos = static_cast<idx_type>(-1);
428 Tabular(Buffer * buf, col_type columns_arg, row_type rows_arg);
430 /// Returns true if there is a topline, returns false if not
431 bool topLine(idx_type cell) const;
432 /// Returns true if there is a topline, returns false if not
433 bool bottomLine(idx_type cell) const;
434 /// Returns true if there is a topline, returns false if not
435 /// If \p ignore_bt is true, we return the state as if booktabs was
437 bool leftLine(idx_type cell, bool const ignore_bt = false) 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 rightLine(idx_type cell, bool const ignore_bt = false) const;
442 /// Returns whether the top line is trimmed left and/or right
443 std::pair<bool, bool> topLineTrim(idx_type const cell) const;
444 /// Returns whether the bottom line is trimmed left and/or right
445 std::pair<bool, bool> bottomLineTrim(idx_type const cell) const;
447 /// return space occupied by the second horizontal line and
448 /// interline space above row \p row in pixels
449 int interRowSpace(row_type row) const;
451 int interColumnSpace(idx_type cell) const;
453 /* returns the maximum over all rows */
455 int cellWidth(idx_type cell) const;
457 int cellHeight(idx_type cell) const;
463 row_type nrows() const {return row_info.size();}
465 col_type ncols() const {return column_info.size();}
467 int rowAscent(row_type row) const;
469 int rowDescent(row_type row) const;
471 void setRowAscent(row_type row, int height);
473 void setRowDescent(row_type row, int height);
475 void setTopLine(idx_type cell, bool line);
477 void setBottomLine(idx_type cell, bool line);
479 void setTopLineLTrim(idx_type cell, bool val);
481 void setBottomLineLTrim(idx_type cell, bool val);
483 void setTopLineRTrim(idx_type cell, bool val);
485 void setBottomLineRTrim(idx_type cell, bool val);
487 void setTopLineTrim(idx_type cell, std::pair<bool, bool>);
489 void setBottomLineTrim(idx_type cell, std::pair<bool, bool>);
491 void setLeftLine(idx_type cell, bool line);
493 void setRightLine(idx_type cell, bool line);
495 bool rowTopLine(row_type row) const;
497 bool rowBottomLine(row_type row) const;
499 bool columnLeftLine(col_type column) const;
501 bool columnRightLine(col_type column) const;
503 void setAlignment(idx_type cell, LyXAlignment align,
504 bool onlycolumn = false);
506 void setVAlignment(idx_type cell, VAlignment align,
507 bool onlycolumn = false);
509 void setTabularWidth(Length const & l) { tabular_width = l; }
511 Length tabularWidth() const { return tabular_width; }
513 void setColumnPWidth(Cursor &, idx_type, Length const &);
515 bool setMColumnPWidth(Cursor &, idx_type, Length const &);
517 bool toggleVarwidth(idx_type, bool const);
519 bool setMROffset(Cursor &, idx_type, Length const &);
521 void setAlignSpecial(idx_type cell, docstring const & special,
524 LyXAlignment getAlignment(idx_type cell,
525 bool onlycolumn = false) const;
527 VAlignment getVAlignment(idx_type cell,
528 bool onlycolumn = false) const;
529 /// The vertical offset of the table due to the vertical
530 /// alignment with respect to the baseline.
531 int offsetVAlignment() const;
533 Length const getPWidth(idx_type cell) const;
535 Length const getMROffset(idx_type cell) const;
537 int textHOffset(idx_type cell) const;
539 int textVOffset(idx_type cell) const;
541 void appendRow(row_type row);
543 void deleteRow(row_type row, bool const force = false);
545 void copyRow(row_type row);
547 void insertRow(row_type row, bool copy);
549 void moveColumn(col_type col, ColDirection direction);
551 void moveRow(row_type row, RowDirection direction);
553 void appendColumn(col_type column);
555 void deleteColumn(col_type column, bool const force = false);
557 void copyColumn(col_type column);
559 void insertColumn(col_type column, bool copy);
561 idx_type getFirstCellInRow(row_type row, bool const ct = false) const;
563 idx_type getLastCellInRow(row_type row, bool const ct = false) const;
565 idx_type getFirstRow(bool const ct = false) const;
567 idx_type getLastRow(bool const ct = false) const;
569 idx_type numberOfCellsInRow(row_type row) const;
571 void write(std::ostream &) const;
575 void latex(otexstream &, OutputParams const &) const;
576 /// serialise the table in DocBook, according to buffer parameters
577 void docbook(XMLStream &, OutputParams const &) const;
579 docstring xhtml(XMLStream &, OutputParams const &) const;
581 void plaintext(odocstringstream &,
582 OutputParams const & runparams, int const depth,
583 bool onlydata, char_type delim, size_t max_length = INT_MAX) const;
585 bool isMultiColumn(idx_type cell) const;
587 bool hasMultiColumn(col_type cell) const;
589 bool hasVarwidthColumn() const;
591 bool isVTypeColumn(col_type cell) const;
593 idx_type setMultiColumn(Cursor & cur, idx_type cell, idx_type number,
594 bool const right_border);
596 void unsetMultiColumn(idx_type cell);
598 bool isPartOfMultiColumn(row_type row, col_type column) const;
600 bool isPartOfMultiRow(row_type row, col_type column) const;
602 bool isMultiRow(idx_type cell) const;
604 bool hasMultiRow(row_type r) const;
606 idx_type setMultiRow(Cursor & cur, idx_type cell, idx_type number,
607 bool const bottom_border,
608 LyXAlignment const halign);
610 void unsetMultiRow(idx_type cell);
612 row_type cellRow(idx_type cell) const;
614 col_type cellColumn(idx_type cell) const;
616 void setRotateCell(idx_type cell, int);
618 int getRotateCell(idx_type cell) const;
620 bool needRotating() const;
622 bool isLastCell(idx_type cell) const;
624 idx_type cellAbove(idx_type cell) const;
626 idx_type cellBelow(idx_type cell) const;
627 /// \return the index of the VISIBLE cell at row, column
628 /// this will be the same as the cell in the previous row,
629 /// e.g., if the cell is part of a multirow
630 idx_type cellIndex(row_type row, col_type column) const;
632 void setUsebox(idx_type cell, BoxType);
634 BoxType getUsebox(idx_type cell) const;
636 // Long Tabular Options support functions
638 void setLTHead(row_type row, bool flag, ltType const &, bool first);
640 bool getRowOfLTHead(row_type row, ltType &) const;
642 bool getRowOfLTFirstHead(row_type row, ltType &) const;
644 void setLTFoot(row_type row, bool flag, ltType const &, bool last);
646 bool getRowOfLTFoot(row_type row, ltType &) const;
648 bool getRowOfLTLastFoot(row_type row, ltType &) const;
650 void setLTNewPage(row_type row, bool what);
652 bool getLTNewPage(row_type row) const;
654 idx_type setLTCaption(Cursor & cur, row_type row, bool what);
656 bool ltCaption(row_type row) const;
658 bool haveLTHead(bool withcaptions = true) const;
660 bool haveLTFirstHead(bool withcaptions = true) const;
662 bool haveLTFoot(bool withcaptions = true) const;
664 bool haveLTLastFoot(bool withcaptions = true) const;
666 bool haveLTCaption(CaptionType captiontype = CAPTION_ANY) const;
668 // end longtable support
671 /// there is a subtle difference between these two methods.
674 /// cellInset(cellIndex(r,c));
675 /// can return different things. this is because cellIndex(r,c)
676 /// returns the VISIBLE cell at r,c, which may be the same as the
677 /// cell at the previous row or column, if we're dealing with some
678 /// multirow or multicell.
679 std::shared_ptr<InsetTableCell> cellInset(idx_type cell);
680 std::shared_ptr<InsetTableCell> cellInset(row_type row, col_type column);
681 InsetTableCell const * cellInset(idx_type cell) const;
684 void setCellInset(row_type row, col_type column,
685 std::shared_ptr<InsetTableCell>);
686 /// Search for \param inset in the tabular, with the
688 void validate(LaTeXFeatures &) const;
691 // FIXME Now that cells have an InsetTableCell as their insets, rather
692 // than an InsetText, it'd be possible to reverse the relationship here,
693 // so that cell_vector was a vector<InsetTableCell> rather than a
694 // vector<CellData>, and an InsetTableCell had a CellData as a member,
695 // or perhaps just had its members as members.
700 explicit CellData(Buffer *);
702 CellData(CellData const &);
704 CellData & operator=(CellData const &);
716 LyXAlignment alignment;
718 VAlignment valignment;
719 /// width of the part before the decimal
721 /// width of the decimal part
734 bool top_line_rtrimmed;
736 bool top_line_ltrimmed;
738 bool bottom_line_rtrimmed;
740 bool bottom_line_ltrimmed;
746 docstring align_special;
748 Length p_width; // this is only set for multicolumn!!!
750 std::shared_ptr<InsetTableCell> inset;
753 CellData const & cellInfo(idx_type cell) const;
755 CellData & cellInfo(idx_type cell);
757 typedef std::vector<CellData> cell_vector;
759 typedef std::vector<cell_vector> cell_vvector;
770 /// Extra space between the top line and this row
772 /// Ignore top_space if true and use the default top space
773 bool top_space_default;
774 /// Extra space between this row and the bottom line
776 /// Ignore bottom_space if true and use the default bottom space
777 bool bottom_space_default;
778 /// Extra space between the bottom line and the next top line
779 Length interline_space;
780 /// Ignore interline_space if true and use the default interline space
781 bool interline_space_default;
782 /// This are for longtabulars only
785 /// a row of endfirsthead
789 /// row of endlastfoot
791 /// row for a newpage
799 typedef std::vector<RowData> row_vector;
807 LyXAlignment alignment;
809 VAlignment valignment;
815 docstring align_special;
817 docstring decimal_point;
824 typedef std::vector<ColumnData> column_vector;
827 idx_type numberofcells;
829 std::vector<row_type> rowofcell;
831 std::vector<col_type> columnofcell;
835 column_vector column_info;
837 cell_vvector cell_info;
839 Length tabular_width;
845 VAlignment tabular_valignment;
849 HAlignment longtabular_alignment;
851 bool is_long_tabular;
854 /// endfirsthead data
862 void init(Buffer *, row_type rows_arg,
863 col_type columns_arg);
865 void updateIndexes();
867 bool setFixedWidth(row_type r, col_type c);
868 /// return true of update is needed
869 bool updateColumnWidths(MetricsInfo & mi);
871 idx_type columnSpan(idx_type cell) const;
873 idx_type rowSpan(idx_type cell) const;
875 BoxType useBox(idx_type cell) const;
877 // helper function for Latex
879 void TeXTopHLine(otexstream &, row_type row, std::list<col_type>,
880 std::list<col_type>) const;
882 void TeXBottomHLine(otexstream &, row_type row, std::list<col_type>,
883 std::list<col_type>) const;
885 void TeXCellPreamble(otexstream &, idx_type cell, bool & ismulticol, bool & ismultirow,
886 bool const bidi) const;
888 void TeXCellPostamble(otexstream &, idx_type cell, bool ismulticol, bool ismultirow) const;
890 void TeXLongtableHeaderFooter(otexstream &, OutputParams const &, std::list<col_type>,
891 std::list<col_type>) const;
893 bool isValidRow(row_type const row) const;
895 void TeXRow(otexstream &, row_type const row,
896 OutputParams const &, std::list<col_type>, std::list<col_type>) const;
898 // helper functions for plain text
900 bool plaintextTopHLine(odocstringstream &, row_type row,
901 std::vector<unsigned int> const &) const;
903 bool plaintextBottomHLine(odocstringstream &, row_type row,
904 std::vector<unsigned int> const &) const;
906 void plaintextPrintCell(odocstringstream &,
907 OutputParams const &,
908 idx_type cell, row_type row, col_type column,
909 std::vector<unsigned int> const &,
910 bool onlydata, size_t max_length) const;
911 /// auxiliary function for DocBook
912 void docbookRow(XMLStream &, row_type, OutputParams const &,
913 bool header = false) const;
914 /// auxiliary function for DocBook: export this row as HTML
915 void docbookRowAsHTML(XMLStream &, row_type, OutputParams const &,
917 /// auxiliary function for DocBook: export this row as CALS
918 void docbookRowAsCALS(XMLStream &, row_type, OutputParams const &) const;
920 docstring xhtmlRow(XMLStream & xs, row_type, OutputParams const &,
921 bool header = false) const;
923 /// change associated Buffer
924 void setBuffer(Buffer & buffer);
925 /// retrieve associated Buffer
926 Buffer const & buffer() const { return *buffer_; }
927 /// retrieve associated Buffer
928 Buffer & buffer() { return *buffer_; }
936 class InsetTabular : public Inset
940 InsetTabular(Buffer *, row_type rows = 1,
941 col_type columns = 1);
945 void setBuffer(Buffer & buffer) override;
948 static void string2params(std::string const &, InsetTabular &);
950 static std::string params2string(InsetTabular const &);
952 void read(Lexer &) override;
954 void write(std::ostream &) const override;
956 void metrics(MetricsInfo &, Dimension &) const override;
958 void draw(PainterInfo & pi, int x, int y) const override;
960 void drawSelection(PainterInfo & pi, int x, int y) const override;
962 void drawBackground(PainterInfo & pi, int x, int y) const override;
964 bool editable() const override { return true; }
966 bool hasSettings() const override { return true; }
968 bool insetAllowed(InsetCode code) const override;
970 bool allowSpellCheck() const override { return true; }
972 bool canTrackChanges() const override { return true; }
974 bool canPaintChange(BufferView const &) const override { return true; }
975 /** returns false if, when outputting LaTeX, font changes should
976 be closed before generating this inset. This is needed for
977 insets that may contain several paragraphs */
978 bool inheritFont() const override { return false; }
980 bool allowMultiPar() const override;
982 bool allowsCaptionVariation(std::string const &) const override;
984 bool isTable() const override { return true; }
986 RowFlags rowFlags() const override;
988 void latex(otexstream &, OutputParams const &) const override;
990 int plaintext(odocstringstream & ods, OutputParams const & op,
991 size_t max_length = INT_MAX) const override;
993 void docbook(XMLStream &, OutputParams const &) const override;
995 docstring xhtml(XMLStream &, OutputParams const &) const override;
997 void validate(LaTeXFeatures & features) const override;
999 InsetCode lyxCode() const override { return TABULAR_CODE; }
1001 std::string contextMenu(BufferView const &, int, int) const override;
1003 std::string contextMenuName() const override;
1004 /// get offset of this cursor slice relative to our upper left corner
1005 void cursorPos(BufferView const & bv, CursorSlice const & sl,
1006 bool boundary, int & x, int & y) const override;
1007 /// Executes a space-separated sequence of tabular-features requests
1008 void tabularFeatures(Cursor & cur, std::string const & what);
1009 /// Change a single tabular feature; does not handle undo.
1010 void tabularFeatures(Cursor & cur, Tabular::Feature feature,
1011 std::string const & val = std::string());
1013 size_t nargs() const override { return tabular.numberofcells; }
1015 std::shared_ptr<InsetTableCell const> cell(idx_type) const;
1017 std::shared_ptr<InsetTableCell> cell(idx_type);
1019 Text * getText(int) const override;
1021 /// does the inset contain changes ?
1022 bool isChanged() const override;
1023 /// set the change for the entire inset
1024 void setChange(Change const & change) override;
1025 /// accept the changes within the inset
1026 void acceptChanges() override;
1027 /// reject the changes within the inset
1028 void rejectChanges() override;
1030 // this should return true if we have a "normal" cell, otherwise false.
1031 // "normal" means without width set!
1032 /// should all paragraphs be output with "Standard" layout?
1033 bool allowParagraphCustomization(idx_type cell = 0) const override;
1035 bool forcePlainLayout(idx_type cell = 0) const override;
1037 void addPreview(DocIterator const & inset_pos,
1038 graphics::PreviewLoader &) const override;
1040 /// lock cell with given index
1041 void edit(Cursor & cur, bool front, EntryDirection entry_from) override;
1042 /// get table row from x coordinate
1043 int rowFromY(Cursor & cur, int y) const;
1044 /// get table column from y coordinate
1045 int columnFromX(Cursor & cur, int x) const;
1047 Inset * editXY(Cursor & cur, int x, int y) override;
1048 /// can we go further down on mouse click?
1049 bool descendable(BufferView const &) const override { return true; }
1050 /// Update the counters of this inset and of its contents
1051 void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
1053 void addToToc(DocIterator const & di, bool output_active,
1054 UpdateType utype, TocBackend & backend) const override;
1057 bool completionSupported(Cursor const &) const override;
1059 bool inlineCompletionSupported(Cursor const & cur) const override;
1061 bool automaticInlineCompletion() const override;
1063 bool automaticPopupCompletion() const override;
1065 bool showCompletionCursor() const override;
1067 CompletionList const * createCompletionList(Cursor const & cur) const override;
1069 docstring completionPrefix(Cursor const & cur) const override;
1071 bool insertCompletion(Cursor & cur, docstring const & s, bool finished) override;
1073 void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const override;
1075 bool usePlainLayout() const override { return true; }
1077 docstring layoutName() const override { return from_ascii("Tabular"); }
1081 InsetTabular * asInsetTabular() override { return this; }
1083 InsetTabular const * asInsetTabular() const override { return this; }
1085 bool isRightToLeft(Cursor & cur) const;
1086 /// writes the cells between stidx and enidx as a string, optionally
1087 /// descending into the insets
1088 docstring asString(idx_type stidx, idx_type enidx, bool intoInsets = true);
1090 ParagraphList asParList(idx_type stidx, idx_type enidx);
1092 /// Returns whether the cell in the specified row and column is selected.
1093 bool isCellSelected(Cursor & cur, row_type row, col_type col) const;
1095 void setLayoutForHiddenCells(DocumentClass const & dc);
1097 // Public structures and variables
1099 mutable Tabular tabular;
1103 InsetTabular(InsetTabular const &);
1105 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
1107 bool getFeatureStatus(Cursor & cur, std::string const & s,
1108 std::string const & argument, FuncStatus & status) const;
1110 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
1112 Inset * clone() const override { return new InsetTabular(*this); }
1115 bool hitSelectRow(BufferView const & bv, int x) const;
1117 bool hitSelectColumn(BufferView const & bv, int y) const;
1118 /// Returns true if coordinates are on row/column selection zones
1119 bool clickable(BufferView const &, int x, int y) const override;
1122 void drawCellLines(PainterInfo &, int x, int y, row_type row,
1123 idx_type cell) const;
1125 void setCursorFromCoordinates(Cursor & cur, int x, int y) const;
1128 void moveNextCell(Cursor & cur,
1129 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
1131 void movePrevCell(Cursor & cur,
1132 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
1134 int cellXPos(idx_type cell) const;
1136 int cellYPos(idx_type cell) const;
1138 bool copySelection(Cursor & cur);
1140 bool pasteClipboard(Cursor & cur);
1142 void cutSelection(Cursor & cur);
1144 void getSelection(Cursor & cur, row_type & rs, row_type & re,
1145 col_type & cs, col_type & ce) const;
1147 bool insertPlaintextString(BufferView &, docstring const & buf, bool usePaste);
1149 /// return the "Manhattan distance" to nearest corner
1150 int dist(BufferView &, idx_type cell, int x, int y) const;
1151 /// return the cell nearest to x, y
1152 idx_type getNearestCell(BufferView &, int x, int y) const;
1154 /// test the rotation state of the given cell range.
1155 bool oneCellHasRotationState(bool rotated,
1156 row_type row_start, row_type row_end,
1157 col_type col_start, col_type col_end) const;
1159 /// true when selecting rows with the mouse
1161 /// true when selecting columns with the mouse
1165 std::string const featureAsString(Tabular::Feature feature);
1167 /// Split cell on decimal symbol
1168 InsetTableCell splitCell(InsetTableCell & head, docstring const & decimal_sym, bool & hassep);
1172 #endif // INSET_TABULAR_H