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();
|
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
virtual docstring const editMessage() const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset::Code lyxCode() const { return Inset::BOX_CODE; }
|
2003-10-07 07:42:15 +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-10-07 07:42:15 +00:00
|
|
|
|
///
|
|
|
|
|
void setButtonLabel();
|
|
|
|
|
///
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool metrics(MetricsInfo &, Dimension &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
/// show the Box dialog
|
|
|
|
|
bool showInsetDialog(BufferView * bv) const;
|
|
|
|
|
///
|
2003-11-10 09:06:48 +00:00
|
|
|
|
bool display() const { return false; }
|
|
|
|
|
///
|
2005-12-05 15:03:38 +00:00
|
|
|
|
bool forceDefaultParagraphs(idx_type) const;
|
|
|
|
|
///
|
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-12-05 15:03:38 +00:00
|
|
|
|
///
|
2006-06-09 12:10:49 +00:00
|
|
|
|
bool noFontChange() const { return true; }
|
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
int latex(Buffer const &, odocstream &, OutputParams const &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
2007-02-15 22:59:06 +00:00
|
|
|
|
int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
2007-02-15 22:59:06 +00:00
|
|
|
|
int docbook(Buffer const &, 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,
|
|
|
|
|
ovalbox,
|
|
|
|
|
Ovalbox,
|
|
|
|
|
Shadowbox,
|
|
|
|
|
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;
|
2007-04-29 12:32:14 +00:00
|
|
|
|
///
|
2007-04-30 14:39:09 +00:00
|
|
|
|
virtual docstring name() const { return from_ascii("Box"); }
|
2003-10-07 07:42:15 +00:00
|
|
|
|
private:
|
|
|
|
|
friend class InsetBoxParams;
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
virtual std::auto_ptr<Inset> doClone() 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
|