+std::string Tabular::getHAlignAsXmlAttribute(idx_type cell, bool is_xhtml) const
+{
+ // TODO: the Boolean flag isn't really clean; switch to an enum at some point.
+ switch (getAlignment(cell)) {
+ case LYX_ALIGN_LEFT:
+ return "align='left'";
+ case LYX_ALIGN_RIGHT:
+ return "align='right'";
+
+ default:
+ // HTML only supports left, right, and center.
+ if (is_xhtml)
+ return "align='center'";
+
+ // DocBook also has justify and decimal.
+ if (getAlignment(cell) == LYX_ALIGN_BLOCK) {
+ return "align='justify'";
+ } else if (getAlignment(cell) == LYX_ALIGN_DECIMAL) {
+ Language const *tlang = buffer().paragraphs().front().getParLanguage(buffer().params());
+ return "align='char' char='" + to_utf8(tlang->decimalSeparator()) + "'";
+ } else {
+ return "align='center'";
+ }
+ }
+}
+
+