1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
2003-10-08 11:31:51 +00:00
|
|
|
|
* \file src/Spacing.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.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
|
#ifndef SPACING_H
|
|
|
|
|
#define SPACING_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-03-28 02:18:55 +00:00
|
|
|
|
#include <iosfwd>
|
2004-07-25 12:59:12 +00:00
|
|
|
|
#include <string>
|
1999-12-07 00:44:53 +00:00
|
|
|
|
|
2000-04-19 01:42:55 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
|
|
|
|
class Spacing {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
enum Space {
|
|
|
|
|
///
|
|
|
|
|
Single,
|
|
|
|
|
///
|
|
|
|
|
Onehalf,
|
|
|
|
|
///
|
|
|
|
|
Double,
|
|
|
|
|
///
|
2000-04-11 22:55:29 +00:00
|
|
|
|
Other,
|
|
|
|
|
///
|
|
|
|
|
Default
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
///
|
2001-08-20 19:08:46 +00:00
|
|
|
|
Spacing() : space(Default), value(1.0) {}
|
2000-04-11 22:55:29 +00:00
|
|
|
|
///
|
2001-03-06 14:07:14 +00:00
|
|
|
|
Spacing(Spacing::Space sp, float val = 1.0) {
|
|
|
|
|
set(sp, val);
|
|
|
|
|
}
|
2003-10-06 15:43:21 +00:00
|
|
|
|
Spacing(Spacing::Space sp, std::string const & val) {
|
2001-03-06 14:07:14 +00:00
|
|
|
|
set(sp, val);
|
|
|
|
|
}
|
|
|
|
|
///
|
2000-04-11 22:55:29 +00:00
|
|
|
|
bool isDefault() const {
|
|
|
|
|
return space == Default;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
///
|
2000-03-28 02:18:55 +00:00
|
|
|
|
float getValue() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-03-28 02:18:55 +00:00
|
|
|
|
Spacing::Space getSpace() const { return space; }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-03-28 02:18:55 +00:00
|
|
|
|
void set(Spacing::Space sp, float val = 1.0);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void set(Spacing::Space sp, std::string const & val) ;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-04-11 22:55:29 +00:00
|
|
|
|
void writeFile(std::ostream &, bool para = false) const;
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const writeEnvirBegin() const;
|
2000-04-19 01:42:55 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const writeEnvirEnd() const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
|
|
|
|
Space space;
|
|
|
|
|
///
|
|
|
|
|
float value;
|
2001-11-09 13:44:48 +00:00
|
|
|
|
/// names of line spacing
|
2003-10-06 15:43:21 +00:00
|
|
|
|
static std::string const spacing_string[];
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
inline
|
|
|
|
|
bool operator==(Spacing const & a, Spacing const & b)
|
|
|
|
|
{
|
|
|
|
|
return a.getSpace() == b.getSpace()
|
|
|
|
|
&& a.getValue() == b.getValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
inline
|
|
|
|
|
bool operator!=(Spacing const & a, Spacing const & b)
|
|
|
|
|
{
|
|
|
|
|
return !(a == b);
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#endif
|