2003-11-12 14:38:26 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-09-05 15:29:04 +00:00
|
|
|
* \file InsetFlex.h
|
2003-11-12 14:38:26 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
* \author Martin Vermeer
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-09-05 15:29:04 +00:00
|
|
|
#ifndef INSETFLEX_H
|
|
|
|
#define INSETFLEX_H
|
2003-11-12 14:38:26 +00:00
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCollapsable.h"
|
2003-11-12 14:38:26 +00:00
|
|
|
|
2008-02-05 10:34:01 +00:00
|
|
|
using std::string;
|
2003-11-12 14:38:26 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
2007-09-05 15:29:04 +00:00
|
|
|
/** The Flex inset, e.g., CharStyle, Custom inset or XML short element
|
2003-11-12 14:38:26 +00:00
|
|
|
|
|
|
|
*/
|
2007-09-05 15:29:04 +00:00
|
|
|
class InsetFlex : public InsetCollapsable {
|
2003-11-12 14:38:26 +00:00
|
|
|
public:
|
|
|
|
///
|
2008-02-05 10:34:01 +00:00
|
|
|
InsetFlex(BufferParams const &,
|
|
|
|
TextClassPtr tc, string const & layoutName);
|
2007-04-29 12:32:14 +00:00
|
|
|
///
|
2007-11-05 10:14:19 +00:00
|
|
|
docstring name() const { return from_utf8(name_); }
|
2007-11-03 09:03:08 +00:00
|
|
|
|
2003-11-12 14:38:26 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
virtual docstring const editMessage() const;
|
2003-11-12 14:38:26 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return FLEX_CODE; }
|
2003-11-12 14:38:26 +00:00
|
|
|
///
|
|
|
|
void write(Buffer const &, std::ostream &) const;
|
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void read(Buffer const & buf, Lexer & lex);
|
2003-11-12 14:38:26 +00:00
|
|
|
///
|
Fix bug 4037 and related problems. The patch has been cleaned up a bit
from the one posted to the list.
The basic idea has two parts. First, we hard code an "empty layout"
(called PlainLayout, for want of a better name) in TextClass and read it
before doing anything else. It can therefore be customized by classes,
if they want---say, to make it left-aligned. Second, InsetText's are
divided into three types: (i) normal ones, that use the "default" layout
defined by the text class; (ii) highly restrictive ones, such as ERT and
(not quite an inset) table cells, which demand the empty layout; (iii)
middling ones, which default to an empty layout and use the empty layout
in place of the default. (This is so we don't get the same problem we
had with ERT in e.g. footnotes.) The type of inset is signaled by new
methods InsetText::forceEmptyLayout() and InsetText::useEmptyLayout().
(The latter might better be called: useEmptyLayoutInsteadOfDefault(),
but that's silly.) The old InsetText::forceDefaultParagraphs() has been
split into these, plus a new method InsetText::allowParagraphCustomization().
A lot of the changes just adapt to this change.
The other big change is in GuiToolbar: We want to show LyXDefault and
the "default" layout only when they're active.
There are a handful of places where I'm not entirely sure whether we
should be using forceEmptyLayout or !allowParagraphCustomization() or
both. The InsetCaption is one of these. These places, and some others,
are marked with FIXMEs, so I'd appreciate it if people would search
through the patch and let me know whether these need changing. If they
don't, the FIXMEs can be deleted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22966 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-12 17:31:07 +00:00
|
|
|
virtual bool allowParagraphCustomization(idx_type) const { return false; }
|
2007-08-16 16:36:50 +00:00
|
|
|
|
2003-11-12 14:38:26 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
int plaintext(Buffer const &, odocstream &,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const &) const;
|
2007-02-17 15:28:50 +00:00
|
|
|
///
|
|
|
|
int docbook(Buffer const &, odocstream &,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const &) const;
|
2005-11-25 14:40:34 +00:00
|
|
|
/// the string that is passed to the TOC
|
2007-01-19 16:23:13 +00:00
|
|
|
virtual void textString(Buffer const &, odocstream &) const;
|
2008-01-07 16:59:10 +00:00
|
|
|
///
|
|
|
|
void validate(LaTeXFeatures &) const;
|
2003-11-12 14:38:26 +00:00
|
|
|
|
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 { return true; }
|
2005-09-10 06:51:58 +00:00
|
|
|
|
2003-11-12 14:38:26 +00:00
|
|
|
protected:
|
2007-09-05 15:29:04 +00:00
|
|
|
InsetFlex(InsetFlex const &);
|
2003-11-12 14:38:26 +00:00
|
|
|
|
|
|
|
private:
|
2007-08-30 18:03:17 +00:00
|
|
|
virtual Inset * clone() const;
|
2004-11-23 23:04:52 +00:00
|
|
|
|
2003-11-12 14:38:26 +00:00
|
|
|
///
|
2007-11-05 10:14:19 +00:00
|
|
|
std::string name_;
|
2008-01-07 16:59:10 +00:00
|
|
|
///
|
2008-02-01 15:12:04 +00:00
|
|
|
std::set<std::string> packages_;
|
2008-01-07 16:59:10 +00:00
|
|
|
///
|
|
|
|
std::string preamble_;
|
2003-11-12 14:38:26 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2003-11-12 14:38:26 +00:00
|
|
|
#endif
|