]> git.lyx.org Git - features.git/blob - src/insets/InsetTabular.h
this we don't use anymore
[features.git] / src / insets / InsetTabular.h
1 // -*- C++ -*-
2 /**
3  * \file InsetTabular.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Matthias Ettrich
9  * \author André Pönitz
10  * \author Jürgen Vigna
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15
16 // This is Juergen's rewrite of the tabular (table) support.
17
18 // Things to think of when designing the new tabular support:
19 // - color support (colortbl, color)
20 // - decimal alignment (dcloumn)
21 // - custom lines (hhline)
22 // - rotation
23 // - multicolumn
24 // - multirow
25 // - column styles
26
27 // This is what I have written about tabular support in the LyX3-Tasks file:
28 //
29 //  o rewrite of table code. Should probably be written as some
30 //    kind of an inset. [Done]
31 // o enhance longtable support
32
33 // Lgb
34
35 #ifndef INSET_TABULAR_H
36 #define INSET_TABULAR_H
37
38 #include "Inset.h"
39 #include "InsetText.h"
40 #include "Layout.h"
41 #include "Length.h"
42
43 #include <boost/shared_ptr.hpp>
44
45 #include <iosfwd>
46 #include <vector>
47
48 namespace lyx {
49
50 class Buffer;
51 class BufferParams;
52 class BufferView;
53 class CompletionList;
54 class CursorSlice;
55 class InsetTableCell;
56 class FuncStatus;
57 class Lexer;
58 class Paragraph;
59
60 namespace frontend { class Painter; }
61
62
63 class InsetTabular;
64 class Cursor;
65 class OutputParams;
66
67 //
68 // A helper struct for tables
69 //
70 class Tabular {
71 public:
72         ///
73         enum Feature {
74                 ///
75                 APPEND_ROW = 0,
76                 ///
77                 APPEND_COLUMN,
78                 ///
79                 DELETE_ROW,
80                 ///
81                 DELETE_COLUMN,
82                 ///
83                 COPY_ROW,
84                 ///
85                 COPY_COLUMN,
86                 ///
87                 TOGGLE_LINE_TOP,
88                 ///
89                 TOGGLE_LINE_BOTTOM,
90                 ///
91                 TOGGLE_LINE_LEFT,
92                 ///
93                 TOGGLE_LINE_RIGHT,
94                 ///
95                 ALIGN_LEFT,
96                 ///
97                 ALIGN_RIGHT,
98                 ///
99                 ALIGN_CENTER,
100                 ///
101                 ALIGN_BLOCK,
102                 ///
103                 VALIGN_TOP,
104                 ///
105                 VALIGN_BOTTOM,
106                 ///
107                 VALIGN_MIDDLE,
108                 ///
109                 M_ALIGN_LEFT,
110                 ///
111                 M_ALIGN_RIGHT,
112                 ///
113                 M_ALIGN_CENTER,
114                 ///
115                 M_VALIGN_TOP,
116                 ///
117                 M_VALIGN_BOTTOM,
118                 ///
119                 M_VALIGN_MIDDLE,
120                 ///
121                 MULTICOLUMN,
122                 ///
123                 SET_ALL_LINES,
124                 ///
125                 UNSET_ALL_LINES,
126                 ///
127                 SET_LONGTABULAR,
128                 ///
129                 UNSET_LONGTABULAR,
130                 ///
131                 SET_PWIDTH,
132                 ///
133                 SET_MPWIDTH,
134                 ///
135                 SET_ROTATE_TABULAR,
136                 ///
137                 UNSET_ROTATE_TABULAR,
138                 ///
139                 TOGGLE_ROTATE_TABULAR,
140                 ///
141                 SET_ROTATE_CELL,
142                 ///
143                 UNSET_ROTATE_CELL,
144                 ///
145                 TOGGLE_ROTATE_CELL,
146                 ///
147                 SET_USEBOX,
148                 ///
149                 SET_LTHEAD,
150                 UNSET_LTHEAD,
151                 ///
152                 SET_LTFIRSTHEAD,
153                 UNSET_LTFIRSTHEAD,
154                 ///
155                 SET_LTFOOT,
156                 UNSET_LTFOOT,
157                 ///
158                 SET_LTLASTFOOT,
159                 UNSET_LTLASTFOOT,
160                 ///
161                 SET_LTNEWPAGE,
162                 ///
163                 SET_SPECIAL_COLUMN,
164                 ///
165                 SET_SPECIAL_MULTI,
166                 ///
167                 SET_BOOKTABS,
168                 ///
169                 UNSET_BOOKTABS,
170                 ///
171                 SET_TOP_SPACE,
172                 ///
173                 SET_BOTTOM_SPACE,
174                 ///
175                 SET_INTERLINE_SPACE,
176                 ///
177                 SET_BORDER_LINES,
178                 ///
179                 LAST_ACTION
180         };
181         ///
182         enum {
183                 ///
184                 CELL_NORMAL = 0,
185                 ///
186                 CELL_BEGIN_OF_MULTICOLUMN,
187                 ///
188                 CELL_PART_OF_MULTICOLUMN
189         };
190
191         ///
192         enum VAlignment {
193                 ///
194                 LYX_VALIGN_TOP = 0,
195                 ///
196                 LYX_VALIGN_BOTTOM = 1,
197                 ///
198                 LYX_VALIGN_MIDDLE = 2
199         };
200
201         enum BoxType {
202                 ///
203                 BOX_NONE = 0,
204                 ///
205                 BOX_PARBOX = 1,
206                 ///
207                 BOX_MINIPAGE = 2
208         };
209
210         class ltType {
211         public:
212                 // constructor
213                 ltType();
214                 // we have this header type (is set in the getLT... functions)
215                 bool set;
216                 // double borders on top
217                 bool topDL;
218                 // double borders on bottom
219                 bool bottomDL;
220                 // used for FirstHeader & LastFooter and if this is true
221                 // all the rows marked as FirstHeader or LastFooter are
222                 // ignored in the output and it is set to be empty!
223                 bool empty;
224         };
225
226         /// type for row numbers
227         typedef size_t row_type;
228         /// type for column numbers
229         typedef size_t col_type;
230         /// type for cell indices
231         typedef size_t idx_type;
232         /// index indicating an invalid position
233         static const idx_type npos = static_cast<idx_type>(-1);
234
235         /// constructor
236         Tabular(Buffer const &, col_type columns_arg, row_type rows_arg);
237
238         /// Returns true if there is a topline, returns false if not
239         bool topLine(idx_type cell) const;
240         /// Returns true if there is a topline, returns false if not
241         bool bottomLine(idx_type cell) const;
242         /// Returns true if there is a topline, returns false if not
243         bool leftLine(idx_type cell) const;
244         /// Returns true if there is a topline, returns false if not
245         bool rightLine(idx_type cell) const;
246
247         ///
248         bool topAlreadyDrawn(idx_type cell) const;
249         ///
250         bool leftAlreadyDrawn(idx_type cell) const;
251         ///
252         bool isLastRow(idx_type cell) const;
253
254         /// return space occupied by the second horizontal line and
255         /// interline space above row \p row in pixels
256         int getAdditionalHeight(row_type row) const;
257         ///
258         int getAdditionalWidth(idx_type cell) const;
259
260         /* returns the maximum over all rows */
261         ///
262         int columnWidth(idx_type cell) const;
263         ///
264         int width() const;
265         ///
266         int height() const;
267         ///
268         int rowAscent(row_type row) const;
269         ///
270         int rowDescent(row_type row) const;
271         ///
272         void setRowAscent(row_type row, int height);
273         ///
274         void setRowDescent(row_type row, int height);
275         ///
276         void setCellWidth(idx_type cell, int new_width);
277         ///
278         void setAllLines(idx_type cell, bool line);
279         ///
280         void setTopLine(idx_type cell, bool line);
281         ///
282         void setBottomLine(idx_type cell, bool line);
283         ///
284         void setLeftLine(idx_type cell, bool line);
285         ///
286         void setRightLine(idx_type cell, bool line);
287         ///
288         bool rowTopLine(row_type row) const;
289         ///
290         bool rowBottomLine(row_type row) const;
291         ///
292         bool columnLeftLine(col_type column) const;
293         ///
294         bool columnRightLine(col_type column) const;
295
296         void setAlignment(idx_type cell, LyXAlignment align,
297                           bool onlycolumn = false);
298         ///
299         void setVAlignment(idx_type cell, VAlignment align,
300                            bool onlycolumn = false);
301         ///
302         void setColumnPWidth(Cursor &, idx_type, Length const &);
303         ///
304         bool setMColumnPWidth(Cursor &, idx_type, Length const &);
305         ///
306         void setAlignSpecial(idx_type cell, docstring const & special,
307                              Feature what);
308         ///
309         LyXAlignment getAlignment(idx_type cell,
310                                   bool onlycolumn = false) const;
311         ///
312         VAlignment getVAlignment(idx_type cell,
313                                  bool onlycolumn = false) const;
314         ///
315         Length const getPWidth(idx_type cell) const;
316         ///
317         int cellWidth(idx_type cell) const;
318         ///
319         int getBeginningOfTextInCell(idx_type cell) const;
320         ///
321         void appendRow(idx_type cell);
322         ///
323         void deleteRow(row_type row);
324         ///
325         void copyRow(row_type);
326         ///
327         void appendColumn(idx_type cell);
328         ///
329         void deleteColumn(col_type column);
330         ///
331         void copyColumn(col_type);
332         ///
333         bool isFirstCellInRow(idx_type cell) const;
334         ///
335         idx_type getFirstCellInRow(row_type row) const;
336         ///
337         bool isLastCellInRow(idx_type cell) const;
338         ///
339         idx_type getLastCellInRow(row_type row) const;
340         ///
341         idx_type numberOfCellsInRow(idx_type cell) const;
342         ///
343         void write(std::ostream &) const;
344         ///
345         void read(Lexer &);
346         ///
347         int latex(odocstream &, OutputParams const &) const;
348         //
349         int docbook(odocstream & os, OutputParams const &) const;
350         ///
351         void plaintext(odocstream &,
352                        OutputParams const & runparams, int const depth,
353                        bool onlydata, char_type delim) const;
354         ///
355         bool isMultiColumn(idx_type cell) const;
356         ///
357         bool isMultiColumnReal(idx_type cell) const;
358         ///
359         void setMultiColumn(idx_type cell, idx_type number);
360         ///
361         idx_type unsetMultiColumn(idx_type cell); // returns number of new cells
362         ///
363         bool isPartOfMultiColumn(row_type row, col_type column) const;
364         ///
365         row_type cellRow(idx_type cell) const;
366         ///
367         col_type cellColumn(idx_type cell) const;
368         ///
369         col_type cellRightColumn(idx_type cell) const;
370         ///
371         void setRotateCell(idx_type cell, bool);
372         ///
373         bool getRotateCell(idx_type cell) const;
374         ///
375         bool needRotating() const;
376         ///
377         bool isLastCell(idx_type cell) const;
378         ///
379         idx_type cellAbove(idx_type cell) const;
380         ///
381         idx_type cellBelow(idx_type cell) const;
382         ///
383         idx_type cellIndex(row_type row, col_type column) const;
384         ///
385         void setUsebox(idx_type cell, BoxType);
386         ///
387         BoxType getUsebox(idx_type cell) const;
388         //
389         // Long Tabular Options support functions
390         ///
391         bool checkLTType(row_type row, ltType const &) const;
392         ///
393         void setLTHead(row_type row, bool flag, ltType const &, bool first);
394         ///
395         bool getRowOfLTHead(row_type row, ltType &) const;
396         ///
397         bool getRowOfLTFirstHead(row_type row, ltType &) const;
398         ///
399         void setLTFoot(row_type row, bool flag, ltType const &, bool last);
400         ///
401         bool getRowOfLTFoot(row_type row, ltType &) const;
402         ///
403         bool getRowOfLTLastFoot(row_type row, ltType &) const;
404         ///
405         void setLTNewPage(row_type row, bool what);
406         ///
407         bool getLTNewPage(row_type row) const;
408         ///
409         bool haveLTHead() const;
410         ///
411         bool haveLTFirstHead() const;
412         ///
413         bool haveLTFoot() const;
414         ///
415         bool haveLTLastFoot() const;
416         ///
417         // end longtable support
418         ///
419         boost::shared_ptr<InsetTableCell> cellInset(idx_type cell) const;
420         ///
421         boost::shared_ptr<InsetTableCell> cellInset(row_type row,
422                                                   col_type column) const;
423         ///
424         void setCellInset(row_type row, col_type column,
425                           boost::shared_ptr<InsetTableCell>) const;
426         /// Search for \param inset in the tabular, with the
427         ///
428         idx_type cellFromInset(Inset const * inset) const;
429         ///
430         void validate(LaTeXFeatures &) const;
431         ///
432 //private:
433         ///
434         class CellData {
435         public:
436                 ///
437                 CellData(Buffer const &, Tabular const &);
438                 ///
439                 CellData(CellData const &);
440                 ///
441                 CellData & operator=(CellData);
442                 ///
443                 void swap(CellData & rhs);
444                 ///
445                 idx_type cellno;
446                 ///
447                 int width;
448                 ///
449                 int multicolumn;
450                 ///
451                 LyXAlignment alignment;
452                 ///
453                 VAlignment valignment;
454                 ///
455                 bool top_line;
456                 ///
457                 bool bottom_line;
458                 ///
459                 bool left_line;
460                 ///
461                 bool right_line;
462                 ///
463                 BoxType usebox;
464                 ///
465                 bool rotate;
466                 ///
467                 docstring align_special;
468                 ///
469                 Length p_width; // this is only set for multicolumn!!!
470                 ///
471                 boost::shared_ptr<InsetTableCell> inset;
472         };
473         CellData & cellInfo(idx_type cell) const;
474         ///
475         typedef std::vector<CellData> cell_vector;
476         ///
477         typedef std::vector<cell_vector> cell_vvector;
478
479         ///
480         class RowData {
481         public:
482                 ///
483                 RowData();
484                 ///
485                 int ascent;
486                 ///
487                 int descent;
488                 /// Extra space between the top line and this row
489                 Length top_space;
490                 /// Ignore top_space if true and use the default top space
491                 bool top_space_default;
492                 /// Extra space between this row and the bottom line
493                 Length bottom_space;
494                 /// Ignore bottom_space if true and use the default bottom space
495                 bool bottom_space_default;
496                 /// Extra space between the bottom line and the next top line
497                 Length interline_space;
498                 /// Ignore interline_space if true and use the default interline space
499                 bool interline_space_default;
500                 /// This are for longtabulars only
501                 /// a row of endhead
502                 bool endhead;
503                 /// a row of endfirsthead
504                 bool endfirsthead;
505                 /// a row of endfoot
506                 bool endfoot;
507                 /// row of endlastfoot
508                 bool endlastfoot;
509                 /// row for a newpage
510                 bool newpage;
511         };
512         ///
513         typedef std::vector<RowData> row_vector;
514
515         ///
516         class ColumnData {
517                 public:
518                 ///
519                 ColumnData();
520                 ///
521                 LyXAlignment alignment;
522                 ///
523                 VAlignment valignment;
524                 ///
525                 int width;
526                 ///
527                 Length p_width;
528                 ///
529                 docstring align_special;
530         };
531         ///
532         typedef std::vector<ColumnData> column_vector;
533
534         ///
535         idx_type numberofcells;
536         ///
537         std::vector<row_type> rowofcell;
538         ///
539         std::vector<col_type> columnofcell;
540         ///
541         row_vector row_info;
542         ///
543         column_vector column_info;
544         ///
545         mutable cell_vvector cell_info;
546         ///
547         bool use_booktabs;
548         ///
549         bool rotate;
550         //
551         // for long tabulars
552         //
553         bool is_long_tabular;
554         /// endhead data
555         ltType endhead;
556         /// endfirsthead data
557         ltType endfirsthead;
558         /// endfoot data
559         ltType endfoot;
560         /// endlastfoot data
561         ltType endlastfoot;
562
563         ///
564         void init(Buffer const &, row_type rows_arg,
565                   col_type columns_arg);
566         ///
567         void updateIndexes();
568         /// return true of update is needed
569         bool updateColumnWidths();
570         ///
571         idx_type columnSpan(idx_type cell) const;
572         ///
573         BoxType useParbox(idx_type cell) const;
574         ///
575         // helper function for Latex returns number of newlines
576         ///
577         int TeXTopHLine(odocstream &, row_type row) const;
578         ///
579         int TeXBottomHLine(odocstream &, row_type row) const;
580         ///
581         int TeXCellPreamble(odocstream &, idx_type cell, bool & ismulticol) const;
582         ///
583         int TeXCellPostamble(odocstream &, idx_type cell, bool ismulticol) const;
584         ///
585         int TeXLongtableHeaderFooter(odocstream &, OutputParams const &) const;
586         ///
587         bool isValidRow(row_type const row) const;
588         ///
589         int TeXRow(odocstream &, row_type const row,
590                    OutputParams const &) const;
591         ///
592         // helper functions for plain text
593         ///
594         bool plaintextTopHLine(odocstream &, row_type row,
595                                std::vector<unsigned int> const &) const;
596         ///
597         bool plaintextBottomHLine(odocstream &, row_type row,
598                                   std::vector<unsigned int> const &) const;
599         ///
600         void plaintextPrintCell(odocstream &,
601                                 OutputParams const &,
602                                 idx_type cell, row_type row, col_type column,
603                                 std::vector<unsigned int> const &,
604                                 bool onlydata) const;
605         /// auxiliary function for docbook
606         int docbookRow(odocstream & os, row_type, OutputParams const &) const;
607
608         /// change associated Buffer
609         void setBuffer(Buffer const & buffer) { buffer_ = &buffer; }
610         /// retrieve associated Buffer
611         Buffer const & buffer() const { return *buffer_; }
612
613 private:
614         Buffer const * buffer_;
615
616 }; // Tabular
617
618
619 ///
620 class InsetTableCell : public InsetText
621 {
622 public:
623         ///
624         InsetTableCell(Buffer const & buf,
625                 Tabular::CellData const * cd, Tabular const * t);
626         ///
627         InsetCode lyxCode() const { return CELL_CODE; }
628         ///
629         Inset * clone() { return new InsetTableCell(*this); }
630         ///
631         virtual bool useEmptyLayout() const { return true; }
632         /// 
633         virtual bool forceEmptyLayout(idx_type = 0) const;
634         /// 
635         virtual bool allowParagraphCustomization(idx_type = 0) const;
636         ///
637         bool getStatus(Cursor & cur, FuncRequest const & cmd,
638                 FuncStatus & status) const;
639         ///
640         virtual bool neverIndent() { return true; }
641         ///
642         void setCellData(Tabular::CellData const * cd) { cell_data_ = cd; }
643         ///
644         void setTabular(Tabular const * t) { table_ = t; }
645 private:
646         /// unimplemented
647         InsetTableCell();
648         /// unimplemented
649         void operator=(InsetTableCell const &);
650
651         /// 
652         Tabular::CellData const * cell_data_;
653         /// 
654         Tabular const * table_;
655 };
656
657
658 class InsetTabular : public Inset
659 {
660 public:
661         ///
662         InsetTabular(Buffer const &, row_type rows = 1,
663                      col_type columns = 1);
664         ///
665         ~InsetTabular();
666         ///
667         static void string2params(std::string const &, InsetTabular &);
668         ///
669         static std::string params2string(InsetTabular const &);
670         ///
671         void read(Lexer &);
672         ///
673         void write(std::ostream &) const;
674         ///
675         void metrics(MetricsInfo &, Dimension &) const;
676         ///
677         void draw(PainterInfo & pi, int x, int y) const;
678         ///
679         void drawSelection(PainterInfo & pi, int x, int y) const;
680         ///
681         docstring editMessage() const;
682         ///
683         EDITABLE editable() const { return HIGHLY_EDITABLE; }
684         ///
685         bool insetAllowed(InsetCode code) const;
686         ///
687         bool allowSpellCheck() const { return true; }
688         ///
689         bool canTrackChanges() const { return true; }
690         /** returns true if, when outputing LaTeX, font changes should
691             be closed before generating this inset. This is needed for
692             insets that may contain several paragraphs */
693         bool noFontChange() const { return true; }
694         ///
695         DisplayType display() const { return tabular.is_long_tabular ? AlignCenter : Inline; }
696         ///
697         int latex(odocstream &, OutputParams const &) const;
698         ///
699         int plaintext(odocstream &, OutputParams const &) const;
700         ///
701         int docbook(odocstream &, OutputParams const &) const;
702         ///
703         void validate(LaTeXFeatures & features) const;
704         ///
705         InsetCode lyxCode() const { return TABULAR_CODE; }
706         ///
707         docstring contextMenu(BufferView const & bv, int x, int y) const;
708         /// get offset of this cursor slice relative to our upper left corner
709         void cursorPos(BufferView const & bv, CursorSlice const & sl,
710                 bool boundary, int & x, int & y) const;
711         ///
712         bool tabularFeatures(Cursor & cur, std::string const & what);
713         ///
714         void tabularFeatures(Cursor & cur, Tabular::Feature feature,
715                              std::string const & val = std::string());
716         ///
717         void openLayoutDialog(BufferView *) const;
718         ///
719         bool showInsetDialog(BufferView *) const;
720         /// number of cells
721         size_t nargs() const { return tabular.numberofcells; }
722         ///
723         boost::shared_ptr<InsetTableCell const> cell(idx_type) const;
724         ///
725         boost::shared_ptr<InsetTableCell> cell(idx_type);
726         ///
727         Text * getText(int) const;
728
729         /// set the change for the entire inset
730         void setChange(Change const & change);
731         /// accept the changes within the inset
732         void acceptChanges(BufferParams const & bparams);
733         /// reject the changes within the inset
734         void rejectChanges(BufferParams const & bparams);
735
736         // this should return true if we have a "normal" cell, otherwise false.
737         // "normal" means without width set!
738         /// should all paragraphs be output with "Standard" layout?
739         virtual bool allowParagraphCustomization(idx_type cell = 0) const;
740         ///
741         virtual bool forceEmptyLayout(idx_type cell = 0) const;
742         ///
743         virtual bool useEmptyLayout() { return true; }
744         ///
745         void addPreview(graphics::PreviewLoader &) const;
746
747         /// lock cell with given index
748         void edit(Cursor & cur, bool front, EntryDirection entry_from);
749         /// get table row from x coordinate
750         int rowFromY(Cursor & cur, int y) const;
751         /// get table column from y coordinate
752         int columnFromX(Cursor & cur, int x) const;
753         ///
754         Inset * editXY(Cursor & cur, int x, int y);
755         /// can we go further down on mouse click?
756         bool descendable() const { return true; }
757         // Update the counters of this inset and of its contents
758         void updateLabels(ParIterator const &);
759
760         ///
761         bool completionSupported(Cursor const &) const;
762         ///
763         bool inlineCompletionSupported(Cursor const & cur) const;
764         ///
765         bool automaticInlineCompletion() const;
766         ///
767         bool automaticPopupCompletion() const;
768         ///
769         bool showCompletionCursor() const;
770         ///
771         CompletionList const * createCompletionList(Cursor const & cur) const;
772         ///
773         docstring completionPrefix(Cursor const & cur) const;
774         ///
775         bool insertCompletion(Cursor & cur, docstring const & s, bool finished);
776         ///
777         void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
778
779         ///
780         virtual InsetTabular * asInsetTabular() { return this; }
781         ///
782         virtual InsetTabular const * asInsetTabular() const { return this; }
783         ///
784         bool isRightToLeft(Cursor & cur) const;
785
786         //
787         // Public structures and variables
788         ///
789         mutable Tabular tabular;
790
791 private:
792         ///
793         InsetTabular(InsetTabular const &);
794         ///
795         void doDispatch(Cursor & cur, FuncRequest & cmd);
796         ///
797         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
798         ///
799         int scroll() const { return scx_; }
800         ///
801         Inset * clone() const { return new InsetTabular(*this); }
802
803         ///
804         void drawCellLines(frontend::Painter &, int x, int y, row_type row,
805                            idx_type cell, bool erased) const;
806         ///
807         void setCursorFromCoordinates(Cursor & cur, int x, int y) const;
808
809         ///
810         void moveNextCell(Cursor & cur, 
811                                 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
812         ///
813         void movePrevCell(Cursor & cur,
814                                 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
815         ///
816         int cellXPos(idx_type cell) const;
817         ///
818         void resetPos(Cursor & cur) const;
819         ///
820         void removeTabularRow();
821         ///
822         bool copySelection(Cursor & cur);
823         ///
824         bool pasteClipboard(Cursor & cur);
825         ///
826         void cutSelection(Cursor & cur);
827         ///
828         void getSelection(Cursor & cur, row_type & rs, row_type & re,
829                           col_type & cs, col_type & ce) const;
830         ///
831         bool insertPlaintextString(BufferView &, docstring const & buf, bool usePaste);
832         /// are we operating on several cells?
833         bool tablemode(Cursor & cur) const;
834
835         /// return the "Manhattan distance" to nearest corner
836         int dist(BufferView &, idx_type cell, int x, int y) const;
837         /// return the cell nearest to x, y
838         idx_type getNearestCell(BufferView &, int x, int y) const;
839
840         /// test the rotation state of the give cell range.
841         bool oneCellHasRotationState(bool rotated,
842                                 row_type row_start, row_type row_end,
843                                 col_type col_start, col_type col_end) const;
844         ///
845         mutable idx_type first_visible_cell;
846         ///
847         mutable int scx_;
848         /// true when selecting rows with the mouse
849         bool rowselect_;
850         /// true when selecting columns with the mouse
851         bool colselect_;
852 };
853
854 std::string const featureAsString(Tabular::Feature feature);
855
856 } // namespace lyx
857
858 #endif // INSET_TABULAR_H