mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 05:40:59 +00:00
tex2lyx: also support rotated xltabulars
This commit is contained in:
parent
766eb3f02c
commit
20663fb3b8
@ -85,7 +85,7 @@ Context::Context(bool need_layout_,
|
|||||||
new_layout_allowed(true), merging_hyphens_allowed(true),
|
new_layout_allowed(true), merging_hyphens_allowed(true),
|
||||||
textclass(textclass_),
|
textclass(textclass_),
|
||||||
layout(layout_), parent_layout(parent_layout_),
|
layout(layout_), parent_layout(parent_layout_),
|
||||||
font(font_), rotlongtable(false)
|
font(font_), tablerotation(0)
|
||||||
{
|
{
|
||||||
if (!layout)
|
if (!layout)
|
||||||
layout = &textclass.defaultLayout();
|
layout = &textclass.defaultLayout();
|
||||||
|
@ -165,8 +165,8 @@ public:
|
|||||||
TeXFont font;
|
TeXFont font;
|
||||||
/// font attributes of normal text
|
/// font attributes of normal text
|
||||||
static TeXFont normalfont;
|
static TeXFont normalfont;
|
||||||
/// A rotated longtable
|
/// Table rotation angle
|
||||||
bool rotlongtable;
|
int tablerotation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void begin_layout(std::ostream & os, Layout const * const & l);
|
void begin_layout(std::ostream & os, Layout const * const & l);
|
||||||
|
@ -1416,13 +1416,10 @@ void handle_tabular(Parser & p, ostream & os, string const & name,
|
|||||||
|
|
||||||
//cerr << "// output what we have\n";
|
//cerr << "// output what we have\n";
|
||||||
// output what we have
|
// output what we have
|
||||||
string rotate = "0";
|
|
||||||
if (is_long_tabular && context.rotlongtable)
|
|
||||||
rotate = "90";
|
|
||||||
os << "\n<lyxtabular version=\"3\" rows=\"" << rowinfo.size()
|
os << "\n<lyxtabular version=\"3\" rows=\"" << rowinfo.size()
|
||||||
<< "\" columns=\"" << colinfo.size() << "\">\n";
|
<< "\" columns=\"" << colinfo.size() << "\">\n";
|
||||||
os << "<features"
|
os << "<features"
|
||||||
<< write_attribute("rotate", rotate)
|
<< write_attribute("rotate", context.tablerotation)
|
||||||
<< write_attribute("booktabs", booktabs)
|
<< write_attribute("booktabs", booktabs)
|
||||||
<< write_attribute("islongtable", is_long_tabular);
|
<< write_attribute("islongtable", is_long_tabular);
|
||||||
if (is_long_tabular) {
|
if (is_long_tabular) {
|
||||||
|
@ -1968,16 +1968,17 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
|||||||
p.get_token();
|
p.get_token();
|
||||||
p.get_token();
|
p.get_token();
|
||||||
string envname = p.getArg('{', '}');
|
string envname = p.getArg('{', '}');
|
||||||
if (envname == "longtable") {
|
if (envname == "longtable" || envname == "xltabular") {
|
||||||
// Now we check if the longtable is the only content
|
// Now we check if the longtable is the only content
|
||||||
// of the landscape environment
|
// of the landscape environment
|
||||||
|
string const ltenv = envname;
|
||||||
while (!found_end && !end_longtable && p.good()) {
|
while (!found_end && !end_longtable && p.good()) {
|
||||||
envname = p.next_token().cat() == catBegin
|
envname = p.next_token().cat() == catBegin
|
||||||
? p.getArg('{', '}') : string();
|
? p.getArg('{', '}') : string();
|
||||||
Token const & t = p.get_token();
|
Token const & t = p.get_token();
|
||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
end_longtable = t.asInput() != "\\end"
|
end_longtable = t.asInput() != "\\end"
|
||||||
&& envname == "longtable";
|
&& envname == ltenv;
|
||||||
found_end = t.asInput() == "\\end"
|
found_end = t.asInput() == "\\end"
|
||||||
&& envname == "landscape";
|
&& envname == "landscape";
|
||||||
}
|
}
|
||||||
@ -1990,10 +1991,10 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
|||||||
if (only_longtable) {
|
if (only_longtable) {
|
||||||
p.popPosition();
|
p.popPosition();
|
||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
bool const save_rotlongtable = parent_context.rotlongtable;
|
int const save_tablerotation = parent_context.tablerotation;
|
||||||
parent_context.rotlongtable = true;
|
parent_context.tablerotation = 90;
|
||||||
parse_text(p, os, FLAG_END, outer, parent_context);
|
parse_text(p, os, FLAG_END, outer, parent_context);
|
||||||
parent_context.rotlongtable = save_rotlongtable;
|
parent_context.tablerotation = save_tablerotation;
|
||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user