]> git.lyx.org Git - lyx.git/blob - src/insets/InsetTabular.h
f042b0a6f32a98377f7c9608d34712680bfa4309
[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 "MailInset.h"
41 #include "LyXLength.h"
42 #include "InsetText.h"
43
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 LCursor;
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                 SET_ROTATE_CELL,
148                 ///
149                 UNSET_ROTATE_CELL,
150                 ///
151                 SET_USEBOX,
152                 ///
153                 SET_LTHEAD,
154                 UNSET_LTHEAD,
155                 ///
156                 SET_LTFIRSTHEAD,
157                 UNSET_LTFIRSTHEAD,
158                 ///
159                 SET_LTFOOT,
160                 UNSET_LTFOOT,
161                 ///
162                 SET_LTLASTFOOT,
163                 UNSET_LTLASTFOOT,
164                 ///
165                 SET_LTNEWPAGE,
166                 ///
167                 SET_SPECIAL_COLUMN,
168                 ///
169                 SET_SPECIAL_MULTI,
170                 ///
171                 SET_BOOKTABS,
172                 ///
173                 UNSET_BOOKTABS,
174                 ///
175                 SET_TOP_SPACE,
176                 ///
177                 SET_BOTTOM_SPACE,
178                 ///
179                 SET_INTERLINE_SPACE,
180                 ///
181                 LAST_ACTION
182         };
183         ///
184         enum {
185                 ///
186                 CELL_NORMAL = 0,
187                 ///
188                 CELL_BEGIN_OF_MULTICOLUMN,
189                 ///
190                 CELL_PART_OF_MULTICOLUMN
191         };
192
193         ///
194         enum VAlignment {
195                 ///
196                 LYX_VALIGN_TOP = 0,
197                 ///
198                 LYX_VALIGN_BOTTOM = 1,
199                 ///
200                 LYX_VALIGN_MIDDLE = 2
201         };
202
203         enum BoxType {
204                 ///
205                 BOX_NONE = 0,
206                 ///
207                 BOX_PARBOX = 1,
208                 ///
209                 BOX_MINIPAGE = 2
210         };
211
212         class ltType {
213         public:
214                 // constructor
215                 ltType();
216                 // we have this header type (is set in the getLT... functions)
217                 bool set;
218                 // double borders on top
219                 bool topDL;
220                 // double borders on bottom
221                 bool bottomDL;
222                 // used for FirstHeader & LastFooter and if this is true
223                 // all the rows marked as FirstHeader or LastFooter are
224                 // ignored in the output and it is set to be empty!
225                 bool empty;
226         };
227
228         /// type for row numbers
229         typedef size_t row_type;
230         /// type for column numbers
231         typedef size_t col_type;
232         /// type for cell indices
233         typedef size_t idx_type;
234         /// index indicating an invalid position
235         static const idx_type npos = static_cast<idx_type>(-1);
236
237         /// constructor
238         Tabular(BufferParams const &, col_type columns_arg,
239                    row_type rows_arg);
240
241         /// Returns true if there is a topline, returns false if not
242         bool topLine(idx_type cell, bool wholerow = false) const;
243         /// Returns true if there is a topline, returns false if not
244         bool bottomLine(idx_type cell, bool wholerow = false) const;
245         /// Returns true if there is a topline, returns false if not
246         bool leftLine(idx_type cell, bool wholecolumn = false) const;
247         /// Returns true if there is a topline, returns false if not
248         bool rightLine(idx_type cell, bool wholecolumn = false) const;
249
250         ///
251         bool topAlreadyDrawn(idx_type cell) const;
252         ///
253         bool leftAlreadyDrawn(idx_type cell) const;
254         ///
255         bool isLastRow(idx_type cell) const;
256
257         /// return space occupied by the second horizontal line and
258         /// interline space above row \p row in pixels
259         int getAdditionalHeight(row_type row) const;
260         ///
261         int getAdditionalWidth(idx_type cell) const;
262
263         /* returns the maximum over all rows */
264         ///
265         int getWidthOfColumn(idx_type cell) const;
266         ///
267         int getWidthOfTabular() const;
268         ///
269         int getAscentOfRow(row_type row) const;
270         ///
271         int getDescentOfRow(row_type row) const;
272         ///
273         int getHeightOfTabular() const;
274         ///
275         void setAscentOfRow(row_type row, int height);
276         ///
277         void setDescentOfRow(row_type row, int height);
278         ///
279         void setWidthOfCell(idx_type cell, int new_width);
280         ///
281         void setAllLines(idx_type cell, bool line);
282         ///
283         void setTopLine(idx_type cell, bool line, bool wholerow = false);
284         ///
285         void setBottomLine(idx_type cell, bool line, bool wholerow = false);
286         ///
287         void setLeftLine(idx_type cell, bool line, bool wholecolumn = false);
288         ///
289         void setRightLine(idx_type cell, bool line, bool wholecolumn = false);
290         ///
291         void setAlignment(idx_type cell, LyXAlignment align,
292                           bool onlycolumn = false);
293         ///
294         void setVAlignment(idx_type cell, VAlignment align,
295                            bool onlycolumn = false);
296         ///
297         void setColumnPWidth(LCursor &, idx_type, LyXLength const &);
298         ///
299         bool setMColumnPWidth(LCursor &, idx_type, LyXLength const &);
300         ///
301         void setAlignSpecial(idx_type cell, docstring const & special,
302                              Feature what);
303         ///
304         LyXAlignment getAlignment(idx_type cell,
305                                   bool onlycolumn = false) const;
306         ///
307         VAlignment getVAlignment(idx_type cell,
308                                  bool onlycolumn = false) const;
309         ///
310         LyXLength const getPWidth(idx_type cell) const;
311         ///
312         LyXLength const getColumnPWidth(idx_type cell) const;
313         ///
314         LyXLength const getMColumnPWidth(idx_type cell) const;
315         ///
316         docstring const getAlignSpecial(idx_type cell, int what) const;
317         ///
318         int getWidthOfCell(idx_type cell) const;
319         ///
320         int getBeginningOfTextInCell(idx_type cell) const;
321         ///
322         void appendRow(BufferParams const &, idx_type cell);
323         ///
324         void deleteRow(row_type row);
325         ///
326         void copyRow(BufferParams const &, row_type);
327         ///
328         void appendColumn(BufferParams const &, idx_type cell);
329         ///
330         void deleteColumn(col_type column);
331         ///
332         void copyColumn(BufferParams const &, col_type);
333         ///
334         bool isFirstCellInRow(idx_type cell) const;
335         ///
336         idx_type getFirstCellInRow(row_type row) const;
337         ///
338         bool isLastCellInRow(idx_type cell) const;
339         ///
340         idx_type getLastCellInRow(row_type row) const;
341         ///
342         idx_type getNumberOfCells() const;
343         ///
344         idx_type numberOfCellsInRow(idx_type cell) const;
345         ///
346         void write(Buffer const &, std::ostream &) const;
347         ///
348         void read(Buffer const &, Lexer &);
349         ///
350         int latex(Buffer const &, odocstream &, OutputParams const &) const;
351         //
352         int docbook(Buffer const & buf, odocstream & os, OutputParams const &) const;
353         ///
354         void plaintext(Buffer const &, odocstream &,
355                        OutputParams const & runparams, int const depth,
356                        bool onlydata, unsigned char delim) const;
357         ///
358         bool isMultiColumn(idx_type cell) const;
359         ///
360         bool isMultiColumnReal(idx_type cell) const;
361         ///
362         void setMultiColumn(Buffer *, idx_type cell, idx_type number);
363         ///
364         idx_type unsetMultiColumn(idx_type cell); // returns number of new cells
365         ///
366         bool isPartOfMultiColumn(row_type row, col_type column) const;
367         ///
368         row_type row_of_cell(idx_type cell) const;
369         ///
370         col_type column_of_cell(idx_type cell) const;
371         ///
372         col_type right_column_of_cell(idx_type cell) const;
373         ///
374         void setBookTabs(bool);
375         ///
376         bool useBookTabs() const;
377         ///
378         void setLongTabular(bool);
379         ///
380         bool isLongTabular() const;
381         ///
382         void setRotateTabular(bool);
383         ///
384         bool getRotateTabular() const;
385         ///
386         void setRotateCell(idx_type cell, bool);
387         ///
388         bool getRotateCell(idx_type cell) const;
389         ///
390         bool needRotating() const;
391         ///
392         bool isLastCell(idx_type cell) const;
393         ///
394         idx_type getCellAbove(idx_type cell) const;
395         ///
396         idx_type getCellBelow(idx_type cell) const;
397         ///
398         idx_type getLastCellAbove(idx_type cell) const;
399         ///
400         idx_type getLastCellBelow(idx_type cell) const;
401         ///
402         idx_type getCellNumber(row_type row, col_type column) const;
403         ///
404         void setUsebox(idx_type cell, BoxType);
405         ///
406         BoxType getUsebox(idx_type cell) const;
407         //
408         // Long Tabular Options support functions
409         ///
410         bool checkLTType(row_type row, ltType const &) const;
411         ///
412         void setLTHead(row_type row, bool flag, ltType const &, bool first);
413         ///
414         bool getRowOfLTHead(row_type row, ltType &) const;
415         ///
416         bool getRowOfLTFirstHead(row_type row, ltType &) const;
417         ///
418         void setLTFoot(row_type row, bool flag, ltType const &, bool last);
419         ///
420         bool getRowOfLTFoot(row_type row, ltType &) const;
421         ///
422         bool getRowOfLTLastFoot(row_type row, ltType &) const;
423         ///
424         void setLTNewPage(row_type row, bool what);
425         ///
426         bool getLTNewPage(row_type row) const;
427         ///
428         bool haveLTHead() const;
429         ///
430         bool haveLTFirstHead() const;
431         ///
432         bool haveLTFoot() const;
433         ///
434         bool haveLTLastFoot() const;
435         ///
436         // end longtable support
437         ///
438         boost::shared_ptr<InsetText> getCellInset(idx_type cell) const;
439         ///
440         boost::shared_ptr<InsetText> getCellInset(row_type row,
441                                                   col_type column) const;
442         ///
443         void setCellInset(row_type row, col_type column,
444                           boost::shared_ptr<InsetText>) const;
445         /// Search for \param inset in the tabular, with the
446         ///
447         idx_type getCellFromInset(InsetBase const * inset) const;
448         ///
449         row_type rows() const { return rows_; }
450         ///
451         col_type columns() const { return columns_;}
452         ///
453         void validate(LaTeXFeatures &) const;
454         ///
455 //private:
456         ///
457         class cellstruct {
458         public:
459                 ///
460                 cellstruct(BufferParams const &);
461                 ///
462                 cellstruct(cellstruct const &);
463                 ///
464                 cellstruct & operator=(cellstruct);
465                 ///
466                 void swap(cellstruct & rhs);
467                 ///
468                 idx_type cellno;
469                 ///
470                 int width_of_cell;
471                 ///
472                 int multicolumn;
473                 ///
474                 LyXAlignment alignment;
475                 ///
476                 VAlignment valignment;
477                 ///
478                 bool top_line;
479                 ///
480                 bool bottom_line;
481                 ///
482                 bool left_line;
483                 ///
484                 bool right_line;
485                 ///
486                 BoxType usebox;
487                 ///
488                 bool rotate;
489                 ///
490                 docstring align_special;
491                 ///
492                 LyXLength p_width; // this is only set for multicolumn!!!
493                 ///
494                 boost::shared_ptr<InsetText> inset;
495         };
496         cellstruct & cellinfo_of_cell(idx_type cell) const;
497         ///
498         typedef std::vector<cellstruct> cell_vector;
499         ///
500         typedef std::vector<cell_vector> cell_vvector;
501
502         ///
503         class rowstruct {
504         public:
505                 ///
506                 rowstruct();
507                 ///
508                 int ascent_of_row;
509                 ///
510                 int descent_of_row;
511                 ///
512                 bool top_line;
513                 ///
514                 bool bottom_line;
515                 /// Extra space between the top line and this row
516                 LyXLength top_space;
517                 /// Ignore top_space if true and use the default top space
518                 bool top_space_default;
519                 /// Extra space between this row and the bottom line
520                 LyXLength bottom_space;
521                 /// Ignore bottom_space if true and use the default bottom space
522                 bool bottom_space_default;
523                 /// Extra space between the bottom line and the next top line
524                 LyXLength interline_space;
525                 /// Ignore interline_space if true and use the default interline space
526                 bool interline_space_default;
527                 /// This are for longtabulars only
528                 /// a row of endhead
529                 bool endhead;
530                 /// a row of endfirsthead
531                 bool endfirsthead;
532                 /// a row of endfoot
533                 bool endfoot;
534                 /// row of endlastfoot
535                 bool endlastfoot;
536                 /// row for a pagebreak
537                 bool newpage;
538         };
539         ///
540         typedef std::vector<rowstruct> row_vector;
541
542         ///
543         class columnstruct {
544                 public:
545                 ///
546                 columnstruct();
547                 ///
548                 LyXAlignment alignment;
549                 ///
550                 VAlignment valignment;
551                 ///
552                 bool left_line;
553                 ///
554                 bool right_line;
555                 ///
556                 int  width_of_column;
557                 ///
558                 LyXLength p_width;
559                 ///
560                 docstring align_special;
561         };
562         ///
563         typedef std::vector<columnstruct> column_vector;
564
565         ///
566         row_type rows_;
567         ///
568         col_type columns_;
569         ///
570         idx_type numberofcells;
571         ///
572         std::vector<row_type> rowofcell;
573         ///
574         std::vector<col_type> columnofcell;
575         ///
576         row_vector row_info;
577         ///
578         column_vector column_info;
579         ///
580         mutable cell_vvector cell_info;
581         ///
582         int width_of_tabular;
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 set_row_column_number_info();
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         void calculate_width_of_tabular();
615         ///
616         void delete_column(col_type column);
617         ///
618         idx_type cells_in_multicolumn(idx_type cell) const;
619         ///
620         BoxType useParbox(idx_type cell) const;
621         ///
622         // helper function for Latex returns number of newlines
623         ///
624         int TeXTopHLine(odocstream &, row_type row) const;
625         ///
626         int TeXBottomHLine(odocstream &, row_type row) const;
627         ///
628         int TeXCellPreamble(odocstream &, idx_type cell) const;
629         ///
630         int TeXCellPostamble(odocstream &, idx_type cell) const;
631         ///
632         int TeXLongtableHeaderFooter(odocstream &, Buffer const & buf,
633                                      OutputParams const &) const;
634         ///
635         bool isValidRow(row_type const row) const;
636         ///
637         int TeXRow(odocstream &, row_type const row, Buffer const & buf,
638                    OutputParams const &) const;
639         ///
640         // helper functions for plain text
641         ///
642         bool plaintextTopHLine(odocstream &, row_type row,
643                                std::vector<unsigned int> const &) const;
644         ///
645         bool plaintextBottomHLine(odocstream &, row_type row,
646                                   std::vector<unsigned int> const &) const;
647         ///
648         void plaintextPrintCell(Buffer const &, odocstream &,
649                                 OutputParams const &,
650                                 idx_type cell, row_type row, col_type column,
651                                 std::vector<unsigned int> const &,
652                                 bool onlydata) const;
653         /// auxiliary function for docbook
654         int docbookRow(Buffer const & buf, odocstream & os, row_type,
655                        OutputParams const &) const;
656
657 private:
658         /// renumber cells after structural changes
659         void fixCellNums();
660 };
661
662
663
664 class InsetTabular : public InsetOld {
665 public:
666         ///
667         InsetTabular(Buffer const &, row_type rows = 1,
668                      col_type columns = 1);
669         ///
670         ~InsetTabular();
671         ///
672         void read(Buffer const &, Lexer &);
673         ///
674         void write(Buffer const &, std::ostream &) const;
675         ///
676         bool metrics(MetricsInfo &, Dimension &) const;
677         ///
678         void draw(PainterInfo & pi, int x, int y) const;
679         ///
680         void drawSelection(PainterInfo & pi, int x, int y) const;
681         ///
682         virtual docstring const editMessage() const;
683         ///
684         EDITABLE editable() const { return HIGHLY_EDITABLE; }
685         ///
686         bool insetAllowed(InsetBase::Code) const { return true; }
687         ///
688         bool allowSpellCheck() const { return true; }
689         ///
690         bool canTrackChanges() const { return true; }
691         /** returns true if, when outputing LaTeX, font changes should
692             be closed before generating this inset. This is needed for
693             insets that may contain several paragraphs */
694         bool noFontChange() const { return true; }
695         ///
696         bool display() const { return tabular.isLongTabular(); }
697         ///
698         int latex(Buffer const &, odocstream &,
699                   OutputParams const &) const;
700         ///
701         int plaintext(Buffer const &, odocstream &,
702                       OutputParams const &) const;
703         ///
704         int docbook(Buffer const &, odocstream &,
705                     OutputParams const &) const;
706         ///
707         void validate(LaTeXFeatures & features) const;
708         ///
709         Code lyxCode() const { return InsetBase::TABULAR_CODE; }
710         /// get offset of this cursor slice relative to our upper left corner
711         void cursorPos(BufferView const & bv, CursorSlice const & sl,
712                 bool boundary, int & x, int & y) const;
713         ///
714         bool tabularFeatures(LCursor & cur, std::string const & what);
715         ///
716         void tabularFeatures(LCursor & cur, Tabular::Feature feature,
717                              std::string const & val = std::string());
718         ///
719         void openLayoutDialog(BufferView *) const;
720         ///
721         bool showInsetDialog(BufferView *) const;
722         /// number of cells
723         size_t nargs() const { return tabular.getNumberOfCells(); }
724         ///
725         boost::shared_ptr<InsetText const> cell(idx_type) const;
726         ///
727         boost::shared_ptr<InsetText> cell(idx_type);
728         ///
729         LyXText * getText(int) const;
730
731         /// set the change for the entire inset
732         void setChange(Change const & change);
733         /// accept the changes within the inset
734         void acceptChanges(BufferParams const & bparams);
735         /// reject the changes within the inset
736         void rejectChanges(BufferParams const & bparams);
737
738         // this should return true if we have a "normal" cell, otherwise false.
739         // "normal" means without width set!
740         /// should all paragraphs be output with "Standard" layout?
741         bool forceDefaultParagraphs(idx_type cell = 0) const;
742
743         ///
744         void addPreview(graphics::PreviewLoader &) const;
745
746         ///
747         Buffer const & buffer() const;
748
749         /// set the owning buffer
750         void buffer(Buffer const * buf);
751         /// lock cell with given index
752         void edit(LCursor & cur, bool left);
753         ///
754         InsetBase * editXY(LCursor & cur, int x, int y);
755         /// can we go further down on mouse click?
756         bool descendable() const { return true; }
757
758         //
759         // Public structures and variables
760         ///
761         mutable Tabular tabular;
762
763 protected:
764         ///
765         InsetTabular(InsetTabular const &);
766         ///
767         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
768         ///
769         bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
770         ///
771         int scroll() const { return scx_; }
772
773 private:
774         virtual std::auto_ptr<InsetBase> doClone() const;
775
776         ///
777         void drawCellLines(frontend::Painter &, int x, int y, row_type row,
778                            idx_type cell, bool erased) const;
779         ///
780         void setCursorFromCoordinates(LCursor & cur, int x, int y) const;
781
782         ///
783         void moveNextCell(LCursor & cur);
784         ///
785         void movePrevCell(LCursor & cur);
786         ///
787         int getCellXPos(idx_type cell) const;
788         ///
789         void resetPos(LCursor & cur) const;
790         ///
791         void removeTabularRow();
792         ///
793         bool copySelection(LCursor & cur);
794         ///
795         bool pasteClipboard(LCursor & cur);
796         ///
797         void cutSelection(LCursor & cur);
798         ///
799         bool isRightToLeft(LCursor & cur) const;
800         ///
801         void getSelection(LCursor & cur, row_type & rs, row_type & re,
802                           col_type & cs, col_type & ce) const;
803         ///
804         bool insertPlaintextString(BufferView &, docstring const & buf, bool usePaste);
805         /// are we operating on several cells?
806         bool tablemode(LCursor & cur) const;
807
808         /// return the "Manhattan distance" to nearest corner
809         int dist(BufferView &, idx_type cell, int x, int y) const;
810         /// return the cell nearest to x, y
811         idx_type getNearestCell(BufferView &, int x, int y) const;
812
813         ///
814         Buffer const * buffer_;
815         ///
816         mutable idx_type first_visible_cell;
817         ///
818         mutable int scx_;
819         /// Ugly boolean used when this inset is dissolved and
820         /// InsetTabularMailer should not be used.
821         bool is_deleted_;
822 };
823
824
825 class InsetTabularMailer : public MailInset {
826 public:
827         ///
828         InsetTabularMailer(InsetTabular const & inset);
829         ///
830         virtual InsetBase & inset() const { return inset_; }
831         ///
832         virtual std::string const & name() const { return name_; }
833         ///
834         virtual std::string const inset2string(Buffer const &) const;
835         ///
836         static void string2params(std::string const &, InsetTabular &);
837         ///
838         static std::string const params2string(InsetTabular const &);
839 private:
840         ///
841         static std::string const name_;
842         ///
843         InsetTabular & inset_;
844 };
845
846 std::string const featureAsString(Tabular::Feature feature);
847
848 } // namespace lyx
849
850 #endif