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; }
96 /// This assures we never output \maketitle in table cells
97 bool isInTitle() const override { return true; }
100 InsetTableCell() = delete;
102 void operator=(InsetTableCell const &) = delete;
104 // These booleans are supposed to track whether the cell has had its
105 // width explicitly set and whether it is part of a multicolumn, respectively.
106 // We need to know this to determine whether
107 // layout changes and paragraph customization are allowed---that is,
108 // we need it in forcePlainLayout() and allowParagraphCustomization().
109 // Unfortunately, that information is not readily available in
110 // InsetTableCell. In the case of multicolumn cells, it is present
111 // in CellData, and so would be available here if CellData were to
112 // become a member of InsetTableCell. But in the other case, it isn't
113 // even available there, but is held in Tabular::ColumnData.
114 // So, the present solution uses this boolean to track the information
115 // we need to track, and tries to keep it updated. This is not ideal,
116 // but the other solutions are no better. These are:
117 // (i) Keep a pointer in InsetTableCell to the table;
118 // (ii) Find the table by iterating over the Buffer's insets.
119 // Solution (i) raises the problem of updating the pointer when an
120 // InsetTableCell is copied, and we'd therefore need a copy constructor
121 // in InsetTabular and then in Tabular, which seems messy, given how
122 // complicated those classes are. Solution (ii) involves a lot of
123 // iterating, since this information is needed quite often, and so may
125 // So, well, if someone can do better, please do!
135 // FIXME: Here the thoughts from the comment above also apply.
137 LyXAlignment contentAlign;
138 /// should paragraph indentation be omitted in any case?
139 bool neverIndent() const override { return true; }
141 LyXAlignment contentAlignment() const override { return contentAlign; }
143 bool usePlainLayout() const override { return true; }
145 bool allowParagraphCustomization(idx_type = 0) const override;
147 bool forceLocalFontSwitch() const override;
148 /// Is the width forced to some value?
149 bool hasFixedWidth() const override { return isFixedWidth; }
154 // A helper struct for tables
257 RESET_FORMAL_DEFAULT,
271 TOGGLE_VARWIDTH_COLUMN,
275 UNSET_ROTATE_TABULAR,
277 TOGGLE_ROTATE_TABULAR,
310 SET_SPECIAL_MULTICOLUMN,
328 TABULAR_VALIGN_MIDDLE,
330 TABULAR_VALIGN_BOTTOM,
332 LONGTABULAR_ALIGN_LEFT,
334 LONGTABULAR_ALIGN_CENTER,
336 LONGTABULAR_ALIGN_RIGHT,
357 CELL_BEGIN_OF_MULTICOLUMN,
359 CELL_PART_OF_MULTICOLUMN,
361 CELL_BEGIN_OF_MULTIROW,
363 CELL_PART_OF_MULTIROW
371 LYX_VALIGN_MIDDLE = 1,
373 LYX_VALIGN_BOTTOM = 2
379 LYX_LONGTABULAR_ALIGN_LEFT = 0,
381 LYX_LONGTABULAR_ALIGN_CENTER = 1,
383 LYX_LONGTABULAR_ALIGN_RIGHT = 2
424 // we have this header type (is set in the getLT... functions)
426 // double borders on top
428 // double borders on bottom
430 // used for FirstHeader & LastFooter and if this is true
431 // all the rows marked as FirstHeader or LastFooter are
432 // ignored in the output and it is set to be empty!
436 /// index indicating an invalid position
437 static const idx_type npos = static_cast<idx_type>(-1);
440 Tabular(Buffer * buf, col_type columns_arg, row_type rows_arg);
442 /// Returns true if there is a topline, returns false if not
443 bool topLine(idx_type cell) const;
444 /// Returns true if there is a topline, returns false if not
445 bool bottomLine(idx_type cell) const;
446 /// Returns true if there is a topline, returns false if not
447 /// If \p ignore_bt is true, we return the state as if booktabs was
449 bool leftLine(idx_type cell, bool const ignore_bt = false) const;
450 /// Returns true if there is a topline, returns false if not
451 /// If \p ignore_bt is true, we return the state as if booktabs was
453 bool rightLine(idx_type cell, bool const ignore_bt = false) const;
454 /// Returns true if there is an outside border around the selection
455 bool outsideBorders(row_type sel_row_start, row_type sel_row_end,
456 col_type sel_col_start, col_type sel_col_end) const;
457 /// Returns true if there are inside lines in the selection
458 bool innerBorders(row_type sel_row_start, row_type sel_row_end,
459 col_type sel_col_start, col_type sel_col_end) const;
460 /// Sets the grid lines in the selection
461 /// if \p setLinesInnerOnly is true, outside borders are excluded
462 /// if \p setLines is true the lines are set otherwise they are unset
463 void setLines(row_type const sel_row_start, row_type const sel_row_end,
464 col_type const sel_col_start, col_type const sel_col_end,
465 bool setLinesInnerOnly, bool setLines);
466 /// Returns whether the top line is trimmed left and/or right
467 std::pair<bool, bool> topLineTrim(idx_type const cell) const;
468 /// Returns whether the bottom line is trimmed left and/or right
469 std::pair<bool, bool> bottomLineTrim(idx_type const cell) const;
471 /// return space occupied by the second horizontal line and
472 /// interline space above row \p row in pixels
473 int interRowSpace(row_type row) const;
475 int interColumnSpace(idx_type cell) const;
477 /* returns the maximum over all rows */
479 int cellWidth(idx_type cell) const;
481 int cellHeight(idx_type cell) const;
487 row_type nrows() const {return row_info.size();}
489 col_type ncols() const {return column_info.size();}
491 int rowAscent(row_type row) const;
493 int rowDescent(row_type row) const;
495 void setRowAscent(row_type row, int height);
497 void setRowDescent(row_type row, int height);
499 void setTopLine(idx_type cell, bool line);
501 void setBottomLine(idx_type cell, bool line);
503 void setTopLineLTrim(idx_type cell, bool val);
505 void setBottomLineLTrim(idx_type cell, bool val);
507 void setTopLineRTrim(idx_type cell, bool val);
509 void setBottomLineRTrim(idx_type cell, bool val);
511 void setTopLineTrim(idx_type cell, std::pair<bool, bool>);
513 void setBottomLineTrim(idx_type cell, std::pair<bool, bool>);
515 void setLeftLine(idx_type cell, bool line);
517 void setRightLine(idx_type cell, bool line);
519 bool rowTopLine(row_type row) const;
521 bool rowBottomLine(row_type row) const;
523 bool columnLeftLine(col_type column) const;
525 bool columnRightLine(col_type column) const;
527 void setAlignment(idx_type cell, LyXAlignment align,
528 bool onlycolumn = false);
530 void setVAlignment(idx_type cell, VAlignment align,
531 bool onlycolumn = false);
533 void setTabularWidth(Length const & l) { tabular_width = l; }
535 Length tabularWidth() const { return tabular_width; }
537 void setColumnPWidth(Cursor &, idx_type, Length const &);
539 bool setMColumnPWidth(Cursor &, idx_type, Length const &);
541 bool toggleVarwidth(idx_type, bool const);
543 bool setMROffset(Cursor &, idx_type, Length const &);
545 void setAlignSpecial(idx_type cell, docstring const & special,
548 LyXAlignment getAlignment(idx_type cell,
549 bool onlycolumn = false) const;
551 VAlignment getVAlignment(idx_type cell,
552 bool onlycolumn = false) const;
553 /// The vertical offset of the table due to the vertical
554 /// alignment with respect to the baseline.
555 int offsetVAlignment() const;
557 Length const getPWidth(idx_type cell) const;
559 Length const getMROffset(idx_type cell) const;
561 int textHOffset(idx_type cell) const;
563 int textVOffset(idx_type cell) const;
565 void appendRow(row_type row);
567 void deleteRow(row_type row, bool const force = false);
569 void copyRow(row_type row);
571 void insertRow(row_type row, bool copy);
573 void moveColumn(col_type col_start, col_type col_end,
574 ColDirection direction);
576 void moveRow(row_type row_start, row_type row_end,
577 RowDirection direction);
579 void appendColumn(col_type column);
581 void deleteColumn(col_type column, bool const force = false);
583 void copyColumn(col_type column);
585 void insertColumn(col_type column, bool copy);
587 idx_type getFirstCellInRow(row_type row, bool const ct = false) const;
589 idx_type getLastCellInRow(row_type row, bool const ct = false) const;
591 idx_type getFirstRow(bool const ct = false) const;
593 idx_type getLastRow(bool const ct = false) const;
595 idx_type numberOfCellsInRow(row_type row) const;
597 void write(std::ostream &) const;
601 void latex(otexstream &, OutputParams const &) const;
602 /// serialise the table in DocBook, according to buffer parameters
603 void docbook(XMLStream &, OutputParams const &) const;
605 docstring xhtml(XMLStream &, OutputParams const &) const;
607 void plaintext(odocstringstream &,
608 OutputParams const & runparams, int const depth,
609 bool onlydata, char_type delim, size_t max_length = INT_MAX) const;
611 bool isMultiColumn(idx_type cell) const;
613 bool hasMultiColumn(col_type cell) const;
615 bool hasVarwidthColumn() const;
617 bool isVTypeColumn(col_type cell) const;
619 idx_type setMultiColumn(Cursor & cur, idx_type cell, idx_type number,
620 bool const right_border);
622 void unsetMultiColumn(idx_type cell);
624 bool isPartOfMultiColumn(row_type row, col_type column) const;
626 bool isPartOfMultiRow(row_type row, col_type column) const;
628 bool isMultiRow(idx_type cell) const;
630 bool hasMultiRow(row_type r) const;
632 idx_type setMultiRow(Cursor & cur, idx_type cell, idx_type number,
633 bool const bottom_border,
634 LyXAlignment const halign);
636 void unsetMultiRow(idx_type cell);
638 row_type cellRow(idx_type cell) const;
640 col_type cellColumn(idx_type cell) const;
642 void setRotateCell(idx_type cell, int);
644 int getRotateCell(idx_type cell) const;
646 bool needRotating() const;
648 bool isLastCell(idx_type cell) const;
650 idx_type cellAbove(idx_type cell) const;
652 idx_type cellBelow(idx_type cell) const;
653 /// \return the index of the VISIBLE cell at row, column
654 /// this will be the same as the cell in the previous row,
655 /// e.g., if the cell is part of a multirow
656 idx_type cellIndex(row_type row, col_type column) const;
658 void setUsebox(idx_type cell, BoxType);
660 BoxType getUsebox(idx_type cell) const;
662 // Long Tabular Options support functions
664 void setLTHead(row_type row, bool flag, ltType const &, bool first);
666 bool getRowOfLTHead(row_type row, ltType &) const;
668 bool getRowOfLTFirstHead(row_type row, ltType &) const;
670 void setLTFoot(row_type row, bool flag, ltType const &, bool last);
672 bool getRowOfLTFoot(row_type row, ltType &) const;
674 bool getRowOfLTLastFoot(row_type row, ltType &) const;
676 void setLTNewPage(row_type row, bool what);
678 bool getLTNewPage(row_type row) const;
680 idx_type setLTCaption(Cursor & cur, row_type row, bool what);
682 bool ltCaption(row_type row) const;
684 bool haveLTHead(bool withcaptions = true) const;
686 bool haveLTFirstHead(bool withcaptions = true) const;
688 bool haveLTFoot(bool withcaptions = true) const;
690 bool haveLTLastFoot(bool withcaptions = true) const;
692 bool haveLTCaption(CaptionType captiontype = CAPTION_ANY) const;
694 // end longtable support
697 /// there is a subtle difference between these two methods.
700 /// cellInset(cellIndex(r,c));
701 /// can return different things. this is because cellIndex(r,c)
702 /// returns the VISIBLE cell at r,c, which may be the same as the
703 /// cell at the previous row or column, if we're dealing with some
704 /// multirow or multicell.
705 std::shared_ptr<InsetTableCell> cellInset(idx_type cell);
706 std::shared_ptr<InsetTableCell> cellInset(row_type row, col_type column);
707 InsetTableCell const * cellInset(idx_type cell) const;
710 void setCellInset(row_type row, col_type column,
711 std::shared_ptr<InsetTableCell>);
712 /// Search for \param inset in the tabular, with the
714 void validate(LaTeXFeatures &) const;
717 // FIXME Now that cells have an InsetTableCell as their insets, rather
718 // than an InsetText, it'd be possible to reverse the relationship here,
719 // so that cell_vector was a vector<InsetTableCell> rather than a
720 // vector<CellData>, and an InsetTableCell had a CellData as a member,
721 // or perhaps just had its members as members.
726 explicit CellData(Buffer *);
728 CellData(CellData const &);
730 CellData & operator=(CellData const &);
742 LyXAlignment alignment;
744 VAlignment valignment;
745 /// width of the part before the decimal
747 /// width of the decimal part
760 bool top_line_rtrimmed;
762 bool top_line_ltrimmed;
764 bool bottom_line_rtrimmed;
766 bool bottom_line_ltrimmed;
772 docstring align_special;
774 Length p_width; // this is only set for multicolumn!!!
776 std::shared_ptr<InsetTableCell> inset;
779 CellData const & cellInfo(idx_type cell) const;
781 CellData & cellInfo(idx_type cell);
783 typedef std::vector<CellData> cell_vector;
785 typedef std::vector<cell_vector> cell_vvector;
796 /// Extra space between the top line and this row
798 /// Ignore top_space if true and use the default top space
799 bool top_space_default;
800 /// Extra space between this row and the bottom line
802 /// Ignore bottom_space if true and use the default bottom space
803 bool bottom_space_default;
804 /// Extra space between the bottom line and the next top line
805 Length interline_space;
806 /// Ignore interline_space if true and use the default interline space
807 bool interline_space_default;
808 /// This are for longtabulars only
811 /// a row of endfirsthead
815 /// row of endlastfoot
817 /// row for a newpage
825 typedef std::vector<RowData> row_vector;
833 LyXAlignment alignment;
835 VAlignment valignment;
841 docstring align_special;
843 docstring decimal_point;
850 typedef std::vector<ColumnData> column_vector;
853 idx_type numberofcells;
855 std::vector<row_type> rowofcell;
857 std::vector<col_type> columnofcell;
861 column_vector column_info;
863 cell_vvector cell_info;
865 Length tabular_width;
871 VAlignment tabular_valignment;
875 HAlignment longtabular_alignment;
877 bool is_long_tabular;
880 /// endfirsthead data
888 void init(Buffer *, row_type rows_arg,
889 col_type columns_arg);
891 void updateIndexes();
893 bool setFixedWidth(row_type r, col_type c);
894 /// return true of update is needed
895 bool updateColumnWidths(MetricsInfo & mi);
897 idx_type columnSpan(idx_type cell) const;
899 idx_type rowSpan(idx_type cell) const;
901 BoxType useBox(idx_type cell) const;
903 // helper function for Latex
905 void TeXTopHLine(otexstream &, row_type row, std::list<col_type>,
906 std::list<col_type>) const;
908 void TeXBottomHLine(otexstream &, row_type row, std::list<col_type>,
909 std::list<col_type>) const;
911 void TeXCellPreamble(otexstream &, idx_type cell, bool & ismulticol, bool & ismultirow,
912 bool const bidi) const;
914 void TeXCellPostamble(otexstream &, idx_type cell, bool ismulticol, bool ismultirow) const;
916 void TeXLongtableHeaderFooter(otexstream &, OutputParams const &, std::list<col_type>,
917 std::list<col_type>) const;
919 bool isValidRow(row_type const row) const;
921 void TeXRow(otexstream &, row_type const row,
922 OutputParams const &, std::list<col_type>, std::list<col_type>) const;
924 // helper functions for plain text
926 bool plaintextTopHLine(odocstringstream &, row_type row,
927 std::vector<unsigned int> const &) const;
929 bool plaintextBottomHLine(odocstringstream &, row_type row,
930 std::vector<unsigned int> const &) const;
932 void plaintextPrintCell(odocstringstream &,
933 OutputParams const &,
934 idx_type cell, row_type row, col_type column,
935 std::vector<unsigned int> const &,
936 bool onlydata, size_t max_length) const;
937 /// auxiliary function for DocBook
938 void docbookRow(XMLStream &, row_type, OutputParams const &,
939 bool header = false) const;
940 /// auxiliary function for DocBook: export this row as HTML
941 void docbookRowAsHTML(XMLStream &, row_type, OutputParams const &,
943 /// auxiliary function for DocBook: export this row as CALS
944 void docbookRowAsCALS(XMLStream &, row_type, OutputParams const &) const;
946 docstring xhtmlRow(XMLStream & xs, row_type, OutputParams const &,
947 bool header = false) const;
949 /// change associated Buffer
950 void setBuffer(Buffer & buffer);
951 /// retrieve associated Buffer
952 Buffer const & buffer() const { return *buffer_; }
953 /// retrieve associated Buffer
954 Buffer & buffer() { return *buffer_; }
962 class InsetTabular : public Inset
966 InsetTabular(Buffer *, row_type rows = 1,
967 col_type columns = 1);
971 void setBuffer(Buffer & buffer) override;
974 static void string2params(std::string const &, InsetTabular &);
976 static std::string params2string(InsetTabular const &);
978 void read(Lexer &) override;
980 void write(std::ostream &) const override;
982 void metrics(MetricsInfo &, Dimension &) const override;
984 void draw(PainterInfo & pi, int x, int y) const override;
986 void drawSelection(PainterInfo & pi, int x, int y) const override;
988 void drawBackground(PainterInfo & pi, int x, int y) const override;
990 bool editable() const override { return true; }
992 bool hasSettings() const override { return true; }
994 bool insetAllowed(InsetCode code) const override;
996 bool allowSpellCheck() const override { return true; }
998 bool canTrackChanges() const override { return true; }
1000 bool canPaintChange(BufferView const &) const override { return true; }
1002 bool inheritFont() const override { return false; }
1004 bool allowMultiPar() const override;
1006 bool allowsCaptionVariation(std::string const &) const override;
1008 bool isTable() const override { return true; }
1010 int rowFlags() const override;
1012 void latex(otexstream &, OutputParams const &) const override;
1014 int plaintext(odocstringstream & ods, OutputParams const & op,
1015 size_t max_length = INT_MAX) const override;
1017 void docbook(XMLStream &, OutputParams const &) const override;
1019 docstring xhtml(XMLStream &, OutputParams const &) const override;
1021 void validate(LaTeXFeatures & features) const override;
1023 InsetCode lyxCode() const override { return TABULAR_CODE; }
1025 std::string contextMenu(BufferView const &, int, int) const override;
1027 std::string contextMenuName() const override;
1028 /// get offset of this cursor slice relative to our upper left corner
1029 void cursorPos(BufferView const & bv, CursorSlice const & sl,
1030 bool boundary, int & x, int & y) const override;
1031 /// Executes a space-separated sequence of tabular-features requests
1032 void tabularFeatures(Cursor & cur, std::string const & what);
1033 /// Change a single tabular feature; does not handle undo.
1034 void tabularFeatures(Cursor & cur, Tabular::Feature feature,
1035 std::string const & val = std::string());
1037 size_t nargs() const override { return tabular.numberofcells; }
1039 std::shared_ptr<InsetTableCell const> cell(idx_type) const;
1041 std::shared_ptr<InsetTableCell> cell(idx_type);
1043 Text * getText(int) const override;
1045 /// does the inset contain changes ?
1046 bool isChanged() const override;
1047 /// set the change for the entire inset
1048 void setChange(Change const & change) override;
1049 /// accept the changes within the inset
1050 void acceptChanges() override;
1051 /// reject the changes within the inset
1052 void rejectChanges() override;
1054 // this should return true if we have a "normal" cell, otherwise false.
1055 // "normal" means without width set!
1056 /// should all paragraphs be output with "Standard" layout?
1057 bool allowParagraphCustomization(idx_type cell = 0) const override;
1059 void addPreview(DocIterator const & inset_pos,
1060 graphics::PreviewLoader &) const override;
1062 /// lock cell with given index
1063 void edit(Cursor & cur, bool front, EntryDirection entry_from) override;
1064 /// get table row from x coordinate
1065 int rowFromY(Cursor & cur, int y) const;
1066 /// get table column from y coordinate
1067 int columnFromX(Cursor & cur, int x) const;
1069 Inset * editXY(Cursor & cur, int x, int y) override;
1070 /// can we go further down on mouse click?
1071 bool descendable(BufferView const &) const override { return true; }
1072 /// Update the counters of this inset and of its contents
1073 void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
1075 void addToToc(DocIterator const & di, bool output_active,
1076 UpdateType utype, TocBackend & backend) const override;
1079 bool completionSupported(Cursor const &) const override;
1081 bool inlineCompletionSupported(Cursor const & cur) const override;
1083 bool automaticInlineCompletion() const override;
1085 bool automaticPopupCompletion() const override;
1087 bool showCompletionCursor() const override;
1089 CompletionList const * createCompletionList(Cursor const & cur) const override;
1091 docstring completionPrefix(Cursor const & cur) const override;
1093 bool insertCompletion(Cursor & cur, docstring const & s, bool finished) override;
1095 void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const override;
1097 bool usePlainLayout() const override { return true; }
1099 docstring layoutName() const override { return from_ascii("Tabular"); }
1103 InsetTabular * asInsetTabular() override { return this; }
1105 InsetTabular const * asInsetTabular() const override { return this; }
1107 bool isRightToLeft(Cursor & cur) const;
1108 /// writes the cells between stidx and enidx as a string, optionally
1109 /// descending into the insets
1110 docstring asString(idx_type stidx, idx_type enidx, bool intoInsets = true);
1112 ParagraphList asParList(idx_type stidx, idx_type enidx);
1114 /// Returns whether the cell in the specified row and column is selected.
1115 bool isCellSelected(Cursor & cur, row_type row, col_type col) const;
1117 void setLayoutForHiddenCells(DocumentClass const & dc);
1119 // Public structures and variables
1121 mutable Tabular tabular;
1125 InsetTabular(InsetTabular const &);
1127 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
1129 bool getFeatureStatus(Cursor & cur, std::string const & s,
1130 std::string const & argument, FuncStatus & status) const;
1132 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
1134 Inset * clone() const override { return new InsetTabular(*this); }
1137 bool hitSelectRow(BufferView const & bv, int x) const;
1139 bool hitSelectColumn(BufferView const & bv, int y) const;
1140 /// Returns true if coordinates are on row/column selection zones
1141 bool clickable(BufferView const &, int x, int y) const override;
1144 void drawCellLines(PainterInfo &, int x, int y, row_type row,
1145 idx_type cell) const;
1147 void setCursorFromCoordinates(Cursor & cur, int x, int y) const;
1150 void moveNextCell(Cursor & cur,
1151 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
1153 void movePrevCell(Cursor & cur,
1154 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
1156 int cellXPos(idx_type cell) const;
1158 int cellYPos(idx_type cell) const;
1160 bool copySelection(Cursor & cur);
1162 bool pasteClipboard(Cursor & cur);
1164 void cutSelection(Cursor & cur);
1166 void getSelection(Cursor & cur, row_type & rs, row_type & re,
1167 col_type & cs, col_type & ce) const;
1169 bool insertPlaintextString(BufferView &, docstring const & buf, bool usePaste);
1171 /// return the "Manhattan distance" to nearest corner
1172 int dist(BufferView &, idx_type cell, int x, int y) const;
1173 /// return the cell nearest to x, y
1174 idx_type getNearestCell(BufferView &, int x, int y) const;
1176 /// test the rotation state of the given cell range.
1177 bool oneCellHasRotationState(bool rotated,
1178 row_type row_start, row_type row_end,
1179 col_type col_start, col_type col_end) const;
1181 /// true when selecting rows with the mouse
1183 /// true when selecting columns with the mouse
1187 std::string const featureAsString(Tabular::Feature feature);
1189 /// Split cell on decimal symbol
1190 InsetTableCell splitCell(InsetTableCell & head, docstring const & decimal_sym, bool & hassep);
1194 #endif // INSET_TABULAR_H