{
LyXFont font = fn;
- pars[pit].checkInsertChar(font);
// insert the string, don't insert doublespace
bool space_inserted = true;
for (string::const_iterator cit = str.begin();
2001-07-27 Juergen Vigna <jug@sad.it>
- * inset.h: remove not used font variable in parameter.
+ * inset.h: remove unused font variable in parameter.
removed checkInsertChar in UpdatableInset as it was equal to
the one in Inset and so not needed.
Language latex_lang("latex", "latex", "Latex", false, 0, "latex", "");
Language const * latex_language = &latex_lang;
+
void Languages::read(string const & filename)
{
// We need to set the encoding of latex_lang
english_language = default_language;
}
+
Language const * Languages::getLanguage(string const & language) const
{
const_iterator it = languagelist.find(language);
- if (it != languagelist.end())
- return &it->second;
- else
- return 0;
+ return it == languagelist.end() ? 0 : &it->second;
}
class Language {
public:
///
- Language() : RightToLeft_(false) {}
+ Language() : rightToLeft_(false) {}
///
Language(std::string const & l, std::string const & b, std::string const & d,
bool rtl, Encoding const * e, std::string const & c,
std::string const & o)
- : lang_(l), babel_(b), display_(d), RightToLeft_(rtl),
+ : lang_(l), babel_(b), display_(d), rightToLeft_(rtl),
encoding_(e), code_(c), latex_options_(o)
{}
///
- std::string const & lang() const {
- return lang_;
- }
+ std::string const & lang() const { return lang_; }
///
- std::string const & babel() const {
- return babel_;
- }
+ std::string const & babel() const { return babel_; }
///
- std::string const & display() const {
- return display_;
- }
+ std::string const & display() const { return display_; }
///
- bool RightToLeft() const {
- return RightToLeft_;
- }
+ bool RightToLeft() const { return rightToLeft_; }
///
- Encoding const * encoding() const {
- return encoding_;
- }
+ Encoding const * encoding() const { return encoding_; }
///
- std::string const & code() const {
- return code_;
- }
+ std::string const & code() const { return code_; }
///
- std::string const & latex_options() const {
- return latex_options_;
- }
+ std::string const & latex_options() const { return latex_options_; }
private:
///
std::string lang_;
///
std::string display_;
///
- bool RightToLeft_;
+ bool rightToLeft_;
///
Encoding const * encoding_;
///
///
Language const * getLanguage(std::string const & language) const;
///
- size_type size() const {
- return languagelist.size();
- }
+ size_type size() const { return languagelist.size(); }
///
- const_iterator begin() const {
- return languagelist.begin();
- }
+ const_iterator begin() const { return languagelist.begin(); }
///
- const_iterator end() const {
- return languagelist.end();
- }
+ const_iterator end() const { return languagelist.end(); }
///
private:
void Paragraph::insert(pos_type start, string const & str,
LyXFont const & font)
{
- int size = str.size();
- for (int i = 0 ; i < size ; ++i)
+ for (size_t i = 0, n = str.size(); i != n ; ++i)
insertChar(start + i, str[i], font);
}
-bool Paragraph::checkInsertChar(LyXFont &)
-{
- return true;
-}
-
-
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
Change change)
{
if (tmpinset)
to.insertInset(j, tmpinset, tmpfont, change);
} else {
- if (!to.checkInsertChar(tmpfont))
- return false;
to.insertChar(j, tmpchar, tmpfont, change);
}
return true;
// The most common case is handled first (Asger)
if (IsPrintable(c)) {
- if (font.language()->RightToLeft()) {
+ Language const * language = font.language();
+ if (language->RightToLeft()) {
if ((lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
lyxrc.font_norm_type == LyXRC::ISO_10646_1)
- && font.language()->lang() == "arabic") {
+ && language->lang() == "arabic") {
if (Encodings::IsComposeChar_arabic(c))
return 0;
c = par.transformChar(c, pos);
- } else if (font.language()->lang() == "hebrew" &&
+ } else if (language->lang() == "hebrew" &&
Encodings::IsComposeChar_hebrew(c))
return 0;
}
return 0;
pos_type ppos = sl.pos();
- //// Correct position in front of big insets
- if (ppos && boundary)
+ // Correct position in front of big insets
+ bool const boundary_correction = ppos != 0 && boundary;
+ if (boundary_correction)
--ppos;
Row const & row = par.getRow(ppos);
x -= singleWidth(par, body_pos - 1);
}
- if (hfillExpansion(par, row, pos)) {
- x += singleWidth(par, pos);
- if (pos >= body_pos)
- x += m.hfill;
- else
- x += m.label_hfill;
- } else if (par.isSeparator(pos)) {
- x += singleWidth(par, pos);
- if (pos >= body_pos)
- x += m.separator;
- } else
- x += singleWidth(par, pos);
+ x += singleWidth(par, pos);
+
+ if (hfillExpansion(par, row, pos))
+ x += (pos >= body_pos) ? m.hfill : m.label_hfill;
+ else if (par.isSeparator(pos) && pos >= body_pos)
+ x += m.separator;
}
// see correction above
- if (ppos && boundary)
+ if (boundary_correction)
x += singleWidth(par, ppos);
return int(x);