2000-07-17 18:27:53 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
|
* \file InsetCaption.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 Lars Gullik Bj<EFBFBD>nnes
|
2000-07-17 18:27:53 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2000-07-17 18:27:53 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef INSETCAPTION_H
|
|
|
|
|
#define INSETCAPTION_H
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "InsetText.h"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2007-11-07 23:34:45 +00:00
|
|
|
|
class TextClass;
|
|
|
|
|
|
2000-07-17 18:27:53 +00:00
|
|
|
|
/** A caption inset
|
|
|
|
|
*/
|
|
|
|
|
class InsetCaption : public InsetText {
|
|
|
|
|
public:
|
2001-03-11 03:20:44 +00:00
|
|
|
|
///
|
2007-04-30 15:17:16 +00:00
|
|
|
|
InsetCaption(InsetCaption const &);
|
2002-03-03 20:25:07 +00:00
|
|
|
|
InsetCaption(BufferParams const &);
|
2000-07-18 17:45:27 +00:00
|
|
|
|
///
|
2007-01-30 13:23:21 +00:00
|
|
|
|
virtual ~InsetCaption() {}
|
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
void write(Buffer const & buf, std::ostream & os) const;
|
2000-07-18 17:45:27 +00:00
|
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
|
void read(Buffer const & buf, Lexer & lex);
|
2000-07-18 17:45:27 +00:00
|
|
|
|
///
|
2007-05-18 14:32:29 +00:00
|
|
|
|
virtual DisplayType display() const;
|
2001-03-11 03:20:44 +00:00
|
|
|
|
///
|
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 neverIndent(Buffer const &) const { return true; }
|
2006-05-05 05:51:51 +00:00
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
|
virtual InsetCode lyxCode() const;
|
2001-03-11 03:20:44 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
virtual docstring const editMessage() const;
|
2001-03-11 03:20:44 +00:00
|
|
|
|
///
|
2006-10-17 16:23:27 +00:00
|
|
|
|
virtual void cursorPos(BufferView const & bv,
|
|
|
|
|
CursorSlice const & sl, bool boundary, int & x, int & y) const;
|
2006-05-05 05:51:51 +00:00
|
|
|
|
///
|
2006-05-28 17:02:57 +00:00
|
|
|
|
bool descendable() const { return true; }
|
|
|
|
|
///
|
2007-09-21 20:39:47 +00:00
|
|
|
|
virtual void metrics(MetricsInfo & mi, Dimension & dim) const;
|
2006-05-05 05:51:51 +00:00
|
|
|
|
///
|
2003-05-30 06:48:24 +00:00
|
|
|
|
virtual void draw(PainterInfo & pi, int x, int y) const;
|
2001-03-11 03:20:44 +00:00
|
|
|
|
///
|
2008-02-11 08:20:13 +00:00
|
|
|
|
virtual void edit(Cursor & cur, bool front, EntryDirection entry_from);
|
2006-05-05 05:51:51 +00:00
|
|
|
|
///
|
2007-04-29 13:39:47 +00:00
|
|
|
|
virtual Inset * editXY(Cursor & cur, int x, int y);
|
2006-05-05 05:51:51 +00:00
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
|
bool insetAllowed(InsetCode code) const;
|
2007-02-02 13:55:14 +00:00
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
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-01-30 13:23:21 +00:00
|
|
|
|
///
|
2007-02-16 09:53:51 +00:00
|
|
|
|
int latex(Buffer const & buf, odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const &) const;
|
2001-03-11 03:20:44 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
int plaintext(Buffer const & buf, odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const & runparams) const;
|
2001-03-11 03:20:44 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
int docbook(Buffer const & buf, odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const & runparams) const;
|
2007-05-14 20:42:14 +00:00
|
|
|
|
/// return the mandatory argument (LaTeX format) only
|
|
|
|
|
int getArgument(Buffer const & buf, odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const &) const;
|
2007-05-14 20:42:14 +00:00
|
|
|
|
/// return the optional argument(s) only
|
|
|
|
|
int getOptArg(Buffer const & buf, odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const &) const;
|
2006-05-28 17:02:57 +00:00
|
|
|
|
///
|
2007-03-15 11:47:02 +00:00
|
|
|
|
std::string const & type() const { return type_; }
|
|
|
|
|
///
|
2007-02-01 12:45:14 +00:00
|
|
|
|
void setCustomLabel(docstring const & label);
|
|
|
|
|
///
|
2007-06-22 13:33:51 +00:00
|
|
|
|
void addToToc(TocList &, Buffer const &, ParConstIterator const &) const;
|
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 forceEmptyLayout() const { return true; }
|
2007-04-17 03:46:55 +00:00
|
|
|
|
/// Captions don't accept alignment, spacing, etc.
|
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-01-30 13:23:21 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2005-02-23 12:01:50 +00:00
|
|
|
|
///
|
2007-08-30 18:03:17 +00:00
|
|
|
|
virtual Inset * clone() const;
|
2006-05-05 05:51:51 +00:00
|
|
|
|
///
|
2007-01-30 13:23:21 +00:00
|
|
|
|
mutable docstring full_label_;
|
2006-05-05 05:51:51 +00:00
|
|
|
|
///
|
|
|
|
|
mutable int labelwidth_;
|
|
|
|
|
///
|
2007-02-01 12:45:14 +00:00
|
|
|
|
std::string type_;
|
|
|
|
|
///
|
|
|
|
|
docstring custom_label_;
|
2007-01-30 13:23:21 +00:00
|
|
|
|
///
|
2007-04-29 19:53:54 +00:00
|
|
|
|
TextClass const & textclass_;
|
2000-07-17 18:27:53 +00:00
|
|
|
|
};
|
|
|
|
|
|
2001-03-11 03:20:44 +00:00
|
|
|
|
|
|
|
|
|
inline
|
2007-05-18 14:32:29 +00:00
|
|
|
|
Inset::DisplayType InsetCaption::display() const
|
2001-03-11 03:20:44 +00:00
|
|
|
|
{
|
2007-05-18 14:32:29 +00:00
|
|
|
|
return AlignCenter;
|
2001-03-11 03:20:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetCode InsetCaption::lyxCode() const
|
2001-03-11 03:20:44 +00:00
|
|
|
|
{
|
|
|
|
|
return CAPTION_CODE;
|
|
|
|
|
}
|
2003-05-19 17:03:12 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2000-07-17 18:27:53 +00:00
|
|
|
|
#endif
|