#ifndef INSETTABULAR_H
#define INSETTABULAR_H
-#ifdef __GNUG__
-#pragma interface
-#endif
-
#include "inset.h"
#include "tabular.h"
#include "LString.h"
#include "lyxcursor.h"
#include "FuncStatus.h"
+#include "frontends/mouse_state.h"
#include <boost/scoped_ptr.hpp>
-
-#include <boost/signals/signal0.hpp>
+#include <boost/weak_ptr.hpp>
class LyXLex;
class Painter;
class BufferView;
class Buffer;
+class BufferParams;
class Paragraph;
class InsetTabular : public UpdatableInset {
///
InsetTabular(Buffer const &, int rows = 1, int columns = 1);
///
- InsetTabular(InsetTabular const &, Buffer const &, bool same_id = false);
+ InsetTabular(InsetTabular const &);
///
~InsetTabular();
///
- Inset * clone(Buffer const &, bool same_id = false) const;
+ Inset * clone() const;
///
void read(Buffer const *, LyXLex &);
///
void write(Buffer const *, std::ostream &) const;
///
- int ascent(BufferView *, LyXFont const &) const;
+ void metrics(MetricsInfo &, Dimension &) const;
///
- int descent(BufferView *, LyXFont const &) const;
+ void draw(PainterInfo & pi, int x, int y) const;
///
- int width(BufferView *, LyXFont const & f) const;
- ///
- void draw(BufferView *, const LyXFont &, int , float &, bool) const;
- ///
- void update(BufferView *, LyXFont const &, bool = false);
+ void update(BufferView *, bool = false);
///
string const editMessage() const;
- ///
- void edit(BufferView *, int x, int y, mouse_button::state);
- ///
- void edit(BufferView * bv, bool front = true);
- ///
- bool doClearArea() const;
- ///
+ //
void insetUnlock(BufferView *);
///
- void updateLocal(BufferView *, UpdateCodes, bool mark_dirty) const;
+ void updateLocal(BufferView *, UpdateCodes) const;
///
bool lockInsetInInset(BufferView *, UpdatableInset *);
///
///
RESULT localDispatch(FuncRequest const &);
///
- int latex(Buffer const *, std::ostream &, bool, bool) const;
+ int latex(Buffer const *, std::ostream &,
+ LatexRunParams const &) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
void validate(LaTeXFeatures & features) const;
///
Inset::Code lyxCode() const { return Inset::TABULAR_CODE; }
- ///
+ /// FIXME, document
void getCursorPos(BufferView *, int & x, int & y) const;
- ///
- void toggleInsetCursor(BufferView *);
+ /// Get the absolute document x,y of the cursor
+ virtual void getCursor(BufferView &, int &, int &) const;
///
bool tabularFeatures(BufferView * bv, string const & what);
///
///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
- Buffer * bufferOwner() const { return const_cast<Buffer *>(buffer); }
- ///
LyXText * getLyXText(BufferView const *,
bool const recursive = false) const;
///
UpdatableInset::scroll(bv, offset);
}
///
- Paragraph * getParFromID(int id) const;
- ///
Inset * getInsetFromID(int id) const;
///
- Paragraph * firstParagraph() const;
- ///
- Paragraph * getFirstParagraph(int) const;
+ ParagraphList * getParagraphs(int) const;
///
LyXCursor const & cursor(BufferView *) const;
///
- bool allowSpellcheck() { return true; }
+ bool allowSpellcheck() const { return true; }
///
WordLangTuple const
selectNextWordToSpellcheck(BufferView *, float & value) const;
void selectSelectedWord(BufferView *);
///
void toggleSelection(BufferView *, bool kill_selection);
+
+ void markErased();
+
+ /// find next change
+ bool nextChange(BufferView *, lyx::pos_type & length);
///
bool searchForward(BufferView *, string const &,
bool = true, bool = false);
// Public structures and variables
///
boost::scoped_ptr<LyXTabular> tabular;
- ///
- boost::signal0<void> hideDialog;
/// are some cells selected ?
bool hasSelection() const {
return has_selection;
}
+
+ ///
+ virtual BufferView * view() const;
+
+ /// set the owning buffer
+ void buffer(Buffer * b);
+
private:
///
void lfunMousePress(FuncRequest const &);
///
void lfunMouseMotion(FuncRequest const &);
///
- bool calculate_dimensions_of_cells(BufferView *, LyXFont const &,
- bool = false) const;
+ bool calculate_dimensions_of_cells(BufferView *, bool = false) const;
///
void drawCellLines(Painter &, int x, int baseline,
int row, int cell) const;
void drawCellSelection(Painter &, int x, int baseline,
int row, int column, int cell) const;
///
- void showInsetCursor(BufferView *, bool show=true);
- ///
- void hideInsetCursor(BufferView *);
- ///
void fitInsetCursor(BufferView *) const;
///
void setPos(BufferView *, int x, int y) const;
///
bool movePrevCell(BufferView *, bool lock = false);
///
- bool deletable() const;
- ///
int getCellXPos(int cell) const;
///
void resetPos(BufferView *) const;
///
bool pasteSelection(BufferView *);
///
- bool cutSelection();
+ bool cutSelection(BufferParams const & bp);
///
bool isRightToLeft(BufferView *);
///
///
InsetText * old_locking_inset;
///
- Buffer const * buffer;
+ Buffer const * buffer_;
///
mutable LyXCursor cursor_;
///
///
mutable int in_reset_pos;
};
+
+
+#include "mailinset.h"
+
+
+class InsetTabularMailer : public MailInset {
+public:
+ ///
+ InsetTabularMailer(InsetTabular & inset);
+ ///
+ virtual InsetBase & inset() const { return inset_; }
+ ///
+ virtual string const & name() const { return name_; }
+ ///
+ virtual string const inset2string() const;
+ /// Returns the active cell if successful, else -1.
+ static int string2params(string const &, InsetTabular &);
+ ///
+ static string const params2string(InsetTabular const &);
+private:
+ ///
+ static string const name_;
+ ///
+ InsetTabular & inset_;
+};
+
+string const featureAsString(LyXTabular::Feature feature);
+
#endif