6 using std::istringstream;
17 /// how can I put this inside of Spacing (class)
19 char const * spacing_string[] = {"single", "onehalf", "double", "other"};
22 float Spacing::getValue() const
25 case Default: // nothing special should happen with this...
26 case Single: return 1.0;
27 case Onehalf: return 1.25;
28 case Double: return 1.667;
29 case Other: return value;
35 void Spacing::set(Spacing::Space sp, float val)
39 switch(int(val * 1000 + 0.5)) {
40 case 1000: space = Single; break;
41 case 1250: space = Onehalf; break;
42 case 1667: space = Double; break;
43 default: value = val; break;
49 void Spacing::set(Spacing::Space sp, char const * val)
53 istringstream istr(val);
62 void Spacing::writeFile(ostream & os, bool para) const
64 if (space == Default) return;
66 string cmd = para ? "\\paragraph_spacing " : "\\spacing ";
68 if (getSpace() == Spacing::Other) {
69 os.setf(ios::showpoint|ios::fixed);
71 os << cmd << spacing_string[getSpace()]
72 << " " << getValue() << " \n";
74 os << cmd << spacing_string[getSpace()] << " \n";