2003-10-07 07:42:15 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
|
* \file InsetBox.h
|
2003-10-07 07:42:15 +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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef INSETBOX_H
|
|
|
|
|
#define INSETBOX_H
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "InsetCollapsable.h"
|
2007-04-28 12:58:49 +00:00
|
|
|
|
#include "Length.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "MailInset.h"
|
2003-10-07 07:42:15 +00:00
|
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class InsetBoxParams {
|
|
|
|
|
public:
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
|
|
|
|
InsetBoxParams(std::string const &);
|
2003-10-13 02:10:45 +00:00
|
|
|
|
///
|
2003-10-07 07:42:15 +00:00
|
|
|
|
void write(std::ostream & os) const;
|
|
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
|
void read(Lexer & lex);
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
|
|
|
|
std::string type;
|
|
|
|
|
/// Use a parbox (true) or minipage (false)
|
|
|
|
|
bool use_parbox;
|
|
|
|
|
/// Do we have an inner parbox or minipage to format paragraphs to
|
|
|
|
|
/// columnwidth?
|
|
|
|
|
bool inner_box;
|
|
|
|
|
///
|
2007-04-28 12:58:49 +00:00
|
|
|
|
Length width;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
/// "special" widths, see usrguide.dvi <20>3.5
|
|
|
|
|
std::string special;
|
|
|
|
|
///
|
|
|
|
|
char pos;
|
|
|
|
|
///
|
|
|
|
|
char hor_pos;
|
|
|
|
|
///
|
|
|
|
|
char inner_pos;
|
|
|
|
|
///
|
2007-04-28 12:58:49 +00:00
|
|
|
|
Length height;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
|
|
|
|
std::string height_special;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** The fbox/fancybox inset
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
class InsetBox : public InsetCollapsable {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
InsetBox(BufferParams const &, std::string const &);
|
|
|
|
|
///
|
|
|
|
|
~InsetBox();
|
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
docstring editMessage() const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetCode lyxCode() const { return BOX_CODE; }
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
2007-12-04 09:25:50 +00:00
|
|
|
|
docstring name() const;
|
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
void write(std::ostream &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
void read(Lexer & lex);
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
|
|
|
|
void setButtonLabel();
|
|
|
|
|
///
|
2007-09-21 20:39:47 +00:00
|
|
|
|
void metrics(MetricsInfo &, Dimension &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
/// show the Box dialog
|
|
|
|
|
bool showInsetDialog(BufferView * bv) const;
|
|
|
|
|
///
|
2007-05-18 14:32:29 +00:00
|
|
|
|
DisplayType display() const { return Inline; }
|
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
|
|
|
|
//FIXME Is this the one we want? or is it:
|
|
|
|
|
//allowParagraphCustomization(idx_type)?
|
2003-11-10 09:06:48 +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 forceEmptyLayout() const;
|
2005-12-05 15:03:38 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
bool neverIndent() const { return true; }
|
2005-12-05 15:03:38 +00:00
|
|
|
|
///
|
2006-06-09 12:10:49 +00:00
|
|
|
|
bool noFontChange() const { return true; }
|
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
bool isMacroScope() const;
|
2007-12-21 20:42:46 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
int latex(odocstream &, OutputParams const &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
|
|
|
|
void validate(LaTeXFeatures &) const;
|
|
|
|
|
///
|
|
|
|
|
InsetBoxParams const & params() const { return params_; }
|
2003-10-13 02:10:45 +00:00
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
2005-04-22 08:57:22 +00:00
|
|
|
|
///
|
2003-10-07 07:42:15 +00:00
|
|
|
|
enum BoxType {
|
|
|
|
|
Frameless,
|
|
|
|
|
Boxed,
|
2007-12-04 09:25:50 +00:00
|
|
|
|
Framed,
|
2003-10-07 07:42:15 +00:00
|
|
|
|
ovalbox,
|
|
|
|
|
Ovalbox,
|
|
|
|
|
Shadowbox,
|
2007-12-04 09:25:50 +00:00
|
|
|
|
Shaded,
|
2003-10-07 07:42:15 +00:00
|
|
|
|
Doublebox
|
|
|
|
|
};
|
2003-10-17 18:01:15 +00:00
|
|
|
|
protected:
|
2004-11-23 23:04:52 +00:00
|
|
|
|
InsetBox(InsetBox const &);
|
2007-04-26 14:56:30 +00:00
|
|
|
|
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
|
2006-12-29 11:52:01 +00:00
|
|
|
|
/// Is the width forced to some value?
|
|
|
|
|
virtual bool hasFixedWidth() const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
private:
|
|
|
|
|
friend class InsetBoxParams;
|
|
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
|
virtual Inset * clone() const;
|
2004-11-23 23:04:52 +00:00
|
|
|
|
|
2003-10-07 07:42:15 +00:00
|
|
|
|
/// used by the constructors
|
|
|
|
|
void init();
|
|
|
|
|
///
|
|
|
|
|
InsetBoxParams params_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class InsetBoxMailer : public MailInset {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
InsetBoxMailer(InsetBox & inset);
|
|
|
|
|
///
|
2007-04-29 13:39:47 +00:00
|
|
|
|
virtual Inset & inset() const { return inset_; }
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
|
|
|
|
virtual std::string const & name() const { return name_; }
|
|
|
|
|
///
|
|
|
|
|
virtual std::string const inset2string(Buffer const &) const;
|
|
|
|
|
///
|
|
|
|
|
static std::string const params2string(InsetBoxParams const &);
|
|
|
|
|
///
|
|
|
|
|
static void string2params(std::string const &, InsetBoxParams &);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
///
|
|
|
|
|
static std::string const name_;
|
|
|
|
|
///
|
|
|
|
|
InsetBox & inset_;
|
|
|
|
|
};
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2003-10-07 07:42:15 +00:00
|
|
|
|
#endif // INSET_BOX_H
|