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
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjø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
|
|
|
|
2007-11-01 22:17:22 +00:00
|
|
|
#include "support/strfwd.h"
|
1999-12-07 00:44:53 +00:00
|
|
|
|
2008-01-22 08:41:45 +00:00
|
|
|
#include <string>
|
2000-04-19 01:42:55 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
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
|
|
|
};
|
|
|
|
///
|
2005-01-06 13:48:13 +00:00
|
|
|
Spacing() : space(Default), value("1.0") {}
|
2000-04-11 22:55:29 +00:00
|
|
|
///
|
2007-09-29 20:02:32 +00:00
|
|
|
Spacing(Spacing::Space sp, double val = 1.0) { set(sp, val); }
|
|
|
|
///
|
|
|
|
Spacing(Spacing::Space sp, std::string const & val) { set(sp, val); }
|
2001-03-06 14:07:14 +00:00
|
|
|
///
|
2007-09-29 20:02:32 +00:00
|
|
|
bool isDefault() const { return space == Default; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2005-01-06 13:48:13 +00:00
|
|
|
std::string const getValueAsString() const;
|
|
|
|
///
|
|
|
|
double 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
|
|
|
///
|
2005-01-27 21:05:44 +00:00
|
|
|
void set(Spacing::Space sp, double val = 1.0);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2005-01-06 13:48:13 +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;
|
2008-01-14 14:53:29 +00:00
|
|
|
/// useSetSpace is true when using the variant supported by
|
|
|
|
/// the memoir class.
|
|
|
|
std::string const writeEnvirBegin(bool useSetSpace) const;
|
|
|
|
/// useSetSpace is true when using the variant supported by
|
|
|
|
/// the memoir class.
|
|
|
|
std::string const writeEnvirEnd(bool useSetSpace) const;
|
2008-01-22 08:41:45 +00:00
|
|
|
/// useSetSpace is true when using the variant supported by
|
|
|
|
/// the memoir class.
|
|
|
|
std::string const writePreamble(bool useSetSpace) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
Space space;
|
|
|
|
///
|
2005-01-06 13:48:13 +00:00
|
|
|
std::string 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()
|
2005-01-06 13:48:13 +00:00
|
|
|
&& a.getValueAsString() == b.getValueAsString();
|
2000-09-14 17:53:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///
|
|
|
|
inline
|
|
|
|
bool operator!=(Spacing const & a, Spacing const & b)
|
|
|
|
{
|
|
|
|
return !(a == b);
|
2007-08-21 23:17:37 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
2007-08-21 23:17:37 +00:00
|
|
|
|
|
|
|
#endif // SPACING_H
|