1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2002-02-26 10:50:48 +00:00
|
|
|
/**
|
|
|
|
* \file vspace.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-11-30 14:57:15 +00:00
|
|
|
*
|
2002-02-26 10:50:48 +00:00
|
|
|
* \author Matthias Ettrich
|
2003-08-23 00:17:00 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-02-26 10:50:48 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
#ifndef VSPACE_H
|
|
|
|
#define VSPACE_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-12-02 23:47:06 +00:00
|
|
|
#include "lyxgluelength.h"
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-02-22 00:36:17 +00:00
|
|
|
class BufferParams;
|
|
|
|
class BufferView;
|
|
|
|
|
2001-11-30 14:57:15 +00:00
|
|
|
|
2002-02-26 10:50:48 +00:00
|
|
|
/// A class representing latex vertical spacing
|
1999-09-27 18:44:28 +00:00
|
|
|
class VSpace {
|
|
|
|
public:
|
2001-02-16 09:25:43 +00:00
|
|
|
/// The different kinds of spaces.
|
2000-08-07 20:58:24 +00:00
|
|
|
enum vspace_kind {
|
|
|
|
DEFSKIP,
|
|
|
|
SMALLSKIP,
|
|
|
|
MEDSKIP,
|
|
|
|
BIGSKIP,
|
|
|
|
VFILL,
|
2002-02-26 10:50:48 +00:00
|
|
|
LENGTH ///< user-defined length
|
2000-08-07 20:58:24 +00:00
|
|
|
};
|
2002-02-26 10:50:48 +00:00
|
|
|
|
2001-11-30 14:57:15 +00:00
|
|
|
VSpace();
|
2002-02-26 10:50:48 +00:00
|
|
|
|
2001-11-30 14:57:15 +00:00
|
|
|
explicit VSpace(vspace_kind k);
|
2002-02-26 10:50:48 +00:00
|
|
|
|
2001-12-02 23:47:06 +00:00
|
|
|
explicit VSpace(LyXLength const & l);
|
2002-02-26 10:50:48 +00:00
|
|
|
|
2001-12-02 23:47:06 +00:00
|
|
|
explicit VSpace(LyXGlueLength const & l);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
/// Constructor for reading from a .lyx file
|
2003-10-06 15:43:21 +00:00
|
|
|
explicit VSpace(std::string const & data);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-02-26 10:50:48 +00:00
|
|
|
/// return the type of vertical space
|
2001-11-30 14:57:15 +00:00
|
|
|
vspace_kind kind() const;
|
2002-02-26 10:50:48 +00:00
|
|
|
/// return the length of this space
|
2003-09-07 01:45:40 +00:00
|
|
|
LyXGlueLength const & length() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// a flag that switches between \vspace and \vspace*
|
2001-11-30 14:57:15 +00:00
|
|
|
bool keep() const;
|
2002-02-26 10:50:48 +00:00
|
|
|
/// if set true, use \vspace* when type is not DEFSKIP
|
2001-11-30 14:57:15 +00:00
|
|
|
void setKeep(bool val);
|
1999-10-02 16:21:10 +00:00
|
|
|
///
|
2001-11-30 14:57:15 +00:00
|
|
|
bool operator==(VSpace const &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// conversion
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-11-30 14:57:15 +00:00
|
|
|
/// how it goes into the LyX file
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const asLyXCommand() const;
|
2002-02-26 10:50:48 +00:00
|
|
|
/// the latex representation
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const asLatexCommand(BufferParams const & params) const;
|
2005-05-24 10:23:30 +00:00
|
|
|
/// how it is seen in the LyX window
|
|
|
|
std::string const VSpace::asGUIName() const;
|
2002-02-26 10:50:48 +00:00
|
|
|
/// the size of the space on-screen
|
2003-02-26 17:04:10 +00:00
|
|
|
int inPixels(BufferView const & bv) const;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2001-02-16 09:25:43 +00:00
|
|
|
/// This VSpace kind
|
2001-11-30 14:57:15 +00:00
|
|
|
vspace_kind kind_;
|
2002-02-26 10:50:48 +00:00
|
|
|
/// the specified length
|
2001-11-30 14:57:15 +00:00
|
|
|
LyXGlueLength len_;
|
2002-02-26 10:50:48 +00:00
|
|
|
/// if true, use \vspace* type
|
2001-11-30 14:57:15 +00:00
|
|
|
bool keep_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2002-08-06 00:54:20 +00:00
|
|
|
#endif // VSPACE_H
|