]> git.lyx.org Git - lyx.git/blob - src/insets/InsetTabular.h
Free line setting in tabulars. FILE FORMAT CHANGE.
[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 CompletionList;
59 class CursorSlice;
60
61 namespace frontend { class Painter; }
62
63
64 class InsetTabular;
65 class Cursor;
66 class OutputParams;
67
68 //
69 // A helper struct for tables
70 //
71 class Tabular {
72 public:
73         ///
74         enum Feature {
75                 ///
76                 APPEND_ROW = 0,
77                 ///
78                 APPEND_COLUMN,
79                 ///
80                 DELETE_ROW,
81                 ///
82                 DELETE_COLUMN,
83                 ///
84                 COPY_ROW,
85                 ///
86                 COPY_COLUMN,
87                 ///
88                 TOGGLE_LINE_TOP,
89                 ///
90                 TOGGLE_LINE_BOTTOM,
91                 ///
92                 TOGGLE_LINE_LEFT,
93                 ///
94                 TOGGLE_LINE_RIGHT,
95                 ///
96                 ALIGN_LEFT,
97                 ///
98                 ALIGN_RIGHT,
99                 ///
100                 ALIGN_CENTER,
101                 ///
102                 ALIGN_BLOCK,
103                 ///
104                 VALIGN_TOP,
105                 ///
106                 VALIGN_BOTTOM,
107                 ///
108                 VALIGN_MIDDLE,
109                 ///
110                 M_ALIGN_LEFT,
111                 ///
112                 M_ALIGN_RIGHT,
113                 ///
114                 M_ALIGN_CENTER,
115                 ///
116                 M_VALIGN_TOP,
117                 ///
118                 M_VALIGN_BOTTOM,
119                 ///
120                 M_VALIGN_MIDDLE,
121                 ///
122                 MULTICOLUMN,
123                 ///
124                 SET_ALL_LINES,
125                 ///
126                 UNSET_ALL_LINES,
127                 ///
128                 SET_LONGTABULAR,
129                 ///
130                 UNSET_LONGTABULAR,
131                 ///
132                 SET_PWIDTH,
133                 ///
134                 SET_MPWIDTH,
135                 ///
136                 SET_ROTATE_TABULAR,
137                 ///
138                 UNSET_ROTATE_TABULAR,
139                 ///
140                 TOGGLE_ROTATE_TABULAR,
141                 ///
142                 SET_ROTATE_CELL,
143                 ///
144                 UNSET_ROTATE_CELL,
145                 ///
146                 TOGGLE_ROTATE_CELL,
147                 ///
148                 SET_USEBOX,
149                 ///
150                 SET_LTHEAD,
151                 UNSET_LTHEAD,
152                 ///
153                 SET_LTFIRSTHEAD,
154                 UNSET_LTFIRSTHEAD,
155                 ///
156                 SET_LTFOOT,
157                 UNSET_LTFOOT,
158                 ///
159                 SET_LTLASTFOOT,
160                 UNSET_LTLASTFOOT,
161                 ///
162                 SET_LTNEWPAGE,
163                 ///
164                 SET_SPECIAL_COLUMN,
165                 ///
166                 SET_SPECIAL_MULTI,
167                 ///
168                 SET_BOOKTABS,
169                 ///
170                 UNSET_BOOKTABS,
171                 ///
172                 SET_TOP_SPACE,
173                 ///
174                 SET_BOTTOM_SPACE,
175                 ///
176                 SET_INTERLINE_SPACE,
177                 ///
178                 LAST_ACTION
179         };
180         ///
181         enum {
182                 ///
183                 CELL_NORMAL = 0,
184                 ///
185                 CELL_BEGIN_OF_MULTICOLUMN,
186                 ///
187                 CELL_PART_OF_MULTICOLUMN
188         };
189
190         ///
191         enum VAlignment {
192                 ///
193                 LYX_VALIGN_TOP = 0,
194                 ///
195                 LYX_VALIGN_BOTTOM = 1,
196                 ///
197                 LYX_VALIGN_MIDDLE = 2
198         };
199
200         enum BoxType {
201                 ///
202                 BOX_NONE = 0,
203                 ///
204                 BOX_PARBOX = 1,
205                 ///
206                 BOX_MINIPAGE = 2
207         };
208
209         class ltType {
210         public:
211                 // constructor
212                 ltType();
213                 // we have this header type (is set in the getLT... functions)
214                 bool set;
215                 // double borders on top
216                 bool topDL;
217                 // double borders on bottom
218                 bool bottomDL;
219                 // used for FirstHeader & LastFooter and if this is true
220                 // all the rows marked as FirstHeader or LastFooter are
221                 // ignored in the output and it is set to be empty!
222                 bool empty;
223         };
224
225         /// type for row numbers
226         typedef size_t row_type;
227         /// type for column numbers
228         typedef size_t col_type;
229         /// type for cell indices
230         typedef size_t idx_type;
231         /// index indicating an invalid position
232         static const idx_type npos = static_cast<idx_type>(-1);
233
234         /// constructor
235         Tabular();
236         /// constructor
237         Tabular(Buffer const &, col_type columns_arg, row_type rows_arg);
238
239         /// Returns true if there is a topline, returns false if not
240         bool topLine(idx_type cell) const;
241         /// Returns true if there is a topline, returns false if not
242         bool bottomLine(idx_type cell) const;
243         /// Returns true if there is a topline, returns false if not
244         bool leftLine(idx_type cell) const;
245         /// Returns true if there is a topline, returns false if not
246         bool rightLine(idx_type cell) const;
247
248         ///
249         bool topAlreadyDrawn(idx_type cell) const;
250         ///
251         bool leftAlreadyDrawn(idx_type cell) const;
252         ///
253         bool isLastRow(idx_type cell) const;
254
255         /// return space occupied by the second horizontal line and
256         /// interline space above row \p row in pixels
257         int getAdditionalHeight(row_type row) const;
258         ///
259         int getAdditionalWidth(idx_type cell) const;
260
261         /* returns the maximum over all rows */
262         ///
263         int columnWidth(idx_type cell) const;
264         ///
265         int width() const;
266         ///
267         int height() const;
268         ///
269         int rowAscent(row_type row) const;
270         ///
271         int rowDescent(row_type row) const;
272         ///
273         void setRowAscent(row_type row, int height);
274         ///
275         void setRowDescent(row_type row, int height);
276         ///
277         void setCellWidth(idx_type cell, int new_width);
278         ///
279         void setAllLines(idx_type cell, bool line);
280         ///
281         void setTopLine(idx_type cell, bool line);
282         ///
283         void setBottomLine(idx_type cell, bool line);
284         ///
285         void setLeftLine(idx_type cell, bool line);
286         ///
287         void setRightLine(idx_type cell, bool line);
288         ///
289         bool rowTopLine(row_type row) const;
290         ///
291         bool rowBottomLine(row_type row) const;
292         ///
293         bool columnLeftLine(col_type column) const;
294         ///
295         bool columnRightLine(col_type column) const;
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(idx_type cell);
329         ///
330         void deleteRow(row_type row);
331         ///
332         void copyRow(row_type);
333         ///
334         void appendColumn(idx_type cell);
335         ///
336         void deleteColumn(col_type column);
337         ///
338         void copyColumn(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(std::ostream &) const;
353         ///
354         void read(Lexer &);
355         ///
356         int latex(odocstream &, OutputParams const &) const;
357         //
358         int docbook(odocstream & os, OutputParams const &) const;
359         ///
360         void plaintext(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(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 CellData {
464         public:
465                 ///
466                 CellData(Buffer const &);
467                 ///
468                 CellData(CellData const &);
469                 ///
470                 CellData & operator=(CellData);
471                 ///
472                 void swap(CellData & 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         CellData & cellinfo_of_cell(idx_type cell) const;
503         ///
504         typedef std::vector<CellData> cell_vector;
505         ///
506         typedef std::vector<cell_vector> cell_vvector;
507
508         ///
509         class RowData {
510         public:
511                 ///
512                 RowData();
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<RowData> row_vector;
547
548         ///
549         class ColumnData {
550                 public:
551                 ///
552                 ColumnData();
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<ColumnData> 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(Buffer 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 columnSpan(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 &, OutputParams const &) const;
629         ///
630         bool isValidRow(row_type const row) const;
631         ///
632         int TeXRow(odocstream &, row_type const row,
633                    OutputParams const &) const;
634         ///
635         // helper functions for plain text
636         ///
637         bool plaintextTopHLine(odocstream &, row_type row,
638                                std::vector<unsigned int> const &) const;
639         ///
640         bool plaintextBottomHLine(odocstream &, row_type row,
641                                   std::vector<unsigned int> const &) const;
642         ///
643         void plaintextPrintCell(odocstream &,
644                                 OutputParams const &,
645                                 idx_type cell, row_type row, col_type column,
646                                 std::vector<unsigned int> const &,
647                                 bool onlydata) const;
648         /// auxiliary function for docbook
649         int docbookRow(odocstream & os, row_type, OutputParams const &) const;
650
651         /// change associated Buffer
652         void setBuffer(Buffer const & buffer) { buffer_ = &buffer; }
653         /// retrieve associated Buffer
654         Buffer const & buffer() const { return *buffer_; }
655
656 private:
657         Buffer const * buffer_;
658
659         /// renumber cells after structural changes
660         void fixCellNums();
661 };
662
663
664
665 class InsetTabular : public Inset {
666 public:
667         ///
668         InsetTabular(Buffer const &, row_type rows = 1,
669                      col_type columns = 1);
670         ///
671         ~InsetTabular();
672         ///
673         void read(Lexer &);
674         ///
675         void write(std::ostream &) const;
676         ///
677         void metrics(MetricsInfo &, Dimension &) const;
678         ///
679         void draw(PainterInfo & pi, int x, int y) const;
680         ///
681         void drawSelection(PainterInfo & pi, int x, int y) const;
682         ///
683         docstring editMessage() const;
684         ///
685         EDITABLE editable() const { return HIGHLY_EDITABLE; }
686         ///
687         bool insetAllowed(InsetCode code) const;
688         ///
689         bool allowSpellCheck() const { return true; }
690         ///
691         bool canTrackChanges() const { return true; }
692         /** returns true if, when outputing LaTeX, font changes should
693             be closed before generating this inset. This is needed for
694             insets that may contain several paragraphs */
695         bool noFontChange() const { return true; }
696         ///
697         DisplayType display() const { return tabular.isLongTabular() ? AlignCenter : Inline; }
698         ///
699         int latex(odocstream &, OutputParams const &) const;
700         ///
701         int plaintext(odocstream &, OutputParams const &) const;
702         ///
703         int docbook(odocstream &, OutputParams const &) const;
704         ///
705         void validate(LaTeXFeatures & features) const;
706         ///
707         InsetCode lyxCode() const { return TABULAR_CODE; }
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.cellCount(); }
722         ///
723         boost::shared_ptr<InsetText const> cell(idx_type) const;
724         ///
725         boost::shared_ptr<InsetText> 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() { return true; }
742         ///
743         void addPreview(graphics::PreviewLoader &) const;
744
745         /// lock cell with given index
746         void edit(Cursor & cur, bool front, EntryDirection entry_from);
747         /// get table row from x coordinate
748         int rowFromY(Cursor & cur, int y) const;
749         /// get table column from y coordinate
750         int columnFromX(Cursor & cur, int x) const;
751         ///
752         Inset * editXY(Cursor & cur, int x, int y);
753         /// can we go further down on mouse click?
754         bool descendable() const { return true; }
755         // Update the counters of this inset and of its contents
756         void updateLabels(ParIterator const &);
757
758         ///
759         bool completionSupported(Cursor const &) const;
760         ///
761         bool inlineCompletionSupported(Cursor const & cur) const;
762         ///
763         bool automaticInlineCompletion() const;
764         ///
765         bool automaticPopupCompletion() const;
766         ///
767         bool showCompletionCursor() const;
768         ///
769         CompletionList const * createCompletionList(Cursor const & cur) const;
770         ///
771         docstring completionPrefix(Cursor const & cur) const;
772         ///
773         bool insertCompletion(Cursor & cur, docstring const & s, bool finished);
774         ///
775         void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
776
777         //
778         // Public structures and variables
779         ///
780         mutable Tabular tabular;
781
782 private:
783         ///
784         InsetTabular(InsetTabular const &);
785         ///
786         void doDispatch(Cursor & cur, FuncRequest & cmd);
787         ///
788         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
789         ///
790         int scroll() const { return scx_; }
791         ///
792         Inset * clone() const { return new InsetTabular(*this); }
793
794         ///
795         void drawCellLines(frontend::Painter &, int x, int y, row_type row,
796                            idx_type cell, bool erased) const;
797         ///
798         void setCursorFromCoordinates(Cursor & cur, int x, int y) const;
799
800         ///
801         void moveNextCell(Cursor & cur);
802         ///
803         void movePrevCell(Cursor & cur);
804         ///
805         int getCellXPos(idx_type cell) const;
806         ///
807         void resetPos(Cursor & cur) const;
808         ///
809         void removeTabularRow();
810         ///
811         bool copySelection(Cursor & cur);
812         ///
813         bool pasteClipboard(Cursor & cur);
814         ///
815         void cutSelection(Cursor & cur);
816         ///
817         bool isRightToLeft(Cursor & cur) const;
818         ///
819         void getSelection(Cursor & cur, row_type & rs, row_type & re,
820                           col_type & cs, col_type & ce) const;
821         ///
822         bool insertPlaintextString(BufferView &, docstring const & buf, bool usePaste);
823         /// are we operating on several cells?
824         bool tablemode(Cursor & cur) const;
825
826         /// return the "Manhattan distance" to nearest corner
827         int dist(BufferView &, idx_type cell, int x, int y) const;
828         /// return the cell nearest to x, y
829         idx_type getNearestCell(BufferView &, int x, int y) const;
830
831         /// test the rotation state of the give cell range.
832         bool oneCellHasRotationState(bool rotated,
833                                 row_type row_start, row_type row_end,
834                                 col_type col_start, col_type col_end) const;
835         ///
836         mutable idx_type first_visible_cell;
837         ///
838         mutable int scx_;
839 };
840
841
842 class InsetTabularMailer : public MailInset {
843 public:
844         ///
845         InsetTabularMailer(InsetTabular const & inset);
846         ///
847         virtual Inset & inset() const { return inset_; }
848         ///
849         virtual std::string const & name() const { return name_; }
850         ///
851         virtual std::string const inset2string(Buffer const &) const;
852         ///
853         static void string2params(std::string const &, InsetTabular &);
854         ///
855         static std::string const params2string(InsetTabular const &);
856 private:
857         ///
858         static std::string const name_;
859         ///
860         InsetTabular & inset_;
861 };
862
863 std::string const featureAsString(Tabular::Feature feature);
864
865 } // namespace lyx
866
867 #endif