2000-02-25 12:06:15 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file insettext.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:09:55 +00:00
|
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
2000-02-25 12:06:15 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2000-02-25 12:06:15 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef INSETTEXT_H
|
|
|
|
|
#define INSETTEXT_H
|
|
|
|
|
|
2005-07-15 22:10:25 +00:00
|
|
|
|
#include "inset.h"
|
2003-09-06 11:01:50 +00:00
|
|
|
|
#include "RowList_fwd.h"
|
2003-12-03 18:17:20 +00:00
|
|
|
|
#include "lyxfont.h"
|
2003-07-10 08:00:41 +00:00
|
|
|
|
#include "lyxtext.h"
|
2006-03-23 20:11:06 +00:00
|
|
|
|
#include "ParagraphList_fwd.h"
|
2002-08-12 00:15:19 +00:00
|
|
|
|
|
2002-07-21 21:21:06 +00:00
|
|
|
|
#include "support/types.h"
|
2001-12-18 03:21:10 +00:00
|
|
|
|
|
2003-07-10 08:00:41 +00:00
|
|
|
|
#include "frontends/mouse_state.h"
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2000-03-08 13:52:57 +00:00
|
|
|
|
class Buffer;
|
2002-03-03 20:25:07 +00:00
|
|
|
|
class BufferParams;
|
2003-09-07 01:45:40 +00:00
|
|
|
|
class BufferView;
|
2005-07-15 22:10:25 +00:00
|
|
|
|
class CursorSlice;
|
2003-09-07 01:45:40 +00:00
|
|
|
|
class Dimension;
|
2003-09-18 11:48:11 +00:00
|
|
|
|
class LColor_color;
|
2000-02-25 12:06:15 +00:00
|
|
|
|
|
2004-03-01 17:12:09 +00:00
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
|
/**
|
2000-09-14 17:53:12 +00:00
|
|
|
|
A text inset is like a TeX box to write full text
|
2002-03-21 17:09:55 +00:00
|
|
|
|
(including styles and other insets) in a given space.
|
2000-06-12 11:27:15 +00:00
|
|
|
|
*/
|
2005-07-15 22:10:25 +00:00
|
|
|
|
class InsetText : public InsetOld {
|
2000-02-25 12:06:15 +00:00
|
|
|
|
public:
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-10-08 14:29:16 +00:00
|
|
|
|
explicit InsetText(BufferParams const &);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-11-23 23:04:52 +00:00
|
|
|
|
InsetText();
|
2005-09-07 10:37:05 +00:00
|
|
|
|
/// empty inset to empty par
|
|
|
|
|
void clear();
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-11-28 08:55:12 +00:00
|
|
|
|
void read(Buffer const & buf, LyXLex & lex);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-11-28 08:55:12 +00:00
|
|
|
|
void write(Buffer const & buf, std::ostream & os) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool metrics(MetricsInfo & mi, Dimension & dim) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-05-30 06:48:24 +00:00
|
|
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
2004-02-06 11:12:49 +00:00
|
|
|
|
/// draw inset selection
|
|
|
|
|
void drawSelection(PainterInfo & pi, int x, int y) const;
|
2006-10-19 19:26:43 +00:00
|
|
|
|
/// are we inside the area covered by the inset?
|
Move BufferView cached pointer out of LyXText:
* LyXText
- bv(), bv_owner, : deleted.
- These methods now need a (Buffer const &) argument: getFont(), applyOuterFont(), getLayoutFont(), getLabelFont(), setCharFont(), setLayout(), singleWidth(), leftMargin(), rightMargin(), computeRowMetrics(), isMainText(), spacing(), isRTL(), cursorX(), rowBreakPoint(), setRowWidth(), labelFill(), labelEnd().
- These methods now need a (BufferView const &) argument and are propably candidates for future removal when 1.6 is opened for development: redoParagraph(), x2pos(), getRowNearY(), getColumnNearX(), checkInsetHit(), setHeightOfRow().
- recUndo(): now need a LCursor argument.
* CoordCache::get(LyXText const *, pit_type):
- now const.
- use const_iterator instead of iterator.
* FontIterator:
- add (Buffer const &) argument to ctor
- buffer_: new const reference to applicable BufferView.
* InsetBase
- xo(), yo(), covers() and neverIndent() are now const.
* InsetText::setViewCache(): deleted
All other changes are due to the LyXText and InsetBase API changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15618 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-30 12:45:33 +00:00
|
|
|
|
virtual bool covers(BufferView const & bv, int x, int y) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
virtual docstring const editMessage() const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2005-07-15 22:10:25 +00:00
|
|
|
|
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
|
|
|
|
///
|
2006-03-17 19:45:28 +00:00
|
|
|
|
bool canTrackChanges() const { return true; }
|
|
|
|
|
///
|
2006-03-18 17:39:54 +00:00
|
|
|
|
InsetText const * asTextInset() const { return this; }
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
int latex(Buffer const &, odocstream &, OutputParams const &) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
int docbook(Buffer const &, odocstream &, OutputParams const &) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
void validate(LaTeXFeatures & features) const;
|
2004-11-30 01:59:49 +00:00
|
|
|
|
|
|
|
|
|
/// return x,y of given position relative to the inset's baseline
|
2006-10-17 16:23:27 +00:00
|
|
|
|
void cursorPos(BufferView const & bv, CursorSlice const & sl,
|
|
|
|
|
bool boundary, int & x, int & y) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-11-23 23:04:52 +00:00
|
|
|
|
Code lyxCode() const { return TEXT_CODE; }
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void setText(docstring const &, LyXFont const &, bool trackChanges);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
void setAutoBreakRows(bool);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-17 16:27:12 +00:00
|
|
|
|
bool getAutoBreakRows() const { return text_.autoBreakRows_; }
|
2001-07-31 09:53:40 +00:00
|
|
|
|
///
|
2004-08-14 15:55:22 +00:00
|
|
|
|
void setDrawFrame(bool);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-09-18 11:48:11 +00:00
|
|
|
|
LColor_color frameColor() const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-11-10 09:06:48 +00:00
|
|
|
|
void setFrameColor(LColor_color);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
bool showInsetDialog(BufferView *) const;
|
2001-04-04 23:00:42 +00:00
|
|
|
|
///
|
2005-07-18 12:57:08 +00:00
|
|
|
|
LyXText * getText(int i) const {
|
|
|
|
|
return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
|
|
|
|
|
}
|
2004-03-18 13:57:20 +00:00
|
|
|
|
///
|
|
|
|
|
bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
2003-03-02 23:44:58 +00:00
|
|
|
|
|
2006-10-20 09:29:19 +00:00
|
|
|
|
/// set the change for the entire inset
|
|
|
|
|
void setChange(Change const & change);
|
2006-10-24 06:11:45 +00:00
|
|
|
|
/// accept the changes within the inset
|
|
|
|
|
void acceptChanges();
|
2006-10-24 21:38:47 +00:00
|
|
|
|
/// reject the changes within the inset
|
|
|
|
|
void rejectChanges();
|
2003-03-02 23:44:58 +00:00
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
|
/// append text onto the existing text
|
2003-04-28 16:22:32 +00:00
|
|
|
|
void appendParagraphs(Buffer * bp, ParagraphList &);
|
2003-03-02 23:44:58 +00:00
|
|
|
|
|
2002-03-21 15:58:54 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void addPreview(graphics::PreviewLoader &) const;
|
2002-08-02 16:39:43 +00:00
|
|
|
|
|
2003-11-04 12:36:59 +00:00
|
|
|
|
///
|
2004-02-06 16:14:06 +00:00
|
|
|
|
void edit(LCursor & cur, bool left);
|
2003-11-04 12:36:59 +00:00
|
|
|
|
///
|
2005-07-15 00:39:44 +00:00
|
|
|
|
InsetBase * editXY(LCursor & cur, int x, int y);
|
2003-11-04 12:36:59 +00:00
|
|
|
|
|
2004-02-16 11:58:51 +00:00
|
|
|
|
/// number of cells in this inset
|
|
|
|
|
size_t nargs() const { return 1; }
|
2003-03-02 23:44:58 +00:00
|
|
|
|
///
|
2004-03-28 22:00:22 +00:00
|
|
|
|
ParagraphList & paragraphs();
|
|
|
|
|
///
|
|
|
|
|
ParagraphList const & paragraphs() const;
|
2004-03-28 19:13:11 +00:00
|
|
|
|
///
|
|
|
|
|
bool insetAllowed(Code) const { return true; }
|
2004-03-31 17:58:11 +00:00
|
|
|
|
///
|
|
|
|
|
bool allowSpellCheck() const { return true; }
|
2005-09-10 06:51:58 +00:00
|
|
|
|
/// should paragraph indendation be ommitted in any case?
|
Move BufferView cached pointer out of LyXText:
* LyXText
- bv(), bv_owner, : deleted.
- These methods now need a (Buffer const &) argument: getFont(), applyOuterFont(), getLayoutFont(), getLabelFont(), setCharFont(), setLayout(), singleWidth(), leftMargin(), rightMargin(), computeRowMetrics(), isMainText(), spacing(), isRTL(), cursorX(), rowBreakPoint(), setRowWidth(), labelFill(), labelEnd().
- These methods now need a (BufferView const &) argument and are propably candidates for future removal when 1.6 is opened for development: redoParagraph(), x2pos(), getRowNearY(), getColumnNearX(), checkInsetHit(), setHeightOfRow().
- recUndo(): now need a LCursor argument.
* CoordCache::get(LyXText const *, pit_type):
- now const.
- use const_iterator instead of iterator.
* FontIterator:
- add (Buffer const &) argument to ctor
- buffer_: new const reference to applicable BufferView.
* InsetBase
- xo(), yo(), covers() and neverIndent() are now const.
* InsetText::setViewCache(): deleted
All other changes are due to the LyXText and InsetBase API changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15618 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-30 12:45:33 +00:00
|
|
|
|
bool neverIndent(Buffer const &) const;
|
2005-05-12 12:22:39 +00:00
|
|
|
|
///
|
|
|
|
|
InsetText(InsetText const &);
|
2006-03-10 16:10:35 +00:00
|
|
|
|
///
|
2006-11-07 15:24:34 +00:00
|
|
|
|
bool wide() const { return wide_inset_; }
|
2006-11-07 15:21:47 +00:00
|
|
|
|
///
|
|
|
|
|
void setWide(bool wide_inset) { wide_inset_ = wide_inset; }
|
2006-03-17 19:45:28 +00:00
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
protected:
|
2003-10-17 18:01:15 +00:00
|
|
|
|
///
|
2004-11-24 21:58:42 +00:00
|
|
|
|
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
2004-11-23 23:04:52 +00:00
|
|
|
|
|
2005-07-15 22:19:49 +00:00
|
|
|
|
private:
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2005-07-15 22:19:49 +00:00
|
|
|
|
virtual std::auto_ptr<InsetBase> doClone() const;
|
2003-10-08 14:29:16 +00:00
|
|
|
|
///
|
|
|
|
|
void init();
|
2002-03-21 17:09:55 +00:00
|
|
|
|
|
2003-09-16 10:01:29 +00:00
|
|
|
|
///
|
2004-08-14 15:55:22 +00:00
|
|
|
|
bool drawFrame_;
|
2003-09-16 10:30:59 +00:00
|
|
|
|
/** We store the LColor::color value as an int to get LColor.h out
|
|
|
|
|
* of the header file.
|
|
|
|
|
*/
|
|
|
|
|
int frame_color_;
|
2003-09-16 10:01:29 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
mutable pit_type old_pit;
|
2005-02-15 19:53:42 +00:00
|
|
|
|
///
|
|
|
|
|
static int border_;
|
2006-03-10 16:10:35 +00:00
|
|
|
|
///
|
2006-11-07 15:21:47 +00:00
|
|
|
|
bool wide_inset_;
|
2003-07-10 08:00:41 +00:00
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
mutable LyXText text_;
|
2003-12-03 18:17:20 +00:00
|
|
|
|
///
|
|
|
|
|
mutable LyXFont font_;
|
2000-02-25 12:06:15 +00:00
|
|
|
|
};
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2000-02-25 12:06:15 +00:00
|
|
|
|
#endif
|