update_borders();
LyXLength pwidth;
- string special;
+ docstring special;
if (multicol) {
special = tabular.getAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
width2 = llen.asString();
// apply the special alignment
- string const sa1 = fromqstr(dialog_->specialAlignmentED->text());
- string sa2;
+ docstring const sa1 = qstring_to_ucs4(dialog_->specialAlignmentED->text());
+ docstring sa2;
if (multicol)
sa2 = tabular.getAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
if (sa1 != sa2) {
if (multicol)
- controller().set(LyXTabular::SET_SPECIAL_MULTI, sa1);
+ controller().set(LyXTabular::SET_SPECIAL_MULTI, to_utf8(sa1));
else
- controller().set(LyXTabular::SET_SPECIAL_COLUMN, sa1);
+ controller().set(LyXTabular::SET_SPECIAL_COLUMN, to_utf8(sa1));
}
if (width != width2) {
docstring linebuf = trim(linebuf0);
if (linebuf.empty())
continue;
- if (prefixIs(linebuf, from_ascii("@"))) {
+ if (prefixIs(linebuf, '@')) {
linebuf = subst(linebuf, '{', '(');
docstring tmp;
linebuf = split(linebuf, tmp, '(');
case LyXTabular::SET_SPECIAL_COLUMN:
case LyXTabular::SET_SPECIAL_MULTI:
- tabular.setAlignSpecial(cur.idx(),value,feature);
+ tabular.setAlignSpecial(cur.idx(), from_utf8(value), feature);
break;
case LyXTabular::APPEND_ROW:
}
+bool prefixIs(docstring const & a, char_type c)
+{
+ if (a.empty())
+ return false;
+ return a[0] == c;
+}
+
+
bool prefixIs(string const & a, string const & pre)
{
string::size_type const prelen = pre.length();
}
+bool suffixIs(docstring const & a, char_type c)
+{
+ if (a.empty())
+ return false;
+ return a[a.length() - 1] == c;
+}
+
+
bool suffixIs(string const & a, string const & suf)
{
string::size_type const suflen = suf.length();
///
std::string const uppercase(std::string const &);
+/// Does the string start with this prefix?
+bool prefixIs(docstring const &, char_type);
+
/// Does the std::string start with this prefix?
bool prefixIs(std::string const &, std::string const &);
-bool prefixIs(lyx::docstring const &, lyx::docstring const &);
+bool prefixIs(docstring const &, docstring const &);
/// Does the string end with this char?
bool suffixIs(std::string const &, char);
+bool suffixIs(docstring const &, char_type);
/// Does the std::string end with this suffix?
bool suffixIs(std::string const &, std::string const &);
}
+template <>
+string const write_attribute(string const & name, docstring const & t)
+{
+ return t.empty() ? string() : " " + name + "=\"" + to_utf8(t) + "\"";
+}
+
+
template <>
string const write_attribute(string const & name, bool const & b)
{
}
+bool getTokenValue(string const & str, char const * token, docstring & ret)
+{
+ string tmp;
+ bool const success = getTokenValue(str, token, tmp);
+ ret = from_utf8(tmp);
+ return success;
+}
+
+
bool getTokenValue(string const & str, char const * token, int & num)
{
string tmp;
{
if (cellinfo_of_cell(cell).align_special.empty())
return cellinfo_of_cell(cell).left_line;
- return prefixIs(ltrim(cellinfo_of_cell(cell).align_special), "|");
+ return prefixIs(ltrim(cellinfo_of_cell(cell).align_special), '|');
}
if (column_info[column_of_cell(cell)].align_special.empty())
return column_info[column_of_cell(cell)].left_line;
- return prefixIs(ltrim(column_info[column_of_cell(cell)].align_special), "|");
+ return prefixIs(ltrim(column_info[column_of_cell(cell)].align_special), '|');
}
{
if (cellinfo_of_cell(cell).align_special.empty())
return cellinfo_of_cell(cell).right_line;
- return suffixIs(rtrim(cellinfo_of_cell(cell).align_special), "|");
+ return suffixIs(rtrim(cellinfo_of_cell(cell).align_special), '|');
}
if (column_info[column_of_cell(cell)].align_special.empty())
return column_info[right_column_of_cell(cell)].right_line;
- return suffixIs(rtrim(column_info[column_of_cell(cell)].align_special), "|");
+ return suffixIs(rtrim(column_info[column_of_cell(cell)].align_special), '|');
}
}
-void LyXTabular::setAlignSpecial(idx_type cell, string const & special,
+void LyXTabular::setAlignSpecial(idx_type cell, docstring const & special,
LyXTabular::Feature what)
{
if (what == SET_SPECIAL_MULTI)
}
-string const LyXTabular::getAlignSpecial(idx_type cell, int what) const
+docstring const LyXTabular::getAlignSpecial(idx_type cell, int what) const
{
if (what == SET_SPECIAL_MULTI)
return cellinfo_of_cell(cell).align_special;
if (isMultiColumn(cell)) {
os << "\\multicolumn{" << cells_in_multicolumn(cell) << "}{";
if (!cellinfo_of_cell(cell).align_special.empty()) {
- os << from_ascii(cellinfo_of_cell(cell).align_special)
- << "}{";
+ os << cellinfo_of_cell(cell).align_special << "}{";
} else {
if (leftLine(cell) &&
(isFirstCellInRow(cell) ||
os << "\\begin{tabular}{";
for (col_type i = 0; i < columns_; ++i) {
if (!column_info[i].align_special.empty()) {
- os << from_ascii(column_info[i].align_special);
+ os << column_info[i].align_special;
} else {
if (!use_booktabs && column_info[i].left_line)
os << '|';
///
bool setMColumnPWidth(LCursor &, idx_type, LyXLength const &);
///
- void setAlignSpecial(idx_type cell, std::string const & special,
+ void setAlignSpecial(idx_type cell, docstring const & special,
Feature what);
///
LyXAlignment getAlignment(idx_type cell,
///
LyXLength const getMColumnPWidth(idx_type cell) const;
///
- std::string const getAlignSpecial(idx_type cell, int what) const;
+ docstring const getAlignSpecial(idx_type cell, int what) const;
///
int getWidthOfCell(idx_type cell) const;
///
///
bool rotate;
///
- std::string align_special;
+ docstring align_special;
///
LyXLength p_width; // this is only set for multicolumn!!!
///
///
LyXLength p_width;
///
- std::string align_special;
+ docstring align_special;
};
///
typedef std::vector<columnstruct> column_vector;