2000-02-25 12:06:15 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
|
* \file InsetText.h
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* 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
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
#include "Inset.h"
|
2007-04-29 18:17:15 +00:00
|
|
|
|
#include "Font.h"
|
2007-04-29 23:33:02 +00:00
|
|
|
|
#include "Text.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
|
|
|
|
|
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;
|
2007-04-26 17:34:20 +00:00
|
|
|
|
class Color_color;
|
2007-04-26 08:30:11 +00:00
|
|
|
|
class ParagraphList;
|
2007-08-30 18:03:17 +00:00
|
|
|
|
class InsetTabular;
|
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
|
|
|
|
*/
|
2007-04-29 13:39:47 +00:00
|
|
|
|
class InsetText : public Inset {
|
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();
|
2007-01-30 13:23:21 +00:00
|
|
|
|
|
2007-09-17 21:45:14 +00:00
|
|
|
|
///
|
|
|
|
|
Dimension const dimension(BufferView const &) const;
|
|
|
|
|
|
2005-09-07 10:37:05 +00:00
|
|
|
|
/// empty inset to empty par
|
|
|
|
|
void clear();
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
|
void read(Buffer const & buf, Lexer & 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
|
|
|
|
///
|
2007-09-21 20:39:47 +00:00
|
|
|
|
void 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;
|
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; }
|
|
|
|
|
///
|
2007-05-29 20:53:32 +00:00
|
|
|
|
InsetText * asTextInset() { return this; }
|
|
|
|
|
///
|
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
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetCode lyxCode() const { return TEXT_CODE; }
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2007-04-29 18:17:15 +00:00
|
|
|
|
void setText(docstring const &, Font 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
|
|
|
|
///
|
2007-04-26 17:34:20 +00:00
|
|
|
|
Color_color frameColor() const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2007-04-26 17:34:20 +00:00
|
|
|
|
void setFrameColor(Color_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
|
|
|
|
///
|
2007-04-29 23:33:02 +00:00
|
|
|
|
Text * getText(int i) const {
|
|
|
|
|
return (i == 0) ? const_cast<Text*>(&text_) : 0;
|
2005-07-18 12:57:08 +00:00
|
|
|
|
}
|
2004-03-18 13:57:20 +00:00
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
virtual bool getStatus(Cursor & 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
|
2007-01-23 21:53:16 +00:00
|
|
|
|
void acceptChanges(BufferParams const & bparams);
|
2006-10-24 21:38:47 +00:00
|
|
|
|
/// reject the changes within the inset
|
2007-01-23 21:53:16 +00:00
|
|
|
|
void rejectChanges(BufferParams const & bparams);
|
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
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
void edit(Cursor & cur, bool left);
|
2003-11-04 12:36:59 +00:00
|
|
|
|
///
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset * editXY(Cursor & 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
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
|
bool insetAllowed(InsetCode) 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
|
|
|
|
///
|
2007-10-11 10:13:45 +00:00
|
|
|
|
virtual bool allowMultiPar() const { return true; }
|
|
|
|
|
///
|
2005-05-12 12:22:39 +00:00
|
|
|
|
InsetText(InsetText const &);
|
2007-08-27 14:38:29 +00:00
|
|
|
|
|
2007-08-12 21:43:58 +00:00
|
|
|
|
// Update the counters of this inset and of its contents
|
|
|
|
|
virtual void updateLabels(Buffer const &, ParIterator const &);
|
2007-08-30 18:03:17 +00:00
|
|
|
|
///
|
|
|
|
|
virtual Inset * clone() const;
|
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
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
|
2004-11-23 23:04:52 +00:00
|
|
|
|
|
2005-07-15 22:19:49 +00:00
|
|
|
|
private:
|
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_;
|
2007-04-26 17:34:20 +00:00
|
|
|
|
/** We store the Color::color value as an int to get Color.h out
|
2003-09-16 10:30:59 +00:00
|
|
|
|
* 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;
|
2007-05-31 12:30:17 +00:00
|
|
|
|
|
2003-07-10 08:00:41 +00:00
|
|
|
|
public:
|
|
|
|
|
///
|
2007-04-29 23:33:02 +00:00
|
|
|
|
mutable Text text_;
|
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
|