2001-12-02 23:47:06 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-02-26 10:50:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file lyxgluelength.h
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-12-02 23:47:06 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2002-02-26 10:50:48 +00:00
|
|
|
|
* \author Matthias Ettrich
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-02-26 10:50:48 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2001-12-02 23:47:06 +00:00
|
|
|
|
#ifndef LYX_GLUE_LENGTH_H
|
|
|
|
|
#define LYX_GLUE_LENGTH_H
|
|
|
|
|
|
|
|
|
|
#include "lyxlength.h"
|
|
|
|
|
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_string.h"
|
2001-12-02 23:47:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LyXGlueLength {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
LyXGlueLength() {}
|
|
|
|
|
///
|
|
|
|
|
explicit LyXGlueLength(LyXLength const & len);
|
|
|
|
|
///
|
|
|
|
|
LyXGlueLength(LyXLength const & len,
|
|
|
|
|
LyXLength const & plus,
|
|
|
|
|
LyXLength const & minus);
|
|
|
|
|
|
|
|
|
|
/** "data" must be a decimal number, followed by a unit, and
|
|
|
|
|
optional "glue" indicated by "+" and "-". You may abbreviate
|
|
|
|
|
reasonably. Examples:
|
|
|
|
|
1.2 cm // 4mm +2pt // 2cm -4mm +2mm // 4+0.1-0.2cm
|
|
|
|
|
The traditional Latex format is also accepted, like
|
|
|
|
|
4cm plus 10pt minus 10pt */
|
|
|
|
|
explicit LyXGlueLength(string const & data);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-12-02 23:47:06 +00:00
|
|
|
|
///
|
|
|
|
|
LyXLength const & len() const;
|
|
|
|
|
///
|
|
|
|
|
LyXLength const & plus() const;
|
|
|
|
|
///
|
|
|
|
|
LyXLength const & minus() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// conversion
|
|
|
|
|
string const asString() const;
|
|
|
|
|
///
|
|
|
|
|
string const asLatexString() const;
|
|
|
|
|
|
|
|
|
|
friend bool isValidGlueLength(string const & data,
|
2003-03-27 17:38:24 +00:00
|
|
|
|
LyXGlueLength* result);
|
2001-12-02 23:47:06 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/// the normal vlaue
|
|
|
|
|
LyXLength len_;
|
|
|
|
|
/// extra stretch
|
|
|
|
|
LyXLength plus_;
|
|
|
|
|
/// extra shrink
|
|
|
|
|
LyXLength minus_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
bool operator==(LyXGlueLength const & l1, LyXGlueLength const & l2);
|
|
|
|
|
///
|
|
|
|
|
bool operator!=(LyXGlueLength const & l1, LyXGlueLength const & l2);
|
2003-03-27 17:38:24 +00:00
|
|
|
|
/** If "data" is valid, the length represented by it is
|
|
|
|
|
stored into "result", if that is not 0. */
|
|
|
|
|
bool isValidGlueLength(string const & data, LyXGlueLength * result = 0);
|
2001-12-02 23:47:06 +00:00
|
|
|
|
|
2002-02-26 10:50:48 +00:00
|
|
|
|
#endif // LYXGLUELENGTH_H
|