X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fvspace.h;h=30aa427ab43ef66f5a5ac9d0e1860f83afa3c786;hb=5bca2431091765b1552cbb5410b1f2c18bbcb9c1;hp=fce31b09fdfe4361aa9943cffd3b74af34edac2d;hpb=797d87b4513088a66b17c7ac653b84e36ea80458;p=lyx.git diff --git a/src/vspace.h b/src/vspace.h index fce31b09fd..30aa427ab4 100644 --- a/src/vspace.h +++ b/src/vspace.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2000 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -50,6 +50,13 @@ public: EM, /// Math unit (18mu = 1em) for positioning in math mode MU, + /// Percent of columnwidth both "%" or "%c" + PW, + PE, + /// Percent of pagewidth + PP, + /// Percent of linewidth + PL, /// no unit UNIT_NONE }; @@ -64,20 +71,19 @@ public: LyXLength(string const & data); /// - float value() const { return val; }; + float value() const { return val; } /// - LyXLength::UNIT unit() const { return uni; }; + LyXLength::UNIT unit() const { return uni; } /// conversion - virtual string asString() const; + virtual string const asString() const; /// - virtual string asLatexString() const { return this->asString(); }; - + virtual string const asLatexString() const; /** If "data" is valid, the length represented by it is stored into "result", if that is not 0. */ friend bool isValidLength(string const & data, - LyXLength * result= 0); + LyXLength * result = 0); protected: /// @@ -98,6 +104,8 @@ bool operator==(LyXLength const & l1, LyXLength const & l2) extern LyXLength::UNIT unitFromString (string const & data); /// extern bool isValidLength(string const & data, LyXLength * result); +/// +extern const char * stringFromUnit(int unit); /// LyXGlueLength class class LyXGlueLength : public LyXLength { @@ -123,30 +131,34 @@ public: LyXGlueLength(string const & data); /// - float plusValue() const { return plus_val; }; + float plusValue() const { return plus_val; } /// - LyXLength::UNIT plusUnit() const { return plus_uni; }; + LyXLength::UNIT plusUnit() const { return plus_uni; } /// - float minusValue() const { return minus_val; }; + float minusValue() const { return minus_val; } /// - LyXLength::UNIT minusUnit() const { return minus_uni; }; + LyXLength::UNIT minusUnit() const { return minus_uni; } /// conversion - virtual string asString() const; + virtual string const asString() const; /// - virtual string asLatexString() const; + virtual string const asLatexString() const; /** If "data" is valid, the length represented by it is stored into "result", if that is not 0. */ friend bool isValidGlueLength(string const & data, - LyXGlueLength* result= 0); + LyXGlueLength* result = 0); protected: /// - float plus_val, minus_val; + float plus_val; + /// + float minus_val; /// - LyXLength::UNIT plus_uni, minus_uni; + LyXLength::UNIT plus_uni; + /// + LyXLength::UNIT minus_uni; }; /// @@ -168,7 +180,7 @@ extern bool isValidGlueLength(string const & data, LyXGlueLength * result); /// VSpace class class VSpace { public: - /// + /// The different kinds of spaces. enum vspace_kind { /// NONE, @@ -185,61 +197,61 @@ public: /// LENGTH }; - /// constructors + /// Constructor VSpace() : kin (NONE), len(0.0, LyXLength::PT), kp (false) {} - /// + /// Constructor explicit - VSpace(vspace_kind k) : + VSpace(vspace_kind k) : kin (k), len (0.0, LyXLength::PT), kp (false) {} - /// + /// Constructor explicit VSpace(LyXGlueLength l) : kin (LENGTH), len (l), kp (false) {} - /// + /// Constructor explicit VSpace(float v, LyXLength::UNIT u) : kin (LENGTH), len (v, u), kp (false) {} - /// this constructor is for reading from a .lyx file + /// Constructor for reading from a .lyx file explicit VSpace(string const & data); - // access functions - vspace_kind kind() const { return kin; } + /// access functions + vspace_kind kind() const { return kin; } /// - LyXLength length() const { return len; } + LyXGlueLength length() const { return len; } // a flag that switches between \vspace and \vspace* bool keep() const { return kp; } /// void setKeep(bool val) { kp = val; } /// - bool operator == (VSpace const &) const; + bool operator==(VSpace const &) const; // conversion /// - string asLyXCommand() const; // how it goes into the LyX file + string const asLyXCommand() const; // how it goes into the LyX file /// - string asLatexCommand(BufferParams const & params) const; + string const asLatexCommand(BufferParams const & params) const; /// int inPixels(BufferView * bv) const; /// - int inPixels(int default_height, int default_skip) const; + int inPixels(int default_height, int default_skip, int default_width=0) const; private: + /// This VSpace kind + vspace_kind kin; /// - vspace_kind kin; - /// - LyXGlueLength len; + LyXGlueLength len; /// bool kp; };