1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2002-02-26 10:50:48 +00:00
|
|
|
/**
|
|
|
|
* \file vspace.h
|
|
|
|
* Copyright 1995-2002 the LyX Team
|
|
|
|
* Read the file COPYING
|
2001-11-30 14:57:15 +00:00
|
|
|
*
|
2002-02-26 10:50:48 +00:00
|
|
|
* \author Matthias Ettrich
|
|
|
|
*/
|
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
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-12-02 23:47:06 +00:00
|
|
|
#include "lyxgluelength.h"
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#include "LString.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 {
|
2002-02-26 10:50:48 +00:00
|
|
|
NONE, ///< no added vertical space
|
2000-08-07 20:58:24 +00:00
|
|
|
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
|
2001-11-30 14:57:15 +00:00
|
|
|
explicit VSpace(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
|
2001-12-02 23:47:06 +00:00
|
|
|
LyXGlueLength 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
|
2002-03-21 17:27:08 +00:00
|
|
|
string const asLyXCommand() const;
|
2002-02-26 10:50:48 +00:00
|
|
|
/// the latex representation
|
2000-09-14 17:53:12 +00:00
|
|
|
string const asLatexCommand(BufferParams const & params) const;
|
2002-02-26 10:50:48 +00:00
|
|
|
/// the size of the space on-screen
|
2002-08-06 00:54:20 +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
|