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