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
27 #include "InsetText.h"
29 #include "support/Length.h"
52 class InsetTableCell : public InsetText
56 explicit InsetTableCell(Buffer * buf);
57 /// We need this since generation of the default is deprecated
58 /// (since we declare the assignment constucture below).
59 /// Please make sure to adjust it if you add members!
60 InsetTableCell(InsetTableCell const &);
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); }
96 void operator=(InsetTableCell const &);
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!
122 // NOTE: Make sure to adapt the construcors (especially the copy
123 // constructor) if you add members!
130 // FIXME: Here the thoughts from the comment above also apply.
132 LyXAlignment contentAlign;
133 /// should paragraph indentation be omitted in any case?
134 bool neverIndent() const override { return true; }
136 LyXAlignment contentAlignment() const override { return contentAlign; }
138 bool usePlainLayout() const override { return true; }
140 bool forcePlainLayout(idx_type = 0) const override;
142 bool allowParagraphCustomization(idx_type = 0) const override;
144 bool forceLocalFontSwitch() const override;
145 /// Is the width forced to some value?
146 bool hasFixedWidth() const override { return isFixedWidth; }
151 // A helper struct for tables
254 RESET_FORMAL_DEFAULT,
268 TOGGLE_VARWIDTH_COLUMN,
272 UNSET_ROTATE_TABULAR,
274 TOGGLE_ROTATE_TABULAR,
307 SET_SPECIAL_MULTICOLUMN,
325 TABULAR_VALIGN_MIDDLE,
327 TABULAR_VALIGN_BOTTOM,
329 LONGTABULAR_ALIGN_LEFT,
331 LONGTABULAR_ALIGN_CENTER,
333 LONGTABULAR_ALIGN_RIGHT,
348 CELL_BEGIN_OF_MULTICOLUMN,
350 CELL_PART_OF_MULTICOLUMN,
352 CELL_BEGIN_OF_MULTIROW,
354 CELL_PART_OF_MULTIROW
362 LYX_VALIGN_MIDDLE = 1,
364 LYX_VALIGN_BOTTOM = 2
370 LYX_LONGTABULAR_ALIGN_LEFT = 0,
372 LYX_LONGTABULAR_ALIGN_CENTER = 1,
374 LYX_LONGTABULAR_ALIGN_RIGHT = 2
415 // we have this header type (is set in the getLT... functions)
417 // double borders on top
419 // double borders on bottom
421 // used for FirstHeader & LastFooter and if this is true
422 // all the rows marked as FirstHeader or LastFooter are
423 // ignored in the output and it is set to be empty!
427 /// type for row numbers
428 typedef size_t row_type;
429 /// type for column numbers
430 typedef size_t col_type;
431 /// type for cell indices
432 typedef size_t idx_type;
433 /// index indicating an invalid position
434 static const idx_type npos = static_cast<idx_type>(-1);
437 Tabular(Buffer * buf, col_type columns_arg, row_type rows_arg);
439 /// Returns true if there is a topline, returns false if not
440 bool topLine(idx_type cell) const;
441 /// Returns true if there is a topline, returns false if not
442 bool bottomLine(idx_type cell) const;
443 /// Returns true if there is a topline, returns false if not
444 /// If \p ignore_bt is true, we return the state as if booktabs was
446 bool leftLine(idx_type cell, bool const ignore_bt = false) const;
447 /// Returns true if there is a topline, returns false if not
448 /// If \p ignore_bt is true, we return the state as if booktabs was
450 bool rightLine(idx_type cell, bool const ignore_bt = false) const;
451 /// Returns whether the top line is trimmed left and/or right
452 std::pair<bool, bool> topLineTrim(idx_type const cell) const;
453 /// Returns whether the bottom line is trimmed left and/or right
454 std::pair<bool, bool> bottomLineTrim(idx_type const cell) const;
456 /// return space occupied by the second horizontal line and
457 /// interline space above row \p row in pixels
458 int interRowSpace(row_type row) const;
460 int interColumnSpace(idx_type cell) const;
462 /* returns the maximum over all rows */
464 int cellWidth(idx_type cell) const;
466 int cellHeight(idx_type cell) const;
472 row_type nrows() const {return row_info.size();}
474 col_type ncols() const {return column_info.size();}
476 int rowAscent(row_type row) const;
478 int rowDescent(row_type row) const;
480 void setRowAscent(row_type row, int height);
482 void setRowDescent(row_type row, int height);
484 void setTopLine(idx_type cell, bool line);
486 void setBottomLine(idx_type cell, bool line);
488 void setTopLineLTrim(idx_type cell, bool val);
490 void setBottomLineLTrim(idx_type cell, bool val);
492 void setTopLineRTrim(idx_type cell, bool val);
494 void setBottomLineRTrim(idx_type cell, bool val);
496 void setTopLineTrim(idx_type cell, std::pair<bool, bool>);
498 void setBottomLineTrim(idx_type cell, std::pair<bool, bool>);
500 void setLeftLine(idx_type cell, bool line);
502 void setRightLine(idx_type cell, bool line);
504 bool rowTopLine(row_type row) const;
506 bool rowBottomLine(row_type row) const;
508 bool columnLeftLine(col_type column) const;
510 bool columnRightLine(col_type column) const;
512 void setAlignment(idx_type cell, LyXAlignment align,
513 bool onlycolumn = false);
515 void setVAlignment(idx_type cell, VAlignment align,
516 bool onlycolumn = false);
518 void setTabularWidth(Length const & l) { tabular_width = l; }
520 Length tabularWidth() const { return tabular_width; }
522 void setColumnPWidth(Cursor &, idx_type, Length const &);
524 bool setMColumnPWidth(Cursor &, idx_type, Length const &);
526 bool toggleVarwidth(idx_type, bool const);
528 bool setMROffset(Cursor &, idx_type, Length const &);
530 void setAlignSpecial(idx_type cell, docstring const & special,
533 LyXAlignment getAlignment(idx_type cell,
534 bool onlycolumn = false) const;
536 VAlignment getVAlignment(idx_type cell,
537 bool onlycolumn = false) const;
538 /// The vertical offset of the table due to the vertical
539 /// alignment with respect to the baseline.
540 int offsetVAlignment() const;
542 Length const getPWidth(idx_type cell) const;
544 Length const getMROffset(idx_type cell) const;
546 int textHOffset(idx_type cell) const;
548 int textVOffset(idx_type cell) const;
550 void appendRow(row_type row);
552 void deleteRow(row_type row, bool const force = false);
554 void copyRow(row_type row);
556 void insertRow(row_type row, bool copy);
558 void moveColumn(col_type col, ColDirection direction);
560 void moveRow(row_type row, RowDirection direction);
562 void appendColumn(col_type column);
564 void deleteColumn(col_type column, bool const force = false);
566 void copyColumn(col_type column);
568 void insertColumn(col_type column, bool copy);
570 idx_type getFirstCellInRow(row_type row, bool const ct = false) const;
572 idx_type getLastCellInRow(row_type row, bool const ct = false) const;
574 idx_type getFirstRow(bool const ct = false) const;
576 idx_type getLastRow(bool const ct = false) const;
578 idx_type numberOfCellsInRow(row_type row) const;
580 void write(std::ostream &) const;
584 void latex(otexstream &, OutputParams const &) const;
585 /// serialise the table in DocBook, according to buffer parameters
586 void docbook(XMLStream &, OutputParams const &) const;
588 docstring xhtml(XMLStream &, OutputParams const &) const;
590 void plaintext(odocstringstream &,
591 OutputParams const & runparams, int const depth,
592 bool onlydata, char_type delim, size_t max_length = INT_MAX) const;
594 bool isMultiColumn(idx_type cell) const;
596 bool hasMultiColumn(col_type cell) const;
598 bool hasVarwidthColumn() const;
600 bool isVTypeColumn(col_type cell) const;
602 idx_type setMultiColumn(Cursor & cur, idx_type cell, idx_type number,
603 bool const right_border);
605 void unsetMultiColumn(idx_type cell);
607 bool isPartOfMultiColumn(row_type row, col_type column) const;
609 bool isPartOfMultiRow(row_type row, col_type column) const;
611 bool isMultiRow(idx_type cell) const;
613 bool hasMultiRow(row_type r) const;
615 idx_type setMultiRow(Cursor & cur, idx_type cell, idx_type number,
616 bool const bottom_border,
617 LyXAlignment const halign);
619 void unsetMultiRow(idx_type cell);
621 row_type cellRow(idx_type cell) const;
623 col_type cellColumn(idx_type cell) const;
625 void setRotateCell(idx_type cell, int);
627 int getRotateCell(idx_type cell) const;
629 bool needRotating() const;
631 bool isLastCell(idx_type cell) const;
633 idx_type cellAbove(idx_type cell) const;
635 idx_type cellBelow(idx_type cell) const;
636 /// \return the index of the VISIBLE cell at row, column
637 /// this will be the same as the cell in the previous row,
638 /// e.g., if the cell is part of a multirow
639 idx_type cellIndex(row_type row, col_type column) const;
641 void setUsebox(idx_type cell, BoxType);
643 BoxType getUsebox(idx_type cell) const;
645 // Long Tabular Options support functions
647 void setLTHead(row_type row, bool flag, ltType const &, bool first);
649 bool getRowOfLTHead(row_type row, ltType &) const;
651 bool getRowOfLTFirstHead(row_type row, ltType &) const;
653 void setLTFoot(row_type row, bool flag, ltType const &, bool last);
655 bool getRowOfLTFoot(row_type row, ltType &) const;
657 bool getRowOfLTLastFoot(row_type row, ltType &) const;
659 void setLTNewPage(row_type row, bool what);
661 bool getLTNewPage(row_type row) const;
663 idx_type setLTCaption(Cursor & cur, row_type row, bool what);
665 bool ltCaption(row_type row) const;
667 bool haveLTHead(bool withcaptions = true) const;
669 bool haveLTFirstHead(bool withcaptions = true) const;
671 bool haveLTFoot(bool withcaptions = true) const;
673 bool haveLTLastFoot(bool withcaptions = true) const;
675 bool haveLTCaption(CaptionType captiontype = CAPTION_ANY) const;
677 // end longtable support
680 /// there is a subtle difference between these two methods.
683 /// cellInset(cellIndex(r,c));
684 /// can return different things. this is because cellIndex(r,c)
685 /// returns the VISIBLE cell at r,c, which may be the same as the
686 /// cell at the previous row or column, if we're dealing with some
687 /// multirow or multicell.
688 std::shared_ptr<InsetTableCell> cellInset(idx_type cell);
689 std::shared_ptr<InsetTableCell> cellInset(row_type row, col_type column);
690 InsetTableCell const * cellInset(idx_type cell) const;
693 void setCellInset(row_type row, col_type column,
694 std::shared_ptr<InsetTableCell>);
695 /// Search for \param inset in the tabular, with the
697 void validate(LaTeXFeatures &) const;
700 // FIXME Now that cells have an InsetTableCell as their insets, rather
701 // than an InsetText, it'd be possible to reverse the relationship here,
702 // so that cell_vector was a vector<InsetTableCell> rather than a
703 // vector<CellData>, and an InsetTableCell had a CellData as a member,
704 // or perhaps just had its members as members.
709 explicit CellData(Buffer *);
711 CellData(CellData const &);
713 CellData & operator=(CellData const &);
725 LyXAlignment alignment;
727 VAlignment valignment;
728 /// width of the part before the decimal
730 /// width of the decimal part
743 bool top_line_rtrimmed;
745 bool top_line_ltrimmed;
747 bool bottom_line_rtrimmed;
749 bool bottom_line_ltrimmed;
755 docstring align_special;
757 Length p_width; // this is only set for multicolumn!!!
759 std::shared_ptr<InsetTableCell> inset;
762 CellData const & cellInfo(idx_type cell) const;
764 CellData & cellInfo(idx_type cell);
766 typedef std::vector<CellData> cell_vector;
768 typedef std::vector<cell_vector> cell_vvector;
779 /// Extra space between the top line and this row
781 /// Ignore top_space if true and use the default top space
782 bool top_space_default;
783 /// Extra space between this row and the bottom line
785 /// Ignore bottom_space if true and use the default bottom space
786 bool bottom_space_default;
787 /// Extra space between the bottom line and the next top line
788 Length interline_space;
789 /// Ignore interline_space if true and use the default interline space
790 bool interline_space_default;
791 /// This are for longtabulars only
794 /// a row of endfirsthead
798 /// row of endlastfoot
800 /// row for a newpage
808 typedef std::vector<RowData> row_vector;
816 LyXAlignment alignment;
818 VAlignment valignment;
824 docstring align_special;
826 docstring decimal_point;
833 typedef std::vector<ColumnData> column_vector;
836 idx_type numberofcells;
838 std::vector<row_type> rowofcell;
840 std::vector<col_type> columnofcell;
844 column_vector column_info;
846 cell_vvector cell_info;
848 Length tabular_width;
854 VAlignment tabular_valignment;
858 HAlignment longtabular_alignment;
860 bool is_long_tabular;
863 /// endfirsthead data
871 void init(Buffer *, row_type rows_arg,
872 col_type columns_arg);
874 void updateIndexes();
876 bool setFixedWidth(row_type r, col_type c);
877 /// return true of update is needed
878 bool updateColumnWidths(MetricsInfo & mi);
880 idx_type columnSpan(idx_type cell) const;
882 idx_type rowSpan(idx_type cell) const;
884 BoxType useBox(idx_type cell) const;
886 // helper function for Latex
888 void TeXTopHLine(otexstream &, row_type row, std::list<col_type>,
889 std::list<col_type>) const;
891 void TeXBottomHLine(otexstream &, row_type row, std::list<col_type>,
892 std::list<col_type>) const;
894 void TeXCellPreamble(otexstream &, idx_type cell, bool & ismulticol, bool & ismultirow,
895 bool const bidi) const;
897 void TeXCellPostamble(otexstream &, idx_type cell, bool ismulticol, bool ismultirow) const;
899 void TeXLongtableHeaderFooter(otexstream &, OutputParams const &, std::list<col_type>,
900 std::list<col_type>) const;
902 bool isValidRow(row_type const row) const;
904 void TeXRow(otexstream &, row_type const row,
905 OutputParams const &, std::list<col_type>, std::list<col_type>) const;
907 // helper functions for plain text
909 bool plaintextTopHLine(odocstringstream &, row_type row,
910 std::vector<unsigned int> const &) const;
912 bool plaintextBottomHLine(odocstringstream &, row_type row,
913 std::vector<unsigned int> const &) const;
915 void plaintextPrintCell(odocstringstream &,
916 OutputParams const &,
917 idx_type cell, row_type row, col_type column,
918 std::vector<unsigned int> const &,
919 bool onlydata, size_t max_length) const;
920 /// auxiliary function for DocBook
921 void docbookRow(XMLStream &, row_type, OutputParams const &,
922 bool header = false) const;
923 /// auxiliary function for DocBook: export this row as HTML
924 void docbookRowAsHTML(XMLStream &, row_type, OutputParams const &,
926 /// auxiliary function for DocBook: export this row as CALS
927 void docbookRowAsCALS(XMLStream &, row_type, OutputParams const &) const;
929 docstring xhtmlRow(XMLStream & xs, row_type, OutputParams const &,
930 bool header = false) const;
932 /// change associated Buffer
933 void setBuffer(Buffer & buffer);
934 /// retrieve associated Buffer
935 Buffer const & buffer() const { return *buffer_; }
936 /// retrieve associated Buffer
937 Buffer & buffer() { return *buffer_; }
945 class InsetTabular : public Inset
949 InsetTabular(Buffer *, row_type rows = 1,
950 col_type columns = 1);
954 void setBuffer(Buffer & buffer) override;
957 static void string2params(std::string const &, InsetTabular &);
959 static std::string params2string(InsetTabular const &);
961 void read(Lexer &) override;
963 void write(std::ostream &) const override;
965 void metrics(MetricsInfo &, Dimension &) const override;
967 void draw(PainterInfo & pi, int x, int y) const override;
969 void drawSelection(PainterInfo & pi, int x, int y) const override;
971 void drawBackground(PainterInfo & pi, int x, int y) const override;
973 bool editable() const override { return true; }
975 bool hasSettings() const override { return true; }
977 bool insetAllowed(InsetCode code) const override;
979 bool allowSpellCheck() const override { return true; }
981 bool canTrackChanges() const override { return true; }
983 bool canPaintChange(BufferView const &) const override { return true; }
984 /** returns false if, when outputting LaTeX, font changes should
985 be closed before generating this inset. This is needed for
986 insets that may contain several paragraphs */
987 bool inheritFont() const override { return false; }
989 bool allowMultiPar() const override;
991 bool allowsCaptionVariation(std::string const &) const override;
993 bool isTable() const override { return true; }
995 RowFlags rowFlags() const override;
997 void latex(otexstream &, OutputParams const &) const override;
999 int plaintext(odocstringstream & ods, OutputParams const & op,
1000 size_t max_length = INT_MAX) const override;
1002 void docbook(XMLStream &, OutputParams const &) const override;
1004 docstring xhtml(XMLStream &, OutputParams const &) const override;
1006 void validate(LaTeXFeatures & features) const override;
1008 InsetCode lyxCode() const override { return TABULAR_CODE; }
1010 std::string contextMenu(BufferView const &, int, int) const override;
1012 std::string contextMenuName() const override;
1013 /// get offset of this cursor slice relative to our upper left corner
1014 void cursorPos(BufferView const & bv, CursorSlice const & sl,
1015 bool boundary, int & x, int & y) const override;
1016 /// Executes a space-separated sequence of tabular-features requests
1017 void tabularFeatures(Cursor & cur, std::string const & what);
1018 /// Change a single tabular feature; does not handle undo.
1019 void tabularFeatures(Cursor & cur, Tabular::Feature feature,
1020 std::string const & val = std::string());
1022 size_t nargs() const override { return tabular.numberofcells; }
1024 std::shared_ptr<InsetTableCell const> cell(idx_type) const;
1026 std::shared_ptr<InsetTableCell> cell(idx_type);
1028 Text * getText(int) const override;
1030 /// does the inset contain changes ?
1031 bool isChanged() const override;
1032 /// set the change for the entire inset
1033 void setChange(Change const & change) override;
1034 /// accept the changes within the inset
1035 void acceptChanges() override;
1036 /// reject the changes within the inset
1037 void rejectChanges() override;
1039 // this should return true if we have a "normal" cell, otherwise false.
1040 // "normal" means without width set!
1041 /// should all paragraphs be output with "Standard" layout?
1042 bool allowParagraphCustomization(idx_type cell = 0) const override;
1044 bool forcePlainLayout(idx_type cell = 0) const override;
1046 void addPreview(DocIterator const & inset_pos,
1047 graphics::PreviewLoader &) const override;
1049 /// lock cell with given index
1050 void edit(Cursor & cur, bool front, EntryDirection entry_from) override;
1051 /// get table row from x coordinate
1052 int rowFromY(Cursor & cur, int y) const;
1053 /// get table column from y coordinate
1054 int columnFromX(Cursor & cur, int x) const;
1056 Inset * editXY(Cursor & cur, int x, int y) override;
1057 /// can we go further down on mouse click?
1058 bool descendable(BufferView const &) const override { return true; }
1059 /// Update the counters of this inset and of its contents
1060 void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
1062 void addToToc(DocIterator const & di, bool output_active,
1063 UpdateType utype, TocBackend & backend) const override;
1066 bool completionSupported(Cursor const &) const override;
1068 bool inlineCompletionSupported(Cursor const & cur) const override;
1070 bool automaticInlineCompletion() const override;
1072 bool automaticPopupCompletion() const override;
1074 bool showCompletionCursor() const override;
1076 CompletionList const * createCompletionList(Cursor const & cur) const override;
1078 docstring completionPrefix(Cursor const & cur) const override;
1080 bool insertCompletion(Cursor & cur, docstring const & s, bool finished) override;
1082 void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const override;
1084 bool usePlainLayout() const override { return true; }
1086 docstring layoutName() const override { return from_ascii("Tabular"); }
1090 InsetTabular * asInsetTabular() override { return this; }
1092 InsetTabular const * asInsetTabular() const override { return this; }
1094 bool isRightToLeft(Cursor & cur) const;
1095 /// writes the cells between stidx and enidx as a string, optionally
1096 /// descending into the insets
1097 docstring asString(idx_type stidx, idx_type enidx, bool intoInsets = true);
1099 ParagraphList asParList(idx_type stidx, idx_type enidx);
1101 /// Returns whether the cell in the specified row and column is selected.
1102 bool isCellSelected(Cursor & cur, row_type row, col_type col) const;
1104 void setLayoutForHiddenCells(DocumentClass const & dc);
1106 // Public structures and variables
1108 mutable Tabular tabular;
1112 InsetTabular(InsetTabular const &);
1114 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
1116 bool getFeatureStatus(Cursor & cur, std::string const & s,
1117 std::string const & argument, FuncStatus & status) const;
1119 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
1121 Inset * clone() const override { return new InsetTabular(*this); }
1124 bool hitSelectRow(BufferView const & bv, int x) const;
1126 bool hitSelectColumn(BufferView const & bv, int y) const;
1127 /// Returns true if coordinates are on row/column selection zones
1128 bool clickable(BufferView const &, int x, int y) const override;
1131 void drawCellLines(PainterInfo &, int x, int y, row_type row,
1132 idx_type cell) const;
1134 void setCursorFromCoordinates(Cursor & cur, int x, int y) const;
1137 void moveNextCell(Cursor & cur,
1138 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
1140 void movePrevCell(Cursor & cur,
1141 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
1143 int cellXPos(idx_type cell) const;
1145 int cellYPos(idx_type cell) const;
1147 bool copySelection(Cursor & cur);
1149 bool pasteClipboard(Cursor & cur);
1151 void cutSelection(Cursor & cur);
1153 void getSelection(Cursor & cur, row_type & rs, row_type & re,
1154 col_type & cs, col_type & ce) const;
1156 bool insertPlaintextString(BufferView &, docstring const & buf, bool usePaste);
1158 /// return the "Manhattan distance" to nearest corner
1159 int dist(BufferView &, idx_type cell, int x, int y) const;
1160 /// return the cell nearest to x, y
1161 idx_type getNearestCell(BufferView &, int x, int y) const;
1163 /// test the rotation state of the given cell range.
1164 bool oneCellHasRotationState(bool rotated,
1165 row_type row_start, row_type row_end,
1166 col_type col_start, col_type col_end) const;
1168 /// true when selecting rows with the mouse
1170 /// true when selecting columns with the mouse
1174 std::string const featureAsString(Tabular::Feature feature);
1176 /// Split cell on decimal symbol
1177 InsetTableCell splitCell(InsetTableCell & head, docstring const & decimal_sym, bool & hassep);
1181 #endif // INSET_TABULAR_H