#include "BufferView.h"
#include "gettext.h"
#include "lengthcommon.h"
-#include "LyXText.h"
+#include "Text.h"
+#include "TextMetrics.h" // for defaultRowHeight()
#include "support/convert.h"
#include "support/lstrings.h"
/// used to return numeric values in parsing vspace
double number[4] = { 0, 0, 0, 0 };
/// used to return unit types in parsing vspace
-LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE,
- LyXLength::UNIT_NONE,
- LyXLength::UNIT_NONE,
- LyXLength::UNIT_NONE };
+Length::UNIT unit[4] = { Length::UNIT_NONE,
+ Length::UNIT_NONE,
+ Length::UNIT_NONE,
+ Length::UNIT_NONE };
/// the current position in the number array
int number_index;
unit[unit_index] = unitFromString(buffer);
}
- if (unit[unit_index] != LyXLength::UNIT_NONE) {
+ if (unit[unit_index] != Length::UNIT_NONE) {
++unit_index;
return 'u';
}
}
-bool isValidGlueLength(string const & data, LyXGlueLength * result)
+bool isValidGlueLength(string const & data, GlueLength * result)
{
// This parser is table-driven. First, it constructs a "pattern"
// that describes the sequence of tokens in "data". For example,
// numbers and units are stored into static arrays. Then, "pattern"
// is searched in the "table". If it is found, the associated
// table entries tell us which number and unit should go where
- // in the LyXLength structure. Example: if "data" has the "pattern"
+ // in the Length structure. Example: if "data" has the "pattern"
// "nu+nu-nu", the associated table entries are "2, 3, 2, 3".
// That means, "plus_val" is the second number that was seen
// in the input, "minus_val" is the third number, and "plus_uni"
unit_index = 1; // entries at index 0 are sentinels
// construct "pattern" from "data"
- while (!isEndOfData (buffer)) {
- if (pattern_index > 20) return false;
- pattern[pattern_index] = nextToken (buffer);
- if (pattern[pattern_index] == 'E') return false;
+ while (!isEndOfData(buffer)) {
+ if (pattern_index > 20)
+ return false;
+ pattern[pattern_index] = nextToken(buffer);
+ if (pattern[pattern_index] == 'E')
+ return false;
++pattern_index;
}
pattern[pattern_index] = '\0';
}
-bool isValidLength(string const & data, LyXLength * result)
+bool isValidLength(string const & data, Length * result)
{
// This is a trimmed down version of isValidGlueLength.
// The parser may seem overkill for lengths without
pattern[pattern_index] = '\0';
// only the most basic pattern is accepted here
- if (compare(pattern, "nu") != 0) return false;
+ if (compare(pattern, "nu") != 0)
+ return false;
// It _was_ a correct length string.
// Store away the values we found.
{}
-VSpace::VSpace(vspace_kind k)
+VSpace::VSpace(VSpaceKind k)
: kind_(k), len_(), keep_(false)
{}
-VSpace::VSpace(LyXLength const & l)
+VSpace::VSpace(Length const & l)
: kind_(LENGTH), len_(l), keep_(false)
{}
-VSpace::VSpace(LyXGlueLength const & l)
+VSpace::VSpace(GlueLength const & l)
: kind_(LENGTH), len_(l), keep_(false)
{}
// without units in added_space_top/bottom.
// Let unit default to centimeters here.
kind_ = LENGTH;
- len_ = LyXGlueLength(LyXLength(convert<double>(input), LyXLength::CM));
+ len_ = GlueLength(Length(convert<double>(input), Length::CM));
}
}
-VSpace::vspace_kind VSpace::kind() const
-{
- return kind_;
-}
-
-
-LyXGlueLength const & VSpace::length() const
-{
- return len_;
-}
-
-
-bool VSpace::keep() const
-{
- return keep_;
-}
-
-
-void VSpace::setKeep(bool val)
-{
- keep_ = val;
-}
-
-
bool VSpace::operator==(VSpace const & other) const
{
if (kind_ != other.kind_)
switch (kind_) {
case DEFSKIP:
- return bv.buffer()->params().getDefSkip().inPixels(bv);
+ return bv.buffer().params().getDefSkip().inPixels(bv);
// This is how the skips are normally defined by LateX.
// But there should be some way to change this per document.